sylphx 0.3.1

The Sylphx SDK: one API, one key, every Sylphx service. Generated from the Sylphx schema registry.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
// @generated by sylphx-gen 0.1.0 from contracts@c8aac0afaf7591d0d5efa1ba6a8540d723d41a97ce7ad5d68601380ef3ab4783. Do not edit.
//! `sylphx.money.v1`.

#![allow(clippy::all)]

/// AppStoreConnection is an App Store Server API key and the app's bundle ids.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct AppStoreConnection {
    /// The apps' bundle ids.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "Vec::is_empty", alias = "bundleIds")]
    pub bundle_ids: Vec<String>,
    /// The App Store Connect issuer id.
    ///
    /// Field behavior: `required`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "issuerId"
    )]
    pub issuer_id: String,
    /// The In-App Purchase key id.
    ///
    /// Field behavior: `required`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "keyId"
    )]
    pub key_id: String,
    /// The In-App Purchase key (`.p8` PEM). Write-only: sealed on write, never
    /// returned; omit it on update to keep the stored key.
    ///
    /// Field behavior: `input_only`, `sensitive`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "privateKey"
    )]
    pub private_key: String,
    /// The app's Apple id, needed to verify production notifications.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        with = "crate::runtime::int64",
        alias = "appAppleId"
    )]
    pub app_apple_id: i64,
    /// An earlier `appAccountToken` scheme the app's shipped builds use: the
    /// token is UUIDv5 in the URL namespace of this prefix followed by the
    /// subject id (for example `https://accounts.example.com/v2/`). Tokens in
    /// Money's own scheme are always accepted as well.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "accountTokenPrefix"
    )]
    pub account_token_prefix: String,
}

/// The request of CancelCustomerSubscription.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct CancelCustomerSubscriptionRequest {
    /// The subscription to cancel.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub name: String,
    /// End it at the period end (true) or now (false).
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "atPeriodEnd"
    )]
    pub at_period_end: bool,
    /// Refund the last payment in full; only with `at_period_end` false.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "refundLastPayment"
    )]
    pub refund_last_payment: bool,
}

/// A Catalog is an environment's features, products, and prices: the desired
/// state Money keeps its merchant account's processor objects equal to, by
/// lookup key. It is declared in `sylphx.toml` `[money]` or written here.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct Catalog {
    /// `orgs/{org}/projects/{project}/envs/{env}/price_catalogs/default`.
    ///
    /// Field behavior: `identifier`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub name: String,
    /// `cat_<cell><ulid>`; never reused.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub uid: String,
    /// Resource metadata.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub meta: Option<crate::common::ResourceMeta>,
    /// Desired state.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub spec: Option<CatalogSpec>,
    /// Observed state.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub status: Option<CatalogStatus>,
}

/// CatalogSpec is the caller-writable state of a Catalog.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct CatalogSpec {
    /// What an entitlement can grant.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub features: Vec<Feature>,
    /// What is sold.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub products: Vec<Product>,
    /// How long a signed store-purchase grant is valid, from the moment it is
    /// issued; a client re-verifies to renew it. Default 7 days, 1 hour to 30
    /// days.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "clientGrantTtl"
    )]
    pub client_grant_ttl: String,
    /// Whether a delivered one-time purchase whose money the store or processor
    /// takes back (a refund, a void, a chargeback) gives back its goods: its
    /// entitlements end, and the refund event asks the app to take back the
    /// assets it granted, up to what the subject still holds. Applies once the
    /// project is enabled for take-backs, to refunds dated from then on; unset
    /// then means on.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        alias = "refundClawBack"
    )]
    pub refund_claw_back: Option<bool>,
}

/// CatalogStatus is the observed state of a Catalog.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct CatalogStatus {
    /// The generation this status was computed from.
    ///
    /// Field behavior: `output_only`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        with = "crate::runtime::int64",
        alias = "observedGeneration"
    )]
    pub observed_generation: i64,
    /// Synced, Reconciling, Stalled.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub conditions: Vec<crate::common::Condition>,
    /// When the processor last matched the spec.
    ///
    /// Field behavior: `output_only`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "syncTime"
    )]
    pub sync_time: String,
    /// The processor object behind each price, by lookup key.
    ///
    /// Field behavior: `output_only`.
    #[serde(
        default,
        skip_serializing_if = "std::collections::BTreeMap::is_empty",
        alias = "processorPriceIds"
    )]
    pub processor_price_ids: std::collections::BTreeMap<String, String>,
}

/// The request of ChangeCustomerSubscriptionPlan.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct ChangeCustomerSubscriptionPlanRequest {
    /// The subscription to change.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub name: String,
    /// The key of the catalog product to move to.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub product: String,
    /// The key of the product's recurring price (for example monthly or yearly).
    /// Optional when the product has one recurring price.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub price: String,
    /// How the change is billed; unspecified is `create_prorations`.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        alias = "prorationBehavior"
    )]
    pub proration_behavior: Option<ProrationBehavior>,
    /// Run every check and answer the subscription as it would read, without
    /// changing anything.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "validateOnly"
    )]
    pub validate_only: bool,
}

/// The request of CheckEntitlement.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct CheckEntitlementRequest {
    /// The environment to check in.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub parent: String,
    /// Who.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub subject: Option<Subject>,
    /// The feature key.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub feature: String,
}

/// The response of CheckEntitlement.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct CheckEntitlementResponse {
    /// Whether the subject holds the feature now.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub entitled: bool,
    /// For a `limit` feature, the largest allowance the subject holds.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub limit: String,
    /// The grant that answers, when entitled.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "entitlementGrant"
    )]
    pub entitlement_grant: String,
    /// When the answering grant ends; unset for no end. A caller may cache the
    /// answer until then.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "expireTime"
    )]
    pub expire_time: String,
}

/// A Checkout Session is a hosted page where a subject pays for catalog
/// prices. Money creates the processor's session on the environment's
/// merchant account and returns its URL.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct CheckoutSession {
    /// `orgs/{org}/projects/{project}/envs/{env}/checkout_sessions/{checkout_session}`.
    ///
    /// Field behavior: `identifier`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub name: String,
    /// `chk_<cell><ulid>`; never reused.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub uid: String,
    /// Resource metadata.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub meta: Option<crate::common::ResourceMeta>,
    /// Who pays and is entitled.
    ///
    /// Field behavior: `required`, `immutable`.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub subject: Option<Subject>,
    /// What is bought: catalog prices by lookup key. One recurring price makes a
    /// subscription; one-time prices make an order.
    ///
    /// Field behavior: `required`, `immutable`.
    #[serde(default, skip_serializing_if = "Vec::is_empty", alias = "lineItems")]
    pub line_items: Vec<LineItem>,
    /// Where the buyer lands after paying; `{CHECKOUT_SESSION_ID}` is replaced
    /// by the processor's session id. HTTPS only.
    ///
    /// Field behavior: `required`, `immutable`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "successUrl"
    )]
    pub success_url: String,
    /// Where the buyer lands on cancel. HTTPS only.
    ///
    /// Field behavior: `immutable`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "cancelUrl"
    )]
    pub cancel_url: String,
    /// The currency to charge in, upper-case ISO 4217; default the processor's
    /// choice for the buyer among the prices' currencies.
    ///
    /// Field behavior: `immutable`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "currencyCode"
    )]
    pub currency_code: String,
    /// The page language, for example `en` or `zh-HK`; default automatic.
    ///
    /// Field behavior: `immutable`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub locale: String,
    /// Copied to the subscription or order, for example attribution
    /// (`utm_source`, `ref`). At most 20 keys.
    ///
    /// Field behavior: `immutable`.
    #[serde(default, skip_serializing_if = "std::collections::BTreeMap::is_empty")]
    pub metadata: std::collections::BTreeMap<String, String>,
    /// Whether the buyer may enter a promotion code.
    ///
    /// Field behavior: `immutable`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "allowPromotionCodes"
    )]
    pub allow_promotion_codes: bool,
    /// The hosted page.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub url: String,
    /// `open`, `complete`, or `expired`.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub state: String,
    /// When the page stops accepting payment.
    ///
    /// Field behavior: `output_only`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "expireTime"
    )]
    pub expire_time: String,
    /// The processor's session id.
    ///
    /// Field behavior: `output_only`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "processorSessionId"
    )]
    pub processor_session_id: String,
}

/// The request of ConnectMerchantAccount.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct ConnectMerchantAccountRequest {
    /// The environment whose seller this becomes.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub parent: String,
    /// The merchant account id; default `default`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "merchantAccountId"
    )]
    pub merchant_account_id: String,
    /// Where the browser returns after the processor, with `status` and, on
    /// success, `merchant_account` in the query. HTTPS only. Required for the
    /// OAuth connection; unused, and so optional, with `restricted_key`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "returnUrl"
    )]
    pub return_url: String,
    /// A Stripe restricted key (`rk_test_…` or `rk_live_…`); when set, no OAuth
    /// happens: the account is read and connected at once. Write-only: sealed on
    /// write, never returned, never logged. A secret key (`sk_…`) is refused,
    /// because a restricted key can be limited to what payments need.
    ///
    /// Field behavior: `input_only`, `sensitive`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "restrictedKey"
    )]
    pub restricted_key: String,
}

/// The response of ConnectMerchantAccount.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct ConnectMerchantAccountResponse {
    /// The processor's authorisation page for an owner of the account to open;
    /// empty when the connection completed in this call.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "authorizeUrl"
    )]
    pub authorize_url: String,
    /// When the link stops working; unset when the connection completed in this
    /// call.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "expireTime"
    )]
    pub expire_time: String,
    /// The merchant account, connected; set when the connection completed in
    /// this call, which is every connection made with a restricted key.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        alias = "merchantAccount"
    )]
    pub merchant_account: Option<MerchantAccount>,
}

/// The request of CreateCheckoutSession.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct CreateCheckoutSessionRequest {
    /// The parent to create in.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub parent: String,
    /// The checkout to create; only caller-writable fields are read.
    ///
    /// Field behavior: `required`.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        alias = "checkoutSession"
    )]
    pub checkout_session: Option<CheckoutSession>,
    /// The id, the final name segment; the server assigns one when empty.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "checkoutSessionId"
    )]
    pub checkout_session_id: String,
}

/// The request of CreatePortalSession.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct CreatePortalSessionRequest {
    /// The parent to create in.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub parent: String,
    /// The portal session to create; only caller-writable fields are read.
    ///
    /// Field behavior: `required`.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        alias = "portalSession"
    )]
    pub portal_session: Option<PortalSession>,
    /// The id, the final name segment; the server assigns one when empty.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "portalSessionId"
    )]
    pub portal_session_id: String,
}

/// The request of CreateStoreConnection.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct CreateStoreConnectionRequest {
    /// The parent to create in.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub parent: String,
    /// The store connection id, the final name segment.
    ///
    /// Field behavior: `required`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "storeConnectionId"
    )]
    pub store_connection_id: String,
    /// The store connection to create; only caller-writable fields are read.
    ///
    /// Field behavior: `required`.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        alias = "storeConnection"
    )]
    pub store_connection: Option<StoreConnection>,
    /// Validate and return the result without writing anything.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "validateOnly"
    )]
    pub validate_only: bool,
}

