@medivy/sdk 0.0.0-stage → 0.3.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,1725 @@
1
+ /** SHA-256 of the OpenAPI document this file was generated from. */
2
+ export const OPENAPI_SHA256 = "3dabfa0780e34d79a471dd341959cae9eef2435f1a3763e796a1d8bf7109ac02";
3
+ /** `info.version` of the public API contract. */
4
+ export const OPENAPI_VERSION = "1.0.0";
5
+ /** Every v1 operation as the runtime client sees it. */
6
+ export const OPERATIONS = {
7
+ outletsList: {
8
+ method: "GET",
9
+ path: "/v1/outlets",
10
+ pathParams: [],
11
+ queryParams: ["limit", "cursor", "q", "type", "isActive"],
12
+ body: "none",
13
+ idempotencyKey: false,
14
+ idempotencyKeyRequired: false,
15
+ paginated: true,
16
+ rateLimitBucket: "read",
17
+ successStatus: 200,
18
+ },
19
+ outletsGet: {
20
+ method: "GET",
21
+ path: "/v1/outlets/{id}",
22
+ pathParams: ["id"],
23
+ queryParams: [],
24
+ body: "none",
25
+ idempotencyKey: false,
26
+ idempotencyKeyRequired: false,
27
+ paginated: false,
28
+ rateLimitBucket: "read",
29
+ successStatus: 200,
30
+ },
31
+ paymentChannelsList: {
32
+ method: "GET",
33
+ path: "/v1/payment-channels",
34
+ pathParams: [],
35
+ queryParams: ["outletId", "isInbound"],
36
+ body: "none",
37
+ idempotencyKey: false,
38
+ idempotencyKeyRequired: false,
39
+ paginated: false,
40
+ rateLimitBucket: "read",
41
+ successStatus: 200,
42
+ },
43
+ unitsList: {
44
+ method: "GET",
45
+ path: "/v1/units",
46
+ pathParams: [],
47
+ queryParams: ["activeOnly"],
48
+ body: "none",
49
+ idempotencyKey: false,
50
+ idempotencyKeyRequired: false,
51
+ paginated: false,
52
+ rateLimitBucket: "read",
53
+ successStatus: 200,
54
+ },
55
+ productsList: {
56
+ method: "GET",
57
+ path: "/v1/products",
58
+ pathParams: [],
59
+ queryParams: ["limit", "cursor", "q", "category", "isActive", "updatedFrom", "updatedTo", "createdFrom", "createdTo", "sort"],
60
+ body: "none",
61
+ idempotencyKey: false,
62
+ idempotencyKeyRequired: false,
63
+ paginated: true,
64
+ rateLimitBucket: "read",
65
+ successStatus: 200,
66
+ },
67
+ productsCreate: {
68
+ method: "POST",
69
+ path: "/v1/products",
70
+ pathParams: [],
71
+ queryParams: [],
72
+ body: "json",
73
+ idempotencyKey: true,
74
+ idempotencyKeyRequired: true,
75
+ paginated: false,
76
+ rateLimitBucket: "write",
77
+ successStatus: 201,
78
+ },
79
+ productsGet: {
80
+ method: "GET",
81
+ path: "/v1/products/{id}",
82
+ pathParams: ["id"],
83
+ queryParams: [],
84
+ body: "none",
85
+ idempotencyKey: false,
86
+ idempotencyKeyRequired: false,
87
+ paginated: false,
88
+ rateLimitBucket: "read",
89
+ successStatus: 200,
90
+ },
91
+ productsUpdate: {
92
+ method: "PATCH",
93
+ path: "/v1/products/{id}",
94
+ pathParams: ["id"],
95
+ queryParams: [],
96
+ body: "json",
97
+ idempotencyKey: true,
98
+ idempotencyKeyRequired: true,
99
+ paginated: false,
100
+ rateLimitBucket: "write",
101
+ successStatus: 200,
102
+ },
103
+ pricesList: {
104
+ method: "GET",
105
+ path: "/v1/prices",
106
+ pathParams: [],
107
+ queryParams: ["limit", "cursor", "q", "productId"],
108
+ body: "none",
109
+ idempotencyKey: false,
110
+ idempotencyKeyRequired: false,
111
+ paginated: true,
112
+ rateLimitBucket: "read",
113
+ successStatus: 200,
114
+ },
115
+ stockLevelsList: {
116
+ method: "GET",
117
+ path: "/v1/stock-levels",
118
+ pathParams: [],
119
+ queryParams: ["limit", "cursor", "outletId", "q", "belowMin", "reorder"],
120
+ body: "none",
121
+ idempotencyKey: false,
122
+ idempotencyKeyRequired: false,
123
+ paginated: true,
124
+ rateLimitBucket: "read",
125
+ successStatus: 200,
126
+ },
127
+ batchesList: {
128
+ method: "GET",
129
+ path: "/v1/batches",
130
+ pathParams: [],
131
+ queryParams: ["limit", "cursor", "outletId", "variantId", "status", "expiringWithinDays", "q"],
132
+ body: "none",
133
+ idempotencyKey: false,
134
+ idempotencyKeyRequired: false,
135
+ paginated: true,
136
+ rateLimitBucket: "read",
137
+ successStatus: 200,
138
+ },
139
+ stockMovementsList: {
140
+ method: "GET",
141
+ path: "/v1/stock-movements",
142
+ pathParams: [],
143
+ queryParams: ["limit", "cursor", "outletId", "variantId", "productId", "batchId", "type", "since", "until"],
144
+ body: "none",
145
+ idempotencyKey: false,
146
+ idempotencyKeyRequired: false,
147
+ paginated: true,
148
+ rateLimitBucket: "read",
149
+ successStatus: 200,
150
+ },
151
+ contactsList: {
152
+ method: "GET",
153
+ path: "/v1/contacts",
154
+ pathParams: [],
155
+ queryParams: ["limit", "cursor", "q", "kind", "isActive", "createdFrom", "createdTo"],
156
+ body: "none",
157
+ idempotencyKey: false,
158
+ idempotencyKeyRequired: false,
159
+ paginated: true,
160
+ rateLimitBucket: "read",
161
+ successStatus: 200,
162
+ },
163
+ contactsGet: {
164
+ method: "GET",
165
+ path: "/v1/contacts/{id}",
166
+ pathParams: ["id"],
167
+ queryParams: [],
168
+ body: "none",
169
+ idempotencyKey: false,
170
+ idempotencyKeyRequired: false,
171
+ paginated: false,
172
+ rateLimitBucket: "read",
173
+ successStatus: 200,
174
+ },
175
+ loyaltyAccountsList: {
176
+ method: "GET",
177
+ path: "/v1/loyalty-accounts",
178
+ pathParams: [],
179
+ queryParams: ["limit", "cursor", "q", "tierId", "contactId", "active"],
180
+ body: "none",
181
+ idempotencyKey: false,
182
+ idempotencyKeyRequired: false,
183
+ paginated: true,
184
+ rateLimitBucket: "read",
185
+ successStatus: 200,
186
+ },
187
+ loyaltyAccountsGet: {
188
+ method: "GET",
189
+ path: "/v1/loyalty-accounts/{id}",
190
+ pathParams: ["id"],
191
+ queryParams: [],
192
+ body: "none",
193
+ idempotencyKey: false,
194
+ idempotencyKeyRequired: false,
195
+ paginated: false,
196
+ rateLimitBucket: "read",
197
+ successStatus: 200,
198
+ },
199
+ salesList: {
200
+ method: "GET",
201
+ path: "/v1/sales",
202
+ pathParams: [],
203
+ queryParams: ["limit", "cursor", "outletId", "status", "source", "customerId", "dateFrom", "dateTo", "timezone", "q", "externalId"],
204
+ body: "none",
205
+ idempotencyKey: false,
206
+ idempotencyKeyRequired: false,
207
+ paginated: true,
208
+ rateLimitBucket: "read",
209
+ successStatus: 200,
210
+ },
211
+ salesCreate: {
212
+ method: "POST",
213
+ path: "/v1/sales",
214
+ pathParams: [],
215
+ queryParams: [],
216
+ body: "json",
217
+ idempotencyKey: true,
218
+ idempotencyKeyRequired: false,
219
+ paginated: false,
220
+ rateLimitBucket: "write",
221
+ successStatus: 201,
222
+ },
223
+ salesGet: {
224
+ method: "GET",
225
+ path: "/v1/sales/{id}",
226
+ pathParams: ["id"],
227
+ queryParams: [],
228
+ body: "none",
229
+ idempotencyKey: false,
230
+ idempotencyKeyRequired: false,
231
+ paginated: false,
232
+ rateLimitBucket: "read",
233
+ successStatus: 200,
234
+ },
235
+ salesRefund: {
236
+ method: "POST",
237
+ path: "/v1/sales/{id}/refunds",
238
+ pathParams: ["id"],
239
+ queryParams: [],
240
+ body: "json",
241
+ idempotencyKey: true,
242
+ idempotencyKeyRequired: true,
243
+ paginated: false,
244
+ rateLimitBucket: "write",
245
+ successStatus: 201,
246
+ },
247
+ invoicesList: {
248
+ method: "GET",
249
+ path: "/v1/invoices",
250
+ pathParams: [],
251
+ queryParams: ["limit", "cursor", "q", "status", "customerId", "dateFrom", "dateTo"],
252
+ body: "none",
253
+ idempotencyKey: false,
254
+ idempotencyKeyRequired: false,
255
+ paginated: true,
256
+ rateLimitBucket: "read",
257
+ successStatus: 200,
258
+ },
259
+ invoicesCreate: {
260
+ method: "POST",
261
+ path: "/v1/invoices",
262
+ pathParams: [],
263
+ queryParams: [],
264
+ body: "json",
265
+ idempotencyKey: true,
266
+ idempotencyKeyRequired: true,
267
+ paginated: false,
268
+ rateLimitBucket: "write",
269
+ successStatus: 201,
270
+ },
271
+ invoicesGet: {
272
+ method: "GET",
273
+ path: "/v1/invoices/{id}",
274
+ pathParams: ["id"],
275
+ queryParams: [],
276
+ body: "none",
277
+ idempotencyKey: false,
278
+ idempotencyKeyRequired: false,
279
+ paginated: false,
280
+ rateLimitBucket: "read",
281
+ successStatus: 200,
282
+ },
283
+ invoicesUpdate: {
284
+ method: "PATCH",
285
+ path: "/v1/invoices/{id}",
286
+ pathParams: ["id"],
287
+ queryParams: [],
288
+ body: "json",
289
+ idempotencyKey: true,
290
+ idempotencyKeyRequired: true,
291
+ paginated: false,
292
+ rateLimitBucket: "write",
293
+ successStatus: 200,
294
+ },
295
+ invoicesIssue: {
296
+ method: "POST",
297
+ path: "/v1/invoices/{id}/issue",
298
+ pathParams: ["id"],
299
+ queryParams: [],
300
+ body: "empty",
301
+ idempotencyKey: true,
302
+ idempotencyKeyRequired: true,
303
+ paginated: false,
304
+ rateLimitBucket: "write",
305
+ successStatus: 200,
306
+ },
307
+ invoicesPay: {
308
+ method: "POST",
309
+ path: "/v1/invoices/{id}/payments",
310
+ pathParams: ["id"],
311
+ queryParams: [],
312
+ body: "json",
313
+ idempotencyKey: true,
314
+ idempotencyKeyRequired: true,
315
+ paginated: false,
316
+ rateLimitBucket: "write",
317
+ successStatus: 201,
318
+ },
319
+ productsCreateVariant: {
320
+ method: "POST",
321
+ path: "/v1/products/{id}/variants",
322
+ pathParams: ["id"],
323
+ queryParams: [],
324
+ body: "json",
325
+ idempotencyKey: true,
326
+ idempotencyKeyRequired: true,
327
+ paginated: false,
328
+ rateLimitBucket: "write",
329
+ successStatus: 201,
330
+ },
331
+ variantsUpdate: {
332
+ method: "PATCH",
333
+ path: "/v1/variants/{id}",
334
+ pathParams: ["id"],
335
+ queryParams: [],
336
+ body: "json",
337
+ idempotencyKey: true,
338
+ idempotencyKeyRequired: true,
339
+ paginated: false,
340
+ rateLimitBucket: "write",
341
+ successStatus: 200,
342
+ },
343
+ stockAdjustmentsCreate: {
344
+ method: "POST",
345
+ path: "/v1/stock-adjustments",
346
+ pathParams: [],
347
+ queryParams: [],
348
+ body: "json",
349
+ idempotencyKey: true,
350
+ idempotencyKeyRequired: true,
351
+ paginated: false,
352
+ rateLimitBucket: "write",
353
+ successStatus: 201,
354
+ },
355
+ purchaseOrdersList: {
356
+ method: "GET",
357
+ path: "/v1/purchase-orders",
358
+ pathParams: [],
359
+ queryParams: ["limit", "cursor", "outletId", "q", "supplierId", "status", "dateFrom", "dateTo"],
360
+ body: "none",
361
+ idempotencyKey: false,
362
+ idempotencyKeyRequired: false,
363
+ paginated: true,
364
+ rateLimitBucket: "read",
365
+ successStatus: 200,
366
+ },
367
+ purchaseOrdersCreate: {
368
+ method: "POST",
369
+ path: "/v1/purchase-orders",
370
+ pathParams: [],
371
+ queryParams: [],
372
+ body: "json",
373
+ idempotencyKey: true,
374
+ idempotencyKeyRequired: true,
375
+ paginated: false,
376
+ rateLimitBucket: "write",
377
+ successStatus: 201,
378
+ },
379
+ purchaseOrdersGet: {
380
+ method: "GET",
381
+ path: "/v1/purchase-orders/{id}",
382
+ pathParams: ["id"],
383
+ queryParams: [],
384
+ body: "none",
385
+ idempotencyKey: false,
386
+ idempotencyKeyRequired: false,
387
+ paginated: false,
388
+ rateLimitBucket: "read",
389
+ successStatus: 200,
390
+ },
391
+ purchaseOrdersUpdate: {
392
+ method: "PATCH",
393
+ path: "/v1/purchase-orders/{id}",
394
+ pathParams: ["id"],
395
+ queryParams: [],
396
+ body: "json",
397
+ idempotencyKey: true,
398
+ idempotencyKeyRequired: true,
399
+ paginated: false,
400
+ rateLimitBucket: "write",
401
+ successStatus: 200,
402
+ },
403
+ purchaseInvoicesList: {
404
+ method: "GET",
405
+ path: "/v1/purchase-invoices",
406
+ pathParams: [],
407
+ queryParams: ["limit", "cursor", "outletId", "q", "supplierId", "status", "type", "paymentStatus", "purchaseOrderId", "consignmentOpen", "journalStatus", "dateFrom", "dateTo"],
408
+ body: "none",
409
+ idempotencyKey: false,
410
+ idempotencyKeyRequired: false,
411
+ paginated: true,
412
+ rateLimitBucket: "read",
413
+ successStatus: 200,
414
+ },
415
+ purchaseInvoicesCreate: {
416
+ method: "POST",
417
+ path: "/v1/purchase-invoices",
418
+ pathParams: [],
419
+ queryParams: [],
420
+ body: "json",
421
+ idempotencyKey: true,
422
+ idempotencyKeyRequired: false,
423
+ paginated: false,
424
+ rateLimitBucket: "write",
425
+ successStatus: 201,
426
+ },
427
+ purchaseInvoicesGet: {
428
+ method: "GET",
429
+ path: "/v1/purchase-invoices/{id}",
430
+ pathParams: ["id"],
431
+ queryParams: [],
432
+ body: "none",
433
+ idempotencyKey: false,
434
+ idempotencyKeyRequired: false,
435
+ paginated: false,
436
+ rateLimitBucket: "read",
437
+ successStatus: 200,
438
+ },
439
+ purchaseInvoicesReceive: {
440
+ method: "POST",
441
+ path: "/v1/purchase-invoices/{id}/receive",
442
+ pathParams: ["id"],
443
+ queryParams: [],
444
+ body: "json",
445
+ idempotencyKey: true,
446
+ idempotencyKeyRequired: true,
447
+ paginated: false,
448
+ rateLimitBucket: "write",
449
+ successStatus: 200,
450
+ },
451
+ purchaseInvoicesJournal: {
452
+ method: "POST",
453
+ path: "/v1/purchase-invoices/{id}/journal",
454
+ pathParams: ["id"],
455
+ queryParams: [],
456
+ body: "empty",
457
+ idempotencyKey: true,
458
+ idempotencyKeyRequired: true,
459
+ paginated: false,
460
+ rateLimitBucket: "write",
461
+ successStatus: 200,
462
+ },
463
+ pipelinesList: {
464
+ method: "GET",
465
+ path: "/v1/pipelines",
466
+ pathParams: [],
467
+ queryParams: ["activeOnly"],
468
+ body: "none",
469
+ idempotencyKey: false,
470
+ idempotencyKeyRequired: false,
471
+ paginated: false,
472
+ rateLimitBucket: "read",
473
+ successStatus: 200,
474
+ },
475
+ pipelinesCreate: {
476
+ method: "POST",
477
+ path: "/v1/pipelines",
478
+ pathParams: [],
479
+ queryParams: [],
480
+ body: "json",
481
+ idempotencyKey: true,
482
+ idempotencyKeyRequired: true,
483
+ paginated: false,
484
+ rateLimitBucket: "write",
485
+ successStatus: 201,
486
+ },
487
+ pipelinesUpdate: {
488
+ method: "PATCH",
489
+ path: "/v1/pipelines/{id}",
490
+ pathParams: ["id"],
491
+ queryParams: [],
492
+ body: "json",
493
+ idempotencyKey: true,
494
+ idempotencyKeyRequired: true,
495
+ paginated: false,
496
+ rateLimitBucket: "write",
497
+ successStatus: 200,
498
+ },
499
+ pipelinesCreateStage: {
500
+ method: "POST",
501
+ path: "/v1/pipelines/{id}/stages",
502
+ pathParams: ["id"],
503
+ queryParams: [],
504
+ body: "json",
505
+ idempotencyKey: true,
506
+ idempotencyKeyRequired: true,
507
+ paginated: false,
508
+ rateLimitBucket: "write",
509
+ successStatus: 201,
510
+ },
511
+ pipelineStagesUpdate: {
512
+ method: "PATCH",
513
+ path: "/v1/pipeline-stages/{id}",
514
+ pathParams: ["id"],
515
+ queryParams: [],
516
+ body: "json",
517
+ idempotencyKey: true,
518
+ idempotencyKeyRequired: true,
519
+ paginated: false,
520
+ rateLimitBucket: "write",
521
+ successStatus: 200,
522
+ },
523
+ dealsList: {
524
+ method: "GET",
525
+ path: "/v1/deals",
526
+ pathParams: [],
527
+ queryParams: ["limit", "cursor", "pipelineId", "stageId", "customerId", "status", "since"],
528
+ body: "none",
529
+ idempotencyKey: false,
530
+ idempotencyKeyRequired: false,
531
+ paginated: true,
532
+ rateLimitBucket: "read",
533
+ successStatus: 200,
534
+ },
535
+ dealsCreate: {
536
+ method: "POST",
537
+ path: "/v1/deals",
538
+ pathParams: [],
539
+ queryParams: [],
540
+ body: "json",
541
+ idempotencyKey: true,
542
+ idempotencyKeyRequired: true,
543
+ paginated: false,
544
+ rateLimitBucket: "write",
545
+ successStatus: 201,
546
+ },
547
+ dealsGet: {
548
+ method: "GET",
549
+ path: "/v1/deals/{id}",
550
+ pathParams: ["id"],
551
+ queryParams: [],
552
+ body: "none",
553
+ idempotencyKey: false,
554
+ idempotencyKeyRequired: false,
555
+ paginated: false,
556
+ rateLimitBucket: "read",
557
+ successStatus: 200,
558
+ },
559
+ dealsUpdate: {
560
+ method: "PATCH",
561
+ path: "/v1/deals/{id}",
562
+ pathParams: ["id"],
563
+ queryParams: [],
564
+ body: "json",
565
+ idempotencyKey: true,
566
+ idempotencyKeyRequired: true,
567
+ paginated: false,
568
+ rateLimitBucket: "write",
569
+ successStatus: 200,
570
+ },
571
+ estimatesList: {
572
+ method: "GET",
573
+ path: "/v1/estimates",
574
+ pathParams: [],
575
+ queryParams: ["limit", "cursor", "q", "status", "customerId", "proposalId", "dateFrom", "dateTo"],
576
+ body: "none",
577
+ idempotencyKey: false,
578
+ idempotencyKeyRequired: false,
579
+ paginated: true,
580
+ rateLimitBucket: "read",
581
+ successStatus: 200,
582
+ },
583
+ estimatesCreate: {
584
+ method: "POST",
585
+ path: "/v1/estimates",
586
+ pathParams: [],
587
+ queryParams: [],
588
+ body: "json",
589
+ idempotencyKey: true,
590
+ idempotencyKeyRequired: true,
591
+ paginated: false,
592
+ rateLimitBucket: "write",
593
+ successStatus: 201,
594
+ },
595
+ estimatesGet: {
596
+ method: "GET",
597
+ path: "/v1/estimates/{id}",
598
+ pathParams: ["id"],
599
+ queryParams: [],
600
+ body: "none",
601
+ idempotencyKey: false,
602
+ idempotencyKeyRequired: false,
603
+ paginated: false,
604
+ rateLimitBucket: "read",
605
+ successStatus: 200,
606
+ },
607
+ estimatesUpdate: {
608
+ method: "PATCH",
609
+ path: "/v1/estimates/{id}",
610
+ pathParams: ["id"],
611
+ queryParams: [],
612
+ body: "json",
613
+ idempotencyKey: true,
614
+ idempotencyKeyRequired: true,
615
+ paginated: false,
616
+ rateLimitBucket: "write",
617
+ successStatus: 200,
618
+ },
619
+ proposalsList: {
620
+ method: "GET",
621
+ path: "/v1/proposals",
622
+ pathParams: [],
623
+ queryParams: ["limit", "cursor", "q", "status", "customerId", "dateFrom", "dateTo"],
624
+ body: "none",
625
+ idempotencyKey: false,
626
+ idempotencyKeyRequired: false,
627
+ paginated: true,
628
+ rateLimitBucket: "read",
629
+ successStatus: 200,
630
+ },
631
+ proposalsCreate: {
632
+ method: "POST",
633
+ path: "/v1/proposals",
634
+ pathParams: [],
635
+ queryParams: [],
636
+ body: "json",
637
+ idempotencyKey: true,
638
+ idempotencyKeyRequired: true,
639
+ paginated: false,
640
+ rateLimitBucket: "write",
641
+ successStatus: 201,
642
+ },
643
+ proposalsGet: {
644
+ method: "GET",
645
+ path: "/v1/proposals/{id}",
646
+ pathParams: ["id"],
647
+ queryParams: [],
648
+ body: "none",
649
+ idempotencyKey: false,
650
+ idempotencyKeyRequired: false,
651
+ paginated: false,
652
+ rateLimitBucket: "read",
653
+ successStatus: 200,
654
+ },
655
+ proposalsUpdate: {
656
+ method: "PATCH",
657
+ path: "/v1/proposals/{id}",
658
+ pathParams: ["id"],
659
+ queryParams: [],
660
+ body: "json",
661
+ idempotencyKey: true,
662
+ idempotencyKeyRequired: true,
663
+ paginated: false,
664
+ rateLimitBucket: "write",
665
+ successStatus: 200,
666
+ },
667
+ proposalsAddLine: {
668
+ method: "POST",
669
+ path: "/v1/proposals/{id}/lines",
670
+ pathParams: ["id"],
671
+ queryParams: [],
672
+ body: "json",
673
+ idempotencyKey: true,
674
+ idempotencyKeyRequired: true,
675
+ paginated: false,
676
+ rateLimitBucket: "write",
677
+ successStatus: 201,
678
+ },
679
+ proposalLinesUpdate: {
680
+ method: "PATCH",
681
+ path: "/v1/proposal-lines/{id}",
682
+ pathParams: ["id"],
683
+ queryParams: [],
684
+ body: "json",
685
+ idempotencyKey: true,
686
+ idempotencyKeyRequired: true,
687
+ paginated: false,
688
+ rateLimitBucket: "write",
689
+ successStatus: 200,
690
+ },
691
+ invoicesCancel: {
692
+ method: "POST",
693
+ path: "/v1/invoices/{id}/cancel",
694
+ pathParams: ["id"],
695
+ queryParams: [],
696
+ body: "json",
697
+ idempotencyKey: true,
698
+ idempotencyKeyRequired: true,
699
+ paginated: false,
700
+ rateLimitBucket: "write",
701
+ successStatus: 200,
702
+ },
703
+ invoicesVoid: {
704
+ method: "POST",
705
+ path: "/v1/invoices/{id}/void",
706
+ pathParams: ["id"],
707
+ queryParams: [],
708
+ body: "json",
709
+ idempotencyKey: true,
710
+ idempotencyKeyRequired: true,
711
+ paginated: false,
712
+ rateLimitBucket: "write",
713
+ successStatus: 200,
714
+ },
715
+ invoicesLedgerReversal: {
716
+ method: "POST",
717
+ path: "/v1/invoices/{id}/ledger-reversal",
718
+ pathParams: ["id"],
719
+ queryParams: [],
720
+ body: "empty",
721
+ idempotencyKey: true,
722
+ idempotencyKeyRequired: true,
723
+ paginated: false,
724
+ rateLimitBucket: "write",
725
+ successStatus: 200,
726
+ },
727
+ posSessionsList: {
728
+ method: "GET",
729
+ path: "/v1/pos-sessions",
730
+ pathParams: [],
731
+ queryParams: ["outletId"],
732
+ body: "none",
733
+ idempotencyKey: false,
734
+ idempotencyKeyRequired: false,
735
+ paginated: false,
736
+ rateLimitBucket: "read",
737
+ successStatus: 200,
738
+ },
739
+ posSessionsGet: {
740
+ method: "GET",
741
+ path: "/v1/pos-sessions/{id}",
742
+ pathParams: ["id"],
743
+ queryParams: [],
744
+ body: "none",
745
+ idempotencyKey: false,
746
+ idempotencyKeyRequired: false,
747
+ paginated: false,
748
+ rateLimitBucket: "read",
749
+ successStatus: 200,
750
+ },
751
+ posSessionsCreateCashMovement: {
752
+ method: "POST",
753
+ path: "/v1/pos-sessions/{id}/cash-movements",
754
+ pathParams: ["id"],
755
+ queryParams: [],
756
+ body: "json",
757
+ idempotencyKey: true,
758
+ idempotencyKeyRequired: true,
759
+ paginated: false,
760
+ rateLimitBucket: "write",
761
+ successStatus: 201,
762
+ },
763
+ heldCartsList: {
764
+ method: "GET",
765
+ path: "/v1/held-carts",
766
+ pathParams: [],
767
+ queryParams: ["outletId"],
768
+ body: "none",
769
+ idempotencyKey: false,
770
+ idempotencyKeyRequired: false,
771
+ paginated: false,
772
+ rateLimitBucket: "read",
773
+ successStatus: 200,
774
+ },
775
+ posFeesList: {
776
+ method: "GET",
777
+ path: "/v1/pos-fees",
778
+ pathParams: [],
779
+ queryParams: ["activeOnly"],
780
+ body: "none",
781
+ idempotencyKey: false,
782
+ idempotencyKeyRequired: false,
783
+ paginated: false,
784
+ rateLimitBucket: "read",
785
+ successStatus: 200,
786
+ },
787
+ posFeesCreate: {
788
+ method: "POST",
789
+ path: "/v1/pos-fees",
790
+ pathParams: [],
791
+ queryParams: [],
792
+ body: "json",
793
+ idempotencyKey: true,
794
+ idempotencyKeyRequired: true,
795
+ paginated: false,
796
+ rateLimitBucket: "write",
797
+ successStatus: 201,
798
+ },
799
+ posFeesUpdate: {
800
+ method: "PATCH",
801
+ path: "/v1/pos-fees/{id}",
802
+ pathParams: ["id"],
803
+ queryParams: [],
804
+ body: "json",
805
+ idempotencyKey: true,
806
+ idempotencyKeyRequired: true,
807
+ paginated: false,
808
+ rateLimitBucket: "write",
809
+ successStatus: 200,
810
+ },
811
+ paymentsList: {
812
+ method: "GET",
813
+ path: "/v1/payments",
814
+ pathParams: [],
815
+ queryParams: ["limit", "cursor", "q", "status", "contactId", "method", "dateFrom", "dateTo"],
816
+ body: "none",
817
+ idempotencyKey: false,
818
+ idempotencyKeyRequired: false,
819
+ paginated: true,
820
+ rateLimitBucket: "read",
821
+ successStatus: 200,
822
+ },
823
+ paymentsGet: {
824
+ method: "GET",
825
+ path: "/v1/payments/{id}",
826
+ pathParams: ["id"],
827
+ queryParams: [],
828
+ body: "none",
829
+ idempotencyKey: false,
830
+ idempotencyKeyRequired: false,
831
+ paginated: false,
832
+ rateLimitBucket: "read",
833
+ successStatus: 200,
834
+ },
835
+ reportsRevenue: {
836
+ method: "GET",
837
+ path: "/v1/reports/revenue",
838
+ pathParams: [],
839
+ queryParams: ["from", "to", "outletId", "timezone", "channelId", "groupBy"],
840
+ body: "none",
841
+ idempotencyKey: false,
842
+ idempotencyKeyRequired: false,
843
+ paginated: false,
844
+ rateLimitBucket: "report",
845
+ successStatus: 200,
846
+ },
847
+ reportsSalesSummary: {
848
+ method: "GET",
849
+ path: "/v1/reports/sales-summary",
850
+ pathParams: [],
851
+ queryParams: ["from", "to", "outletId", "timezone", "channelId"],
852
+ body: "none",
853
+ idempotencyKey: false,
854
+ idempotencyKeyRequired: false,
855
+ paginated: false,
856
+ rateLimitBucket: "report",
857
+ successStatus: 200,
858
+ },
859
+ reportsSalesPerformance: {
860
+ method: "GET",
861
+ path: "/v1/reports/sales-performance",
862
+ pathParams: [],
863
+ queryParams: ["from", "to", "outletId", "timezone", "channelId", "groupBy"],
864
+ body: "none",
865
+ idempotencyKey: false,
866
+ idempotencyKeyRequired: false,
867
+ paginated: false,
868
+ rateLimitBucket: "report",
869
+ successStatus: 200,
870
+ },
871
+ reportsProductPerformance: {
872
+ method: "GET",
873
+ path: "/v1/reports/product-performance",
874
+ pathParams: [],
875
+ queryParams: ["days", "outletId", "channelId"],
876
+ body: "none",
877
+ idempotencyKey: false,
878
+ idempotencyKeyRequired: false,
879
+ paginated: false,
880
+ rateLimitBucket: "report",
881
+ successStatus: 200,
882
+ },
883
+ reportsStockMovement: {
884
+ method: "GET",
885
+ path: "/v1/reports/stock-movement",
886
+ pathParams: [],
887
+ queryParams: ["from", "to", "outletId", "timezone", "variantId", "type"],
888
+ body: "none",
889
+ idempotencyKey: false,
890
+ idempotencyKeyRequired: false,
891
+ paginated: false,
892
+ rateLimitBucket: "report",
893
+ successStatus: 200,
894
+ },
895
+ };
896
+ /** Builds the per-resource methods (`client.products.list()`, `client.sales.create()`, …) on a caller. */
897
+ export function createResources(c) {
898
+ return {
899
+ outlets: {
900
+ /**
901
+ * List outlets
902
+ *
903
+ * Scope: `org:read` · rate limit: read
904
+ *
905
+ * `GET /v1/outlets` · rate-limit bucket: read
906
+ */
907
+ list: (query, options) => c.call("outletsList", { query }, options),
908
+ /** Every row of `GET /v1/outlets`, page after page (follows `nextCursor` with the same filters and `limit`). */
909
+ listAll: (query, options) => c.paginate("outletsList", { query }, options),
910
+ /**
911
+ * Get an outlet
912
+ *
913
+ * Scope: `org:read` · rate limit: read
914
+ *
915
+ * `GET /v1/outlets/{id}` · rate-limit bucket: read
916
+ */
917
+ get: (id, options) => c.call("outletsGet", { path: { id } }, options),
918
+ },
919
+ paymentChannels: {
920
+ /**
921
+ * List the organization's payment channels (for sales, refunds and invoice payments)
922
+ *
923
+ * Own, active channels. `outletId` = the channel's account outlet (null = usable at every outlet); filter with `outletId` to get the channels usable at one outlet. A sale or an invoice payment needs an inbound channel (`isInbound`); a refund may use any. Not paged: `nextCursor` is always null; at most 500 (`truncated: true` past that).
924
+ *
925
+ * Scope: `org:read` · rate limit: read
926
+ *
927
+ * `GET /v1/payment-channels` · rate-limit bucket: read
928
+ */
929
+ list: (query, options) => c.call("paymentChannelsList", { query }, options),
930
+ },
931
+ units: {
932
+ /**
933
+ * List measurement / packaging units
934
+ *
935
+ * Platform units plus the organization's own. Not paged (a short list): `nextCursor` is always null; at most 1000 units (`truncated: true` past that).
936
+ *
937
+ * Scope: `catalog:read` · user permission: `product.read` · rate limit: read
938
+ *
939
+ * `GET /v1/units` · rate-limit bucket: read
940
+ */
941
+ list: (query, options) => c.call("unitsList", { query }, options),
942
+ },
943
+ products: {
944
+ /**
945
+ * List products (variants and units embedded)
946
+ *
947
+ * At most 100 variants and 50 units per product (`truncated` names a cut array). `*_from` / `*_to` are UTC calendar days, both inclusive, from ≤ to.
948
+ *
949
+ * Scope: `catalog:read` · user permission: `product.read` · rate limit: read
950
+ *
951
+ * `GET /v1/products` · rate-limit bucket: read
952
+ */
953
+ list: (query, options) => c.call("productsList", { query }, options),
954
+ /** Every row of `GET /v1/products`, page after page (follows `nextCursor` with the same filters and `limit`). */
955
+ listAll: (query, options) => c.paginate("productsList", { query }, options),
956
+ /**
957
+ * Create a product with its units, option axes and variants
958
+ *
959
+ * One call, like the dash's product form: the base unit (`baseUnit`, created when unknown), larger packaging units (`extraUnits`, each `toBaseQty` base units), option axes (`variantTypes`, e.g. Size: 100ml, 250ml) and one variant per option combination (`variants[].optionValues` lists one value per axis, in axis order). With no `variants` the product gets one default variant. The first variant is the default.
960
+ *
961
+ * At most 200 variants, 20 extra units and 3 option axes. SKUs are unique across the platform (409 `duplicate_sku`, `details.sku`). The organization's SKU limit applies (403). Returns the product as `GET /v1/products/{id}`.
962
+ *
963
+ * Fields the key user may not write are refused whole (403 `forbidden`): a sell price needs `price.safeWrite`, a buy price `cost.*` and the `cost:read` scope.
964
+ *
965
+ * Scope: `catalog:write` · user permission: `product.safeWrite` · rate limit: write (60 / min per key) · `Idempotency-Key` required
966
+ *
967
+ * `POST /v1/products` · rate-limit bucket: write · requires `options.idempotencyKey`: your own stable key for this logical operation (e.g. derived from your invoice / payment id), stored before the call and sent again on every retry — without it the call throws `idempotency_key_required` before sending anything
968
+ */
969
+ create: (body, options) => c.call("productsCreate", { body }, options),
970
+ /**
971
+ * Get a product with its variants and units
972
+ *
973
+ * Scope: `catalog:read` · user permission: `product.read` · rate limit: read
974
+ *
975
+ * `GET /v1/products/{id}` · rate-limit bucket: read
976
+ */
977
+ get: (id, options) => c.call("productsGet", { path: { id } }, options),
978
+ /**
979
+ * Update a product's own fields
980
+ *
981
+ * Only the fields sent change; `null` clears a nullable field. `defaultVariantId` makes another variant of this product the default. `isActive: false` deactivates the product (history-safe, as the dash's Deactivate); `true` reactivates it. Variants, units and option axes are not edited here (see the variant endpoints). Returns the product.
982
+ *
983
+ * Scope: `catalog:write` · rate limit: write (60 / min per key) · `Idempotency-Key` required
984
+ *
985
+ * `PATCH /v1/products/{id}` · rate-limit bucket: write · requires `options.idempotencyKey`: your own stable key for this logical operation (e.g. derived from your invoice / payment id), stored before the call and sent again on every retry — without it the call throws `idempotency_key_required` before sending anything
986
+ */
987
+ update: (id, body, options) => c.call("productsUpdate", { path: { id }, body }, options),
988
+ /**
989
+ * Add a variant to a product
990
+ *
991
+ * For a product without option axes (a product created with `variantTypes` defines its variants at creation). SKU rules as on create. Returns the product with the new variant.
992
+ *
993
+ * Scope: `catalog:write` · user permission: `product.safeWrite` · rate limit: write (60 / min per key) · `Idempotency-Key` required
994
+ *
995
+ * `POST /v1/products/{id}/variants` · rate-limit bucket: write · requires `options.idempotencyKey`: your own stable key for this logical operation (e.g. derived from your invoice / payment id), stored before the call and sent again on every retry — without it the call throws `idempotency_key_required` before sending anything
996
+ */
997
+ createVariant: (id, body, options) => c.call("productsCreateVariant", { path: { id }, body }, options),
998
+ },
999
+ prices: {
1000
+ /**
1001
+ * Sell prices per product: base, per sales channel and per unit
1002
+ *
1003
+ * Active products of the organization with their active variants. `channels` lists the sales channels the prices refer to (only those the key's user may price; at most 200). Per product at most 100 variants and 50 units; per variant at most 500 unit-price cells (`truncated` names a cut array).
1004
+ *
1005
+ * Scope: `catalog:read` · user permission: `product.read` · rate limit: read
1006
+ *
1007
+ * `GET /v1/prices` · rate-limit bucket: read
1008
+ */
1009
+ list: (query, options) => c.call("pricesList", { query }, options),
1010
+ /** Every row of `GET /v1/prices`, page after page (follows `nextCursor` with the same filters and `limit`). */
1011
+ listAll: (query, options) => c.paginate("pricesList", { query }, options),
1012
+ },
1013
+ stockLevels: {
1014
+ /**
1015
+ * Stock levels per variant and outlet
1016
+ *
1017
+ * Scope: `stock:read` · user permission: `stock.level.read` · rate limit: read
1018
+ *
1019
+ * `GET /v1/stock-levels` · rate-limit bucket: read
1020
+ */
1021
+ list: (query, options) => c.call("stockLevelsList", { query }, options),
1022
+ /** Every row of `GET /v1/stock-levels`, page after page (follows `nextCursor` with the same filters and `limit`). */
1023
+ listAll: (query, options) => c.paginate("stockLevelsList", { query }, options),
1024
+ },
1025
+ batches: {
1026
+ /**
1027
+ * Stock batches (lots), soonest expiry first
1028
+ *
1029
+ * Scope: `stock:read` · user permission: `stock.batch.read` · rate limit: read
1030
+ *
1031
+ * `GET /v1/batches` · rate-limit bucket: read
1032
+ */
1033
+ list: (query, options) => c.call("batchesList", { query }, options),
1034
+ /** Every row of `GET /v1/batches`, page after page (follows `nextCursor` with the same filters and `limit`). */
1035
+ listAll: (query, options) => c.paginate("batchesList", { query }, options),
1036
+ },
1037
+ stockMovements: {
1038
+ /**
1039
+ * Stock movements (the stock ledger), newest first
1040
+ *
1041
+ * Every change of stock is a movement; quantities are signed base units. Use `since` for incremental sync (business time `occurredAt`). `since` / `until` are ISO 8601 instants, both inclusive; since ≤ until and since not in the future. Paged like every list (≤ 100 per page, ≤ 25 000 rows deep) — narrow by `since` to go further.
1042
+ *
1043
+ * Scope: `stock:read` · user permission: `stock.movement.read` · rate limit: read
1044
+ *
1045
+ * `GET /v1/stock-movements` · rate-limit bucket: read
1046
+ */
1047
+ list: (query, options) => c.call("stockMovementsList", { query }, options),
1048
+ /** Every row of `GET /v1/stock-movements`, page after page (follows `nextCursor` with the same filters and `limit`). */
1049
+ listAll: (query, options) => c.paginate("stockMovementsList", { query }, options),
1050
+ },
1051
+ contacts: {
1052
+ /**
1053
+ * List contacts (customers, accounts, leads)
1054
+ *
1055
+ * Scope: `crm:read` · rate limit: read
1056
+ *
1057
+ * `GET /v1/contacts` · rate-limit bucket: read
1058
+ */
1059
+ list: (query, options) => c.call("contactsList", { query }, options),
1060
+ /** Every row of `GET /v1/contacts`, page after page (follows `nextCursor` with the same filters and `limit`). */
1061
+ listAll: (query, options) => c.paginate("contactsList", { query }, options),
1062
+ /**
1063
+ * Get a contact
1064
+ *
1065
+ * Scope: `crm:read` · rate limit: read
1066
+ *
1067
+ * `GET /v1/contacts/{id}` · rate-limit bucket: read
1068
+ */
1069
+ get: (id, options) => c.call("contactsGet", { path: { id } }, options),
1070
+ },
1071
+ loyaltyAccounts: {
1072
+ /**
1073
+ * List loyalty accounts
1074
+ *
1075
+ * Scope: `crm:read` · user permission: `loyalty.read` · rate limit: read
1076
+ *
1077
+ * `GET /v1/loyalty-accounts` · rate-limit bucket: read
1078
+ */
1079
+ list: (query, options) => c.call("loyaltyAccountsList", { query }, options),
1080
+ /** Every row of `GET /v1/loyalty-accounts`, page after page (follows `nextCursor` with the same filters and `limit`). */
1081
+ listAll: (query, options) => c.paginate("loyaltyAccountsList", { query }, options),
1082
+ /**
1083
+ * Get a loyalty account
1084
+ *
1085
+ * Scope: `crm:read` · user permission: `loyalty.read` · rate limit: read
1086
+ *
1087
+ * `GET /v1/loyalty-accounts/{id}` · rate-limit bucket: read
1088
+ */
1089
+ get: (id, options) => c.call("loyaltyAccountsGet", { path: { id } }, options),
1090
+ },
1091
+ sales: {
1092
+ /**
1093
+ * List POS sales, newest first
1094
+ *
1095
+ * `dateFrom` / `dateTo` are calendar days, both inclusive, on `completedAt` (else `createdAt`). A day is the LOCAL day of the sale's outlet (each sale in its own outlet's timezone); `timezone` (IANA, e.g. `UTC`) makes it one zone for the whole request. Timestamps in the response carry the offset of the sale's outlet zone, and each sale names it in `timezone`. Give both or neither; dateFrom ≤ dateTo, at most one calendar month, and dateFrom not after today in the latest of the zones involved.
1096
+ *
1097
+ * Scope: `sales:read` · user permission: `transaction.read` · rate limit: read
1098
+ *
1099
+ * `GET /v1/sales` · rate-limit bucket: read
1100
+ */
1101
+ list: (query, options) => c.call("salesList", { query }, options),
1102
+ /** Every row of `GET /v1/sales`, page after page (follows `nextCursor` with the same filters and `limit`). */
1103
+ listAll: (query, options) => c.paginate("salesList", { query }, options),
1104
+ /**
1105
+ * Record a POS sale
1106
+ *
1107
+ * Records a completed sale through the same POS ingest the tills use: every line is priced from the catalog (outlet > sales channel > unit > base price, volume tiers) and `unitPrice` must match it (422 `price_mismatch` with `details.unitPrice`); PPN is derived server-side (shelf prices include PPN); stock is consumed FEFO at the outlet and the cost of goods computed from the lots consumed; a contact with a loyalty account earns points. Selling more than the stock on hand is allowed by default, as on the POS (the shortfall is booked as an unbatched movement); with `stockPolicy: "reject"` the whole sale is refused instead (422 `insufficient_stock`, `details: { variantId, requested, available, shortages }` in base units at the outlet) and nothing is written — checked under row locks in the transaction that takes the stock, so concurrent sales can't both take the last units.
1108
+ *
1109
+ * `externalId` (your sale id) is unique per organization: a second sale with it is 409 `duplicate_external_id` with `details.saleId`. Payments must cover the sale's total (422 `payment_total_mismatch` with `details.totalAmount`) — for a sale on credit create an invoice instead. Only cash may be more than the total, as at the till: split tender is allowed, the non-cash payments together are at most the total, and the change (`changeAmount` = payments − total) comes out of the cash; each payment is recorded at the amount tendered. `occurredAt` (default now) must not be in the future and at most 7 days back. No register session is attached; the cashier is the API key's user. Prescriptions, manual lot picks, promotions / coupons and loyalty redemptions are not accepted in v1.
1110
+ *
1111
+ * Discounts are rupiah amounts, as on the POS (never a percentage): `lines[].discountAmount` (POS web's per-line discount) at most the line's catalog amount (qty × unitPrice), and a sale-level `discountAmount` (POS Android's per-sale discount) at most what is left after the line discounts (422 `discount_exceeds_amount` with `details.maxAmount`). `unitPrice` is still the undiscounted catalog price. The sale discount is spread over the lines pro rata (to the cent), so every line's `totalPrice` is what was charged for it; the sale's `discountAmount` is the sum. Payments then add up to the discounted total.
1112
+ *
1113
+ * Scope: `sales:write` · user permission: `cashier.*` · rate limit: write (60 / min per key) · `Idempotency-Key` required
1114
+ *
1115
+ * `POST /v1/sales` · rate-limit bucket: write · sends an `Idempotency-Key` (options.idempotencyKey, else a fresh UUID reused across this call's retries; `externalId` dedupes a later retry)
1116
+ */
1117
+ create: (body, options) => c.call("salesCreate", { body }, options),
1118
+ /**
1119
+ * Get a POS sale with its lines, lots and payments
1120
+ *
1121
+ * Prescription details are never returned by v1. At most 500 lines, 50 lots per line and 100 payments (`truncated` names a cut array).
1122
+ *
1123
+ * Scope: `sales:read` · user permission: `transaction.read` · rate limit: read
1124
+ *
1125
+ * `GET /v1/sales/{id}` · rate-limit bucket: read
1126
+ */
1127
+ get: (id, options) => c.call("salesGet", { path: { id } }, options),
1128
+ /**
1129
+ * Refund lines of a POS sale
1130
+ *
1131
+ * The till's refund: some or all of the quantity of one or more lines (partial refunds allowed, repeatable until nothing remains). Stock goes back into the lots the sale drew from; the money goes back on a payment channel (`refundTo: payment_channel`, a negative payment on the sale) or as a credit note for the sale's customer (`refundTo: credit_note`). The amount is the line's net price × qty.
1132
+ *
1133
+ * A sale that already has a live faktur pajak is never rewritten: the response carries `taxInvoiceWarning` (and the sale's audit log `tax_invoice_correction_needed`) — the organization corrects the faktur in Reports → Coretax. Faktur pajak are not created through v1.
1134
+ *
1135
+ * Scope: `sales:write` · user permission: `cashier.*` · rate limit: write (60 / min per key) · `Idempotency-Key` required
1136
+ *
1137
+ * `POST /v1/sales/{id}/refunds` · rate-limit bucket: write · requires `options.idempotencyKey`: your own stable key for this logical operation (e.g. derived from your invoice / payment id), stored before the call and sent again on every retry — without it the call throws `idempotency_key_required` before sending anything
1138
+ */
1139
+ refund: (id, body, options) => c.call("salesRefund", { path: { id }, body }, options),
1140
+ },
1141
+ invoices: {
1142
+ /**
1143
+ * List invoices, newest first
1144
+ *
1145
+ * `dateFrom` / `dateTo` filter the issue date (a calendar date, no timezone), both inclusive; dateFrom ≤ dateTo. Future dates are allowed (an invoice may be issued ahead).
1146
+ *
1147
+ * Scope: `sales:read` · user permission: `commercial.invoice.read` · rate limit: read
1148
+ *
1149
+ * `GET /v1/invoices` · rate-limit bucket: read
1150
+ */
1151
+ list: (query, options) => c.call("invoicesList", { query }, options),
1152
+ /** Every row of `GET /v1/invoices`, page after page (follows `nextCursor` with the same filters and `limit`). */
1153
+ listAll: (query, options) => c.paginate("invoicesList", { query }, options),
1154
+ /**
1155
+ * Create a draft sales invoice
1156
+ *
1157
+ * A DRAFT invoice (no stock movement, no journal) for a customer at one outlet, built like the dash's invoice builder: each line's volume-discount tier is applied server-side, the unit snapshot and totals are computed, a payment term sets the due date and down payment. `unitPrice` is the agreed price (not re-priced from the catalog). Issue it with POST /v1/invoices/{id}/issue.
1158
+ *
1159
+ * `issueDate` (default today, organization timezone) at most 366 days back and 31 ahead; `dueDate` on or after it (at most 731 days), required unless `paymentTermId` is given. The same variant may appear on one line only.
1160
+ *
1161
+ * Scope: `invoices:write` · user permission: `commercial.*` · rate limit: write (60 / min per key) · `Idempotency-Key` required
1162
+ *
1163
+ * `POST /v1/invoices` · rate-limit bucket: write · requires `options.idempotencyKey`: your own stable key for this logical operation (e.g. derived from your invoice / payment id), stored before the call and sent again on every retry — without it the call throws `idempotency_key_required` before sending anything
1164
+ */
1165
+ create: (body, options) => c.call("invoicesCreate", { body }, options),
1166
+ /**
1167
+ * Get an invoice with its lines and payment allocations
1168
+ *
1169
+ * At most 500 lines and 200 allocations (`truncated` names a cut array).
1170
+ *
1171
+ * Scope: `sales:read` · user permission: `commercial.invoice.read` · rate limit: read
1172
+ *
1173
+ * `GET /v1/invoices/{id}` · rate-limit bucket: read
1174
+ */
1175
+ get: (id, options) => c.call("invoicesGet", { path: { id } }, options),
1176
+ /**
1177
+ * Edit a sales invoice's due date, notes or payment term
1178
+ *
1179
+ * Header fields only: a status change (cancel, void) is not made through v1 — cancelling reverses the invoice's journals, which stays a dash action. Refused on a cancelled or void invoice (422). Returns the invoice.
1180
+ *
1181
+ * Scope: `invoices:write` · user permission: `commercial.*` · rate limit: write (60 / min per key) · `Idempotency-Key` required
1182
+ *
1183
+ * `PATCH /v1/invoices/{id}` · rate-limit bucket: write · requires `options.idempotencyKey`: your own stable key for this logical operation (e.g. derived from your invoice / payment id), stored before the call and sent again on every retry — without it the call throws `idempotency_key_required` before sending anything
1184
+ */
1185
+ update: (id, body, options) => c.call("invoicesUpdate", { path: { id }, body }, options),
1186
+ /**
1187
+ * Issue a draft invoice
1188
+ *
1189
+ * Draft → sent, as the dash's Send: the lines' stock is consumed FEFO at the invoice's outlet in the same transaction as the status change; the receivable is journaled by the automatic-journals sweep (when the organization has it on). Only a draft with at least one line (422 `invoice_not_draft` / `invoice_has_no_lines`). Empty body.
1190
+ *
1191
+ * Scope: `invoices:write` · user permission: `commercial.*` · rate limit: write (60 / min per key) · `Idempotency-Key` required
1192
+ *
1193
+ * `POST /v1/invoices/{id}/issue` · rate-limit bucket: write · requires `options.idempotencyKey`: your own stable key for this logical operation (e.g. derived from your invoice / payment id), stored before the call and sent again on every retry — without it the call throws `idempotency_key_required` before sending anything
1194
+ */
1195
+ issue: (id, options) => c.call("invoicesIssue", { path: { id } }, options),
1196
+ /**
1197
+ * Record a payment of an invoice
1198
+ *
1199
+ * An incoming payment on one of the organization's inbound payment channels, allocated to this (issued) invoice — the dash's Record payment. The amount must not exceed the invoice's remaining balance (+ the organization's rounding tolerance; 422 `amount_exceeds_balance` with `details.remainingAmount`); balances are re-checked under lock. `paymentDate` (default today, organization timezone) not after today and at most 366 days back. A customer with a loyalty account earns points on the amount paid.
1200
+ *
1201
+ * Scope: `payments:write` · user permission: `commercial.*` · rate limit: write (60 / min per key) · `Idempotency-Key` required
1202
+ *
1203
+ * `POST /v1/invoices/{id}/payments` · rate-limit bucket: write · requires `options.idempotencyKey`: your own stable key for this logical operation (e.g. derived from your invoice / payment id), stored before the call and sent again on every retry — without it the call throws `idempotency_key_required` before sending anything
1204
+ */
1205
+ pay: (id, body, options) => c.call("invoicesPay", { path: { id }, body }, options),
1206
+ /**
1207
+ * Cancel an invoice (before settlement)
1208
+ *
1209
+ * The sale is called off before settlement: allowed from draft, sent, awaiting-payment, partially-paid and overdue (a paid invoice is voided instead — 422). A cancelled invoice can no longer be edited.
1210
+ *
1211
+ * In ONE transaction: the invoice's payments are released back to their payers as on-account money (or the call is refused, per the organization's void-payment policy), beneficiary payouts are settled per its payout policy, the invoice's stock is returned, and the terminal status is written. **The invoice's journals are NOT reversed** — its sales and cost-of-goods entries stay in the ledger (revenue, receivable) until you call `POST /v1/invoices/{id}/ledger-reversal`; the answer's `ledgerReversal` is `pending` while they wait. An invoice with an active gateway virtual account is refused (422 `virtual_account_active`): release the account in the dashboard first.
1212
+ *
1213
+ * Scope: `invoices:void` · user permission: `commercial.*` · rate limit: write (60 / min per key) · `Idempotency-Key` required
1214
+ *
1215
+ * `POST /v1/invoices/{id}/cancel` · rate-limit bucket: write · requires `options.idempotencyKey`: your own stable key for this logical operation (e.g. derived from your invoice / payment id), stored before the call and sent again on every retry — without it the call throws `idempotency_key_required` before sending anything
1216
+ */
1217
+ cancel: (id, body, options) => c.call("invoicesCancel", { path: { id }, body }, options),
1218
+ /**
1219
+ * Void an invoice (also one that was paid)
1220
+ *
1221
+ * A void ends an issued invoice for good, including a paid one (its payments follow the void-payment policy). A voided invoice can no longer be edited.
1222
+ *
1223
+ * In ONE transaction: the invoice's payments are released back to their payers as on-account money (or the call is refused, per the organization's void-payment policy), beneficiary payouts are settled per its payout policy, the invoice's stock is returned, and the terminal status is written. **The invoice's journals are NOT reversed** — its sales and cost-of-goods entries stay in the ledger (revenue, receivable) until you call `POST /v1/invoices/{id}/ledger-reversal`; the answer's `ledgerReversal` is `pending` while they wait. An invoice with an active gateway virtual account is refused (422 `virtual_account_active`): release the account in the dashboard first.
1224
+ *
1225
+ * Scope: `invoices:void` · user permission: `commercial.*` · rate limit: write (60 / min per key) · `Idempotency-Key` required
1226
+ *
1227
+ * `POST /v1/invoices/{id}/void` · rate-limit bucket: write · requires `options.idempotencyKey`: your own stable key for this logical operation (e.g. derived from your invoice / payment id), stored before the call and sent again on every retry — without it the call throws `idempotency_key_required` before sending anything
1228
+ */
1229
+ void: (id, body, options) => c.call("invoicesVoid", { path: { id }, body }, options),
1230
+ /**
1231
+ * Reverse the journals of a cancelled or voided invoice
1232
+ *
1233
+ * Posts a line-for-line reversal of every live journal of the invoice (its sales entry and its cost-of-goods entry), dated today, referencing the invoice — the same reversal the dashboard makes on cancel / void. Safe to read first: the invoice's `ledgerReversal` is `pending` while journals wait. Returns the invoice with `ledgerReversal: done`.
1234
+ *
1235
+ * Refused, nothing posted: `invoice_not_terminated` (only a cancelled or voided invoice), `nothing_to_reverse` (409: none was ever journaled, or already reversed), `accounting_period_closed` (no open period covers today, `details.date`).
1236
+ *
1237
+ * Scope: `accounting:write` · user permission: `accounting.*` · rate limit: write (60 / min per key) · `Idempotency-Key` required
1238
+ *
1239
+ * `POST /v1/invoices/{id}/ledger-reversal` · rate-limit bucket: write · requires `options.idempotencyKey`: your own stable key for this logical operation (e.g. derived from your invoice / payment id), stored before the call and sent again on every retry — without it the call throws `idempotency_key_required` before sending anything
1240
+ */
1241
+ ledgerReversal: (id, options) => c.call("invoicesLedgerReversal", { path: { id } }, options),
1242
+ },
1243
+ variants: {
1244
+ /**
1245
+ * Update a variant
1246
+ *
1247
+ * Only the fields sent change; `null` clears a nullable field. Returns the variant's product.
1248
+ *
1249
+ * Scope: `catalog:write` · rate limit: write (60 / min per key) · `Idempotency-Key` required
1250
+ *
1251
+ * `PATCH /v1/variants/{id}` · rate-limit bucket: write · requires `options.idempotencyKey`: your own stable key for this logical operation (e.g. derived from your invoice / payment id), stored before the call and sent again on every retry — without it the call throws `idempotency_key_required` before sending anything
1252
+ */
1253
+ update: (id, body, options) => c.call("variantsUpdate", { path: { id }, body }, options),
1254
+ },
1255
+ stockAdjustments: {
1256
+ /**
1257
+ * Adjust stock at one outlet
1258
+ *
1259
+ * A manual stock change at ONE outlet: 1–100 lines applied in a single transaction — all lines or none. Every line posts a stock movement (the ledger; `GET /v1/stock-movements`), as the dash's Stock adjustment.
1260
+ *
1261
+ * `type`: `adjustment` (in or out), `damaged` and `expired-writeoff` (out only, qty < 0). Stock out takes the oldest-expiry batches first, or the line's `batchId`; it never goes below what the outlet holds (422 `insufficient_stock`, `details` { variantId, requested, available }). A stock-in line may carry `unitCost` (needs the `cost:read` scope). Quantities are base units.
1262
+ *
1263
+ * This call creates **no accounting journal**. Write-offs and variances are journaled by the organization's automatic-journals setting, not by this endpoint.
1264
+ *
1265
+ * Returns the movements it posted (one per batch a stock-out drew from).
1266
+ *
1267
+ * Scope: `stock:write` · user permission: `stock.*` · rate limit: write (60 / min per key) · `Idempotency-Key` required
1268
+ *
1269
+ * `POST /v1/stock-adjustments` · rate-limit bucket: write · requires `options.idempotencyKey`: your own stable key for this logical operation (e.g. derived from your invoice / payment id), stored before the call and sent again on every retry — without it the call throws `idempotency_key_required` before sending anything
1270
+ */
1271
+ create: (body, options) => c.call("stockAdjustmentsCreate", { body }, options),
1272
+ },
1273
+ purchaseOrders: {
1274
+ /**
1275
+ * List purchase orders of an outlet, newest first
1276
+ *
1277
+ * `dateFrom` / `dateTo` filter the order date (calendar days, both inclusive).
1278
+ *
1279
+ * Scope: `purchase:read` · user permission: `purchase.order.read` · rate limit: read
1280
+ *
1281
+ * `GET /v1/purchase-orders` · rate-limit bucket: read
1282
+ */
1283
+ list: (query, options) => c.call("purchaseOrdersList", { query }, options),
1284
+ /** Every row of `GET /v1/purchase-orders`, page after page (follows `nextCursor` with the same filters and `limit`). */
1285
+ listAll: (query, options) => c.paginate("purchaseOrdersList", { query }, options),
1286
+ /**
1287
+ * Create a draft purchase order
1288
+ *
1289
+ * A DRAFT order at one outlet (no stock, no journal, no e-mail) with 1–200 lines, as the dash's New purchase order. `orderDate` defaults to today (organization timezone). The responsible pharmacist defaults to the outlet's (`pharmacistInChargeId` overrides it); an outlet without one can't order (422). A regulated product class (narcotic, psychotropic, precursor, OOT) needs its own order — the category is derived from the lines.
1290
+ *
1291
+ * Submitting the order for the pharmacist's approval stays in the dash (it e-mails a one-time link). After it is approved there, `PATCH` can move it to `ordered`.
1292
+ *
1293
+ * Scope: `purchase:write` · user permission: `purchase.*` · rate limit: write (60 / min per key) · `Idempotency-Key` required
1294
+ *
1295
+ * `POST /v1/purchase-orders` · rate-limit bucket: write · requires `options.idempotencyKey`: your own stable key for this logical operation (e.g. derived from your invoice / payment id), stored before the call and sent again on every retry — without it the call throws `idempotency_key_required` before sending anything
1296
+ */
1297
+ create: (body, options) => c.call("purchaseOrdersCreate", { body }, options),
1298
+ /**
1299
+ * Get a purchase order with its lines
1300
+ *
1301
+ * Scope: `purchase:read` · user permission: `purchase.order.read` · rate limit: read
1302
+ *
1303
+ * `GET /v1/purchase-orders/{id}` · rate-limit bucket: read
1304
+ */
1305
+ get: (id, options) => c.call("purchaseOrdersGet", { path: { id } }, options),
1306
+ /**
1307
+ * Edit a draft purchase order, mark it ordered, or cancel it
1308
+ *
1309
+ * Header fields change only while the order is a draft. `status: cancelled` is allowed from any open state; `status: ordered` only once the responsible pharmacist approved the order in the dash (else 422). Other transitions (submit for approval, partially-received, received) are not made through v1: receiving goods on an invoice moves the order on by itself. Lines are not edited here — cancel and create a new draft.
1310
+ *
1311
+ * Scope: `purchase:write` · user permission: `purchase.*` · rate limit: write (60 / min per key) · `Idempotency-Key` required
1312
+ *
1313
+ * `PATCH /v1/purchase-orders/{id}` · rate-limit bucket: write · requires `options.idempotencyKey`: your own stable key for this logical operation (e.g. derived from your invoice / payment id), stored before the call and sent again on every retry — without it the call throws `idempotency_key_required` before sending anything
1314
+ */
1315
+ update: (id, body, options) => c.call("purchaseOrdersUpdate", { path: { id }, body }, options),
1316
+ },
1317
+ purchaseInvoices: {
1318
+ /**
1319
+ * List purchase invoices of an outlet, newest first
1320
+ *
1321
+ * `status`: draft (not received), received, voided. `journalStatus` filters the page by ledger state — `none` finds the received invoices still waiting for `POST /v1/purchase-invoices/{id}/journal`. `consignmentOpen=true` = received consignment invoices not settled yet. `dateFrom` / `dateTo` filter the invoice date.
1322
+ *
1323
+ * Scope: `purchase:read` · user permission: `purchase.invoice.read` · rate limit: read
1324
+ *
1325
+ * `GET /v1/purchase-invoices` · rate-limit bucket: read
1326
+ */
1327
+ list: (query, options) => c.call("purchaseInvoicesList", { query }, options),
1328
+ /** Every row of `GET /v1/purchase-invoices`, page after page (follows `nextCursor` with the same filters and `limit`). */
1329
+ listAll: (query, options) => c.paginate("purchaseInvoicesList", { query }, options),
1330
+ /**
1331
+ * Record a supplier invoice as a draft
1332
+ *
1333
+ * A DRAFT purchase invoice at one outlet — what the supplier billed — with 1–200 lines, or against a purchase order of that outlet (`purchaseOrderId`; with no `lines` its open lines are copied). Nothing is received: no stock, no PO roll-up, no journal. `type: consignment` records consignment goods (received later as consignment batches; journaled at settlement in the dash). The supplier's invoice number is unique among its live invoices (409 `duplicate_invoice_number`, `details.invoiceId`).
1334
+ *
1335
+ * Tax: `taxCodeId` (an organization tax code; `null` = no PPN; omitted = no PPN), `pricesIncludeTax`. Header discount (`discountType` cash | percent + `headerDiscountValue`) and `shippingAmount` as the dash's invoice form.
1336
+ *
1337
+ * Receive it with `POST /v1/purchase-invoices/{id}/receive`.
1338
+ *
1339
+ * Scope: `purchase:write` · user permission: `purchase.*` · rate limit: write (60 / min per key) · `Idempotency-Key` required
1340
+ *
1341
+ * `POST /v1/purchase-invoices` · rate-limit bucket: write · sends an `Idempotency-Key` (options.idempotencyKey, else a fresh UUID reused across this call's retries; `invoiceNumber` dedupes a later retry)
1342
+ */
1343
+ create: (body, options) => c.call("purchaseInvoicesCreate", { body }, options),
1344
+ /**
1345
+ * Get a purchase invoice with its lines and journal status
1346
+ *
1347
+ * Scope: `purchase:read` · user permission: `purchase.invoice.read` · rate limit: read
1348
+ *
1349
+ * `GET /v1/purchase-invoices/{id}` · rate-limit bucket: read
1350
+ */
1351
+ get: (id, options) => c.call("purchaseInvoicesGet", { path: { id } }, options),
1352
+ /**
1353
+ * Receive the goods of a draft purchase invoice (no journal)
1354
+ *
1355
+ * Draft → received, as the dash's Receive goods: every line is stocked at the invoice's outlet (one batch per line; consignment lines as consignment batches), the purchase order's received quantities roll up, buy prices and supplier price tiers follow the invoice. The receipt happens in one transaction and exactly once (a second call is 422 `invoice_not_draft`). `receiptDate` is an ISO 8601 instant (default now).
1356
+ *
1357
+ * **This does not post an accounting journal.** The invoice stays out of the ledger (AP aging, supplier balances) until you call `POST /v1/purchase-invoices/{id}/journal`; `journalStatus` is `none` meanwhile. If the organization requires a second person to receive (Settings → Purchasing), the key's user must not be the invoice's author (422).
1358
+ *
1359
+ * Scope: `purchase:write` · user permission: `purchase.*` · rate limit: write (60 / min per key) · `Idempotency-Key` required
1360
+ *
1361
+ * `POST /v1/purchase-invoices/{id}/receive` · rate-limit bucket: write · requires `options.idempotencyKey`: your own stable key for this logical operation (e.g. derived from your invoice / payment id), stored before the call and sent again on every retry — without it the call throws `idempotency_key_required` before sending anything
1362
+ */
1363
+ receive: (id, body, options) => c.call("purchaseInvoicesReceive", { path: { id }, body }, options),
1364
+ /**
1365
+ * Post the accounting journal of a received purchase invoice
1366
+ *
1367
+ * Posts the same entry the dash posts on receipt (the `purchase-invoice` posting rule: debit inventory — and input VAT when it is not a cost —, credit accounts payable), dated the invoice date, referencing the invoice. Once per invoice: 409 `already_journaled` (`details.journalEntryId`).
1368
+ *
1369
+ * Refused, nothing posted: `invoice_not_received` (a draft or voided invoice), `consignment_invoice` (journaled at settlement in the dash), `accounting_period_closed` (no open period covers the invoice date, `details.date`), `posting_rule_missing` (set the rule up in Accounting → Rules). Returns the invoice with `journalStatus: posted`.
1370
+ *
1371
+ * Scope: `accounting:write` · user permission: `accounting.*` · rate limit: write (60 / min per key) · `Idempotency-Key` required
1372
+ *
1373
+ * `POST /v1/purchase-invoices/{id}/journal` · rate-limit bucket: write · requires `options.idempotencyKey`: your own stable key for this logical operation (e.g. derived from your invoice / payment id), stored before the call and sent again on every retry — without it the call throws `idempotency_key_required` before sending anything
1374
+ */
1375
+ journal: (id, options) => c.call("purchaseInvoicesJournal", { path: { id } }, options),
1376
+ },
1377
+ pipelines: {
1378
+ /**
1379
+ * List deal pipelines with their ordered stages
1380
+ *
1381
+ * Not paged (a short list): `nextCursor` is always null.
1382
+ *
1383
+ * Scope: `deals:read` · user permission: `deal.read` · rate limit: read
1384
+ *
1385
+ * `GET /v1/pipelines` · rate-limit bucket: read
1386
+ */
1387
+ list: (query, options) => c.call("pipelinesList", { query }, options),
1388
+ /**
1389
+ * Create a pipeline
1390
+ *
1391
+ * `withDefaultStages: true` adds the dash's starter stages (Prospecting, Qualified, Proposal, Negotiation, Won, Lost). The pipeline goes to the end of the display order. Returns it with its stages.
1392
+ *
1393
+ * Scope: `deals:write` · user permission: `deal.*` · rate limit: write (60 / min per key) · `Idempotency-Key` required
1394
+ *
1395
+ * `POST /v1/pipelines` · rate-limit bucket: write · requires `options.idempotencyKey`: your own stable key for this logical operation (e.g. derived from your invoice / payment id), stored before the call and sent again on every retry — without it the call throws `idempotency_key_required` before sending anything
1396
+ */
1397
+ create: (body, options) => c.call("pipelinesCreate", { body }, options),
1398
+ /**
1399
+ * Update a pipeline
1400
+ *
1401
+ * Only the fields sent change. Returns the pipeline with its stages.
1402
+ *
1403
+ * Scope: `deals:write` · user permission: `deal.*` · rate limit: write (60 / min per key) · `Idempotency-Key` required
1404
+ *
1405
+ * `PATCH /v1/pipelines/{id}` · rate-limit bucket: write · requires `options.idempotencyKey`: your own stable key for this logical operation (e.g. derived from your invoice / payment id), stored before the call and sent again on every retry — without it the call throws `idempotency_key_required` before sending anything
1406
+ */
1407
+ update: (id, body, options) => c.call("pipelinesUpdate", { path: { id }, body }, options),
1408
+ /**
1409
+ * Add a stage to a pipeline
1410
+ *
1411
+ * `probability` is the default win probability of a deal in this stage (0–100). A stage can't be both won and lost. Returns the pipeline with its stages.
1412
+ *
1413
+ * Scope: `deals:write` · user permission: `deal.*` · rate limit: write (60 / min per key) · `Idempotency-Key` required
1414
+ *
1415
+ * `POST /v1/pipelines/{id}/stages` · rate-limit bucket: write · requires `options.idempotencyKey`: your own stable key for this logical operation (e.g. derived from your invoice / payment id), stored before the call and sent again on every retry — without it the call throws `idempotency_key_required` before sending anything
1416
+ */
1417
+ createStage: (id, body, options) => c.call("pipelinesCreateStage", { path: { id }, body }, options),
1418
+ },
1419
+ pipelineStages: {
1420
+ /**
1421
+ * Update a pipeline stage
1422
+ *
1423
+ * Only the fields sent change; a stage never moves to another pipeline. Returns the stage's pipeline with its stages.
1424
+ *
1425
+ * Scope: `deals:write` · user permission: `deal.*` · rate limit: write (60 / min per key) · `Idempotency-Key` required
1426
+ *
1427
+ * `PATCH /v1/pipeline-stages/{id}` · rate-limit bucket: write · requires `options.idempotencyKey`: your own stable key for this logical operation (e.g. derived from your invoice / payment id), stored before the call and sent again on every retry — without it the call throws `idempotency_key_required` before sending anything
1428
+ */
1429
+ update: (id, body, options) => c.call("pipelineStagesUpdate", { path: { id }, body }, options),
1430
+ },
1431
+ deals: {
1432
+ /**
1433
+ * List deals, newest activity first
1434
+ *
1435
+ * Ordered by when the deal was won / lost, or created while open. `since` is a UTC calendar day: only deals whose won / lost / created date is on or after it. A customer or contact the key's user may not see is masked (`customerMasked`).
1436
+ *
1437
+ * Scope: `deals:read` · user permission: `deal.read` · rate limit: read
1438
+ *
1439
+ * `GET /v1/deals` · rate-limit bucket: read
1440
+ */
1441
+ list: (query, options) => c.call("dealsList", { query }, options),
1442
+ /** Every row of `GET /v1/deals`, page after page (follows `nextCursor` with the same filters and `limit`). */
1443
+ listAll: (query, options) => c.paginate("dealsList", { query }, options),
1444
+ /**
1445
+ * Create a deal
1446
+ *
1447
+ * In an OPEN stage of the given pipeline (a stage of another pipeline is 422 `unknown_stage`); move it to a won / lost stage with PATCH. The customer must be a contact of the organization visible to the key's user. Returns the deal.
1448
+ *
1449
+ * Scope: `deals:write` · user permission: `deal.safeWrite` · rate limit: write (60 / min per key) · `Idempotency-Key` required
1450
+ *
1451
+ * `POST /v1/deals` · rate-limit bucket: write · requires `options.idempotencyKey`: your own stable key for this logical operation (e.g. derived from your invoice / payment id), stored before the call and sent again on every retry — without it the call throws `idempotency_key_required` before sending anything
1452
+ */
1453
+ create: (body, options) => c.call("dealsCreate", { body }, options),
1454
+ /**
1455
+ * Get a deal
1456
+ *
1457
+ * Scope: `deals:read` · user permission: `deal.read` · rate limit: read
1458
+ *
1459
+ * `GET /v1/deals/{id}` · rate-limit bucket: read
1460
+ */
1461
+ get: (id, options) => c.call("dealsGet", { path: { id } }, options),
1462
+ /**
1463
+ * Update a deal or move it between stages
1464
+ *
1465
+ * Only the fields sent change. A stage move must stay inside the deal's pipeline (`unknown_stage`); moving to a won / lost stage sets the status and its timestamp (`lostReason` is kept with a lost deal), moving back to an open stage reopens it. `status` can also be set directly. Returns the deal.
1466
+ *
1467
+ * Scope: `deals:write` · user permission: `deal.safeWrite` · rate limit: write (60 / min per key) · `Idempotency-Key` required
1468
+ *
1469
+ * `PATCH /v1/deals/{id}` · rate-limit bucket: write · requires `options.idempotencyKey`: your own stable key for this logical operation (e.g. derived from your invoice / payment id), stored before the call and sent again on every retry — without it the call throws `idempotency_key_required` before sending anything
1470
+ */
1471
+ update: (id, body, options) => c.call("dealsUpdate", { path: { id }, body }, options),
1472
+ },
1473
+ estimates: {
1474
+ /**
1475
+ * List estimates, newest first
1476
+ *
1477
+ * `dateFrom` / `dateTo` filter the issue date (calendar days, both inclusive). Only estimates inside the key's outlet boundary are listed.
1478
+ *
1479
+ * Scope: `commercial:read` · user permission: `commercial.proposal.read` · rate limit: read
1480
+ *
1481
+ * `GET /v1/estimates` · rate-limit bucket: read
1482
+ */
1483
+ list: (query, options) => c.call("estimatesList", { query }, options),
1484
+ /** Every row of `GET /v1/estimates`, page after page (follows `nextCursor` with the same filters and `limit`). */
1485
+ listAll: (query, options) => c.paginate("estimatesList", { query }, options),
1486
+ /**
1487
+ * Create a draft estimate
1488
+ *
1489
+ * A DRAFT estimate for a customer with 1–200 lines, as the dash's New estimate: every total is computed by the server (line volume-discount tiers resolved in base units, unit snapshots). One line per variant. `issueDate` defaults to today (organization timezone). Cashback beneficiaries are not set through v1. Returns the estimate.
1490
+ *
1491
+ * Scope: `commercial:write` · user permission: `commercial.*` · rate limit: write (60 / min per key) · `Idempotency-Key` required
1492
+ *
1493
+ * `POST /v1/estimates` · rate-limit bucket: write · requires `options.idempotencyKey`: your own stable key for this logical operation (e.g. derived from your invoice / payment id), stored before the call and sent again on every retry — without it the call throws `idempotency_key_required` before sending anything
1494
+ */
1495
+ create: (body, options) => c.call("estimatesCreate", { body }, options),
1496
+ /**
1497
+ * Get an estimate with its lines
1498
+ *
1499
+ * Scope: `commercial:read` · user permission: `commercial.proposal.read` · rate limit: read
1500
+ *
1501
+ * `GET /v1/estimates/{id}` · rate-limit bucket: read
1502
+ */
1503
+ get: (id, options) => c.call("estimatesGet", { path: { id } }, options),
1504
+ /**
1505
+ * Edit a draft estimate or move its status
1506
+ *
1507
+ * `items` (replaced wholesale, totals recomputed) can be sent only while the estimate is a draft (422 otherwise); the header fields follow the dash. `status` moves along the dash's transitions (draft → sent → accepted | rejected | expired). Returns the estimate.
1508
+ *
1509
+ * Scope: `commercial:write` · user permission: `commercial.*` · rate limit: write (60 / min per key) · `Idempotency-Key` required
1510
+ *
1511
+ * `PATCH /v1/estimates/{id}` · rate-limit bucket: write · requires `options.idempotencyKey`: your own stable key for this logical operation (e.g. derived from your invoice / payment id), stored before the call and sent again on every retry — without it the call throws `idempotency_key_required` before sending anything
1512
+ */
1513
+ update: (id, body, options) => c.call("estimatesUpdate", { path: { id }, body }, options),
1514
+ },
1515
+ proposals: {
1516
+ /**
1517
+ * List commercial proposals, newest first
1518
+ *
1519
+ * `dateFrom` / `dateTo` filter the issue date. Only proposals inside the key's outlet boundary are listed.
1520
+ *
1521
+ * Scope: `commercial:read` · user permission: `commercial.proposal.read` · rate limit: read
1522
+ *
1523
+ * `GET /v1/proposals` · rate-limit bucket: read
1524
+ */
1525
+ list: (query, options) => c.call("proposalsList", { query }, options),
1526
+ /** Every row of `GET /v1/proposals`, page after page (follows `nextCursor` with the same filters and `limit`). */
1527
+ listAll: (query, options) => c.paginate("proposalsList", { query }, options),
1528
+ /**
1529
+ * Create a draft proposal
1530
+ *
1531
+ * Basic information only (a DRAFT, owned by the key's user); add the product lines with `POST /v1/proposals/{id}/lines`. `issueDate` defaults to today (organization timezone). Returns the proposal.
1532
+ *
1533
+ * Scope: `commercial:write` · user permission: `commercial.*` · rate limit: write (60 / min per key) · `Idempotency-Key` required
1534
+ *
1535
+ * `POST /v1/proposals` · rate-limit bucket: write · requires `options.idempotencyKey`: your own stable key for this logical operation (e.g. derived from your invoice / payment id), stored before the call and sent again on every retry — without it the call throws `idempotency_key_required` before sending anything
1536
+ */
1537
+ create: (body, options) => c.call("proposalsCreate", { body }, options),
1538
+ /**
1539
+ * Get a proposal with its lines and the invoices raised from it
1540
+ *
1541
+ * Scope: `commercial:read` · user permission: `commercial.proposal.read` · rate limit: read
1542
+ *
1543
+ * `GET /v1/proposals/{id}` · rate-limit bucket: read
1544
+ */
1545
+ get: (id, options) => c.call("proposalsGet", { path: { id } }, options),
1546
+ /**
1547
+ * Update a proposal or move its status
1548
+ *
1549
+ * Only the fields sent change; `status` moves along the dash's transitions (draft → active → expired | closed | cancelled). Returns the proposal.
1550
+ *
1551
+ * Scope: `commercial:write` · user permission: `commercial.*` · rate limit: write (60 / min per key) · `Idempotency-Key` required
1552
+ *
1553
+ * `PATCH /v1/proposals/{id}` · rate-limit bucket: write · requires `options.idempotencyKey`: your own stable key for this logical operation (e.g. derived from your invoice / payment id), stored before the call and sent again on every retry — without it the call throws `idempotency_key_required` before sending anything
1554
+ */
1555
+ update: (id, body, options) => c.call("proposalsUpdate", { path: { id }, body }, options),
1556
+ /**
1557
+ * Add a product line to an open proposal
1558
+ *
1559
+ * One line per variant (a second one is 422). `sellPrice` is the proposal's price, `suggestedSellPrice` the reference price. Allowed until the proposal is closed or cancelled (422 after). Returns the proposal.
1560
+ *
1561
+ * Scope: `commercial:write` · user permission: `commercial.*` · rate limit: write (60 / min per key) · `Idempotency-Key` required
1562
+ *
1563
+ * `POST /v1/proposals/{id}/lines` · rate-limit bucket: write · requires `options.idempotencyKey`: your own stable key for this logical operation (e.g. derived from your invoice / payment id), stored before the call and sent again on every retry — without it the call throws `idempotency_key_required` before sending anything
1564
+ */
1565
+ addLine: (id, body, options) => c.call("proposalsAddLine", { path: { id }, body }, options),
1566
+ },
1567
+ proposalLines: {
1568
+ /**
1569
+ * Update a line of an open proposal
1570
+ *
1571
+ * Only the fields sent change. Returns the proposal.
1572
+ *
1573
+ * Scope: `commercial:write` · user permission: `commercial.*` · rate limit: write (60 / min per key) · `Idempotency-Key` required
1574
+ *
1575
+ * `PATCH /v1/proposal-lines/{id}` · rate-limit bucket: write · requires `options.idempotencyKey`: your own stable key for this logical operation (e.g. derived from your invoice / payment id), stored before the call and sent again on every retry — without it the call throws `idempotency_key_required` before sending anything
1576
+ */
1577
+ update: (id, body, options) => c.call("proposalLinesUpdate", { path: { id }, body }, options),
1578
+ },
1579
+ posSessions: {
1580
+ /**
1581
+ * List the shifts open right now
1582
+ *
1583
+ * Open register shifts inside the key's outlets, newest first, at most 200 (not paged: `nextCursor` is always null). `outletId` narrows to one outlet. A closed shift is read with `GET /v1/pos-sessions/{id}`. The till's device and sign-in details are never returned.
1584
+ *
1585
+ * Scope: `pos:read` · user permission: `transaction.read` · rate limit: read
1586
+ *
1587
+ * `GET /v1/pos-sessions` · rate-limit bucket: read
1588
+ */
1589
+ list: (query, options) => c.call("posSessionsList", { query }, options),
1590
+ /**
1591
+ * Get a shift (open or closed) with its cashiers and cash movement totals
1592
+ *
1593
+ * Scope: `pos:read` · user permission: `transaction.read` · rate limit: read
1594
+ *
1595
+ * `GET /v1/pos-sessions/{id}` · rate-limit bucket: read
1596
+ */
1597
+ get: (id, options) => c.call("posSessionsGet", { path: { id } }, options),
1598
+ /**
1599
+ * Record a manual cash movement in an open shift
1600
+ *
1601
+ * `cash-in` / `cash-out` (money put in or taken out of the drawer), `bank-drop`, `payout` and `correction`, as the till's cash in / out. The shift must be open (422 otherwise) and inside the key's outlets (404 otherwise). `amount` is a positive IDR amount; the type carries the direction. Returns the movement.
1602
+ *
1603
+ * Scope: `pos:write` · user permission: `cashier.*` · rate limit: write (60 / min per key) · `Idempotency-Key` required
1604
+ *
1605
+ * `POST /v1/pos-sessions/{id}/cash-movements` · rate-limit bucket: write · requires `options.idempotencyKey`: your own stable key for this logical operation (e.g. derived from your invoice / payment id), stored before the call and sent again on every retry — without it the call throws `idempotency_key_required` before sending anything
1606
+ */
1607
+ createCashMovement: (id, body, options) => c.call("posSessionsCreateCashMovement", { path: { id }, body }, options),
1608
+ },
1609
+ heldCarts: {
1610
+ /**
1611
+ * List the parked (held) carts of an outlet
1612
+ *
1613
+ * Carts parked on a till in the last 24 hours, newest first (older ones are abandoned and not listed). `cartData` is the till app's own snapshot, returned as stored — its shape belongs to the app and is not part of this contract. Not paged: `nextCursor` is always null. Parking and dropping carts is done on the till.
1614
+ *
1615
+ * Scope: `pos:read` · user permission: `cashier.*` · rate limit: read
1616
+ *
1617
+ * `GET /v1/held-carts` · rate-limit bucket: read
1618
+ */
1619
+ list: (query, options) => c.call("heldCartsList", { query }, options),
1620
+ },
1621
+ posFees: {
1622
+ /**
1623
+ * List the 'other fees' a cashier can add to a sale
1624
+ *
1625
+ * Organization-wide fees (delivery, service charge, racikan fees), in the dash's order. `activeOnly=true` leaves out switched-off ones. Not paged: `nextCursor` is always null.
1626
+ *
1627
+ * Scope: `pos:read` · rate limit: read
1628
+ *
1629
+ * `GET /v1/pos-fees` · rate-limit bucket: read
1630
+ */
1631
+ list: (query, options) => c.call("posFeesList", { query }, options),
1632
+ /**
1633
+ * Create a fee
1634
+ *
1635
+ * Needs an admin or owner key user (the dash's rule) and a key without an outlet restriction (fees are organization-wide). The fee goes to the end of the list; the order changes in the dash. `minAmount` ≤ `maxAmount` when both are set. Returns the fee.
1636
+ *
1637
+ * Scope: `pos:write` · rate limit: write (60 / min per key) · `Idempotency-Key` required
1638
+ *
1639
+ * `POST /v1/pos-fees` · rate-limit bucket: write · requires `options.idempotencyKey`: your own stable key for this logical operation (e.g. derived from your invoice / payment id), stored before the call and sent again on every retry — without it the call throws `idempotency_key_required` before sending anything
1640
+ */
1641
+ create: (body, options) => c.call("posFeesCreate", { body }, options),
1642
+ /**
1643
+ * Update a fee
1644
+ *
1645
+ * Only the fields sent change. Same access rule as create. The fee's position in the list is not changed here. Returns the fee.
1646
+ *
1647
+ * Scope: `pos:write` · rate limit: write (60 / min per key) · `Idempotency-Key` required
1648
+ *
1649
+ * `PATCH /v1/pos-fees/{id}` · rate-limit bucket: write · requires `options.idempotencyKey`: your own stable key for this logical operation (e.g. derived from your invoice / payment id), stored before the call and sent again on every retry — without it the call throws `idempotency_key_required` before sending anything
1650
+ */
1651
+ update: (id, body, options) => c.call("posFeesUpdate", { path: { id }, body }, options),
1652
+ },
1653
+ payments: {
1654
+ /**
1655
+ * List incoming payments, newest first
1656
+ *
1657
+ * `dateFrom` / `dateTo` filter the payment date (a calendar date, no timezone), both inclusive; dateFrom ≤ dateTo. At most 200 invoice references per payment.
1658
+ *
1659
+ * Scope: `sales:read` · user permission: `commercial.payment.read` · rate limit: read
1660
+ *
1661
+ * `GET /v1/payments` · rate-limit bucket: read
1662
+ */
1663
+ list: (query, options) => c.call("paymentsList", { query }, options),
1664
+ /** Every row of `GET /v1/payments`, page after page (follows `nextCursor` with the same filters and `limit`). */
1665
+ listAll: (query, options) => c.paginate("paymentsList", { query }, options),
1666
+ /**
1667
+ * Get an incoming payment with its invoice allocations
1668
+ *
1669
+ * At most 200 allocations (`truncated` names a cut array).
1670
+ *
1671
+ * Scope: `sales:read` · user permission: `commercial.payment.read` · rate limit: read
1672
+ *
1673
+ * `GET /v1/payments/{id}` · rate-limit bucket: read
1674
+ */
1675
+ get: (id, options) => c.call("paymentsGet", { path: { id } }, options),
1676
+ },
1677
+ reports: {
1678
+ /**
1679
+ * Revenue by day / week / month (POS + invoices)
1680
+ *
1681
+ * Scope: `reports:read` · user permission: `report.default` · rate limit: report
1682
+ *
1683
+ * `GET /v1/reports/revenue` · rate-limit bucket: report
1684
+ */
1685
+ revenue: (query, options) => c.call("reportsRevenue", { query }, options),
1686
+ /**
1687
+ * POS sales summary: totals, refunds, voids, by selling type and day
1688
+ *
1689
+ * Scope: `reports:read` · user permission: `report.default` · rate limit: report
1690
+ *
1691
+ * `GET /v1/reports/sales-summary` · rate-limit bucket: report
1692
+ */
1693
+ salesSummary: (query, options) => c.call("reportsSalesSummary", { query }, options),
1694
+ /**
1695
+ * Sales performance per outlet or per sales channel
1696
+ *
1697
+ * Scope: `reports:read` · user permission: `report.default` · rate limit: report
1698
+ *
1699
+ * `GET /v1/reports/sales-performance` · rate-limit bucket: report
1700
+ */
1701
+ salesPerformance: (query, options) => c.call("reportsSalesPerformance", { query }, options),
1702
+ /**
1703
+ * Product performance over the last N days: quantity, revenue, velocity, bought together
1704
+ *
1705
+ * A rolling window: the last `days` × 24 h up to now (not calendar days). At most 31 days — the report scans every POS line of the window. At most 500 variant rows (most sold first) and 15 bought-together pairs.
1706
+ *
1707
+ * Scope: `reports:read` · user permission: `product.read` · rate limit: report
1708
+ *
1709
+ * `GET /v1/reports/product-performance` · rate-limit bucket: report
1710
+ */
1711
+ productPerformance: (query, options) => c.call("reportsProductPerformance", { query }, options),
1712
+ /**
1713
+ * Stock movement summary by movement type
1714
+ *
1715
+ * Totals per movement type in the window. A day is the local day of each movement's outlet (organization zone for a movement without an outlet); `timezone` makes it one zone. The movements themselves: GET /v1/stock-movements.
1716
+ *
1717
+ * Scope: `reports:read` · user permission: `report.default` · rate limit: report
1718
+ *
1719
+ * `GET /v1/reports/stock-movement` · rate-limit bucket: report
1720
+ */
1721
+ stockMovement: (query, options) => c.call("reportsStockMovement", { query }, options),
1722
+ },
1723
+ };
1724
+ }
1725
+ //# sourceMappingURL=v1.js.map