@umxr/bagsy 0.0.0-stage → 0.2.0

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.
@@ -0,0 +1,1022 @@
1
+ /**
2
+ * This file was auto-generated by openapi-typescript.
3
+ * Do not make direct changes to the file.
4
+ */
5
+ interface paths {
6
+ "/lists": {
7
+ parameters: {
8
+ query?: never;
9
+ header?: never;
10
+ path?: never;
11
+ cookie?: never;
12
+ };
13
+ /** List the owner's lists */
14
+ get: operations["listLists"];
15
+ put?: never;
16
+ /** Create a named list */
17
+ post: operations["createList"];
18
+ delete?: never;
19
+ options?: never;
20
+ head?: never;
21
+ patch?: never;
22
+ trace?: never;
23
+ };
24
+ "/lists/{listId}": {
25
+ parameters: {
26
+ query?: never;
27
+ header?: {
28
+ /** @description Server key only. Customer GID of the logged-in shopper. */
29
+ "Bagsy-Customer-Id"?: components["parameters"]["CustomerId"];
30
+ /** @description Guest identity. Ignored when a customer is identified. */
31
+ "Bagsy-Visitor-Id"?: components["parameters"]["VisitorId"];
32
+ };
33
+ path: {
34
+ /** @description A list id, or `default`. */
35
+ listId: components["parameters"]["ListId"];
36
+ };
37
+ cookie?: never;
38
+ };
39
+ /** Get a list */
40
+ get: operations["getList"];
41
+ put?: never;
42
+ post?: never;
43
+ /**
44
+ * Delete a list and its items
45
+ * @description The default list cannot be deleted, only cleared.
46
+ */
47
+ delete: operations["deleteList"];
48
+ options?: never;
49
+ head?: never;
50
+ /**
51
+ * Rename a list
52
+ * @description Visibility changes go through the share endpoints.
53
+ */
54
+ patch: operations["updateList"];
55
+ trace?: never;
56
+ };
57
+ "/lists/{listId}/items": {
58
+ parameters: {
59
+ query?: never;
60
+ header?: {
61
+ /** @description Server key only. Customer GID of the logged-in shopper. */
62
+ "Bagsy-Customer-Id"?: components["parameters"]["CustomerId"];
63
+ /** @description Guest identity. Ignored when a customer is identified. */
64
+ "Bagsy-Visitor-Id"?: components["parameters"]["VisitorId"];
65
+ };
66
+ path: {
67
+ /** @description A list id, or `default`. */
68
+ listId: components["parameters"]["ListId"];
69
+ };
70
+ cookie?: never;
71
+ };
72
+ /** List items, newest first */
73
+ get: operations["listItems"];
74
+ put?: never;
75
+ /**
76
+ * Save a product (idempotent)
77
+ * @description Saving the same `productId` + `variantId` twice is a no-op that
78
+ * returns the existing item with `200`, so a double-tapped heart never
79
+ * creates duplicates.
80
+ */
81
+ post: operations["addItem"];
82
+ /**
83
+ * Unsave by product
84
+ * @description With `variantId`, removes that variant's item. Without it, removes
85
+ * every item for the product. Lets a heart button unsave without
86
+ * knowing the item id.
87
+ */
88
+ delete: operations["removeItemByProduct"];
89
+ options?: never;
90
+ head?: never;
91
+ patch?: never;
92
+ trace?: never;
93
+ };
94
+ "/lists/{listId}/items/{itemId}": {
95
+ parameters: {
96
+ query?: never;
97
+ header?: {
98
+ /** @description Server key only. Customer GID of the logged-in shopper. */
99
+ "Bagsy-Customer-Id"?: components["parameters"]["CustomerId"];
100
+ /** @description Guest identity. Ignored when a customer is identified. */
101
+ "Bagsy-Visitor-Id"?: components["parameters"]["VisitorId"];
102
+ };
103
+ path: {
104
+ /** @description A list id, or `default`. */
105
+ listId: components["parameters"]["ListId"];
106
+ itemId: string;
107
+ };
108
+ cookie?: never;
109
+ };
110
+ get?: never;
111
+ put?: never;
112
+ post?: never;
113
+ /** Remove an item */
114
+ delete: operations["removeItem"];
115
+ options?: never;
116
+ head?: never;
117
+ /**
118
+ * Change an item's variant, quantity or note
119
+ * @description Fails with `validation_failed` if the list already holds the target variant.
120
+ */
121
+ patch: operations["updateItem"];
122
+ trace?: never;
123
+ };
124
+ "/saved": {
125
+ parameters: {
126
+ query?: never;
127
+ header?: never;
128
+ path?: never;
129
+ cookie?: never;
130
+ };
131
+ /**
132
+ * Which of these products are saved?
133
+ * @description Batch lookup for rendering heart state on collection and search
134
+ * pages in one request. Checks across all of the owner's lists.
135
+ */
136
+ get: operations["lookupSaved"];
137
+ put?: never;
138
+ post?: never;
139
+ delete?: never;
140
+ options?: never;
141
+ head?: never;
142
+ patch?: never;
143
+ trace?: never;
144
+ };
145
+ "/identity/merge": {
146
+ parameters: {
147
+ query?: never;
148
+ header?: never;
149
+ path?: never;
150
+ cookie?: never;
151
+ };
152
+ get?: never;
153
+ put?: never;
154
+ /**
155
+ * Merge a guest's lists into the logged-in customer
156
+ * @description Call once after login. Visitor items move into the customer's lists
157
+ * (default into default, named lists by name), duplicates collapse, and
158
+ * the visitor id is retired. Safe to retry.
159
+ */
160
+ post: operations["mergeVisitor"];
161
+ delete?: never;
162
+ options?: never;
163
+ head?: never;
164
+ patch?: never;
165
+ trace?: never;
166
+ };
167
+ "/lists/{listId}/share": {
168
+ parameters: {
169
+ query?: never;
170
+ header?: {
171
+ /** @description Server key only. Customer GID of the logged-in shopper. */
172
+ "Bagsy-Customer-Id"?: components["parameters"]["CustomerId"];
173
+ /** @description Guest identity. Ignored when a customer is identified. */
174
+ "Bagsy-Visitor-Id"?: components["parameters"]["VisitorId"];
175
+ };
176
+ path: {
177
+ /** @description A list id, or `default`. */
178
+ listId: components["parameters"]["ListId"];
179
+ };
180
+ cookie?: never;
181
+ };
182
+ get?: never;
183
+ put?: never;
184
+ /**
185
+ * Share a list
186
+ * @description Returns the list's share token, creating one if the list isn't shared
187
+ * yet. Calling it again returns the same token, so links already sent
188
+ * keep working. Pass `rotate=true` to issue a new token and invalidate
189
+ * the old one.
190
+ */
191
+ post: operations["shareList"];
192
+ /** Revoke sharing */
193
+ delete: operations["unshareList"];
194
+ options?: never;
195
+ head?: never;
196
+ patch?: never;
197
+ trace?: never;
198
+ };
199
+ "/shared/{shareToken}": {
200
+ parameters: {
201
+ query?: never;
202
+ header?: never;
203
+ path?: never;
204
+ cookie?: never;
205
+ };
206
+ /** Read a shared list (public) */
207
+ get: operations["getSharedList"];
208
+ put?: never;
209
+ post?: never;
210
+ delete?: never;
211
+ options?: never;
212
+ head?: never;
213
+ patch?: never;
214
+ trace?: never;
215
+ };
216
+ "/insights/top-products": {
217
+ parameters: {
218
+ query?: never;
219
+ header?: never;
220
+ path?: never;
221
+ cookie?: never;
222
+ };
223
+ /** Most-saved products */
224
+ get: operations["topProducts"];
225
+ put?: never;
226
+ post?: never;
227
+ delete?: never;
228
+ options?: never;
229
+ head?: never;
230
+ patch?: never;
231
+ trace?: never;
232
+ };
233
+ }
234
+ interface components {
235
+ schemas: {
236
+ /** @example gid://shopify/Product/8123456789 */
237
+ ProductGid: string;
238
+ /** @example gid://shopify/ProductVariant/44123456789 */
239
+ VariantGid: string;
240
+ /** @example gid://shopify/Customer/7123456789 */
241
+ CustomerGid: string;
242
+ List: {
243
+ /** @example lst_01JB2Y9K3T7M */
244
+ id: string;
245
+ /** @example Wishlist */
246
+ name: string;
247
+ isDefault: boolean;
248
+ /** @enum {string} */
249
+ visibility: "private" | "shared";
250
+ itemCount: number;
251
+ /** @description The list's share token while it is shared. Only ever returned to the list's owner. */
252
+ shareToken?: string | null;
253
+ /** Format: date-time */
254
+ createdAt: string;
255
+ /** Format: date-time */
256
+ updatedAt: string;
257
+ /** @description Present only with `include=items`. */
258
+ items?: components["schemas"]["ItemPage"];
259
+ };
260
+ ListCreate: {
261
+ name: string;
262
+ };
263
+ ListUpdate: {
264
+ name?: string;
265
+ };
266
+ Item: {
267
+ /** @example itm_01JB2Z6Q8V4K */
268
+ id: string;
269
+ listId: string;
270
+ productId: components["schemas"]["ProductGid"];
271
+ /** @description Null means "any variant". */
272
+ variantId?: components["schemas"]["VariantGid"] | null;
273
+ /** @default 1 */
274
+ quantity: number;
275
+ note?: string | null;
276
+ /** Format: date-time */
277
+ addedAt: string;
278
+ };
279
+ ItemCreate: {
280
+ productId: components["schemas"]["ProductGid"];
281
+ variantId?: components["schemas"]["VariantGid"];
282
+ /** @default 1 */
283
+ quantity?: number;
284
+ note?: string;
285
+ };
286
+ ItemUpdate: {
287
+ variantId?: components["schemas"]["VariantGid"] | null;
288
+ quantity?: number;
289
+ note?: string | null;
290
+ };
291
+ ItemPage: {
292
+ data: components["schemas"]["Item"][];
293
+ pageInfo: {
294
+ hasNextPage: boolean;
295
+ endCursor?: string | null;
296
+ };
297
+ };
298
+ Problem: {
299
+ /**
300
+ * Format: uri
301
+ * @example https://bagsy.dev/errors/list_not_found
302
+ */
303
+ type: string;
304
+ /** @example List not found */
305
+ title: string;
306
+ /** @example 404 */
307
+ status: number;
308
+ /** @enum {string} */
309
+ code: "unauthorized" | "owner_required" | "list_not_found" | "item_not_found" | "list_limit_reached" | "default_list_protected" | "list_name_taken" | "item_limit_reached" | "not_found" | "validation_failed" | "rate_limited";
310
+ detail?: string;
311
+ /** @description Field-level detail for `validation_failed`. */
312
+ errors?: {
313
+ /** @example /productId */
314
+ path: string;
315
+ message: string;
316
+ }[];
317
+ };
318
+ };
319
+ responses: {
320
+ /** @description Missing or invalid credentials, or no owner identified. */
321
+ Unauthorized: {
322
+ headers: {
323
+ [name: string]: unknown;
324
+ };
325
+ content: {
326
+ "application/problem+json": components["schemas"]["Problem"];
327
+ };
328
+ };
329
+ /** @description Not found, or not owned by the caller (never distinguished). */
330
+ NotFound: {
331
+ headers: {
332
+ [name: string]: unknown;
333
+ };
334
+ content: {
335
+ "application/problem+json": components["schemas"]["Problem"];
336
+ };
337
+ };
338
+ /** @description A limit was reached, the name is taken, or the default list is protected. */
339
+ Conflict: {
340
+ headers: {
341
+ [name: string]: unknown;
342
+ };
343
+ content: {
344
+ "application/problem+json": components["schemas"]["Problem"];
345
+ };
346
+ };
347
+ /** @description Request failed validation. */
348
+ Invalid: {
349
+ headers: {
350
+ [name: string]: unknown;
351
+ };
352
+ content: {
353
+ "application/problem+json": components["schemas"]["Problem"];
354
+ };
355
+ };
356
+ };
357
+ parameters: {
358
+ /** @description A list id, or `default`. */
359
+ ListId: string;
360
+ /** @description Server key only. Customer GID of the logged-in shopper. */
361
+ CustomerId: components["schemas"]["CustomerGid"];
362
+ /** @description Guest identity. Ignored when a customer is identified. */
363
+ VisitorId: string;
364
+ /** @description Replays within 24h return the original response. */
365
+ IdempotencyKey: string;
366
+ Limit: number;
367
+ /** @description Cursor from `pageInfo.endCursor`. */
368
+ After: string;
369
+ };
370
+ requestBodies: never;
371
+ headers: never;
372
+ pathItems: never;
373
+ }
374
+ interface operations {
375
+ listLists: {
376
+ parameters: {
377
+ query?: never;
378
+ header?: {
379
+ /** @description Server key only. Customer GID of the logged-in shopper. */
380
+ "Bagsy-Customer-Id"?: components["parameters"]["CustomerId"];
381
+ /** @description Guest identity. Ignored when a customer is identified. */
382
+ "Bagsy-Visitor-Id"?: components["parameters"]["VisitorId"];
383
+ };
384
+ path?: never;
385
+ cookie?: never;
386
+ };
387
+ requestBody?: never;
388
+ responses: {
389
+ /** @description The owner's lists, default first. */
390
+ 200: {
391
+ headers: {
392
+ [name: string]: unknown;
393
+ };
394
+ content: {
395
+ "application/json": {
396
+ data: components["schemas"]["List"][];
397
+ };
398
+ };
399
+ };
400
+ 401: components["responses"]["Unauthorized"];
401
+ };
402
+ };
403
+ createList: {
404
+ parameters: {
405
+ query?: never;
406
+ header?: {
407
+ /** @description Server key only. Customer GID of the logged-in shopper. */
408
+ "Bagsy-Customer-Id"?: components["parameters"]["CustomerId"];
409
+ /** @description Guest identity. Ignored when a customer is identified. */
410
+ "Bagsy-Visitor-Id"?: components["parameters"]["VisitorId"];
411
+ /** @description Replays within 24h return the original response. */
412
+ "Idempotency-Key"?: components["parameters"]["IdempotencyKey"];
413
+ };
414
+ path?: never;
415
+ cookie?: never;
416
+ };
417
+ requestBody: {
418
+ content: {
419
+ "application/json": components["schemas"]["ListCreate"];
420
+ };
421
+ };
422
+ responses: {
423
+ /** @description Created. */
424
+ 201: {
425
+ headers: {
426
+ [name: string]: unknown;
427
+ };
428
+ content: {
429
+ "application/json": components["schemas"]["List"];
430
+ };
431
+ };
432
+ 401: components["responses"]["Unauthorized"];
433
+ 409: components["responses"]["Conflict"];
434
+ 422: components["responses"]["Invalid"];
435
+ };
436
+ };
437
+ getList: {
438
+ parameters: {
439
+ query?: {
440
+ /** @description Embed the first page of items. */
441
+ include?: "items"[];
442
+ };
443
+ header?: {
444
+ /** @description Server key only. Customer GID of the logged-in shopper. */
445
+ "Bagsy-Customer-Id"?: components["parameters"]["CustomerId"];
446
+ /** @description Guest identity. Ignored when a customer is identified. */
447
+ "Bagsy-Visitor-Id"?: components["parameters"]["VisitorId"];
448
+ };
449
+ path: {
450
+ /** @description A list id, or `default`. */
451
+ listId: components["parameters"]["ListId"];
452
+ };
453
+ cookie?: never;
454
+ };
455
+ requestBody?: never;
456
+ responses: {
457
+ /** @description The list. */
458
+ 200: {
459
+ headers: {
460
+ [name: string]: unknown;
461
+ };
462
+ content: {
463
+ "application/json": components["schemas"]["List"];
464
+ };
465
+ };
466
+ 404: components["responses"]["NotFound"];
467
+ };
468
+ };
469
+ deleteList: {
470
+ parameters: {
471
+ query?: never;
472
+ header?: {
473
+ /** @description Server key only. Customer GID of the logged-in shopper. */
474
+ "Bagsy-Customer-Id"?: components["parameters"]["CustomerId"];
475
+ /** @description Guest identity. Ignored when a customer is identified. */
476
+ "Bagsy-Visitor-Id"?: components["parameters"]["VisitorId"];
477
+ };
478
+ path: {
479
+ /** @description A list id, or `default`. */
480
+ listId: components["parameters"]["ListId"];
481
+ };
482
+ cookie?: never;
483
+ };
484
+ requestBody?: never;
485
+ responses: {
486
+ /** @description Deleted. */
487
+ 204: {
488
+ headers: {
489
+ [name: string]: unknown;
490
+ };
491
+ content?: never;
492
+ };
493
+ 404: components["responses"]["NotFound"];
494
+ 409: components["responses"]["Conflict"];
495
+ };
496
+ };
497
+ updateList: {
498
+ parameters: {
499
+ query?: never;
500
+ header?: {
501
+ /** @description Server key only. Customer GID of the logged-in shopper. */
502
+ "Bagsy-Customer-Id"?: components["parameters"]["CustomerId"];
503
+ /** @description Guest identity. Ignored when a customer is identified. */
504
+ "Bagsy-Visitor-Id"?: components["parameters"]["VisitorId"];
505
+ };
506
+ path: {
507
+ /** @description A list id, or `default`. */
508
+ listId: components["parameters"]["ListId"];
509
+ };
510
+ cookie?: never;
511
+ };
512
+ requestBody: {
513
+ content: {
514
+ "application/json": components["schemas"]["ListUpdate"];
515
+ };
516
+ };
517
+ responses: {
518
+ /** @description Updated. */
519
+ 200: {
520
+ headers: {
521
+ [name: string]: unknown;
522
+ };
523
+ content: {
524
+ "application/json": components["schemas"]["List"];
525
+ };
526
+ };
527
+ 404: components["responses"]["NotFound"];
528
+ 409: components["responses"]["Conflict"];
529
+ 422: components["responses"]["Invalid"];
530
+ };
531
+ };
532
+ listItems: {
533
+ parameters: {
534
+ query?: {
535
+ limit?: components["parameters"]["Limit"];
536
+ /** @description Cursor from `pageInfo.endCursor`. */
537
+ after?: components["parameters"]["After"];
538
+ };
539
+ header?: {
540
+ /** @description Server key only. Customer GID of the logged-in shopper. */
541
+ "Bagsy-Customer-Id"?: components["parameters"]["CustomerId"];
542
+ /** @description Guest identity. Ignored when a customer is identified. */
543
+ "Bagsy-Visitor-Id"?: components["parameters"]["VisitorId"];
544
+ };
545
+ path: {
546
+ /** @description A list id, or `default`. */
547
+ listId: components["parameters"]["ListId"];
548
+ };
549
+ cookie?: never;
550
+ };
551
+ requestBody?: never;
552
+ responses: {
553
+ /** @description A page of items. */
554
+ 200: {
555
+ headers: {
556
+ [name: string]: unknown;
557
+ };
558
+ content: {
559
+ "application/json": components["schemas"]["ItemPage"];
560
+ };
561
+ };
562
+ 404: components["responses"]["NotFound"];
563
+ };
564
+ };
565
+ addItem: {
566
+ parameters: {
567
+ query?: never;
568
+ header?: {
569
+ /** @description Server key only. Customer GID of the logged-in shopper. */
570
+ "Bagsy-Customer-Id"?: components["parameters"]["CustomerId"];
571
+ /** @description Guest identity. Ignored when a customer is identified. */
572
+ "Bagsy-Visitor-Id"?: components["parameters"]["VisitorId"];
573
+ /** @description Replays within 24h return the original response. */
574
+ "Idempotency-Key"?: components["parameters"]["IdempotencyKey"];
575
+ };
576
+ path: {
577
+ /** @description A list id, or `default`. */
578
+ listId: components["parameters"]["ListId"];
579
+ };
580
+ cookie?: never;
581
+ };
582
+ requestBody: {
583
+ content: {
584
+ "application/json": components["schemas"]["ItemCreate"];
585
+ };
586
+ };
587
+ responses: {
588
+ /** @description Already saved; existing item returned. */
589
+ 200: {
590
+ headers: {
591
+ [name: string]: unknown;
592
+ };
593
+ content: {
594
+ "application/json": components["schemas"]["Item"];
595
+ };
596
+ };
597
+ /** @description Saved. */
598
+ 201: {
599
+ headers: {
600
+ [name: string]: unknown;
601
+ };
602
+ content: {
603
+ "application/json": components["schemas"]["Item"];
604
+ };
605
+ };
606
+ 404: components["responses"]["NotFound"];
607
+ 409: components["responses"]["Conflict"];
608
+ 422: components["responses"]["Invalid"];
609
+ };
610
+ };
611
+ removeItemByProduct: {
612
+ parameters: {
613
+ query: {
614
+ productId: components["schemas"]["ProductGid"];
615
+ variantId?: components["schemas"]["VariantGid"];
616
+ };
617
+ header?: {
618
+ /** @description Server key only. Customer GID of the logged-in shopper. */
619
+ "Bagsy-Customer-Id"?: components["parameters"]["CustomerId"];
620
+ /** @description Guest identity. Ignored when a customer is identified. */
621
+ "Bagsy-Visitor-Id"?: components["parameters"]["VisitorId"];
622
+ };
623
+ path: {
624
+ /** @description A list id, or `default`. */
625
+ listId: components["parameters"]["ListId"];
626
+ };
627
+ cookie?: never;
628
+ };
629
+ requestBody?: never;
630
+ responses: {
631
+ /** @description Removed, or was not saved. */
632
+ 204: {
633
+ headers: {
634
+ [name: string]: unknown;
635
+ };
636
+ content?: never;
637
+ };
638
+ 404: components["responses"]["NotFound"];
639
+ };
640
+ };
641
+ removeItem: {
642
+ parameters: {
643
+ query?: never;
644
+ header?: {
645
+ /** @description Server key only. Customer GID of the logged-in shopper. */
646
+ "Bagsy-Customer-Id"?: components["parameters"]["CustomerId"];
647
+ /** @description Guest identity. Ignored when a customer is identified. */
648
+ "Bagsy-Visitor-Id"?: components["parameters"]["VisitorId"];
649
+ };
650
+ path: {
651
+ /** @description A list id, or `default`. */
652
+ listId: components["parameters"]["ListId"];
653
+ itemId: string;
654
+ };
655
+ cookie?: never;
656
+ };
657
+ requestBody?: never;
658
+ responses: {
659
+ /** @description Removed. */
660
+ 204: {
661
+ headers: {
662
+ [name: string]: unknown;
663
+ };
664
+ content?: never;
665
+ };
666
+ 404: components["responses"]["NotFound"];
667
+ };
668
+ };
669
+ updateItem: {
670
+ parameters: {
671
+ query?: never;
672
+ header?: {
673
+ /** @description Server key only. Customer GID of the logged-in shopper. */
674
+ "Bagsy-Customer-Id"?: components["parameters"]["CustomerId"];
675
+ /** @description Guest identity. Ignored when a customer is identified. */
676
+ "Bagsy-Visitor-Id"?: components["parameters"]["VisitorId"];
677
+ };
678
+ path: {
679
+ /** @description A list id, or `default`. */
680
+ listId: components["parameters"]["ListId"];
681
+ itemId: string;
682
+ };
683
+ cookie?: never;
684
+ };
685
+ requestBody: {
686
+ content: {
687
+ "application/json": components["schemas"]["ItemUpdate"];
688
+ };
689
+ };
690
+ responses: {
691
+ /** @description Updated. */
692
+ 200: {
693
+ headers: {
694
+ [name: string]: unknown;
695
+ };
696
+ content: {
697
+ "application/json": components["schemas"]["Item"];
698
+ };
699
+ };
700
+ 404: components["responses"]["NotFound"];
701
+ 422: components["responses"]["Invalid"];
702
+ };
703
+ };
704
+ lookupSaved: {
705
+ parameters: {
706
+ query: {
707
+ productIds: components["schemas"]["ProductGid"][];
708
+ };
709
+ header?: {
710
+ /** @description Server key only. Customer GID of the logged-in shopper. */
711
+ "Bagsy-Customer-Id"?: components["parameters"]["CustomerId"];
712
+ /** @description Guest identity. Ignored when a customer is identified. */
713
+ "Bagsy-Visitor-Id"?: components["parameters"]["VisitorId"];
714
+ };
715
+ path?: never;
716
+ cookie?: never;
717
+ };
718
+ requestBody?: never;
719
+ responses: {
720
+ /** @description Saved state per requested product. */
721
+ 200: {
722
+ headers: {
723
+ [name: string]: unknown;
724
+ };
725
+ content: {
726
+ "application/json": {
727
+ /** @description Keyed by product GID. Unsaved products map to an empty array. */
728
+ data: {
729
+ [key: string]: {
730
+ listId: string;
731
+ itemId: string;
732
+ variantId?: components["schemas"]["VariantGid"];
733
+ }[];
734
+ };
735
+ };
736
+ };
737
+ };
738
+ 401: components["responses"]["Unauthorized"];
739
+ 422: components["responses"]["Invalid"];
740
+ };
741
+ };
742
+ mergeVisitor: {
743
+ parameters: {
744
+ query?: never;
745
+ header?: {
746
+ /** @description Server key only. Customer GID of the logged-in shopper. */
747
+ "Bagsy-Customer-Id"?: components["parameters"]["CustomerId"];
748
+ /** @description Replays within 24h return the original response. */
749
+ "Idempotency-Key"?: components["parameters"]["IdempotencyKey"];
750
+ };
751
+ path?: never;
752
+ cookie?: never;
753
+ };
754
+ requestBody: {
755
+ content: {
756
+ "application/json": {
757
+ /** Format: uuid */
758
+ visitorId: string;
759
+ };
760
+ };
761
+ };
762
+ responses: {
763
+ /** @description Merged. */
764
+ 200: {
765
+ headers: {
766
+ [name: string]: unknown;
767
+ };
768
+ content: {
769
+ "application/json": {
770
+ mergedItems: number;
771
+ lists: components["schemas"]["List"][];
772
+ };
773
+ };
774
+ };
775
+ 401: components["responses"]["Unauthorized"];
776
+ };
777
+ };
778
+ shareList: {
779
+ parameters: {
780
+ query?: {
781
+ rotate?: boolean;
782
+ };
783
+ header?: {
784
+ /** @description Server key only. Customer GID of the logged-in shopper. */
785
+ "Bagsy-Customer-Id"?: components["parameters"]["CustomerId"];
786
+ /** @description Guest identity. Ignored when a customer is identified. */
787
+ "Bagsy-Visitor-Id"?: components["parameters"]["VisitorId"];
788
+ };
789
+ path: {
790
+ /** @description A list id, or `default`. */
791
+ listId: components["parameters"]["ListId"];
792
+ };
793
+ cookie?: never;
794
+ };
795
+ requestBody?: never;
796
+ responses: {
797
+ /** @description The list's share token. */
798
+ 200: {
799
+ headers: {
800
+ [name: string]: unknown;
801
+ };
802
+ content: {
803
+ "application/json": {
804
+ /** @example shr_7Hq2LmX9 */
805
+ shareToken: string;
806
+ };
807
+ };
808
+ };
809
+ 404: components["responses"]["NotFound"];
810
+ };
811
+ };
812
+ unshareList: {
813
+ parameters: {
814
+ query?: never;
815
+ header?: {
816
+ /** @description Server key only. Customer GID of the logged-in shopper. */
817
+ "Bagsy-Customer-Id"?: components["parameters"]["CustomerId"];
818
+ /** @description Guest identity. Ignored when a customer is identified. */
819
+ "Bagsy-Visitor-Id"?: components["parameters"]["VisitorId"];
820
+ };
821
+ path: {
822
+ /** @description A list id, or `default`. */
823
+ listId: components["parameters"]["ListId"];
824
+ };
825
+ cookie?: never;
826
+ };
827
+ requestBody?: never;
828
+ responses: {
829
+ /** @description Revoked. */
830
+ 204: {
831
+ headers: {
832
+ [name: string]: unknown;
833
+ };
834
+ content?: never;
835
+ };
836
+ 404: components["responses"]["NotFound"];
837
+ };
838
+ };
839
+ getSharedList: {
840
+ parameters: {
841
+ query?: {
842
+ limit?: components["parameters"]["Limit"];
843
+ /** @description Cursor from `pageInfo.endCursor`. */
844
+ after?: components["parameters"]["After"];
845
+ };
846
+ header?: never;
847
+ path: {
848
+ shareToken: string;
849
+ };
850
+ cookie?: never;
851
+ };
852
+ requestBody?: never;
853
+ responses: {
854
+ /** @description Read-only view. Owner identity is never exposed. */
855
+ 200: {
856
+ headers: {
857
+ [name: string]: unknown;
858
+ };
859
+ content: {
860
+ "application/json": {
861
+ list: {
862
+ name: string;
863
+ itemCount: number;
864
+ };
865
+ items: components["schemas"]["ItemPage"];
866
+ };
867
+ };
868
+ };
869
+ 404: components["responses"]["NotFound"];
870
+ };
871
+ };
872
+ topProducts: {
873
+ parameters: {
874
+ query?: {
875
+ since?: string;
876
+ limit?: components["parameters"]["Limit"];
877
+ };
878
+ header?: never;
879
+ path?: never;
880
+ cookie?: never;
881
+ };
882
+ requestBody?: never;
883
+ responses: {
884
+ /** @description Ranked by distinct owners who saved each product. */
885
+ 200: {
886
+ headers: {
887
+ [name: string]: unknown;
888
+ };
889
+ content: {
890
+ "application/json": {
891
+ data: {
892
+ productId: components["schemas"]["ProductGid"];
893
+ saves: number;
894
+ }[];
895
+ };
896
+ };
897
+ };
898
+ 401: components["responses"]["Unauthorized"];
899
+ };
900
+ };
901
+ }
902
+
903
+ /**
904
+ * Shopify IDs arrive in two shapes: numeric (Liquid's `product.id`) and GIDs
905
+ * (Storefront and Customer Account APIs). Bagsy accepts either and always
906
+ * sends GIDs on the wire.
907
+ */
908
+ type ProductRef = string | number;
909
+ type VariantRef = string | number;
910
+ type CustomerRef = string | number;
911
+ declare const productGid: (ref: ProductRef) => string;
912
+ declare const variantGid: (ref: VariantRef) => string;
913
+ declare const customerGid: (ref: CustomerRef) => string;
914
+
915
+ type Schemas = components['schemas'];
916
+ type Json<T> = T extends {
917
+ content: {
918
+ 'application/json': infer B;
919
+ };
920
+ } ? B : never;
921
+ type List = Schemas['List'];
922
+ type Item = components['schemas']['Item'];
923
+ type ItemPage = components['schemas']['ItemPage'];
924
+ type MergeResult = Json<operations['mergeVisitor']['responses']['200']>;
925
+ type SharedList = Json<operations['getSharedList']['responses']['200']>;
926
+ type TopProduct = Json<operations['topProducts']['responses']['200']>['data'][number];
927
+ interface RequestOptions {
928
+ query?: Record<string, string | number | string[] | undefined>;
929
+ body?: unknown;
930
+ }
931
+ /** A list id, or `'default'` for the owner's default list. */
932
+ type ListRef = string;
933
+ interface Owner {
934
+ /** Server mode only. On the app proxy, Shopify supplies the customer. */
935
+ customerId?: CustomerRef;
936
+ /** Guest identity; see `getVisitorId()`. Ignored once a customer is known. */
937
+ visitorId?: string;
938
+ }
939
+ interface CommonOptions {
940
+ /** Override the API origin and path, e.g. for local development or tests. */
941
+ baseUrl?: string;
942
+ /** Custom fetch, e.g. Oxygen's or a test double. */
943
+ fetch?: typeof globalThis.fetch;
944
+ }
945
+ interface ProxyOptions extends CommonOptions {
946
+ /** Liquid themes. Requests go through the store's app proxy. */
947
+ mode: 'proxy';
948
+ /**
949
+ * Proxy path on the store. Pass `{{ routes.root_url }}apps/bagsy` from Liquid
950
+ * so Markets locale prefixes (`/en-gb/…`) are respected.
951
+ * @default '/apps/bagsy'
952
+ */
953
+ proxyPath?: string;
954
+ visitorId?: string;
955
+ }
956
+ interface ServerOptions extends CommonOptions, Owner {
957
+ /** Hydrogen, Node, Workers. Never in a browser. */
958
+ mode: 'server';
959
+ /** Per-shop secret key (`bsk_live_…` or `bsk_test_…`). */
960
+ apiKey: string;
961
+ }
962
+ interface AccountOptions extends CommonOptions {
963
+ /**
964
+ * Customer account UI extensions. Authenticates every request with a
965
+ * Shopify session token; the customer comes from the token. Use with
966
+ * createBagsy() or createAccountTransport(), not createTransport().
967
+ */
968
+ mode: 'account';
969
+ /** Returns a current session token, e.g. `() => shopify.sessionToken.get()`. */
970
+ sessionToken: () => Promise<string>;
971
+ visitorId?: undefined;
972
+ }
973
+ interface RelayOptions {
974
+ /**
975
+ * Browsers on headless storefronts (Hydrogen, other React apps). Calls go to
976
+ * one endpoint on your server, which adds the key and the shopper's identity.
977
+ * See `@umxr/bagsy/hydrogen`.
978
+ */
979
+ mode: 'relay';
980
+ /** Your server's relay endpoint. @default '/api/bagsy' */
981
+ endpoint?: string;
982
+ fetch?: typeof globalThis.fetch;
983
+ baseUrl?: undefined;
984
+ visitorId?: undefined;
985
+ }
986
+ type BagsyOptions = ProxyOptions | ServerOptions | AccountOptions | RelayOptions;
987
+ interface SavedEntry {
988
+ listId: string;
989
+ itemId: string;
990
+ variantId?: string;
991
+ }
992
+ interface SavedLookup {
993
+ /** True if the product (optionally that exact variant) is saved in any list. */
994
+ has(product: ProductRef, variant?: VariantRef): boolean;
995
+ /** Every place the product is saved. Empty when it isn't. */
996
+ get(product: ProductRef): SavedEntry[];
997
+ /** Raw result keyed by product GID. */
998
+ readonly byProduct: Readonly<Record<string, SavedEntry[]>>;
999
+ }
1000
+ interface PageOptions {
1001
+ limit?: number;
1002
+ after?: string;
1003
+ }
1004
+ interface ItemOptions {
1005
+ listId?: ListRef;
1006
+ variantId?: VariantRef;
1007
+ }
1008
+
1009
+ /** How operations reach the API: base URL, identity headers and fetch. */
1010
+ interface Transport {
1011
+ readonly options: BagsyOptions;
1012
+ send<T>(method: string, path: string, init?: RequestOptions): Promise<{
1013
+ status: number;
1014
+ data: T;
1015
+ }>;
1016
+ request<T>(method: string, path: string, init?: RequestOptions): Promise<T>;
1017
+ }
1018
+ /** Proxy, server and account modes. Relay mode has its own: `createRelayTransport()`. */
1019
+ declare function createTransport(options: Exclude<BagsyOptions, RelayOptions>): Transport;
1020
+
1021
+ export { createTransport as k, customerGid as l, productGid as m, variantGid as v };
1022
+ export type { AccountOptions as A, BagsyOptions as B, CustomerRef as C, ItemOptions as I, ListRef as L, MergeResult as M, Owner as O, PageOptions as P, RelayOptions as R, SavedLookup as S, Transport as T, VariantRef as V, ProductRef as a, SavedEntry as b, components as c, Item as d, List as e, SharedList as f, ItemPage as g, TopProduct as h, ProxyOptions as i, ServerOptions as j, operations as o, paths as p };