/// A Customer Subscription is a subject's recurring purchase, mirrored from
/// the processor after Money read it back. Money writes it; a caller changes it
/// only through `:cancel` and `:resume`.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct CustomerSubscription {
    /// `orgs/{org}/projects/{project}/envs/{env}/customer_subscriptions/{customer_subscription}`.
    ///
    /// Field behavior: `identifier`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub name: String,
    /// `csb_<cell><ulid>`; never reused.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub uid: String,
    /// Resource metadata.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub meta: Option<crate::common::ResourceMeta>,
    /// Who holds it.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub subject: Option<Subject>,
    /// `stripe`, `app_store`, or `google_play`.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub source: String,
    /// The processor's subscription id.
    ///
    /// Field behavior: `output_only`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "processorSubscriptionId"
    )]
    pub processor_subscription_id: String,
    /// `trialing`, `active`, `past_due`, `paused`, `canceled`, `unpaid`,
    /// `incomplete`, or `incomplete_expired`, as the processor reports it.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub status: String,
    /// The prices, by lookup key, and their quantities.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub items: Vec<LineItem>,
    /// The end of the paid period.
    ///
    /// Field behavior: `output_only`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "currentPeriodEndTime"
    )]
    pub current_period_end_time: String,
    /// Whether it ends at `current_period_end_time` instead of renewing.
    ///
    /// Field behavior: `output_only`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "cancelAtPeriodEnd"
    )]
    pub cancel_at_period_end: bool,
    /// The end of the trial, when there is one.
    ///
    /// Field behavior: `output_only`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "trialEndTime"
    )]
    pub trial_end_time: String,
    /// The checkout's metadata.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub metadata: Option<serde_json::Value>,
}

/// The request of DeleteStoreConnection.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct DeleteStoreConnectionRequest {
    /// The name of the store connection to delete.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub name: String,
    /// The ETag the caller read; the delete fails if it changed.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub etag: String,
}

/// The request of DisconnectMerchantAccount.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct DisconnectMerchantAccountRequest {
    /// The merchant account to disconnect.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub name: String,
}

/// An Entitlement Grant is one feature a subject holds, from one source: a
/// subscription, an order, a store purchase, or a manual grant. Money derives
/// it; a client event never writes one.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct EntitlementGrant {
    /// `orgs/{org}/projects/{project}/envs/{env}/entitlement_grants/{entitlement_grant}`.
    ///
    /// Field behavior: `identifier`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub name: String,
    /// `egr_<cell><ulid>`; never reused.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub uid: String,
    /// Resource metadata.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub meta: Option<crate::common::ResourceMeta>,
    /// Who holds it.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub subject: Option<Subject>,
    /// The feature key.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub feature: String,
    /// For a `limit` feature, the allowance as a decimal string.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub limit: String,
    /// The resource that grants it, for example a customer subscription's name.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub source: String,
    /// When it ends; unset for no end.
    ///
    /// Field behavior: `output_only`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "expireTime"
    )]
    pub expire_time: String,
}

/// A Feature is what an app checks, for example `plus` or
/// `exports.per_month`.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct Feature {
    /// The key the app checks; `^[a-z][a-z0-9_.]{0,63}$`.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub key: String,
    /// `boolean` (on or off) or `limit` (a numeric allowance).
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub kind: Option<FeatureKind>,
    /// Shown to people.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "displayName"
    )]
    pub display_name: String,
}

/// The request of GenerateLicenceKey.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct GenerateLicenceKeyRequest {
    /// The environment the key belongs to.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub parent: String,
    /// The key's id; `^[a-z]([a-z0-9_-]{0,61}[a-z0-9])?$`. Empty: Money assigns
    /// one.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "licenceKeyId"
    )]
    pub licence_key_id: String,
    /// Shown to operators.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub spec: Option<LicenceKeySpec>,
}

/// The request of GetCatalog.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct GetCatalogRequest {
    /// The name of the catalog to get.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub name: String,
}

/// The request of GetCheckoutSession.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct GetCheckoutSessionRequest {
    /// The name of the checkout session to get.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub name: String,
}

/// The request of GetCustomerSubscription.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct GetCustomerSubscriptionRequest {
    /// The name of the customer subscription to get.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub name: String,
}

/// The request of GetEntitlementGrant.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct GetEntitlementGrantRequest {
    /// The name of the entitlement grant to get.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub name: String,
}

/// The request of GetLicenceKey.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct GetLicenceKeyRequest {
    /// The name of the licence key to get.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub name: String,
}

/// The request of GetMerchantAccount.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct GetMerchantAccountRequest {
    /// The name of the merchant account to get.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub name: String,
}

/// The request of GetPortalSession.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct GetPortalSessionRequest {
    /// The name of the portal session to get.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub name: String,
}

/// The request of GetStoreConnection.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct GetStoreConnectionRequest {
    /// The name of the store connection to get.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub name: String,
}

/// The request of GetStorePurchase.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct GetStorePurchaseRequest {
    /// The name of the store purchase to get.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub name: String,
}

/// GooglePlayConnection is a Play service account and the app's package names.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct GooglePlayConnection {
    /// The apps' package names.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "Vec::is_empty", alias = "packageNames")]
    pub package_names: Vec<String>,
    /// The service account's JSON key. Write-only: sealed on write, never
    /// returned; omit it on update to keep the stored key.
    ///
    /// Field behavior: `input_only`, `sensitive`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "serviceAccountJson"
    )]
    pub service_account_json: String,
    /// The audience Play's Pub/Sub push token must carry for real-time developer
    /// notifications; unset refuses them.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "notificationAudience"
    )]
    pub notification_audience: String,
    /// The service account Pub/Sub pushes as.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "notificationServiceAccount"
    )]
    pub notification_service_account: String,
}

/// The request of ImportLicenceKey.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct ImportLicenceKeyRequest {
    /// The environment the key belongs to.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub parent: String,
    /// The key's id; as on GenerateLicenceKeyRequest. Required.
    ///
    /// Field behavior: `required`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "licenceKeyId"
    )]
    pub licence_key_id: String,
    /// The Ed25519 private key as PKCS8 DER in standard base64. Write-only:
    /// sealed on import, never returned.
    ///
    /// Field behavior: `required`, `input_only`, `sensitive`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "privateKeyPkcs8"
    )]
    pub private_key_pkcs8: String,
    /// The public key shipped clients pin, raw base64url without padding. The
    /// import is refused unless it is the public half of the imported key.
    ///
    /// Field behavior: `required`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "expectedPublicKey"
    )]
    pub expected_public_key: String,
    /// Shown to operators.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub spec: Option<LicenceKeySpec>,
}

/// A Licence Key is one Ed25519 signing key Money holds for an environment. The
/// private half is generated here (or imported once, for a key already pinned in
/// shipped clients), sealed with Money's seal keys, and never returned or
/// logged. The public half is exported keyless at
/// `GET /v1/money/licence_keys/{uid}`, in the raw base64url form a client pins.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct LicenceKey {
    /// `orgs/{org}/projects/{project}/envs/{env}/licence_keys/{licence_key}`.
    ///
    /// Field behavior: `identifier`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub name: String,
    /// `lkey_<cell><ulid>`; never reused. The keyless public export is addressed
    /// by it.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub uid: String,
    /// Resource metadata.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub meta: Option<crate::common::ResourceMeta>,
    /// Desired state.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub spec: Option<LicenceKeySpec>,
    /// Observed state.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub status: Option<LicenceKeyStatus>,
}

/// LicenceKeySpec is the caller-writable state of a LicenceKey.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct LicenceKeySpec {
    /// Shown to operators.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub description: String,
}

/// LicenceKeyStatus is the observed state of a LicenceKey.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct LicenceKeyStatus {
    /// The generation this status was computed from.
    ///
    /// Field behavior: `output_only`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        with = "crate::runtime::int64",
        alias = "observedGeneration"
    )]
    pub observed_generation: i64,
    /// Ready while the key exists.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub conditions: Vec<crate::common::Condition>,
    /// `active` signs new terms; `retired` signs only terms already frozen to it
    /// and stays exported for verification.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub state: String,
    /// `generated` or `imported`.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub origin: String,
    /// The raw Ed25519 public key, base64url without padding.
    ///
    /// Field behavior: `output_only`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "publicKey"
    )]
    pub public_key: String,
    /// When the key was retired.
    ///
    /// Field behavior: `output_only`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "retireTime"
    )]
    pub retire_time: String,
}

/// A LicencePolicy is the product-owned rule for the offline licence a paid
/// one-time purchase of the product carries. Written by the merchant with the
/// catalog (`billing:write`); it names no key material, only the LicenceKey that
/// signs. A licence is refused on a consumable product and on a product with a
/// recurring price. There is no grace period.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct LicencePolicy {
    /// The token scheme; `sylphx-offline-ed25519-v1`.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub scheme: String,
    /// The `plan` the token carries.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub plan: String,
    /// The `product` the token carries (what the client checks it against).
    ///
    /// Field behavior: `required`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "tokenProduct"
    )]
    pub token_product: String,
    /// The id of the LicenceKey that signs new terms.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub key: String,
    /// How long one purchase lasts.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub term: Option<LicenceTerm>,
}

/// A LicenceTerm is a length of time with explicit arithmetic: `days` add
/// exact 86 400 000 ms multiples to the UTC instant; `calendar_months` and
/// `calendar_years` add months to the UTC calendar date, keep the time of day,
/// and clamp a day that does not exist in the target month to the month's last
/// day (2028-02-29 plus one year is 2029-02-28).
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct LicenceTerm {
    /// The unit of `count`.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub unit: Option<LicenceTermUnit>,
    /// How many units; at least 1.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub count: i32,
}

/// A Licence Token is one issued offline licence, re-derived from its frozen
/// term: the same bytes every time. Money derives it; nothing writes one.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct LicenceToken {
    /// `orgs/{org}/projects/{project}/envs/{env}/licence_tokens/{licence_token}`.
    ///
    /// Field behavior: `identifier`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub name: String,
    /// `ltok_<cell><ulid>`; never reused.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub uid: String,
    /// Resource metadata.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub meta: Option<crate::common::ResourceMeta>,
    /// The grant source the term was frozen for:
    /// `<checkout session name>/line_items/<n>`.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub source: String,
    /// The checkout line the token is for.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub line: i32,
    /// The token: `base64url(payload) "." base64url(signature)`.
    ///
    /// Field behavior: `output_only`, `sensitive`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub token: String,
    /// The `product` the token carries.
    ///
    /// Field behavior: `output_only`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "tokenProduct"
    )]
    pub token_product: String,
    /// When the term was frozen.
    ///
    /// Field behavior: `output_only`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "issueTime"
    )]
    pub issue_time: String,
    /// When the token expires.
    ///
    /// Field behavior: `output_only`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "expireTime"
    )]
    pub expire_time: String,
    /// The seats the token carries.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub seats: i32,
}

/// A Line Item is one catalog price and its quantity.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct LineItem {
    /// The price's lookup key.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub price: String,
    /// How many; default 1. Seats for a per-seat or family price.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub quantity: i32,
}

/// The request of ListCustomerSubscriptions.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct ListCustomerSubscriptionsRequest {
    /// The parent to list in.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub parent: String,
    /// At most this many; default 50, clamped to 1000.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "pageSize"
    )]
    pub page_size: i32,
    /// `next_page_token` of the previous page.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "pageToken"
    )]
    pub page_token: String,
    /// AIP-160 filter over filterable fields.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub filter: String,
}

/// The response of ListCustomerSubscriptions.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct ListCustomerSubscriptionsResponse {
    /// The page.
    #[serde(
        default,
        skip_serializing_if = "Vec::is_empty",
        alias = "customerSubscriptions"
    )]
    pub customer_subscriptions: Vec<CustomerSubscription>,
    /// The token of the next page; empty on the last page.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "nextPageToken"
    )]
    pub next_page_token: String,
}

/// The request of ListEntitlementGrants.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct ListEntitlementGrantsRequest {
    /// The parent to list in.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub parent: String,
    /// At most this many; default 50, clamped to 1000.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "pageSize"
    )]
    pub page_size: i32,
    /// `next_page_token` of the previous page.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "pageToken"
    )]
    pub page_token: String,
    /// AIP-160 filter over filterable fields, for example `feature = "plus"`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub filter: String,
}

/// The response of ListEntitlementGrants.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct ListEntitlementGrantsResponse {
    /// The page.
    #[serde(
        default,
        skip_serializing_if = "Vec::is_empty",
        alias = "entitlementGrants"
    )]
    pub entitlement_grants: Vec<EntitlementGrant>,
    /// The token of the next page; empty on the last page.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "nextPageToken"
    )]
    pub next_page_token: String,
}

/// The request of ListLicenceKeys.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct ListLicenceKeysRequest {
    /// The parent to list in.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub parent: String,
    /// At most this many; default 50, clamped to 1000.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "pageSize"
    )]
    pub page_size: i32,
    /// `next_page_token` of the previous page.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "pageToken"
    )]
    pub page_token: String,
}

/// The response of ListLicenceKeys.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct ListLicenceKeysResponse {
    /// The page.
    #[serde(default, skip_serializing_if = "Vec::is_empty", alias = "licenceKeys")]
    pub licence_keys: Vec<LicenceKey>,
    /// The token of the next page; empty on the last page.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "nextPageToken"
    )]
    pub next_page_token: String,
}

/// The request of ListLicenceTokens.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct ListLicenceTokensRequest {
    /// The environment to list in.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub parent: String,
    /// At most this many; default 50, clamped to 1000.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "pageSize"
    )]
    pub page_size: i32,
    /// `next_page_token` of the previous page.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "pageToken"
    )]
    pub page_token: String,
    /// AIP-160 filter. It must name whose tokens (else `INVALID_FIELD`): `end_user = "…"` or
    /// `customer_organization = "…"`; `token_product = "…"` (joined with `AND`)
    /// keeps only that product, and no `token_product` lists every product.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub filter: String,
}

/// The response of ListLicenceTokens.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct ListLicenceTokensResponse {
    /// Every unexpired token of a paid order, newest first.
    #[serde(
        default,
        skip_serializing_if = "Vec::is_empty",
        alias = "licenceTokens"
    )]
    pub licence_tokens: Vec<LicenceToken>,
    /// The token of the next page; empty on the last page.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "nextPageToken"
    )]
    pub next_page_token: String,
}

/// The request of ListMerchantAccounts.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct ListMerchantAccountsRequest {
    /// The parent to list in.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub parent: String,
    /// At most this many; default 50, clamped to 1000.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "pageSize"
    )]
    pub page_size: i32,
    /// `next_page_token` of the previous page.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "pageToken"
    )]
    pub page_token: String,
}

/// The response of ListMerchantAccounts.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct ListMerchantAccountsResponse {
    /// The page.
    #[serde(
        default,
        skip_serializing_if = "Vec::is_empty",
        alias = "merchantAccounts"
    )]
    pub merchant_accounts: Vec<MerchantAccount>,
    /// The token of the next page; empty on the last page.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "nextPageToken"
    )]
    pub next_page_token: String,
}

/// The request of ListStoreConnections.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct ListStoreConnectionsRequest {
    /// The parent to list in.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub parent: String,
    /// At most this many; default 50, clamped to 1000.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "pageSize"
    )]
    pub page_size: i32,
    /// `next_page_token` of the previous page.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "pageToken"
    )]
    pub page_token: String,
    /// AIP-160 filter over filterable fields.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub filter: String,
}

/// The response of ListStoreConnections.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct ListStoreConnectionsResponse {
    /// The page.
    #[serde(
        default,
        skip_serializing_if = "Vec::is_empty",
        alias = "storeConnections"
    )]
    pub store_connections: Vec<StoreConnection>,
    /// The token of the next page; empty on the last page.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "nextPageToken"
    )]
    pub next_page_token: String,
}

/// The request of ListStorePurchases.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct ListStorePurchasesRequest {
    /// The parent to list in.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub parent: String,
    /// At most this many; default 50, clamped to 1000.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "pageSize"
    )]
    pub page_size: i32,
    /// `next_page_token` of the previous page.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "pageToken"
    )]
    pub page_token: String,
    /// AIP-160 filter over filterable fields, for example `transaction_id = "…"`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub filter: String,
}

/// The response of ListStorePurchases.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct ListStorePurchasesResponse {
    /// The page.
    #[serde(
        default,
        skip_serializing_if = "Vec::is_empty",
        alias = "storePurchases"
    )]
    pub store_purchases: Vec<StorePurchase>,
    /// The token of the next page; empty on the last page.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "nextPageToken"
    )]
    pub next_page_token: String,
}

/// A Merchant Account is the seller an environment charges as on the web: the
/// customer's own Stripe account, connected through Stripe Connect OAuth, or
/// with a restricted key when OAuth cannot be used (the platform's own
/// products). Sylphx stores the account id, and for a key connection the key
/// sealed, never in the clear and never returned. `:connect` starts the
/// connection; the processor's redirect completes an OAuth one.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct MerchantAccount {
    /// `orgs/{org}/projects/{project}/envs/{env}/merchant_accounts/{merchant_account}`;
    /// the environment's seller is `default`.
    ///
    /// Field behavior: `identifier`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub name: String,
    /// `mac_<cell><ulid>`; never reused.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub uid: String,
    /// Resource metadata.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub meta: Option<crate::common::ResourceMeta>,
    /// The processor: `stripe`.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub processor: String,
    /// The connected account id, for example `acct_1Nv…`.
    ///
    /// Field behavior: `output_only`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "accountId"
    )]
    pub account_id: String,
    /// Whether the connection is in live mode (false is test mode).
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub livemode: bool,
    /// `connected` or `disconnected`.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub state: String,
    /// Whether the account can take payments now.
    ///
    /// Field behavior: `output_only`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "chargesEnabled"
    )]
    pub charges_enabled: bool,
    /// Whether the account can be paid out.
    ///
    /// Field behavior: `output_only`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "payoutsEnabled"
    )]
    pub payouts_enabled: bool,
    /// The business name the processor holds for the account.
    ///
    /// Field behavior: `output_only`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "businessName"
    )]
    pub business_name: String,
    /// ISO 3166-1 alpha-2 country of the account.
    ///
    /// Field behavior: `output_only`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "regionCode"
    )]
    pub region_code: String,
    /// ISO 4217 default currency of the account, upper case.
    ///
    /// Field behavior: `output_only`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "defaultCurrencyCode"
    )]
    pub default_currency_code: String,
    /// When the processor last confirmed these fields.
    ///
    /// Field behavior: `output_only`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "refreshTime"
    )]
    pub refresh_time: String,
    /// How the account is called at the processor: `connect` (the platform's
    /// key acts for a connected account) or `restricted_key` (the account's own
    /// key, held sealed).
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub credential: String,
}

/// A Portal Session is a hosted page where a subject manages its
/// subscriptions, payment method, and invoices.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct PortalSession {
    /// `orgs/{org}/projects/{project}/envs/{env}/portal_sessions/{portal_session}`.
    ///
    /// Field behavior: `identifier`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub name: String,
    /// `pts_<cell><ulid>`; never reused.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub uid: String,
    /// Resource metadata.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub meta: Option<crate::common::ResourceMeta>,
    /// Whose portal.
    ///
    /// Field behavior: `required`, `immutable`.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub subject: Option<Subject>,
    /// Where the portal's back link goes. HTTPS only.
    ///
    /// Field behavior: `required`, `immutable`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "returnUrl"
    )]
    pub return_url: String,
    /// The hosted page; valid for a few minutes.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub url: String,
}

/// A Price is one way to pay for a product, named by its lookup key.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct Price {
    /// The lookup key the app uses; `^[a-z][a-z0-9_]{0,63}$`, unique in the
    /// catalog.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub key: String,
    /// Unset for a one-time price; `day`, `week`, `month`, or `year`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "recurringInterval"
    )]
    pub recurring_interval: String,
    /// Intervals per period; default 1.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "recurringIntervalCount"
    )]
    pub recurring_interval_count: i32,
    /// Unit amount per ISO 4217 currency code in upper case, as a decimal string
    /// of minor units, for example `{"USD": "499", "GBP": "399"}`. The processor's
    /// base currency is `default_currency` when set, else the first currency in
    /// code order.
    ///
    /// Field behavior: `required`.
    #[serde(
        default,
        skip_serializing_if = "std::collections::BTreeMap::is_empty",
        alias = "unitAmounts"
    )]
    pub unit_amounts: std::collections::BTreeMap<String, String>,
    /// `inclusive` (the amount includes tax) or `exclusive`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "taxBehavior"
    )]
    pub tax_behavior: String,
    /// Free trial days for a recurring price.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "trialDays"
    )]
    pub trial_days: i32,
    /// Whether checkout may sell this price.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub archived: bool,
    /// The processor's base currency: an upper-case ISO 4217 code that is a key of
    /// `unit_amounts`. Unset uses the first currency in code order. Changing it
    /// creates a new processor price under the same lookup key, because the base
    /// currency is immutable there.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "defaultCurrency"
    )]
    pub default_currency: String,
}

/// A Product is one thing sold, with its prices and the features it grants.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct Product {
    /// The product key; `^[a-z][a-z0-9_]{0,63}$`.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub key: String,
    /// Shown on checkout and invoices.
    ///
    /// Field behavior: `required`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "displayName"
    )]
    pub display_name: String,
    /// Shown on checkout.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub description: String,
    /// Feature grants: a feature key and, for a `limit` feature, the allowance as
    /// a decimal string; `true` for a boolean feature.
    #[serde(default, skip_serializing_if = "std::collections::BTreeMap::is_empty")]
    pub features: std::collections::BTreeMap<String, String>,
    /// The product's prices.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub prices: Vec<Price>,
    /// Store product ids that sell this product, by store (`app_store`,
    /// `google_play`).
    #[serde(
        default,
        skip_serializing_if = "std::collections::BTreeMap::is_empty",
        alias = "storeProductIds"
    )]
    pub store_product_ids: std::collections::BTreeMap<String, String>,
    /// Whether one purchase is used up (a pack of game currency) rather than
    /// kept (an unlock or a subscription).
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub consumable: bool,
    /// What one unit grants in the app's own assets, by asset code, as decimal
    /// strings, for example `{"GEMS": "650"}`. Carried in the signed grant so the
    /// app's server credits exactly this.
    #[serde(default, skip_serializing_if = "std::collections::BTreeMap::is_empty")]
    pub grants: std::collections::BTreeMap<String, String>,
    /// The offline licence a paid one-time purchase carries; refused on a
    /// consumable product and on a product with a recurring price.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub licence: Option<LicencePolicy>,
}

/// The request of RefreshMerchantAccount.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct RefreshMerchantAccountRequest {
    /// The merchant account to read back.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub name: String,
}

/// The request of ResumeCustomerSubscription.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct ResumeCustomerSubscriptionRequest {
    /// The subscription to resume.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub name: String,
}

/// The request of RetireLicenceKey.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct RetireLicenceKeyRequest {
    /// The key to retire.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub name: String,
}

/// A Store Connection is the environment's access to one app store: its App
/// Store Server API key or Google Play service account, sealed by Money and
/// never returned, and the apps (bundle ids or package names) it covers.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct StoreConnection {
    /// `orgs/{org}/projects/{project}/envs/{env}/store_connections/{store_connection}`;
    /// by convention `app-store` or `google-play`.
    ///
    /// Field behavior: `identifier`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub name: String,
    /// `stc_<cell><ulid>`; never reused. Store notifications for this
    /// connection are sent to a URL that carries it.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub uid: String,
    /// Resource metadata.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub meta: Option<crate::common::ResourceMeta>,
    /// Desired state.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub spec: Option<StoreConnectionSpec>,
    /// Observed state.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub status: Option<StoreConnectionStatus>,
}

/// StoreConnectionSpec is the caller-writable state of a StoreConnection.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct StoreConnectionSpec {
    /// The App Store.
    #[serde(default, skip_serializing_if = "Option::is_none", alias = "appStore")]
    pub app_store: Option<AppStoreConnection>,
    /// Google Play.
    #[serde(default, skip_serializing_if = "Option::is_none", alias = "googlePlay")]
    pub google_play: Option<GooglePlayConnection>,
    /// Accept purchases the store marks as sandbox or license-test. Off in
    /// production: a sandbox purchase is then refused.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "allowSandbox"
    )]
    pub allow_sandbox: bool,
    /// Refuse a purchase that does not carry the subject's account token (App
    /// Store `appAccountToken`, Play `obfuscatedAccountId`).
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "requireAccountToken"
    )]
    pub require_account_token: bool,
}

/// StoreConnectionStatus is the observed state of a StoreConnection.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct StoreConnectionStatus {
    /// The generation this status was computed from.
    ///
    /// Field behavior: `output_only`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        with = "crate::runtime::int64",
        alias = "observedGeneration"
    )]
    pub observed_generation: i64,
    /// Ready when a credential is stored.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub conditions: Vec<crate::common::Condition>,
    /// Whether a credential is stored.
    ///
    /// Field behavior: `output_only`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "credentialSet"
    )]
    pub credential_set: bool,
    /// Where the store sends its notifications for this connection.
    ///
    /// Field behavior: `output_only`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "notificationUrl"
    )]
    pub notification_url: String,
    /// The service account's email, read from the stored key (Play only).
    ///
    /// Field behavior: `output_only`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "serviceAccountEmail"
    )]
    pub service_account_email: String,
}

/// A Store Purchase is one store transaction Money verified with the store and
/// bound to one subject. Re-verifying it returns the same record and grant.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct StorePurchase {
    /// `orgs/{org}/projects/{project}/envs/{env}/store_purchases/{store_purchase}`.
    ///
    /// Field behavior: `identifier`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub name: String,
    /// `spu_<cell><ulid>`; never reused.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub uid: String,
    /// Resource metadata.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub meta: Option<crate::common::ResourceMeta>,
    /// Who it belongs to.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub subject: Option<Subject>,
    /// `app_store` or `google_play`.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub store: String,
    /// The store product id.
    ///
    /// Field behavior: `output_only`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "productId"
    )]
    pub product_id: String,
    /// The catalog product it sells, when the catalog maps the store product.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub product: String,
    /// The bundle id or package name.
    ///
    /// Field behavior: `output_only`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "bundleOrPackage"
    )]
    pub bundle_or_package: String,
    /// The store's transaction id (App Store transaction id, Play order id).
    ///
    /// Field behavior: `output_only`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "transactionId"
    )]
    pub transaction_id: String,
    /// The first transaction of a subscription or restored purchase.
    ///
    /// Field behavior: `output_only`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "originalTransactionId"
    )]
    pub original_transaction_id: String,
    /// Units bought.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub quantity: i32,
    /// `production` or `sandbox`.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub environment: String,
    /// `purchased`, `pending`, or `revoked`.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub state: String,
    /// When the store says it was bought.
    ///
    /// Field behavior: `output_only`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "purchaseTime"
    )]
    pub purchase_time: String,
    /// When the store refunded or revoked it.
    ///
    /// Field behavior: `output_only`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "revokeTime"
    )]
    pub revoke_time: String,
    /// The price the store charged, in minor units of `currency`, when the store
    /// reports it.
    ///
    /// Field behavior: `output_only`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub price: String,
    /// ISO 4217 currency of `price`.
    ///
    /// Field behavior: `output_only`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "currencyCode"
    )]
    pub currency_code: String,
    /// The subscription it belongs to, for a subscription purchase.
    ///
    /// Field behavior: `output_only`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "customerSubscription"
    )]
    pub customer_subscription: String,
    /// Revoked after it was delivered, and its goods come back: its
    /// entitlements ended, and the app takes back the assets its grant credited,
    /// up to what the subject still holds. False while it stands, and for a
    /// refund the catalog's `refund_claw_back` lets the subject keep.
    ///
    /// Field behavior: `output_only`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "clawBack"
    )]
    pub claw_back: bool,
}

/// A Subject is who pays and holds entitlements: exactly one of an end user
/// or a customer organization of the app.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct Subject {
    /// An end user's id (Sylphx Auth, or the app's own OIDC issuer).
    #[serde(default, skip_serializing_if = "Option::is_none", alias = "endUser")]
    pub end_user: Option<String>,
    /// A customer organization's id.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        alias = "customerOrganization"
    )]
    pub customer_organization: Option<String>,
}

/// The request of SyncCatalog.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct SyncCatalogRequest {
    /// The catalog to push.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub name: String,
}

/// The request of UpdateCatalog.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct UpdateCatalogRequest {
    /// The catalog to write; `name` identifies it.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub catalog: Option<Catalog>,
    /// The fields to write; unset writes every populated field.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "updateMask"
    )]
    pub update_mask: String,
    /// Create the catalog when it does not exist (declarative upsert).
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "allowMissing"
    )]
    pub allow_missing: bool,
    /// Validate and return the result without writing anything.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "validateOnly"
    )]
    pub validate_only: bool,
}

/// The request of UpdateCustomerSubscriptionQuantity.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct UpdateCustomerSubscriptionQuantityRequest {
    /// The subscription to change.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub name: String,
    /// The new quantity (seats) of the subscription's one item; at least 1.
    /// To end the subscription, cancel it.
    ///
    /// Field behavior: `required`.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        with = "crate::runtime::int64"
    )]
    pub quantity: i64,
    /// How the change is billed; unspecified is `create_prorations`.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        alias = "prorationBehavior"
    )]
    pub proration_behavior: Option<ProrationBehavior>,
}

/// The request of UpdateStoreConnection.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct UpdateStoreConnectionRequest {
    /// The store connection to update; `name` identifies it.
    ///
    /// Field behavior: `required`.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        alias = "storeConnection"
    )]
    pub store_connection: Option<StoreConnection>,
    /// The fields to write; unset writes every populated field.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "updateMask"
    )]
    pub update_mask: String,
    /// Create the store connection when it does not exist (declarative upsert).
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "allowMissing"
    )]
    pub allow_missing: bool,
    /// Validate and return the result without writing anything.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "validateOnly"
    )]
    pub validate_only: bool,
}

/// The request of VerifyStorePurchase.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct VerifyStorePurchaseRequest {
    /// The environment the purchase is verified in.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub parent: String,
    /// Who bought it.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub subject: Option<Subject>,
    /// `app_store` or `google_play`.
    ///
    /// Field behavior: `required`.
    #[serde(default, skip_serializing_if = "crate::runtime::is_default")]
    pub store: String,
    /// App Store: the StoreKit 2 signed transaction (`jwsRepresentation`).
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "signedTransaction"
    )]
    pub signed_transaction: String,
    /// Google Play: the purchase token.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "purchaseToken"
    )]
    pub purchase_token: String,
    /// Google Play: the store product id (for a subscription, its id).
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "productId"
    )]
    pub product_id: String,
    /// Google Play: the package name, when the connection covers several.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "packageName"
    )]
    pub package_name: String,
    /// App Store, instead of `signed_transaction`: the transaction id, for apps
    /// on original StoreKit whose receipts carry no signed transaction. Money
    /// reads the transaction from Apple with the connection's key; Apple's
    /// signed answer is the proof.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "transactionId"
    )]
    pub transaction_id: String,
    /// App Store, with `transaction_id`: the app's bundle id.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "bundleId"
    )]
    pub bundle_id: String,
}

/// The response of VerifyStorePurchase.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
#[non_exhaustive]
pub struct VerifyStorePurchaseResponse {
    /// The verified purchase.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        alias = "storePurchase"
    )]
    pub store_purchase: Option<StorePurchase>,
    /// A compact EdDSA JWS (`typ` `money-grant+jwt`) the app's server or client
    /// verifies offline against Money's published keys; it names the subject,
    /// the store product, the transaction, the quantity, and the catalog grants.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "grantToken"
    )]
    pub grant_token: String,
    /// Whether this transaction was verified before; the record and grant are
    /// the same.
    #[serde(
        default,
        skip_serializing_if = "crate::runtime::is_default",
        alias = "alreadyVerified"
    )]
    pub already_verified: bool,
    /// The subscription, for a subscription purchase.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        alias = "customerSubscription"
    )]
    pub customer_subscription: Option<CustomerSubscription>,
}

/// FeatureKind is how a feature is granted.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum FeatureKind {
    /// On or off.
    Boolean,
    /// A numeric allowance per period.
    Limit,
    /// A value this SDK version does not know.
    Unknown(String),
}

impl FeatureKind {
    /// The wire string.
    pub fn as_str(&self) -> &str {
        match self {
            Self::Boolean => "boolean",
            Self::Limit => "limit",
            Self::Unknown(s) => s.as_str(),
        }
    }

    /// Parses a wire string; unknown values are kept.
    pub fn from_wire(s: &str) -> Self {
        match s {
            "boolean" => Self::Boolean,
            "limit" => Self::Limit,
            other => Self::Unknown(other.to_string()),
        }
    }
}

impl serde::Serialize for FeatureKind {
    fn serialize<S: serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
        s.serialize_str(self.as_str())
    }
}

impl<'de> serde::Deserialize<'de> for FeatureKind {
    fn deserialize<D: serde::Deserializer<'de>>(d: D) -> Result<Self, D::Error> {
        let s = <String as serde::Deserialize>::deserialize(d)?;
        Ok(Self::from_wire(&s))
    }
}

impl crate::runtime::QueryValue for FeatureKind {
    fn query_value(&self) -> Option<String> {
        Some(self.as_str().to_string())
    }
}

/// LicenceTermUnit is the unit of a licence term.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum LicenceTermUnit {
    /// Calendar years (twelve calendar months each).
    CalendarYears,
    /// Calendar months.
    CalendarMonths,
    /// Exact days of 86 400 000 ms.
    Days,
    /// A value this SDK version does not know.
    Unknown(String),
}

impl LicenceTermUnit {
    /// The wire string.
    pub fn as_str(&self) -> &str {
        match self {
            Self::CalendarYears => "calendar_years",
            Self::CalendarMonths => "calendar_months",
            Self::Days => "days",
            Self::Unknown(s) => s.as_str(),
        }
    }

    /// Parses a wire string; unknown values are kept.
    pub fn from_wire(s: &str) -> Self {
        match s {
            "calendar_years" => Self::CalendarYears,
            "calendar_months" => Self::CalendarMonths,
            "days" => Self::Days,
            other => Self::Unknown(other.to_string()),
        }
    }
}

impl serde::Serialize for LicenceTermUnit {
    fn serialize<S: serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
        s.serialize_str(self.as_str())
    }
}

impl<'de> serde::Deserialize<'de> for LicenceTermUnit {
    fn deserialize<D: serde::Deserializer<'de>>(d: D) -> Result<Self, D::Error> {
        let s = <String as serde::Deserialize>::deserialize(d)?;
        Ok(Self::from_wire(&s))
    }
}

impl crate::runtime::QueryValue for LicenceTermUnit {
    fn query_value(&self) -> Option<String> {
        Some(self.as_str().to_string())
    }
}

/// ProrationBehavior is how a subscription change is billed for the rest of
/// the current period.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum ProrationBehavior {
    /// Prorate the change onto the next invoice: an increase adds a charge and a
    /// decrease adds a credit.
    CreateProrations,
    /// No proration: the new quantity bills from the next period.
    None,
    /// Prorate and invoice the difference at once.
    AlwaysInvoice,
    /// A value this SDK version does not know.
    Unknown(String),
}

impl ProrationBehavior {
    /// The wire string.
    pub fn as_str(&self) -> &str {
        match self {
            Self::CreateProrations => "create_prorations",
            Self::None => "none",
            Self::AlwaysInvoice => "always_invoice",
            Self::Unknown(s) => s.as_str(),
        }
    }

    /// Parses a wire string; unknown values are kept.
    pub fn from_wire(s: &str) -> Self {
        match s {
            "create_prorations" => Self::CreateProrations,
            "none" => Self::None,
            "always_invoice" => Self::AlwaysInvoice,
            other => Self::Unknown(other.to_string()),
        }
    }
}

impl serde::Serialize for ProrationBehavior {
    fn serialize<S: serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
        s.serialize_str(self.as_str())
    }
}

impl<'de> serde::Deserialize<'de> for ProrationBehavior {
    fn deserialize<D: serde::Deserializer<'de>>(d: D) -> Result<Self, D::Error> {
        let s = <String as serde::Deserialize>::deserialize(d)?;
        Ok(Self::from_wire(&s))
    }
}

impl crate::runtime::QueryValue for ProrationBehavior {
    fn query_value(&self) -> Option<String> {
        Some(self.as_str().to_string())
    }
}

impl<T: crate::runtime::Transport> crate::runtime::Client<T> {
    /// Sylphx Money (`preview`).
    pub fn money(&self) -> MoneyApi<'_, T> {
        MoneyApi { client: self }
    }
}

/// MoneyService is Sylphx Money's customer payments: an app sells to its own
/// users through the stores and processors Money integrates once, and asks one
/// question on its request path, "does this subject have this feature"
/// (docs/services/money/customer-payments.md).
///
/// Namespace of Sylphx Money on the client.
pub struct MoneyApi<'a, T> {
    client: &'a crate::runtime::Client<T>,
}

impl<'a, T: crate::runtime::Transport> MoneyApi<'a, T> {
    /// The `price_catalogs` collection.
    pub fn price_catalogs(&self) -> PriceCatalogsCollection<'a, T> {
        PriceCatalogsCollection {
            client: self.client,
        }
    }

    /// The `store_connections` collection.
    pub fn store_connections(&self) -> StoreConnectionsCollection<'a, T> {
        StoreConnectionsCollection {
            client: self.client,
        }
    }

    /// The `store_purchases` collection.
    pub fn store_purchases(&self) -> StorePurchasesCollection<'a, T> {
        StorePurchasesCollection {
            client: self.client,
        }
    }

    /// The `customer_subscriptions` collection.
    pub fn customer_subscriptions(&self) -> CustomerSubscriptionsCollection<'a, T> {
        CustomerSubscriptionsCollection {
            client: self.client,
        }
    }

    /// The `entitlement_grants` collection.
    pub fn entitlement_grants(&self) -> EntitlementGrantsCollection<'a, T> {
        EntitlementGrantsCollection {
            client: self.client,
        }
    }

    /// The `merchant_accounts` collection.
    pub fn merchant_accounts(&self) -> MerchantAccountsCollection<'a, T> {
        MerchantAccountsCollection {
            client: self.client,
        }
    }

    /// The `checkout_sessions` collection.
    pub fn checkout_sessions(&self) -> CheckoutSessionsCollection<'a, T> {
        CheckoutSessionsCollection {
            client: self.client,
        }
    }

    /// The `portal_sessions` collection.
    pub fn portal_sessions(&self) -> PortalSessionsCollection<'a, T> {
        PortalSessionsCollection {
            client: self.client,
        }
    }

    /// The `licence_keys` collection.
    pub fn licence_keys(&self) -> LicenceKeysCollection<'a, T> {
        LicenceKeysCollection {
            client: self.client,
        }
    }

    /// The `licence_tokens` collection.
    pub fn licence_tokens(&self) -> LicenceTokensCollection<'a, T> {
        LicenceTokensCollection {
            client: self.client,
        }
    }
}

/// `price_catalogs` of Sylphx Money: Resource type `money.sylphx.com/PriceCatalog`.
pub struct PriceCatalogsCollection<'a, T> {
    client: &'a crate::runtime::Client<T>,
}

impl<'a, T: crate::runtime::Transport> PriceCatalogsCollection<'a, T> {
    /// Gets the environment's catalog.
    ///
    /// `GET /v1/{name=orgs/*/projects/*/envs/*/price_catalogs/*}` · permission `billing:read` · effect `read`
    ///
    /// Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`.
    pub async fn get(&self, request: GetCatalogRequest) -> Result<Catalog, crate::runtime::Error> {
        let path = format!(
            "/v1/{}",
            crate::runtime::path_param(
                &request.name,
                "orgs/*/projects/*/envs/*/price_catalogs/*",
                "name"
            )?
        );
        let query = crate::runtime::Query::default();
        let http = crate::runtime::HttpRequest {
            method: "GET",
            path,
            query: query.0,
            body: None,
            mutation: false,
            origin: None,
            effect_ids: false,
        };
        self.client.call(http).await
    }

    /// Updates the environment's catalog: its features and products, whole.
    ///
    /// `PATCH /v1/{catalog.name=orgs/*/projects/*/envs/*/price_catalogs/*}` · permission `billing:write` · effect `write`
    ///
    /// Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `UNKNOWN_FIELD`, `INVALID_FIELD`, `ETAG_MISMATCH`, `IDEMPOTENCY_KEY_REUSED`, `IDEMPOTENCY_IN_PROGRESS`.
    pub async fn update(
        &self,
        request: UpdateCatalogRequest,
    ) -> Result<Catalog, crate::runtime::Error> {
        let path = format!(
            "/v1/{}",
            crate::runtime::path_param(
                request
                    .catalog
                    .as_ref()
                    .map(|v| v.name.as_str())
                    .unwrap_or(""),
                "orgs/*/projects/*/envs/*/price_catalogs/*",
                "catalog.name"
            )?
        );
        let mut query = crate::runtime::Query::default();
        query.push("update_mask", &request.update_mask);
        query.push("allow_missing", &request.allow_missing);
        query.push("validate_only", &request.validate_only);
        let http = crate::runtime::HttpRequest {
            method: "PATCH",
            path,
            query: query.0,
            body: Some(crate::runtime::body(&request.catalog)?),
            mutation: true,
            origin: None,
            effect_ids: false,
        };
        self.client.call(http).await
    }

    /// Pushes the catalog to the merchant account's processor now: products and
    /// prices by lookup key; an amount change makes a new price.
    ///
    /// `POST /v1/{name=orgs/*/projects/*/envs/*/price_catalogs/*}:sync` · permission `billing:write` · effect `write`
    ///
    /// Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`, `INVALID_STATE`, `UNAVAILABLE`.
    pub async fn sync(
        &self,
        request: SyncCatalogRequest,
    ) -> Result<Catalog, crate::runtime::Error> {
        let path = format!(
            "/v1/{}:sync",
            crate::runtime::path_param(
                &request.name,
                "orgs/*/projects/*/envs/*/price_catalogs/*",
                "name"
            )?
        );
        let query = crate::runtime::Query::default();
        let http = crate::runtime::HttpRequest {
            method: "POST",
            path,
            query: query.0,
            body: Some(crate::runtime::body_without(&request, &["name"])?),
            mutation: true,
            origin: None,
            effect_ids: false,
        };
        self.client.call(http).await
    }
}

/// `store_connections` of Sylphx Money: Resource type `money.sylphx.com/StoreConnection`.
pub struct StoreConnectionsCollection<'a, T> {
    client: &'a crate::runtime::Client<T>,
}

impl<'a, T: crate::runtime::Transport> StoreConnectionsCollection<'a, T> {
    /// Gets a store connection.
    ///
    /// `GET /v1/{name=orgs/*/projects/*/envs/*/store_connections/*}` · permission `billing:read` · effect `read`
    ///
    /// Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`.
    pub async fn get(
        &self,
        request: GetStoreConnectionRequest,
    ) -> Result<StoreConnection, crate::runtime::Error> {
        let path = format!(
            "/v1/{}",
            crate::runtime::path_param(
                &request.name,
                "orgs/*/projects/*/envs/*/store_connections/*",
                "name"
            )?
        );
        let query = crate::runtime::Query::default();
        let http = crate::runtime::HttpRequest {
            method: "GET",
            path,
            query: query.0,
            body: None,
            mutation: false,
            origin: None,
            effect_ids: false,
        };
        self.client.call(http).await
    }

    /// Lists store connections.
    ///
    /// `GET /v1/{parent=orgs/*/projects/*/envs/*}/store_connections` · permission `billing:read` · effect `read`
    ///
    /// Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `INVALID_FIELD`, `PAGE_TOKEN_MISMATCH`.
    pub async fn list(
        &self,
        request: ListStoreConnectionsRequest,
    ) -> Result<ListStoreConnectionsResponse, crate::runtime::Error> {
        let path = format!(
            "/v1/{}/store_connections",
            crate::runtime::path_param(&request.parent, "orgs/*/projects/*/envs/*", "parent")?
        );
        let mut query = crate::runtime::Query::default();
        query.push("page_size", &request.page_size);
        query.push("page_token", &request.page_token);
        query.push("filter", &request.filter);
        let http = crate::runtime::HttpRequest {
            method: "GET",
            path,
            query: query.0,
            body: None,
            mutation: false,
            origin: None,
            effect_ids: false,
        };
        self.client.call(http).await
    }

    /// Every page of [`Self::list`], collected.
    pub async fn list_all(
        &self,
        mut request: ListStoreConnectionsRequest,
    ) -> Result<Vec<StoreConnection>, crate::runtime::Error> {
        let mut items = Vec::new();
        loop {
            let page = self.list(request.clone()).await?;
            items.extend(page.store_connections);
            if page.next_page_token.is_empty() {
                return Ok(items);
            }
            request.page_token = page.next_page_token;
        }
    }

    /// Creates a store connection; its credential is sealed and never returned.
    ///
    /// `POST /v1/{parent=orgs/*/projects/*/envs/*}/store_connections` · permission `billing:write` · effect `write`
    ///
    /// Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `UNKNOWN_FIELD`, `INVALID_FIELD`, `RESOURCE_ALREADY_EXISTS`, `IDEMPOTENCY_KEY_REUSED`, `IDEMPOTENCY_IN_PROGRESS`.
    pub async fn create(
        &self,
        request: CreateStoreConnectionRequest,
    ) -> Result<StoreConnection, crate::runtime::Error> {
        let path = format!(
            "/v1/{}/store_connections",
            crate::runtime::path_param(&request.parent, "orgs/*/projects/*/envs/*", "parent")?
        );
        let mut query = crate::runtime::Query::default();
        query.push("store_connection_id", &request.store_connection_id);
        query.push("validate_only", &request.validate_only);
        let http = crate::runtime::HttpRequest {
            method: "POST",
            path,
            query: query.0,
            body: Some(crate::runtime::body(&request.store_connection)?),
            mutation: true,
            origin: None,
            effect_ids: false,
        };
        self.client.call(http).await
    }

    /// Updates a store connection; a new credential replaces the stored one.
    ///
    /// `PATCH /v1/{store_connection.name=orgs/*/projects/*/envs/*/store_connections/*}` · permission `billing:write` · effect `write`
    ///
    /// Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`, `UNKNOWN_FIELD`, `INVALID_FIELD`, `ETAG_MISMATCH`, `IDEMPOTENCY_KEY_REUSED`, `IDEMPOTENCY_IN_PROGRESS`.
    pub async fn update(
        &self,
        request: UpdateStoreConnectionRequest,
    ) -> Result<StoreConnection, crate::runtime::Error> {
        let path = format!(
            "/v1/{}",
            crate::runtime::path_param(
                request
                    .store_connection
                    .as_ref()
                    .map(|v| v.name.as_str())
                    .unwrap_or(""),
                "orgs/*/projects/*/envs/*/store_connections/*",
                "store_connection.name"
            )?
        );
        let mut query = crate::runtime::Query::default();
        query.push("update_mask", &request.update_mask);
        query.push("allow_missing", &request.allow_missing);
        query.push("validate_only", &request.validate_only);
        let http = crate::runtime::HttpRequest {
            method: "PATCH",
            path,
            query: query.0,
            body: Some(crate::runtime::body(&request.store_connection)?),
            mutation: true,
            origin: None,
            effect_ids: false,
        };
        self.client.call(http).await
    }

    /// Deletes a store connection and its sealed credential.
    ///
    /// `DELETE /v1/{name=orgs/*/projects/*/envs/*/store_connections/*}` · permission `billing:write` · effect `destructive`
    ///
    /// Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`, `ETAG_MISMATCH`, `IDEMPOTENCY_KEY_REUSED`, `IDEMPOTENCY_IN_PROGRESS`.
    pub async fn delete(
        &self,
        request: DeleteStoreConnectionRequest,
    ) -> Result<crate::runtime::Empty, crate::runtime::Error> {
        let path = format!(
            "/v1/{}",
            crate::runtime::path_param(
                &request.name,
                "orgs/*/projects/*/envs/*/store_connections/*",
                "name"
            )?
        );
        let mut query = crate::runtime::Query::default();
        query.push("etag", &request.etag);
        let http = crate::runtime::HttpRequest {
            method: "DELETE",
            path,
            query: query.0,
            body: None,
            mutation: true,
            origin: None,
            effect_ids: false,
        };
        self.client.call(http).await
    }
}

/// `store_purchases` of Sylphx Money: Resource type `money.sylphx.com/StorePurchase`.
pub struct StorePurchasesCollection<'a, T> {
    client: &'a crate::runtime::Client<T>,
}

impl<'a, T: crate::runtime::Transport> StorePurchasesCollection<'a, T> {
    /// Verifies a store purchase with the store, binds it to the subject, and
    /// returns its record and a signed grant. Re-verifying returns the same
    /// record and grant. Called from the app's server with a secret key that
    /// holds `billing:write`; a publishable key cannot call it.
    ///
    /// `POST /v1/{parent=orgs/*/projects/*/envs/*}/store_purchases:verify` · permission `billing:write` · effect `write`
    ///
    /// Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `INVALID_FIELD`, `INVALID_STATE`, `RESOURCE_IN_USE`, `UNAVAILABLE`.
    pub async fn verify(
        &self,
        request: VerifyStorePurchaseRequest,
    ) -> Result<VerifyStorePurchaseResponse, crate::runtime::Error> {
        let path = format!(
            "/v1/{}/store_purchases:verify",
            crate::runtime::path_param(&request.parent, "orgs/*/projects/*/envs/*", "parent")?
        );
        let query = crate::runtime::Query::default();
        let http = crate::runtime::HttpRequest {
            method: "POST",
            path,
            query: query.0,
            body: Some(crate::runtime::body_without(&request, &["parent"])?),
            mutation: true,
            origin: None,
            effect_ids: false,
        };
        self.client.call(http).await
    }

    /// Gets a store purchase.
    ///
    /// `GET /v1/{name=orgs/*/projects/*/envs/*/store_purchases/*}` · permission `billing:read` · effect `read`
    ///
    /// Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`.
    pub async fn get(
        &self,
        request: GetStorePurchaseRequest,
    ) -> Result<StorePurchase, crate::runtime::Error> {
        let path = format!(
            "/v1/{}",
            crate::runtime::path_param(
                &request.name,
                "orgs/*/projects/*/envs/*/store_purchases/*",
                "name"
            )?
        );
        let query = crate::runtime::Query::default();
        let http = crate::runtime::HttpRequest {
            method: "GET",
            path,
            query: query.0,
            body: None,
            mutation: false,
            origin: None,
            effect_ids: false,
        };
        self.client.call(http).await
    }

    /// Lists store purchases, newest first.
    ///
    /// `GET /v1/{parent=orgs/*/projects/*/envs/*}/store_purchases` · permission `billing:read` · effect `read`
    ///
    /// Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `INVALID_FIELD`, `PAGE_TOKEN_MISMATCH`.
    pub async fn list(
        &self,
        request: ListStorePurchasesRequest,
    ) -> Result<ListStorePurchasesResponse, crate::runtime::Error> {
        let path = format!(
            "/v1/{}/store_purchases",
            crate::runtime::path_param(&request.parent, "orgs/*/projects/*/envs/*", "parent")?
        );
        let mut query = crate::runtime::Query::default();
        query.push("page_size", &request.page_size);
        query.push("page_token", &request.page_token);
        query.push("filter", &request.filter);
        let http = crate::runtime::HttpRequest {
            method: "GET",
            path,
            query: query.0,
            body: None,
            mutation: false,
            origin: None,
            effect_ids: false,
        };
        self.client.call(http).await
    }

    /// Every page of [`Self::list`], collected.
    pub async fn list_all(
        &self,
        mut request: ListStorePurchasesRequest,
    ) -> Result<Vec<StorePurchase>, crate::runtime::Error> {
        let mut items = Vec::new();
        loop {
            let page = self.list(request.clone()).await?;
            items.extend(page.store_purchases);
            if page.next_page_token.is_empty() {
                return Ok(items);
            }
            request.page_token = page.next_page_token;
        }
    }
}

/// `customer_subscriptions` of Sylphx Money: Resource type `money.sylphx.com/CustomerSubscription`.
pub struct CustomerSubscriptionsCollection<'a, T> {
    client: &'a crate::runtime::Client<T>,
}

impl<'a, T: crate::runtime::Transport> CustomerSubscriptionsCollection<'a, T> {
    /// Gets a customer subscription.
    ///
    /// `GET /v1/{name=orgs/*/projects/*/envs/*/customer_subscriptions/*}` · permission `billing:read` · effect `read`
    ///
    /// Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`.
    pub async fn get(
        &self,
        request: GetCustomerSubscriptionRequest,
    ) -> Result<CustomerSubscription, crate::runtime::Error> {
        let path = format!(
            "/v1/{}",
            crate::runtime::path_param(
                &request.name,
                "orgs/*/projects/*/envs/*/customer_subscriptions/*",
                "name"
            )?
        );
        let query = crate::runtime::Query::default();
        let http = crate::runtime::HttpRequest {
            method: "GET",
            path,
            query: query.0,
            body: None,
            mutation: false,
            origin: None,
            effect_ids: false,
        };
        self.client.call(http).await
    }

    /// Lists customer subscriptions, newest first.
    ///
    /// `GET /v1/{parent=orgs/*/projects/*/envs/*}/customer_subscriptions` · permission `billing:read` · effect `read`
    ///
    /// Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `INVALID_FIELD`, `PAGE_TOKEN_MISMATCH`.
    pub async fn list(
        &self,
        request: ListCustomerSubscriptionsRequest,
    ) -> Result<ListCustomerSubscriptionsResponse, crate::runtime::Error> {
        let path = format!(
            "/v1/{}/customer_subscriptions",
            crate::runtime::path_param(&request.parent, "orgs/*/projects/*/envs/*", "parent")?
        );
        let mut query = crate::runtime::Query::default();
        query.push("page_size", &request.page_size);
        query.push("page_token", &request.page_token);
        query.push("filter", &request.filter);
        let http = crate::runtime::HttpRequest {
            method: "GET",
            path,
            query: query.0,
            body: None,
            mutation: false,
            origin: None,
            effect_ids: false,
        };
        self.client.call(http).await
    }

    /// Every page of [`Self::list`], collected.
    pub async fn list_all(
        &self,
        mut request: ListCustomerSubscriptionsRequest,
    ) -> Result<Vec<CustomerSubscription>, crate::runtime::Error> {
        let mut items = Vec::new();
        loop {
            let page = self.list(request.clone()).await?;
            items.extend(page.customer_subscriptions);
            if page.next_page_token.is_empty() {
                return Ok(items);
            }
            request.page_token = page.next_page_token;
        }
    }

    /// Cancels a web subscription, now or at the period end, and optionally
    /// refunds its last payment (for example a statutory cancellation window).
    ///
    /// `POST /v1/{name=orgs/*/projects/*/envs/*/customer_subscriptions/*}:cancel` · permission `billing:write` · effect `destructive`
    ///
    /// Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`, `INVALID_STATE`, `UNAVAILABLE`.
    pub async fn cancel(
        &self,
        request: CancelCustomerSubscriptionRequest,
    ) -> Result<CustomerSubscription, crate::runtime::Error> {
        let path = format!(
            "/v1/{}:cancel",
            crate::runtime::path_param(
                &request.name,
                "orgs/*/projects/*/envs/*/customer_subscriptions/*",
                "name"
            )?
        );
        let query = crate::runtime::Query::default();
        let http = crate::runtime::HttpRequest {
            method: "POST",
            path,
            query: query.0,
            body: Some(crate::runtime::body_without(&request, &["name"])?),
            mutation: true,
            origin: None,
            effect_ids: false,
        };
        self.client.call(http).await
    }

    /// Resumes a web subscription set to cancel at its period end.
    ///
    /// `POST /v1/{name=orgs/*/projects/*/envs/*/customer_subscriptions/*}:resume` · permission `billing:write` · effect `write`
    ///
    /// Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`, `INVALID_STATE`, `UNAVAILABLE`.
    pub async fn resume(
        &self,
        request: ResumeCustomerSubscriptionRequest,
    ) -> Result<CustomerSubscription, crate::runtime::Error> {
        let path = format!(
            "/v1/{}:resume",
            crate::runtime::path_param(
                &request.name,
                "orgs/*/projects/*/envs/*/customer_subscriptions/*",
                "name"
            )?
        );
        let query = crate::runtime::Query::default();
        let http = crate::runtime::HttpRequest {
            method: "POST",
            path,
            query: query.0,
            body: Some(crate::runtime::body_without(&request, &["name"])?),
            mutation: true,
            origin: None,
            effect_ids: false,
        };
        self.client.call(http).await
    }

    /// Changes the seat quantity of a web subscription, now, and syncs the
    /// processor's subscription item to it. A retry with the same
    /// `Idempotency-Key` (required) and the same request changes nothing twice.
    ///
    /// `POST /v1/{name=orgs/*/projects/*/envs/*/customer_subscriptions/*}:updateQuantity` · permission `billing:write` · effect `write`
    ///
    /// Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`, `INVALID_FIELD`, `INVALID_STATE`, `IDEMPOTENCY_KEY_REUSED`, `IDEMPOTENCY_IN_PROGRESS`, `UNAVAILABLE`.
    pub async fn update_quantity(
        &self,
        request: UpdateCustomerSubscriptionQuantityRequest,
    ) -> Result<CustomerSubscription, crate::runtime::Error> {
        let path = format!(
            "/v1/{}:updateQuantity",
            crate::runtime::path_param(
                &request.name,
                "orgs/*/projects/*/envs/*/customer_subscriptions/*",
                "name"
            )?
        );
        let query = crate::runtime::Query::default();
        let http = crate::runtime::HttpRequest {
            method: "POST",
            path,
            query: query.0,
            body: Some(crate::runtime::body_without(&request, &["name"])?),
            mutation: true,
            origin: None,
            effect_ids: false,
        };
        self.client.call(http).await
    }

    /// Move a web subscription onto another recurring catalog plan.
    ///
    /// Stripe changes the subscription's one item and bills the difference as
    /// `proration_behavior` says; Money reads the subscription back and replaces
    /// its entitlements from it. Needs an `Idempotency-Key` unless `validate_only`.
    /// A store subscription is refused (`store_managed`): the store owns it.
    ///
    /// `POST /v1/{name=orgs/*/projects/*/envs/*/customer_subscriptions/*}:changePlan` · permission `billing:write` · effect `write`
    ///
    /// Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`, `INVALID_FIELD`, `INVALID_STATE`, `IDEMPOTENCY_KEY_REUSED`, `IDEMPOTENCY_IN_PROGRESS`, `UNAVAILABLE`.
    pub async fn change_plan(
        &self,
        request: ChangeCustomerSubscriptionPlanRequest,
    ) -> Result<CustomerSubscription, crate::runtime::Error> {
        let path = format!(
            "/v1/{}:changePlan",
            crate::runtime::path_param(
                &request.name,
                "orgs/*/projects/*/envs/*/customer_subscriptions/*",
                "name"
            )?
        );
        let query = crate::runtime::Query::default();
        let http = crate::runtime::HttpRequest {
            method: "POST",
            path,
            query: query.0,
            body: Some(crate::runtime::body_without(&request, &["name"])?),
            mutation: true,
            origin: None,
            effect_ids: false,
        };
        self.client.call(http).await
    }
}

/// `entitlement_grants` of Sylphx Money: Resource type `money.sylphx.com/EntitlementGrant`.
pub struct EntitlementGrantsCollection<'a, T> {
    client: &'a crate::runtime::Client<T>,
}

impl<'a, T: crate::runtime::Transport> EntitlementGrantsCollection<'a, T> {
    /// Gets an entitlement grant.
    ///
    /// `GET /v1/{name=orgs/*/projects/*/envs/*/entitlement_grants/*}` · permission `billing:read` · effect `read`
    ///
    /// Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`.
    pub async fn get(
        &self,
        request: GetEntitlementGrantRequest,
    ) -> Result<EntitlementGrant, crate::runtime::Error> {
        let path = format!(
            "/v1/{}",
            crate::runtime::path_param(
                &request.name,
                "orgs/*/projects/*/envs/*/entitlement_grants/*",
                "name"
            )?
        );
        let query = crate::runtime::Query::default();
        let http = crate::runtime::HttpRequest {
            method: "GET",
            path,
            query: query.0,
            body: None,
            mutation: false,
            origin: None,
            effect_ids: false,
        };
        self.client.call(http).await
    }

    /// Lists entitlement grants.
    ///
    /// `GET /v1/{parent=orgs/*/projects/*/envs/*}/entitlement_grants` · permission `billing:read` · effect `read`
    ///
    /// Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `INVALID_FIELD`, `PAGE_TOKEN_MISMATCH`.
    pub async fn list(
        &self,
        request: ListEntitlementGrantsRequest,
    ) -> Result<ListEntitlementGrantsResponse, crate::runtime::Error> {
        let path = format!(
            "/v1/{}/entitlement_grants",
            crate::runtime::path_param(&request.parent, "orgs/*/projects/*/envs/*", "parent")?
        );
        let mut query = crate::runtime::Query::default();
        query.push("page_size", &request.page_size);
        query.push("page_token", &request.page_token);
        query.push("filter", &request.filter);
        let http = crate::runtime::HttpRequest {
            method: "GET",
            path,
            query: query.0,
            body: None,
            mutation: false,
            origin: None,
            effect_ids: false,
        };
        self.client.call(http).await
    }

    /// Every page of [`Self::list`], collected.
    pub async fn list_all(
        &self,
        mut request: ListEntitlementGrantsRequest,
    ) -> Result<Vec<EntitlementGrant>, crate::runtime::Error> {
        let mut items = Vec::new();
        loop {
            let page = self.list(request.clone()).await?;
            items.extend(page.entitlement_grants);
            if page.next_page_token.is_empty() {
                return Ok(items);
            }
            request.page_token = page.next_page_token;
        }
    }

    /// Answers whether a subject holds a feature now, and how much of it.
    ///
    /// `POST /v1/{parent=orgs/*/projects/*/envs/*}/entitlement_grants:check` · permission `billing:read` · effect `read`
    ///
    /// Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `INVALID_FIELD`.
    pub async fn check(
        &self,
        request: CheckEntitlementRequest,
    ) -> Result<CheckEntitlementResponse, crate::runtime::Error> {
        let path = format!(
            "/v1/{}/entitlement_grants:check",
            crate::runtime::path_param(&request.parent, "orgs/*/projects/*/envs/*", "parent")?
        );
        let query = crate::runtime::Query::default();
        let http = crate::runtime::HttpRequest {
            method: "POST",
            path,
            query: query.0,
            body: Some(crate::runtime::body_without(&request, &["parent"])?),
            mutation: true,
            origin: None,
            effect_ids: false,
        };
        self.client.call(http).await
    }
}

/// `merchant_accounts` of Sylphx Money: Resource type `money.sylphx.com/MerchantAccount`.
pub struct MerchantAccountsCollection<'a, T> {
    client: &'a crate::runtime::Client<T>,
}

impl<'a, T: crate::runtime::Transport> MerchantAccountsCollection<'a, T> {
    /// Gets a merchant account.
    ///
    /// `GET /v1/{name=orgs/*/projects/*/envs/*/merchant_accounts/*}` · permission `billing:read` · effect `read`
    ///
    /// Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`.
    pub async fn get(
        &self,
        request: GetMerchantAccountRequest,
    ) -> Result<MerchantAccount, crate::runtime::Error> {
        let path = format!(
            "/v1/{}",
            crate::runtime::path_param(
                &request.name,
                "orgs/*/projects/*/envs/*/merchant_accounts/*",
                "name"
            )?
        );
        let query = crate::runtime::Query::default();
        let http = crate::runtime::HttpRequest {
            method: "GET",
            path,
            query: query.0,
            body: None,
            mutation: false,
            origin: None,
            effect_ids: false,
        };
        self.client.call(http).await
    }

    /// Lists merchant accounts.
    ///
    /// `GET /v1/{parent=orgs/*/projects/*/envs/*}/merchant_accounts` · permission `billing:read` · effect `read`
    ///
    /// Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `INVALID_FIELD`, `PAGE_TOKEN_MISMATCH`.
    pub async fn list(
        &self,
        request: ListMerchantAccountsRequest,
    ) -> Result<ListMerchantAccountsResponse, crate::runtime::Error> {
        let path = format!(
            "/v1/{}/merchant_accounts",
            crate::runtime::path_param(&request.parent, "orgs/*/projects/*/envs/*", "parent")?
        );
        let mut query = crate::runtime::Query::default();
        query.push("page_size", &request.page_size);
        query.push("page_token", &request.page_token);
        let http = crate::runtime::HttpRequest {
            method: "GET",
            path,
            query: query.0,
            body: None,
            mutation: false,
            origin: None,
            effect_ids: false,
        };
        self.client.call(http).await
    }

    /// Every page of [`Self::list`], collected.
    pub async fn list_all(
        &self,
        mut request: ListMerchantAccountsRequest,
    ) -> Result<Vec<MerchantAccount>, crate::runtime::Error> {
        let mut items = Vec::new();
        loop {
            let page = self.list(request.clone()).await?;
            items.extend(page.merchant_accounts);
            if page.next_page_token.is_empty() {
                return Ok(items);
            }
            request.page_token = page.next_page_token;
        }
    }

    /// Starts connecting a Stripe account: returns the processor's authorisation
    /// URL for an org owner to open, which the processor's redirect completes.
    /// With a restricted key in the request the account connects at once
    /// instead, and the connected merchant account comes back in the response.
    ///
    /// `POST /v1/{parent=orgs/*/projects/*/envs/*}/merchant_accounts:connect` · permission `billing:write` · effect `write`
    ///
    /// Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `INVALID_FIELD`, `UNAVAILABLE`.
    pub async fn connect(
        &self,
        request: ConnectMerchantAccountRequest,
    ) -> Result<ConnectMerchantAccountResponse, crate::runtime::Error> {
        let path = format!(
            "/v1/{}/merchant_accounts:connect",
            crate::runtime::path_param(&request.parent, "orgs/*/projects/*/envs/*", "parent")?
        );
        let query = crate::runtime::Query::default();
        let http = crate::runtime::HttpRequest {
            method: "POST",
            path,
            query: query.0,
            body: Some(crate::runtime::body_without(&request, &["parent"])?),
            mutation: true,
            origin: None,
            effect_ids: false,
        };
        self.client.call(http).await
    }

    /// Reads the connected account back from the processor.
    ///
    /// `POST /v1/{name=orgs/*/projects/*/envs/*/merchant_accounts/*}:refresh` · permission `billing:write` · effect `write`
    ///
    /// Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`, `UNAVAILABLE`.
    pub async fn refresh(
        &self,
        request: RefreshMerchantAccountRequest,
    ) -> Result<MerchantAccount, crate::runtime::Error> {
        let path = format!(
            "/v1/{}:refresh",
            crate::runtime::path_param(
                &request.name,
                "orgs/*/projects/*/envs/*/merchant_accounts/*",
                "name"
            )?
        );
        let query = crate::runtime::Query::default();
        let http = crate::runtime::HttpRequest {
            method: "POST",
            path,
            query: query.0,
            body: Some(crate::runtime::body_without(&request, &["name"])?),
            mutation: true,
            origin: None,
            effect_ids: false,
        };
        self.client.call(http).await
    }

    /// Disconnects the account: Sylphx loses access; checkout is refused.
    ///
    /// `POST /v1/{name=orgs/*/projects/*/envs/*/merchant_accounts/*}:disconnect` · permission `billing:write` · effect `destructive`
    ///
    /// Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`, `UNAVAILABLE`.
    pub async fn disconnect(
        &self,
        request: DisconnectMerchantAccountRequest,
    ) -> Result<MerchantAccount, crate::runtime::Error> {
        let path = format!(
            "/v1/{}:disconnect",
            crate::runtime::path_param(
                &request.name,
                "orgs/*/projects/*/envs/*/merchant_accounts/*",
                "name"
            )?
        );
        let query = crate::runtime::Query::default();
        let http = crate::runtime::HttpRequest {
            method: "POST",
            path,
            query: query.0,
            body: Some(crate::runtime::body_without(&request, &["name"])?),
            mutation: true,
            origin: None,
            effect_ids: false,
        };
        self.client.call(http).await
    }
}

/// `checkout_sessions` of Sylphx Money: Resource type `money.sylphx.com/CheckoutSession`.
pub struct CheckoutSessionsCollection<'a, T> {
    client: &'a crate::runtime::Client<T>,
}

impl<'a, T: crate::runtime::Transport> CheckoutSessionsCollection<'a, T> {
    /// Creates a hosted checkout for a subject.
    ///
    /// `POST /v1/{parent=orgs/*/projects/*/envs/*}/checkout_sessions` · permission `billing:write` · effect `write`
    ///
    /// Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `UNKNOWN_FIELD`, `INVALID_FIELD`, `INVALID_STATE`, `UNAVAILABLE`, `IDEMPOTENCY_KEY_REUSED`, `IDEMPOTENCY_IN_PROGRESS`.
    pub async fn create(
        &self,
        request: CreateCheckoutSessionRequest,
    ) -> Result<CheckoutSession, crate::runtime::Error> {
        let path = format!(
            "/v1/{}/checkout_sessions",
            crate::runtime::path_param(&request.parent, "orgs/*/projects/*/envs/*", "parent")?
        );
        let mut query = crate::runtime::Query::default();
        query.push("checkout_session_id", &request.checkout_session_id);
        let http = crate::runtime::HttpRequest {
            method: "POST",
            path,
            query: query.0,
            body: Some(crate::runtime::body(&request.checkout_session)?),
            mutation: true,
            origin: None,
            effect_ids: false,
        };
        self.client.call(http).await
    }

    /// Gets a checkout session.
    ///
    /// `GET /v1/{name=orgs/*/projects/*/envs/*/checkout_sessions/*}` · permission `billing:read` · effect `read`
    ///
    /// Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`.
    pub async fn get(
        &self,
        request: GetCheckoutSessionRequest,
    ) -> Result<CheckoutSession, crate::runtime::Error> {
        let path = format!(
            "/v1/{}",
            crate::runtime::path_param(
                &request.name,
                "orgs/*/projects/*/envs/*/checkout_sessions/*",
                "name"
            )?
        );
        let query = crate::runtime::Query::default();
        let http = crate::runtime::HttpRequest {
            method: "GET",
            path,
            query: query.0,
            body: None,
            mutation: false,
            origin: None,
            effect_ids: false,
        };
        self.client.call(http).await
    }
}

/// `portal_sessions` of Sylphx Money: Resource type `money.sylphx.com/PortalSession`.
pub struct PortalSessionsCollection<'a, T> {
    client: &'a crate::runtime::Client<T>,
}

impl<'a, T: crate::runtime::Transport> PortalSessionsCollection<'a, T> {
    /// Creates a customer portal session for a subject.
    ///
    /// `POST /v1/{parent=orgs/*/projects/*/envs/*}/portal_sessions` · permission `billing:write` · effect `write`
    ///
    /// Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `UNKNOWN_FIELD`, `INVALID_FIELD`, `INVALID_STATE`, `UNAVAILABLE`, `IDEMPOTENCY_KEY_REUSED`, `IDEMPOTENCY_IN_PROGRESS`.
    pub async fn create(
        &self,
        request: CreatePortalSessionRequest,
    ) -> Result<PortalSession, crate::runtime::Error> {
        let path = format!(
            "/v1/{}/portal_sessions",
            crate::runtime::path_param(&request.parent, "orgs/*/projects/*/envs/*", "parent")?
        );
        let mut query = crate::runtime::Query::default();
        query.push("portal_session_id", &request.portal_session_id);
        let http = crate::runtime::HttpRequest {
            method: "POST",
            path,
            query: query.0,
            body: Some(crate::runtime::body(&request.portal_session)?),
            mutation: true,
            origin: None,
            effect_ids: false,
        };
        self.client.call(http).await
    }

    /// Gets a portal session.
    ///
    /// `GET /v1/{name=orgs/*/projects/*/envs/*/portal_sessions/*}` · permission `billing:read` · effect `read`
    ///
    /// Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`.
    pub async fn get(
        &self,
        request: GetPortalSessionRequest,
    ) -> Result<PortalSession, crate::runtime::Error> {
        let path = format!(
            "/v1/{}",
            crate::runtime::path_param(
                &request.name,
                "orgs/*/projects/*/envs/*/portal_sessions/*",
                "name"
            )?
        );
        let query = crate::runtime::Query::default();
        let http = crate::runtime::HttpRequest {
            method: "GET",
            path,
            query: query.0,
            body: None,
            mutation: false,
            origin: None,
            effect_ids: false,
        };
        self.client.call(http).await
    }
}

/// `licence_keys` of Sylphx Money: Resource type `money.sylphx.com/LicenceKey`.
pub struct LicenceKeysCollection<'a, T> {
    client: &'a crate::runtime::Client<T>,
}

impl<'a, T: crate::runtime::Transport> LicenceKeysCollection<'a, T> {
    /// Generates a licence key: Money creates the Ed25519 key, seals it, and never
    /// returns the private half. Needs the approval-class scope, which the developer
    /// role does not hold.
    ///
    /// `POST /v1/{parent=orgs/*/projects/*/envs/*}/licence_keys:generate` · permission `billing:licence_keys.approve` · effect `write`
    ///
    /// Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `INVALID_FIELD`, `UNKNOWN_FIELD`, `RESOURCE_ALREADY_EXISTS`, `IDEMPOTENCY_KEY_REUSED`, `IDEMPOTENCY_IN_PROGRESS`.
    pub async fn generate(
        &self,
        request: GenerateLicenceKeyRequest,
    ) -> Result<LicenceKey, crate::runtime::Error> {
        let path = format!(
            "/v1/{}/licence_keys:generate",
            crate::runtime::path_param(&request.parent, "orgs/*/projects/*/envs/*", "parent")?
        );
        let query = crate::runtime::Query::default();
        let http = crate::runtime::HttpRequest {
            method: "POST",
            path,
            query: query.0,
            body: Some(crate::runtime::body_without(&request, &["parent"])?),
            mutation: true,
            origin: None,
            effect_ids: false,
        };
        self.client.call(http).await
    }

    /// Imports an existing Ed25519 key (PKCS8), for a key already pinned in shipped
    /// clients. Refused unless the expected public key is the imported key's public
    /// half.
    ///
    /// `POST /v1/{parent=orgs/*/projects/*/envs/*}/licence_keys:import` · permission `billing:licence_keys.approve` · effect `write`
    ///
    /// Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `INVALID_FIELD`, `UNKNOWN_FIELD`, `RESOURCE_ALREADY_EXISTS`, `IDEMPOTENCY_KEY_REUSED`, `IDEMPOTENCY_IN_PROGRESS`.
    pub async fn import(
        &self,
        request: ImportLicenceKeyRequest,
    ) -> Result<LicenceKey, crate::runtime::Error> {
        let path = format!(
            "/v1/{}/licence_keys:import",
            crate::runtime::path_param(&request.parent, "orgs/*/projects/*/envs/*", "parent")?
        );
        let query = crate::runtime::Query::default();
        let http = crate::runtime::HttpRequest {
            method: "POST",
            path,
            query: query.0,
            body: Some(crate::runtime::body_without(&request, &["parent"])?),
            mutation: true,
            origin: None,
            effect_ids: false,
        };
        self.client.call(http).await
    }

    /// Retires a licence key: it stops signing new terms and stays exported for
    /// verification.
    ///
    /// `POST /v1/{name=orgs/*/projects/*/envs/*/licence_keys/*}:retire` · permission `billing:licence_keys.approve` · effect `write`
    ///
    /// Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`, `IDEMPOTENCY_KEY_REUSED`, `IDEMPOTENCY_IN_PROGRESS`.
    pub async fn retire(
        &self,
        request: RetireLicenceKeyRequest,
    ) -> Result<LicenceKey, crate::runtime::Error> {
        let path = format!(
            "/v1/{}:retire",
            crate::runtime::path_param(
                &request.name,
                "orgs/*/projects/*/envs/*/licence_keys/*",
                "name"
            )?
        );
        let query = crate::runtime::Query::default();
        let http = crate::runtime::HttpRequest {
            method: "POST",
            path,
            query: query.0,
            body: Some(crate::runtime::body_without(&request, &["name"])?),
            mutation: true,
            origin: None,
            effect_ids: false,
        };
        self.client.call(http).await
    }

    /// Gets a licence key (its public half, never the private).
    ///
    /// `GET /v1/{name=orgs/*/projects/*/envs/*/licence_keys/*}` · permission `billing:read` · effect `read`
    ///
    /// Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`.
    pub async fn get(
        &self,
        request: GetLicenceKeyRequest,
    ) -> Result<LicenceKey, crate::runtime::Error> {
        let path = format!(
            "/v1/{}",
            crate::runtime::path_param(
                &request.name,
                "orgs/*/projects/*/envs/*/licence_keys/*",
                "name"
            )?
        );
        let query = crate::runtime::Query::default();
        let http = crate::runtime::HttpRequest {
            method: "GET",
            path,
            query: query.0,
            body: None,
            mutation: false,
            origin: None,
            effect_ids: false,
        };
        self.client.call(http).await
    }

    /// Lists licence keys, newest first.
    ///
    /// `GET /v1/{parent=orgs/*/projects/*/envs/*}/licence_keys` · permission `billing:read` · effect `read`
    ///
    /// Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `PAGE_TOKEN_MISMATCH`.
    pub async fn list(
        &self,
        request: ListLicenceKeysRequest,
    ) -> Result<ListLicenceKeysResponse, crate::runtime::Error> {
        let path = format!(
            "/v1/{}/licence_keys",
            crate::runtime::path_param(&request.parent, "orgs/*/projects/*/envs/*", "parent")?
        );
        let mut query = crate::runtime::Query::default();
        query.push("page_size", &request.page_size);
        query.push("page_token", &request.page_token);
        let http = crate::runtime::HttpRequest {
            method: "GET",
            path,
            query: query.0,
            body: None,
            mutation: false,
            origin: None,
            effect_ids: false,
        };
        self.client.call(http).await
    }

    /// Every page of [`Self::list`], collected.
    pub async fn list_all(
        &self,
        mut request: ListLicenceKeysRequest,
    ) -> Result<Vec<LicenceKey>, crate::runtime::Error> {
        let mut items = Vec::new();
        loop {
            let page = self.list(request.clone()).await?;
            items.extend(page.licence_keys);
            if page.next_page_token.is_empty() {
                return Ok(items);
            }
            request.page_token = page.next_page_token;
        }
    }
}

/// `licence_tokens` of Sylphx Money: Resource type `money.sylphx.com/LicenceToken`.
pub struct LicenceTokensCollection<'a, T> {
    client: &'a crate::runtime::Client<T>,
}

impl<'a, T: crate::runtime::Transport> LicenceTokensCollection<'a, T> {
    /// Lists a subject's unexpired offline licence tokens of paid orders, for
    /// support. Re-derived from the frozen terms: the same bytes as at purchase.
    ///
    /// `GET /v1/{parent=orgs/*/projects/*/envs/*}/licence_tokens` · permission `billing:read` · effect `read`
    ///
    /// Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `INVALID_FIELD`, `PAGE_TOKEN_MISMATCH`.
    pub async fn list(
        &self,
        request: ListLicenceTokensRequest,
    ) -> Result<ListLicenceTokensResponse, crate::runtime::Error> {
        let path = format!(
            "/v1/{}/licence_tokens",
            crate::runtime::path_param(&request.parent, "orgs/*/projects/*/envs/*", "parent")?
        );
        let mut query = crate::runtime::Query::default();
        query.push("page_size", &request.page_size);
        query.push("page_token", &request.page_token);
        query.push("filter", &request.filter);
        let http = crate::runtime::HttpRequest {
            method: "GET",
            path,
            query: query.0,
            body: None,
            mutation: false,
            origin: None,
            effect_ids: false,
        };
        self.client.call(http).await
    }

    /// Every page of [`Self::list`], collected.
    pub async fn list_all(
        &self,
        mut request: ListLicenceTokensRequest,
    ) -> Result<Vec<LicenceToken>, crate::runtime::Error> {
        let mut items = Vec::new();
        loop {
            let page = self.list(request.clone()).await?;
            items.extend(page.licence_tokens);
            if page.next_page_token.is_empty() {
                return Ok(items);
            }
            request.page_token = page.next_page_token;
        }
    }
}