late 0.0.1289

API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api Versioning and deprecation: all endpoints are versioned in the URL path (current version: /v1). Breaking changes only ship in a new path version; existing versions keep working. Deprecated operations are marked 'deprecated: true' in this spec and announced in the changelog (https://zernio.com/changelog) before removal. Errors: every 4xx/5xx response is application/json with a machine-readable 'code' and a human-readable 'error' message (see the ErrorResponse schema). Request ids: responses carry an X-Request-Id header with the id we log the request under. Quote it when reporting a problem. A valid x-request-id you send is reused as that id.
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
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
/*
 * Zernio API
 *
 * API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api  Versioning and deprecation: all endpoints are versioned in the URL path (current version: /v1). Breaking changes only ship in a new path version; existing versions keep working. Deprecated operations are marked 'deprecated: true' in this spec and announced in the changelog (https://zernio.com/changelog) before removal.  Errors: every 4xx/5xx response is application/json with a machine-readable 'code' and a human-readable 'error' message (see the ErrorResponse schema).  Request ids: responses carry an X-Request-Id header with the id we log the request under. Quote it when reporting a problem. A valid x-request-id you send is reused as that id.
 *
 * The version of the OpenAPI document: 1.415.0
 * Contact: support@zernio.com
 * Generated by: https://openapi-generator.tech
 */

use super::{configuration, ContentType, Error};
use crate::{apis::ResponseContent, models};
use reqwest;
use serde::{de::Error as _, Deserialize, Serialize};

/// struct for typed errors of method [`add_ad_keywords`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AddAdKeywordsError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(models::ErrorResponse),
    Status404(models::ErrorResponse),
    Status409(models::ErrorResponse),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`apply_google_recommendations`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ApplyGoogleRecommendationsError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(models::ErrorResponse),
    Status404(models::InlineObject1),
    Status422(),
    Status429(),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`attach_ad_group_assets`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AttachAdGroupAssetsError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(),
    Status404(models::ErrorResponse),
    Status409(models::ErrorResponse),
    Status429(),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`attach_campaign_assets`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AttachCampaignAssetsError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(),
    Status404(models::ErrorResponse),
    Status409(models::ErrorResponse),
    Status429(),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`boost_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum BoostPostError {
    Status400(),
    Status401(models::ErrorResponse),
    Status403(),
    Status404(models::ErrorResponse),
    Status409(),
    Status422(),
    Status429(models::ErrorResponse),
    Status503(models::ErrorResponse),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`bulk_update_ad_campaign_status`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum BulkUpdateAdCampaignStatusError {
    Status400(),
    Status401(models::ErrorResponse),
    Status403(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`create_ad_campaign`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateAdCampaignError {
    Status400(),
    Status401(models::ErrorResponse),
    Status403(models::ErrorResponse),
    Status404(models::ErrorResponse),
    Status409(models::ErrorResponse),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`create_ad_set`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateAdSetError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(),
    Status404(models::ErrorResponse),
    Status409(models::ErrorResponse),
    Status422(),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`create_bid_strategy`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateBidStrategyError {
    Status400(),
    Status401(models::ErrorResponse),
    Status403(models::ErrorResponse),
    Status404(models::ErrorResponse),
    Status409(models::ErrorResponse),
    Status422(),
    Status429(),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`create_google_asset_group`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateGoogleAssetGroupError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(models::ErrorResponse),
    Status404(models::InlineObject1),
    Status422(),
    Status429(),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`create_shared_budget`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateSharedBudgetError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(models::ErrorResponse),
    Status404(models::ErrorResponse),
    Status409(models::ErrorResponse),
    Status422(),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`create_standalone_ad`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateStandaloneAdError {
    Status400(),
    Status401(models::ErrorResponse),
    Status403(),
    Status404(models::ErrorResponse),
    Status409(models::ErrorResponse),
    Status422(),
    Status429(models::ErrorResponse),
    Status501(),
    Status502(),
    Status503(models::ErrorResponse),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`delete_ad`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeleteAdError {
    Status401(models::ErrorResponse),
    Status403(models::ErrorResponse),
    Status404(models::InlineObject1),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`delete_ad_campaign`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeleteAdCampaignError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(models::ErrorResponse),
    Status404(models::ErrorResponse),
    Status409(models::ErrorResponse),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`delete_ad_set`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeleteAdSetError {
    Status401(models::ErrorResponse),
    Status403(models::ErrorResponse),
    Status404(),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`dismiss_ads_alert`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DismissAdsAlertError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(),
    Status503(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`dismiss_google_recommendations`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DismissGoogleRecommendationsError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(models::ErrorResponse),
    Status404(models::InlineObject1),
    Status422(),
    Status429(),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`duplicate_ad`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DuplicateAdError {
    Status400(),
    Status401(models::ErrorResponse),
    Status403(),
    Status404(),
    Status409(),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`duplicate_ad_campaign`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DuplicateAdCampaignError {
    Status400(),
    Status401(models::ErrorResponse),
    Status403(),
    Status404(),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`duplicate_ad_set`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DuplicateAdSetError {
    Status400(),
    Status401(models::ErrorResponse),
    Status403(),
    Status404(),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`edit_google_asset_group_assets`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum EditGoogleAssetGroupAssetsError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(models::ErrorResponse),
    Status404(models::InlineObject1),
    Status422(),
    Status429(),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_ad`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetAdError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(models::ErrorResponse),
    Status404(models::InlineObject1),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_ad_campaign_details`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetAdCampaignDetailsError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(models::ErrorResponse),
    Status404(models::ErrorResponse),
    Status409(models::ErrorResponse),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_ad_review`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetAdReviewError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(models::ErrorResponse),
    Status404(),
    Status429(models::ErrorResponse),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_ad_set_details`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetAdSetDetailsError {
    Status400(),
    Status401(models::ErrorResponse),
    Status403(models::ErrorResponse),
    Status404(models::ErrorResponse),
    Status409(models::ErrorResponse),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_ad_set_targeting`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetAdSetTargetingError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status404(),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_ad_tree`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetAdTreeError {
    Status401(models::ErrorResponse),
    Status403(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_ads_timeline`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetAdsTimelineError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(),
    Status404(models::ErrorResponse),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_campaign_ad_schedule`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCampaignAdScheduleError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(),
    Status404(models::ErrorResponse),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_campaign_bidding`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCampaignBiddingError {
    Status400(),
    Status401(models::ErrorResponse),
    Status403(),
    Status404(models::ErrorResponse),
    Status409(models::ErrorResponse),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_campaign_conversion_goals`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCampaignConversionGoalsError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(models::ErrorResponse),
    Status404(),
    Status409(),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_campaign_targeting`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCampaignTargetingError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(),
    Status404(),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_google_asset_group`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetGoogleAssetGroupError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(models::ErrorResponse),
    Status404(models::InlineObject1),
    Status422(),
    Status429(),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_tik_tok_smart_plus_ad_review`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetTikTokSmartPlusAdReviewError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(models::ErrorResponse),
    Status404(),
    Status422(),
    Status429(models::ErrorResponse),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`list_ad_campaigns`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ListAdCampaignsError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(),
    Status404(models::ErrorResponse),
    Status409(models::ErrorResponse),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`list_ad_group_assets`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ListAdGroupAssetsError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(),
    Status404(models::ErrorResponse),
    Status409(models::ErrorResponse),
    Status429(),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`list_ad_keywords`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ListAdKeywordsError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`list_ad_sets`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ListAdSetsError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`list_ads`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ListAdsError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`list_ads_alerts`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ListAdsAlertsError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`list_bid_strategies`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ListBidStrategiesError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(models::ErrorResponse),
    Status404(models::ErrorResponse),
    Status409(models::ErrorResponse),
    Status429(),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`list_campaign_assets`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ListCampaignAssetsError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(),
    Status404(models::ErrorResponse),
    Status409(models::ErrorResponse),
    Status429(),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`list_campaign_negative_keyword_lists`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ListCampaignNegativeKeywordListsError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(),
    Status404(models::ErrorResponse),
    Status409(),
    Status422(),
    Status429(),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`list_campaign_negative_keywords`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ListCampaignNegativeKeywordsError {
    Status401(models::ErrorResponse),
    Status403(models::ErrorResponse),
    Status404(),
    Status429(),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`list_google_asset_groups`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ListGoogleAssetGroupsError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(models::ErrorResponse),
    Status404(models::InlineObject1),
    Status429(),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`list_google_recommendations`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ListGoogleRecommendationsError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(models::ErrorResponse),
    Status404(models::InlineObject1),
    Status422(),
    Status429(),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`list_shared_budgets`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ListSharedBudgetsError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(models::ErrorResponse),
    Status404(models::ErrorResponse),
    Status409(models::ErrorResponse),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`list_tik_tok_smart_plus_reviews`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ListTikTokSmartPlusReviewsError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(),
    Status404(models::ErrorResponse),
    Status409(models::ErrorResponse),
    Status422(),
    Status429(models::ErrorResponse),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`remove_ad_group_assets`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum RemoveAdGroupAssetsError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(),
    Status404(models::ErrorResponse),
    Status409(models::ErrorResponse),
    Status429(),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`remove_ad_keyword`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum RemoveAdKeywordError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(models::ErrorResponse),
    Status404(models::ErrorResponse),
    Status409(models::ErrorResponse),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`remove_campaign_assets`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum RemoveCampaignAssetsError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(),
    Status404(models::ErrorResponse),
    Status409(models::ErrorResponse),
    Status429(),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`remove_google_asset_group`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum RemoveGoogleAssetGroupError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(models::ErrorResponse),
    Status404(models::InlineObject1),
    Status422(),
    Status429(),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`replace_campaign_negative_keyword_lists`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ReplaceCampaignNegativeKeywordListsError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(),
    Status404(models::ErrorResponse),
    Status409(),
    Status422(),
    Status429(),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`replace_campaign_negative_keywords`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ReplaceCampaignNegativeKeywordsError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(models::ErrorResponse),
    Status404(),
    Status429(),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`replace_google_listing_group_filters`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ReplaceGoogleListingGroupFiltersError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(models::ErrorResponse),
    Status404(models::InlineObject1),
    Status422(),
    Status429(),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`update_ad`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdateAdError {
    Status400(),
    Status401(models::ErrorResponse),
    Status403(),
    Status404(models::InlineObject1),
    Status422(),
    Status429(),
    Status501(),
    Status502(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`update_ad_campaign`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdateAdCampaignError {
    Status400(),
    Status401(models::ErrorResponse),
    Status403(),
    Status404(models::ErrorResponse),
    Status409(),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`update_ad_campaign_status`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdateAdCampaignStatusError {
    Status400(),
    Status401(models::ErrorResponse),
    Status403(),
    Status404(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`update_ad_group_assets`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdateAdGroupAssetsError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(),
    Status404(models::ErrorResponse),
    Status409(models::ErrorResponse),
    Status429(),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`update_ad_keyword`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdateAdKeywordError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(models::ErrorResponse),
    Status404(models::ErrorResponse),
    Status409(models::ErrorResponse),
    Status422(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`update_ad_set`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdateAdSetError {
    Status400(),
    Status401(models::ErrorResponse),
    Status403(),
    Status404(),
    Status409(),
    Status422(),
    Status501(),
    Status502(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`update_ad_set_status`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdateAdSetStatusError {
    Status400(),
    Status401(models::ErrorResponse),
    Status403(),
    Status404(),
    Status409(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`update_ad_status`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdateAdStatusError {
    Status400(),
    Status401(models::ErrorResponse),
    Status403(),
    Status404(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`update_bid_strategy`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdateBidStrategyError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(models::ErrorResponse),
    Status404(models::ErrorResponse),
    Status409(models::ErrorResponse),
    Status429(),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`update_campaign_ad_schedule`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdateCampaignAdScheduleError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(),
    Status404(models::ErrorResponse),
    Status422(),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`update_campaign_assets`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdateCampaignAssetsError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(),
    Status404(models::ErrorResponse),
    Status409(models::ErrorResponse),
    Status429(),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`update_campaign_conversion_goals`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdateCampaignConversionGoalsError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(models::ErrorResponse),
    Status404(),
    Status409(),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`update_campaign_targeting`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdateCampaignTargetingError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(),
    Status404(),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`update_google_asset_group`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdateGoogleAssetGroupError {
    Status400(models::ErrorResponse),
    Status401(models::ErrorResponse),
    Status403(models::ErrorResponse),
    Status404(models::InlineObject1),
    Status422(),
    Status429(),
    Status501(),
    UnknownValue(serde_json::Value),
}

/// Adds keywords, or negative keywords, to a Google Search ad group without replacing the ones already there.  Adds one or more keyword criteria to an existing Google Search ad group, without touching the keywords already there (unlike the whole-set diff on `PUT /v1/ads/{adId}`, `keywords`/`negativeKeywords` in `platformSpecificData`, which replaces the set). Set `negative: true` to add ad-group-level negatives instead of positive keywords.
pub async fn add_ad_keywords(
    configuration: &configuration::Configuration,
    add_ad_keywords_request: models::AddAdKeywordsRequest,
) -> Result<models::AddAdKeywords201Response, Error<AddAdKeywordsError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_body_add_ad_keywords_request = add_ad_keywords_request;

    let uri_str = format!("{}/v1/ads/keywords", configuration.base_path);
    let mut req_builder = configuration
        .client
        .request(reqwest::Method::POST, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };
    req_builder = req_builder.json(&p_body_add_ad_keywords_request);

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AddAdKeywords201Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::AddAdKeywords201Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<AddAdKeywordsError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Applies Google's optimization suggestions to an ad account, using Google's values or your own; the changes cannot be undone.  Apply up to 100 recommendations. This changes the account (budgets, bidding, keywords, assets) and is not reversible or idempotent. Google offers no validate-only mode for it.  Items run in partial-failure mode, so one stale recommendation does not block the rest.  ### `parameters`  Optional. It takes exactly one key named for the recommendation type, in Google's ApplyRecommendationOperation shape. For example:  - `campaignBudget: { newBudgetAmountMicros }` - `keyword: { matchType, cpcBidMicros }`  Omit it to apply Google's suggested values.
pub async fn apply_google_recommendations(
    configuration: &configuration::Configuration,
    apply_google_recommendations_request: models::ApplyGoogleRecommendationsRequest,
) -> Result<models::ApplyGoogleRecommendations200Response, Error<ApplyGoogleRecommendationsError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_body_apply_google_recommendations_request = apply_google_recommendations_request;

    let uri_str = format!("{}/v1/ads/recommendations/apply", configuration.base_path);
    let mut req_builder = configuration
        .client
        .request(reqwest::Method::POST, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };
    req_builder = req_builder.json(&p_body_apply_google_recommendations_request);

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ApplyGoogleRecommendations200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ApplyGoogleRecommendations200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<ApplyGoogleRecommendationsError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Creates sitelinks, callouts, structured snippets or image assets and attaches them to a Google ad group in one step.  Creates and attaches sitelinks, callouts, structured snippets and image assets in one Google mutation. Google shows images only on accounts it deems eligible (account age, policy history, vertical).
pub async fn attach_ad_group_assets(
    configuration: &configuration::Configuration,
    ad_set_id: &str,
    attach_campaign_assets_request: models::AttachCampaignAssetsRequest,
) -> Result<models::AttachAdGroupAssets201Response, Error<AttachAdGroupAssetsError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_ad_set_id = ad_set_id;
    let p_body_attach_campaign_assets_request = attach_campaign_assets_request;

    let uri_str = format!(
        "{}/v1/ads/ad-sets/{adSetId}/assets",
        configuration.base_path,
        adSetId = crate::apis::urlencode(p_path_ad_set_id)
    );
    let mut req_builder = configuration
        .client
        .request(reqwest::Method::POST, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };
    req_builder = req_builder.json(&p_body_attach_campaign_assets_request);

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AttachAdGroupAssets201Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::AttachAdGroupAssets201Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<AttachAdGroupAssetsError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Adds sitelinks, callouts, structured snippets and images to a Google campaign in one step.  Creates and attaches sitelinks, callouts, structured snippets and image assets in one Google mutation. Google shows images only on accounts it deems eligible (account age, policy history, vertical).
pub async fn attach_campaign_assets(
    configuration: &configuration::Configuration,
    campaign_id: &str,
    attach_campaign_assets_request: models::AttachCampaignAssetsRequest,
) -> Result<models::AttachCampaignAssets201Response, Error<AttachCampaignAssetsError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_campaign_id = campaign_id;
    let p_body_attach_campaign_assets_request = attach_campaign_assets_request;

    let uri_str = format!(
        "{}/v1/ads/campaigns/{campaignId}/assets",
        configuration.base_path,
        campaignId = crate::apis::urlencode(p_path_campaign_id)
    );
    let mut req_builder = configuration
        .client
        .request(reqwest::Method::POST, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };
    req_builder = req_builder.json(&p_body_attach_campaign_assets_request);

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AttachCampaignAssets201Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::AttachCampaignAssets201Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<AttachCampaignAssetsError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Turns an already published post into a paid ad that keeps the post's likes and comments, creating the campaign around it.  By default it provisions the whole hierarchy (campaign, ad set, ad).  ### Attach shape (Meta)  Send `adSetId` to put the ad under an EXISTING ad set instead, so that ad set keeps its learning phase.  That ad set then owns `budget`, `schedule` and `targeting`. Sending any of those alongside `adSetId` is a 400 rather than a silent drop. `budget` is required only without `adSetId`.  `instagramAccountId`, `destinationType`, `whatsappPhoneNumber` and `adSetId` are Meta-only and return 400 on other platforms.  ### Meta accounts  `accountId` may be a Facebook, Instagram or Meta ads (business login) connection.  A business-login connection has no posting account, so pass the post as `platformPostId` (Facebook `pageId_postId` or an Instagram media id). A Zernio `postId` is a 400 there.  ### X  `accountId` may be the posting X account or its X Ads connection: either resolves the other on the same profile.  A Zernio `postId` on an X Ads connection resolves through its X account, and is a 400 when the profile has none (pass `platformPostId` instead).  ### Reddit  `accountId` is the Reddit Ads connection (platform `redditads`). Pass the Reddit post as either:  - `platformPostId` (`t3_abc123` or the bare id) - a Zernio `postId`, which resolves through the Reddit account connected on the same profile (400 when there is none)  Reddit promotes only posts made by a profile of the ad account: a post by any other author returns 422.  Goals:  - traffic - awareness - conversions - video_views (the post must be a video, 422 otherwise) - lead_generation  conversions and lead_generation need a pixel that already received the event (see `promotedObject`).  `leadGenFormId` returns 400: Reddit retired its native lead forms, so `lead_generation` sends people to `linkUrl` and optimizes toward the pixel's Lead event.  Each boost creates a campaign, an ad group carrying the budget, the targeting and the bid, and the ad. `bidStrategy` sets the ad group's bid:  - LOWEST_COST_WITHOUT_CAP (or omitted): automatic bidding (BIDLESS) - LOWEST_COST_WITH_BID_CAP: MANUAL_BIDDING with `bidAmount` as the bid - COST_CAP: MAXIMIZE_VOLUME with `bidAmount` as the cap - Any other strategy returns 422 before anything is created.  ### Messaging boosts (Meta)  Use `goal: engagement` with one of these CTAs:  - `callToAction: WHATSAPP_MESSAGE`: implies WHATSAPP - `MESSAGE_PAGE`: implies MESSENGER - `INSTAGRAM_MESSAGE`: implies INSTAGRAM_DIRECT  `destinationType` alone does not select a messaging CTA. Omit `linkUrl` only for messaging CTAs. Plain link CTAs keep their goal and link behavior when combined with an independent `destinationType`.  The campaign uses OUTCOME_ENGAGEMENT and the ad set uses CONVERSATIONS with the promoted Page. Optional `whatsappPhoneNumber` selects a number already paired with that Page.  Conflicting CTA/destination, instant form, goal, or optimizationGoal inputs return 400. Attach requires the target ad set destination to match.  Existing post references preserve social proof. An Instagram reel rejected by Meta is not re-uploaded as a new post for a messaging boost.  ### Retries  Boosts are NOT idempotent and can take minutes when Meta requires re-hosting an Instagram video, so do not retry on client timeout.  Send an Idempotency-Key header to make retries safe: same key and body replays the original 201, and distinct keys always create distinct ads.  Without the header, an identical request is treated as a retry:  - While one is in flight it returns 409. - Within 10 minutes of a completed boost it returns the already-created ad instead of creating another.  To intentionally duplicate an ad, send distinct Idempotency-Keys (or vary the body, e.g. the name).
pub async fn boost_post(
    configuration: &configuration::Configuration,
    boost_post_request: models::BoostPostRequest,
    idempotency_key: Option<&str>,
) -> Result<models::BoostPost200Response, Error<BoostPostError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_body_boost_post_request = boost_post_request;
    let p_header_idempotency_key = idempotency_key;

    let uri_str = format!("{}/v1/ads/boost", configuration.base_path);
    let mut req_builder = configuration
        .client
        .request(reqwest::Method::POST, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(param_value) = p_header_idempotency_key {
        req_builder = req_builder.header("Idempotency-Key", param_value.to_string());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };
    req_builder = req_builder.json(&p_body_boost_post_request);

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BoostPost200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::BoostPost200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<BoostPostError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Pauses or resumes up to 50 campaigns in one call, with a separate result per campaign so one failure does not block the rest.  Each campaign is updated concurrently, and the response contains a per-campaign result so a single bad row does not fail the whole batch.  Each campaign is read, written and re-read exactly as PUT /v1/ads/campaigns/{campaignId}/status describes: only the campaign's own switch is written, never its ad sets' or ads'.  `updated` / `skipped` count campaigns.
pub async fn bulk_update_ad_campaign_status(
    configuration: &configuration::Configuration,
    bulk_update_ad_campaign_status_request: models::BulkUpdateAdCampaignStatusRequest,
) -> Result<models::BulkUpdateAdCampaignStatus200Response, Error<BulkUpdateAdCampaignStatusError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_body_bulk_update_ad_campaign_status_request = bulk_update_ad_campaign_status_request;

    let uri_str = format!("{}/v1/ads/campaigns/bulk-status", configuration.base_path);
    let mut req_builder = configuration
        .client
        .request(reqwest::Method::POST, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };
    req_builder = req_builder.json(&p_body_bulk_update_ad_campaign_status_request);

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BulkUpdateAdCampaignStatus200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::BulkUpdateAdCampaignStatus200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<BulkUpdateAdCampaignStatusError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Creates an empty campaign, paused, so you can add ad sets and ads to it afterwards.  Creates a campaign WITHOUT its first ad set / ad, on the platform of the given `accountId`. Ad sets join it later via `existingCampaignId` on the create endpoints.  Created `PAUSED` (TikTok `DISABLE`) unless `status: ACTIVE` where the platform supports it.  **Idempotency:** send an `Idempotency-Key` header to make retries safe.  ### Field support  - `specialAdCategories`: Meta-only (400 elsewhere). - `bidStrategy`: Meta and Google (400 elsewhere). Google also accepts `portfolioBidStrategyId` instead. - Budget: Google, X and OpenAI require one (422 without one). OpenAI accepts daily or lifetime, Google only `budgetType: daily`.  ### Platform notes  - Meta: a budget here is campaign-level (CBO) by definition. Omit it for ABO (each ad set carries its own budget). - OpenAI: `goal` sets the campaign objective, and `conversions` needs an active standard conversion event on the account. - Reddit: see below. - LinkedIn: creates the campaign GROUP (our campaign level) and rejects a budget, which lives on the campaign (ad set) level there. It comes back `status: DRAFT`.  ### Reddit  `goal` is one of traffic, awareness, conversions, video_views or lead_generation (422 otherwise). The budget is optional.  - With a budget, the campaign uses Reddit's campaign budget optimization and carries the pixel (see `promotedObject`, which then needs `customEventType` for `conversions`). The budget is daily or lifetime; a lifetime budget needs `endDate` (400 otherwise). - `startDate` / `endDate` set the campaign's schedule and need that campaign budget (400 without one). - Without a budget, each ad set carries its own budget and dates.
pub async fn create_ad_campaign(
    configuration: &configuration::Configuration,
    create_ad_campaign_request: models::CreateAdCampaignRequest,
    idempotency_key: Option<&str>,
) -> Result<models::CreateAdCampaign200Response, Error<CreateAdCampaignError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_body_create_ad_campaign_request = create_ad_campaign_request;
    let p_header_idempotency_key = idempotency_key;

    let uri_str = format!("{}/v1/ads/campaigns", configuration.base_path);
    let mut req_builder = configuration
        .client
        .request(reqwest::Method::POST, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(param_value) = p_header_idempotency_key {
        req_builder = req_builder.header("Idempotency-Key", param_value.to_string());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };
    req_builder = req_builder.json(&p_body_create_ad_campaign_request);

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateAdCampaign200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CreateAdCampaign200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<CreateAdCampaignError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Creates an empty ad group under an existing campaign, ready for ads to be added later.  The ad group is created WITHOUT an ad (Google Ads compliance row C.190). Ads join it later via `adSetId` on POST /v1/ads/create. Supports Google Ads and Reddit Ads; every other platform returns 501.  **Reddit Ads** (`platform: reddit`)  - `adAccountId` (the Reddit ad account id) is required and must be a selected ad account of the connection (403 otherwise). - When the campaign has no campaign budget, send `budgetAmount` + `budgetType` (a lifetime budget needs `endDate`). - The ad group is optimized for the campaign's objective. `promotedObject.customEventType` is required on a conversions campaign, and the pixel must have received that event, else 422. - It bids with `bidStrategy`/`bidAmount` like POST /v1/ads/create. - Under campaign budget optimization the ad group takes the campaign's bid, goal type, optimization event and pixel, and bid fields return 400. - The ad group must start no earlier than a future campaign start and end no later than the campaign end (400 otherwise). - `targeting` takes the same targeting object as the other ad endpoints (no geo defaults to the US). - A campaign of another ad account returns 404, a Reddit Max campaign 422. - `maxCpc` and `customerId` are Google only (400 on Reddit), and the Reddit fields return 400 on Google.  ### After creation  Created `PAUSED` unless `status: ACTIVE`. The new ad group has no ad yet, so it will not appear in GET /v1/ads/tree (built purely from `ads` rows) until one is added. Use GET /v1/ads/ad-sets to see it in the meantime.  It can be read, edited and deleted through `/v1/ads/ad-sets/{adSetId}` right away (targeting, schedule, name, `status`, `budget` and bid fields). A budget on an ad group that spends its campaign budget returns 422.  **Idempotency:** send an `Idempotency-Key` header to make retries safe.
pub async fn create_ad_set(
    configuration: &configuration::Configuration,
    create_ad_set_request: models::CreateAdSetRequest,
    idempotency_key: Option<&str>,
) -> Result<models::CreateAdSet201Response, Error<CreateAdSetError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_body_create_ad_set_request = create_ad_set_request;
    let p_header_idempotency_key = idempotency_key;

    let uri_str = format!("{}/v1/ads/ad-sets", configuration.base_path);
    let mut req_builder = configuration
        .client
        .request(reqwest::Method::POST, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(param_value) = p_header_idempotency_key {
        req_builder = req_builder.header("Idempotency-Key", param_value.to_string());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };
    req_builder = req_builder.json(&p_body_create_ad_set_request);

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateAdSet201Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CreateAdSet201Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<CreateAdSetError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Creates a Google Ads bid strategy that several campaigns can share, such as one target CPA or ROAS.  Attach it to a campaign with `portfolioBidStrategyId` on POST /v1/ads/create, PUT /v1/ads/campaigns/{campaignId}, or PUT /v1/ads/ad-sets/{adSetId}. Attaching a strategy aligned to a shared budget fails there with a 400 (Google's `BIDDING_STRATEGY_AND_BUDGET_MUST_BE_ALIGNED`); this is not retryable.
pub async fn create_bid_strategy(
    configuration: &configuration::Configuration,
    create_bid_strategy_request: models::CreateBidStrategyRequest,
) -> Result<models::CreateBidStrategy201Response, Error<CreateBidStrategyError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_body_create_bid_strategy_request = create_bid_strategy_request;

    let uri_str = format!("{}/v1/ads/bid-strategies", configuration.base_path);
    let mut req_builder = configuration
        .client
        .request(reqwest::Method::POST, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };
    req_builder = req_builder.json(&p_body_create_bid_strategy_request);

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateBidStrategy201Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CreateBidStrategy201Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<CreateBidStrategyError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Adds an asset group with its assets and optional product targeting to a Performance Max campaign, or just validates it without creating anything.  The group, any new assets, their links and an optional listing-group tree are created in one atomic request, so Google checks the asset minimums (for non-retail campaigns) against the whole set. Created PAUSED unless status is ENABLED. validateOnly: true runs Google's validation without creating anything.
pub async fn create_google_asset_group(
    configuration: &configuration::Configuration,
    campaign_id: &str,
    create_google_asset_group_request: models::CreateGoogleAssetGroupRequest,
) -> Result<models::CreateGoogleAssetGroup200Response, Error<CreateGoogleAssetGroupError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_campaign_id = campaign_id;
    let p_body_create_google_asset_group_request = create_google_asset_group_request;

    let uri_str = format!(
        "{}/v1/ads/campaigns/{campaignId}/asset-groups",
        configuration.base_path,
        campaignId = crate::apis::urlencode(p_path_campaign_id)
    );
    let mut req_builder = configuration
        .client
        .request(reqwest::Method::POST, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };
    req_builder = req_builder.json(&p_body_create_google_asset_group_request);

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateGoogleAssetGroup200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CreateGoogleAssetGroup200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<CreateGoogleAssetGroupError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Creates a daily Google Ads budget that several campaigns can share.  Creates a daily shared campaign budget (`explicitly_shared: true`, standard delivery) that several campaigns can draw from. A lifetime budget returns 422, like every Google budget. Google refuses some bidding strategies on a shared budget; that error surfaces when a campaign is moved onto it.
pub async fn create_shared_budget(
    configuration: &configuration::Configuration,
    create_shared_budget_request: models::CreateSharedBudgetRequest,
) -> Result<models::CreateSharedBudget201Response, Error<CreateSharedBudgetError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_body_create_shared_budget_request = create_shared_budget_request;

    let uri_str = format!("{}/v1/ads/shared-budgets", configuration.base_path);
    let mut req_builder = configuration
        .client
        .request(reqwest::Method::POST, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };
    req_builder = req_builder.json(&p_body_create_shared_budget_request);

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateSharedBudget201Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CreateSharedBudget201Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<CreateSharedBudgetError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Creates a paid ad with your own creative, building the campaign and ad set it needs or adding it to existing ones.  Works across Meta, Google Ads, Pinterest, TikTok, X, LinkedIn, OpenAI Ads (ChatGPT Ads) and Reddit Ads. Per-platform required fields, budget minimums, and video-ad rules are documented on each property below.  ### Request shapes  The body selects one of these mutually exclusive shapes:  - Legacy single-creative shape (all platforms, the default). - Meta-only multi-creative shape via the creatives array: one ad set with N ads sharing budget and targeting. - Attach shape via adSetId: adds one new ad to an existing ad set, inheriting its budget, targeting, and schedule (Meta, Google Ads, TikTok, and LinkedIn).  On LinkedIn, adSetId in the attach shape is the existing Campaign id, and the budget, schedule, targeting and bidding fields must be omitted. `goal` may be omitted too (taken from the Campaign's objective), and the created ad's `targeting` echoes the Campaign's audience.  ### Google Performance Max  Set `campaignType: \"pmax\"` and supply `assetGroup` with text, images by role, business name and finalUrl. This creates a daily budget, PAUSED campaign and asset group atomically.  - `validateOnly: true` validates the complete request with Google without creating or persisting resources. - Read assets with `GET /v1/ads/campaigns/{campaignId}/asset-groups`. - The logo is required; video is optional via `assetGroup.youtubeVideoId`. - Brand guidelines are disabled at creation. - All supplied asset links are validated together against Google's minimum asset requirements. - PMax rejects ACTIVE creation, portfolio bidding, bid caps, legacy creative fields and attach shapes. - Geo and language targeting are supported; omitted geo targets all locations. - PMax does not require top-level goal, headline, body or linkUrl.  Supported bidding:  - Omitted or LOWEST_COST_WITHOUT_CAP: Maximize Conversions. - COST_CAP plus bidAmount: target CPA. - LOWEST_COST_WITH_MIN_ROAS plus roasAverageFloor: Maximize Conversion Value with target ROAS.  ### Google Demand Gen  Set `campaignType: \"demand_gen\"` and supply `demandGen`. One atomic request creates a daily budget, PAUSED campaign, one ad group and one ad. The ad is:  - a multi-asset image ad by default; - a video responsive ad when `demandGen.youtubeVideoIds` is sent; - a carousel ad (2 to 10 cards) when `demandGen.carouselCards` is sent.  Targeting and validation:  - Geo (countries, regions, cities, zips, metros) and languages go on the ad group, as Demand Gen requires. - `demandGen.channels` sets the ad group's channel controls. - `demandGen.audience` builds a Google Audience (user lists, interests, custom audiences, age ranges, genders) attached to the ad group, or `demandGen.audienceId` attaches an existing one. - `validateOnly: true` validates everything with Google without creating resources.  Supported bidding:  - Omitted or LOWEST_COST_WITHOUT_CAP: Maximize Conversions. - COST_CAP plus bidAmount: target CPA. - LOWEST_COST_WITH_MIN_ROAS plus roasAverageFloor: target ROAS. - LOWEST_COST_WITH_BID_CAP plus bidAmount: target CPC.  The created ad carries the native `platformCampaignId`, `platformAdSetId` (ad group) and `platformAdId`. After creation:  - Activate with PUT /v1/ads/campaigns/{campaignId}/status. - Edit budget, bidding and name with the regular campaign endpoints. - Edit creative, channels, audience and ad group targeting with PUT /v1/ads/{adId} (`demandGen`, `targeting`).  To grow an existing Demand Gen campaign, send one of these (neither takes budget, bidding or schedule fields; both support `validateOnly`):  - `existingCampaignId`: adds a PAUSED ad group, with its own geo, languages, channels and audience, plus its ad. - `adSetId`: adds a PAUSED ad to that ad group.  ### Meta creative options  Meta accepts `creativeFeatures` on the single and attach shapes and as defaults for `creatives[]`; an item replaces the whole feature map.  `promotion` is not supported on any shape, and any object is rejected with 400.  Reusing `existingCreativeId` uses the existing creative settings instead of new settings. Requested settings are persisted for lists, exports, and default ad-detail reads.  ### Meta required fields per shape  A missing field is a 400 naming it in `param`.  - Every shape that builds a new ad set (no `adSetId`, `existingCampaignId` or `buyingType: \"RESERVED\"`): `budgetAmount`. `budgetType` defaults to daily, and a lifetime budget without `endDate` ends 7 days after it starts (see `appliedDefaults`). - Single image or video (the default), also with `adSetId`: `headline` (max 255), `body`, `callToAction`, and exactly one of `imageUrl` / `video`. A catalog template creative takes none, and ignores and does not upload any sent. - Single image or video also needs `linkUrl`, unless the goal is `lead_generation` or `page_visits` or `leadGenFormId` is set. - `bodies[]` / `headlines[]` text variations: `body`, one list with 2+ items, `callToAction`, `imageUrl` or `video`, and `linkUrl` unless the goal is `lead_generation` or `leadGenFormId` is set. `headline` is not required. - `placementAssets`: `headline`, `body`, `callToAction`, and `linkUrl` with the same exemptions as the single shape; the media comes from `placementAssets`. - `carouselCards`: `body`, `callToAction`, and `linkUrl` unless the goal is `lead_generation` or `leadGenFormId` is set. `headline` is not required. - `creatives[]`: per entry `headline`, `body`, `callToAction`, `imageUrl` or `video`, and `linkUrl` unless the goal is `lead_generation`. Top-level `body` is not required. - `dynamicCreative`: `imageUrls` or `videoUrls`, `callToActionTypes`, and `linkUrls` unless the goal is `lead_generation`. Top-level `body` is not required. - `existingCreativeId`: no creative fields. - Goal `page_likes`: `body` only. - Goal `lead_generation` always needs `leadGenFormId`, except with `existingCreativeId`.  ### Meta activation  Meta builds the campaign, ad set and ads PAUSED and switches the requested levels to ACTIVE as the last step.  When Meta refuses that switch, or the connection drops, after Zernio's retries, the request still answers 201 and nothing is deleted:  - The refused level and every level below it stay PAUSED. - Levels above it that already went ACTIVE stay ACTIVE. - The ad comes back with `status: paused` and its `configuredStatus` as read back from Meta. - A switch Meta applied although its answer was lost counts as ACTIVE, since Zernio reads the status back first.  `message` says not everything is ACTIVE. `warnings` carries one entry starting with `activation_failed:` that quotes Meta's code, subcode and message, and names what was kept PAUSED and what was switched ACTIVE.  That warning also lists the calls that switch the PAUSED ones on later, in this order, with status `active`:  1. PUT /v1/ads/campaigns/{campaignId}/status 2. PUT /v1/ads/ad-sets/{adSetId}/status 3. PUT /v1/ads/{adId}/status  On the `creatives[]` shape, only the ads Meta refused stay PAUSED when the campaign and ad set went through. A Reach and Frequency ad is created ACTIVE and is never listed as kept PAUSED. With an `Idempotency-Key`, a retry replays this 201.  ### LinkedIn  LinkedIn creates a Single Image or Single Video Ad backed by a Direct Sponsored Content \"dark post\" authored by a Company Page (see `organizationId`).  - Supported goals: engagement, traffic, awareness, and video_views. - Video ads use the `video` field; video_views requires a video. - Traffic ads require `linkUrl`.  ### Reddit Ads  Use the `accountId` of a `redditads` connection and an `adAccountId` like `a2_abc123`. Zernio creates a campaign, an ad group carrying the budget, schedule, targeting and pixel, and an ad running a new promoted post. The post is authored by the ad account's first profile (422 when it has none).  The creative format follows the body:  - `carouselCards`: a carousel. - `video`: a video ad. - `imageUrl`: an image ad. - None of them: a text ad, which cannot link out (`linkUrl` is a 400 there; `body` is required).  Only the legacy single-creative shape is available: `creatives[]`, `adSetId`, `existingCampaignId` and `validateOnly` are refused.  Reddit throttling surfaces as 429 `rate_limited` with `platform: reddit`; retry after a delay. To promote an existing Reddit post, use POST /v1/ads/boost.  ### Idempotency  This endpoint is not idempotent at the platform level: a blind retry creates a second campaign/ad set/ad. Send an `Idempotency-Key` header to make retries safe.  - The first request with a given key creates the ad and we store the response. - A retry with the same key replays that exact response (with `Idempotent-Replayed: true`) instead of creating duplicates. - Reusing a key with a different body returns 422. - A key whose first request is still in flight returns 409 (retry after a short backoff). - If the first request is cut off mid-create (for example by a function timeout), its key can stay in progress and keep returning 409 until it expires. Use a new key to retry sooner, after checking whether the ad was created. - Keys are scoped to your credential and expire after 24h.
pub async fn create_standalone_ad(
    configuration: &configuration::Configuration,
    create_standalone_ad_request: models::CreateStandaloneAdRequest,
    idempotency_key: Option<&str>,
) -> Result<models::CreateStandaloneAd200Response, Error<CreateStandaloneAdError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_body_create_standalone_ad_request = create_standalone_ad_request;
    let p_header_idempotency_key = idempotency_key;

    let uri_str = format!("{}/v1/ads/create", configuration.base_path);
    let mut req_builder = configuration
        .client
        .request(reqwest::Method::POST, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(param_value) = p_header_idempotency_key {
        req_builder = req_builder.header("Idempotency-Key", param_value.to_string());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };
    req_builder = req_builder.json(&p_body_create_standalone_ad_request);

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateStandaloneAd200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CreateStandaloneAd200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<CreateStandaloneAdError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Deletes an ad on the platform while keeping its history, and removes empty parents only when they were created through this API.  The ad is deleted on the platform and marked as cancelled in the database. It is preserved for history.  - OpenAI Ads has no delete API: the ad is archived instead (a terminal state, the closest equivalent). - Reddit Ads has no delete either: the ad is archived (`configured_status` ARCHIVED).  To delete a whole campaign on purpose use `DELETE /v1/ads/campaigns/{campaignId}`.  ### Parents  Only the ad is deleted; a campaign or ad set is never deleted while it still holds another ad. Parents created outside Zernio, and the parents of an ad imported from the platform, are always kept.  ### Meta  When the ad set and campaign were created by Zernio (by `POST /v1/ads/create` or `POST /v1/ads/boost`) and Meta lists no other ad in the ad set (archived ads count), the emptied ad set is deleted too. The campaign follows once it holds no other ad set.  ### LinkedIn  The ad is a creative inside a campaign inside a campaign group.  - The creative is always removed. - The campaign is removed only when Zernio created it and LinkedIn lists no other creative in it that is not archived, canceled or deleted. - The campaign group is removed only when Zernio created it and LinkedIn lists no other campaign in it that is not canceled or deleted (archived campaigns count).  If the creative itself cannot be removed the request fails and no parent is touched.  ### X  The ad is a promoted post inside a line item inside a campaign.  - The promoted post is always removed. - The line item is removed only when Zernio created it (by `POST /v1/ads/create` or `POST /v1/ads/boost`) and X lists no other undeleted promoted post in it. - The campaign is removed only when Zernio created it and X lists no other undeleted line item in it.  If X refuses the promoted post delete the request fails and no parent is touched.
pub async fn delete_ad(
    configuration: &configuration::Configuration,
    ad_id: &str,
) -> Result<models::DeleteAccountGroup200Response, Error<DeleteAdError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_ad_id = ad_id;

    let uri_str = format!(
        "{}/v1/ads/{adId}",
        configuration.base_path,
        adId = crate::apis::urlencode(p_path_ad_id)
    );
    let mut req_builder = configuration
        .client
        .request(reqwest::Method::DELETE, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeleteAccountGroup200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::DeleteAccountGroup200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<DeleteAdError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Deletes a campaign on its platform, including a campaign that never got any ads.  Only the campaign itself is sent to the platform:  - Meta, Google, TikTok, LinkedIn and X delete it. - OpenAI, Reddit and Pinterest have no campaign delete and archive it instead (see below).  Locally, all Ad documents for this campaign are marked `status: cancelled`.  ### Empty campaigns  A campaign with zero ads has no local Ad documents to resolve, so it is invisible to `/v1/ads/tree` and this endpoint would 404. That state comes from the two-step create flow (campaign, then ads via `existingCampaignId`) whenever Meta rejects the ad step.  To delete such a shell, send `accountId` in the body or the query string. We skip the local lookup entirely and forward the delete to the platform of that connection. `accountId` is ignored when the campaign does have ads.  ### Google, TikTok, LinkedIn, Pinterest, Reddit and OpenAI  Google, TikTok, LinkedIn, Pinterest and Reddit take the ad account from the synced campaign (OpenAI needs none). When the campaign was never synced (or is synced under several ad accounts), the answer is 409 `invalid_resource_state` on `campaignId` and nothing is deleted: sync the ad account and retry.  Before deleting on Google, TikTok, LinkedIn, Pinterest, OpenAI or Reddit, Zernio asks the platform whether the campaign still holds ad groups or ads. Google asset groups count; on LinkedIn, campaigns inside the campaign group count.  If it does, or the platform cannot confirm it has none (a TikTok Smart+ campaign), the answer is 409 `invalid_resource_state` on `campaignId` and nothing is deleted. Either:  - sync the ad account and delete the campaign again so its ads are cancelled with it, or - delete them on the platform first.  ### X  On X the ad account comes from the synced campaign, which wins over `adAccountId`. When the campaign was never synced, send `adAccountId` too.  Before deleting, Zernio asks X whether the campaign still holds undeleted line items (ads not synced yet). If it does, the answer is 409 `invalid_field_value` on `campaignId` and nothing is deleted.  - Line items that hold promoted posts: sync the ad account and retry. - Line items without promoted posts never sync, so delete them in X Ads Manager first.  ### Reddit Ads  Reddit Ads has no delete: the campaign is archived instead (`configured_status` ARCHIVED), which stops delivery for good. Its ad groups and ads keep their own switches but cannot deliver under an archived campaign.  ### OpenAI Ads  OpenAI Ads has no delete either: the campaign is archived (state `archive`). Its ad groups and ads are not touched on OpenAI.
pub async fn delete_ad_campaign(
    configuration: &configuration::Configuration,
    campaign_id: &str,
    delete_ad_campaign_request: models::DeleteAdCampaignRequest,
) -> Result<models::DeleteAdCampaign200Response, Error<DeleteAdCampaignError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_campaign_id = campaign_id;
    let p_body_delete_ad_campaign_request = delete_ad_campaign_request;

    let uri_str = format!(
        "{}/v1/ads/campaigns/{campaignId}",
        configuration.base_path,
        campaignId = crate::apis::urlencode(p_path_campaign_id)
    );
    let mut req_builder = configuration
        .client
        .request(reqwest::Method::DELETE, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };
    req_builder = req_builder.json(&p_body_delete_ad_campaign_request);

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeleteAdCampaign200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::DeleteAdCampaign200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<DeleteAdCampaignError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Deletes an ad set and its ads while keeping the campaign, archiving it instead on platforms without a hard delete.  Locally, every Ad document under the ad set is marked `status: cancelled`.  Delete is soft on platforms that have no hard delete: LinkedIn moves the campaign to `PENDING_DELETION`, Pinterest and Reddit archive the ad group, and X soft-flags the line item. Google removes the ad group. All remain readable for reporting.
pub async fn delete_ad_set(
    configuration: &configuration::Configuration,
    ad_set_id: &str,
) -> Result<models::DeleteAdSet200Response, Error<DeleteAdSetError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_ad_set_id = ad_set_id;

    let uri_str = format!(
        "{}/v1/ads/ad-sets/{adSetId}",
        configuration.base_path,
        adSetId = crate::apis::urlencode(p_path_ad_set_id)
    );
    let mut req_builder = configuration
        .client
        .request(reqwest::Method::DELETE, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeleteAdSet200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::DeleteAdSet200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<DeleteAdSetError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Hides an alert from `GET /v1/ads/alerts` for 30 days for the calling user. If the problem is still there after that, the alert comes back.
pub async fn dismiss_ads_alert(
    configuration: &configuration::Configuration,
    alert_id: &str,
) -> Result<models::DismissAdsAlert200Response, Error<DismissAdsAlertError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_alert_id = alert_id;

    let uri_str = format!(
        "{}/v1/ads/alerts/{alertId}/dismiss",
        configuration.base_path,
        alertId = crate::apis::urlencode(p_path_alert_id)
    );
    let mut req_builder = configuration
        .client
        .request(reqwest::Method::POST, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DismissAdsAlert200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::DismissAdsAlert200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<DismissAdsAlertError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Dismisses Google optimization suggestions so Google stops showing them.  Dismiss up to 100 recommendations so Google stops suggesting them. Items run in partial-failure mode.
pub async fn dismiss_google_recommendations(
    configuration: &configuration::Configuration,
    dismiss_google_recommendations_request: models::DismissGoogleRecommendationsRequest,
) -> Result<models::ApplyGoogleRecommendations200Response, Error<DismissGoogleRecommendationsError>>
{
    // add a prefix to parameters to efficiently prevent name collisions
    let p_body_dismiss_google_recommendations_request = dismiss_google_recommendations_request;

    let uri_str = format!("{}/v1/ads/recommendations/dismiss", configuration.base_path);
    let mut req_builder = configuration
        .client
        .request(reqwest::Method::POST, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };
    req_builder = req_builder.json(&p_body_dismiss_google_recommendations_request);

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ApplyGoogleRecommendations200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ApplyGoogleRecommendations200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<DismissGoogleRecommendationsError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Copies a single Meta ad, optionally into another ad set, created paused so you can review it before launch.  It duplicates the ad via Meta's native `POST /{ad-id}/copies`. The copy is created paused.  - `adSetId` retargets the copy into another ad set; omitted = the source's own ad set. - Accepts the Zernio ad id or the platform ad id. - Sync discovery is triggered automatically (`syncAfter: false` to skip).  ### Creative settings  Creative settings returned by Meta, including explicit promotion metadata and creativeFeatures, are preserved when the native copy requires a creative rebuild. Metadata Meta does not return cannot be recovered.  ### Fallback rebuild  When Meta refuses the native copy with its capability error (code 3), which happens for some creatives built by other tools, the ad is rebuilt instead:  1. A new creative from the source's returned spec. 2. A new ad in the target ad set, carrying the source name, status option, rename options and tracking specs.
pub async fn duplicate_ad(
    configuration: &configuration::Configuration,
    ad_id: &str,
    idempotency_key: Option<&str>,
    duplicate_ad_request: Option<models::DuplicateAdRequest>,
) -> Result<models::DuplicateAd200Response, Error<DuplicateAdError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_ad_id = ad_id;
    let p_header_idempotency_key = idempotency_key;
    let p_body_duplicate_ad_request = duplicate_ad_request;

    let uri_str = format!(
        "{}/v1/ads/{adId}/duplicate",
        configuration.base_path,
        adId = crate::apis::urlencode(p_path_ad_id)
    );
    let mut req_builder = configuration
        .client
        .request(reqwest::Method::POST, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(param_value) = p_header_idempotency_key {
        req_builder = req_builder.header("Idempotency-Key", param_value.to_string());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };
    req_builder = req_builder.json(&p_body_duplicate_ad_request);

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DuplicateAd200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::DuplicateAd200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<DuplicateAdError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Copies a campaign with its ad sets, ads, creatives and targeting, created paused so you can review it before launch.  Ad sets, ads, creatives, and targeting are copied by default (`deepCopy: true`). The copy is created paused so callers can review before launching.  ### Per-platform implementation  - **Meta** copies one level at a time with Meta's `/copies` endpoint. See below. - **TikTok** has no native copy primitive. See below. - **LinkedIn** has no native copy primitive. See below. - Other platforms return 501 Not Implemented.  ### Meta  Zernio copies the campaign, then each of its ad sets (DELETED and ARCHIVED ones are skipped), then each ad of every ad set. So a campaign of any size copies: Meta refuses a single deep copy of 3 or more objects.  - `statusOption` applies at every level. - If any child copy fails, the partial copy is deleted and the request fails with Meta's error, so a retry starts clean. - Each copied object takes a few seconds, so a large campaign takes minutes to answer.  ### TikTok  Zernio walks the source graph (`/v2/campaign/get/`, `/v2/adgroup/get/`, `/v2/ad/get/`) and recreates each entity via the corresponding `/create/` endpoints. It carries over budget / targeting / bid_type / bid_price / deep_bid_type / creative fields. Spark Ad linkage (`tiktok_item_id`) is preserved.  ### LinkedIn  Zernio walks the source CampaignGroup → Campaigns → Creatives and recreates each entity. It carries over these fields, plus every Creative's `content` object verbatim:  - `type` / `costType` / `unitCost` / `optimizationTargetType` - `creativeSelection` / `objectiveType` / `format` - `dailyBudget` / `totalBudget` / `targetingCriteria` / `runSchedule`  `statusOption: INHERITED_FROM_SOURCE` is evaluated **per entity**: any Group / Campaign / Creative whose source is `ACTIVE` gets its clone activated too.  Duplicating an ACTIVE campaign with `INHERITED_FROM_SOURCE` starts a second front of spend the moment the clone activates. The safe default is `PAUSED`.  ### Sync  The new hierarchy is asynchronous to materialize in our DB, and we trigger sync discovery automatically. Set `syncAfter: false` to skip and poll `/v1/ads/tree` on your own cadence.
pub async fn duplicate_ad_campaign(
    configuration: &configuration::Configuration,
    campaign_id: &str,
    duplicate_ad_campaign_request: models::DuplicateAdCampaignRequest,
    idempotency_key: Option<&str>,
) -> Result<models::DuplicateAdCampaign200Response, Error<DuplicateAdCampaignError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_campaign_id = campaign_id;
    let p_body_duplicate_ad_campaign_request = duplicate_ad_campaign_request;
    let p_header_idempotency_key = idempotency_key;

    let uri_str = format!(
        "{}/v1/ads/campaigns/{campaignId}/duplicate",
        configuration.base_path,
        campaignId = crate::apis::urlencode(p_path_campaign_id)
    );
    let mut req_builder = configuration
        .client
        .request(reqwest::Method::POST, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(param_value) = p_header_idempotency_key {
        req_builder = req_builder.header("Idempotency-Key", param_value.to_string());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };
    req_builder = req_builder.json(&p_body_duplicate_ad_campaign_request);

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DuplicateAdCampaign200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::DuplicateAdCampaign200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<DuplicateAdCampaignError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Copies an ad set, optionally with its ads and into another campaign, created paused so you can review it before launch.  The copy is created paused so callers can review before launching. `campaignId` retargets the copy into another campaign; omitted = the source's own campaign.  **Meta:** ads and creatives are included by default (`deepCopy: true`).  - The ad set is copied with Meta's `/copies` endpoint, then each of its ads (DELETED and ARCHIVED ones are skipped) into the new ad set. - So an ad set with any number of ads copies: Meta refuses a single deep copy of 3 or more objects. - `statusOption` applies to the ad set and every ad. - If an ad copy fails, the partial ad set copy is deleted and the request fails with Meta's error. - Sync discovery is triggered automatically (`syncAfter: false` to skip).  TikTok: the ad group is read and recreated under the campaign with its targeting, bidding, budget and schedule (start reset to now); `deepCopy: true` recreates its ads too (default false). `startTime`, `endTime` and `renameStrategy` are ignored and `statusOption` must be PAUSED or absent. The copy appears on the next discovery sync.
pub async fn duplicate_ad_set(
    configuration: &configuration::Configuration,
    ad_set_id: &str,
    duplicate_ad_set_request: models::DuplicateAdSetRequest,
    idempotency_key: Option<&str>,
) -> Result<models::DuplicateAdSet200Response, Error<DuplicateAdSetError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_ad_set_id = ad_set_id;
    let p_body_duplicate_ad_set_request = duplicate_ad_set_request;
    let p_header_idempotency_key = idempotency_key;

    let uri_str = format!(
        "{}/v1/ads/ad-sets/{adSetId}/duplicate",
        configuration.base_path,
        adSetId = crate::apis::urlencode(p_path_ad_set_id)
    );
    let mut req_builder = configuration
        .client
        .request(reqwest::Method::POST, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(param_value) = p_header_idempotency_key {
        req_builder = req_builder.header("Idempotency-Key", param_value.to_string());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };
    req_builder = req_builder.json(&p_body_duplicate_ad_set_request);

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DuplicateAdSet200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::DuplicateAdSet200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<DuplicateAdSetError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Links new or existing assets to a Performance Max asset group and unlinks others in one change, keeping unlinked assets in the account library.  Link existing assets or new content to the asset group, and unlink assets, in one atomic request.  - Links are applied before unlinks, so swapping the last asset of a role does not trip Google's per-role minimum. - Unlinking removes the link only; the asset stays in the account library. - validateOnly: true validates without writing.
pub async fn edit_google_asset_group_assets(
    configuration: &configuration::Configuration,
    campaign_id: &str,
    asset_group_id: &str,
    edit_google_asset_group_assets_request: models::EditGoogleAssetGroupAssetsRequest,
) -> Result<models::EditGoogleAssetGroupAssets200Response, Error<EditGoogleAssetGroupAssetsError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_campaign_id = campaign_id;
    let p_path_asset_group_id = asset_group_id;
    let p_body_edit_google_asset_group_assets_request = edit_google_asset_group_assets_request;

    let uri_str = format!(
        "{}/v1/ads/campaigns/{campaignId}/asset-groups/{assetGroupId}/assets",
        configuration.base_path,
        campaignId = crate::apis::urlencode(p_path_campaign_id),
        assetGroupId = crate::apis::urlencode(p_path_asset_group_id)
    );
    let mut req_builder = configuration
        .client
        .request(reqwest::Method::POST, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };
    req_builder = req_builder.json(&p_body_edit_google_asset_group_assets_request);

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::EditGoogleAssetGroupAssets200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::EditGoogleAssetGroupAssets200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<EditGoogleAssetGroupAssetsError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Shows one ad with its creative, targeting, status and performance metrics.  ### Google Search ads  Google Search ads include current creative.headlines, creative.descriptions and creative.finalUrls, preserving pinnedField. Top-level cachedAt and stale report cache freshness. Google mutations invalidate this read.  RSA enrichment requires a stored advertisingChannelType of SEARCH. Ads with an unknown or other channel return their stored details without a Google read. If RSA enrichment fails, the stored ad is returned with HTTP 200 and without cache metadata.  ### Accepted ad ids  The `{adId}` path segment accepts any identifier dialect Zernio indexes for the ad:  - the Zernio internal `_id` (24-char hex) - Meta's numeric `platformAdId` (the value shipped in `comment.received` webhooks as `comment.ad.id`) - the creative's `effective_object_story_id` (`{pageId}_{postId}` shape, Facebook side) - the creative's `effective_instagram_media_id` (Instagram side) - an Instagram media id an ad comment arrived on (`comment.platformPostId` of a `comment.received` carrying `comment.ad.id`), including the extra media Meta creates for placement variants  Any of these resolve to the same ad, so the caller doesn't need a translation step.  `creative.creativeFeatures` holds the stored requested settings, which do not confirm platform application.  ### Facebook ad dark posts  Meta gives an ad with per-placement assets one extra unpublished post per placement, and comments land on it. Meta exposes no link from that post to its ad.  - When exactly one ad on the Page, created before the dark post, carries the same copy as the post, the dark post id resolves to that ad. - Otherwise, when the id is a dark post Zernio has seen comments on and its Page is connected, the response is `ad: null` plus `darkPost`. It carries the Meta Ads account and the ad accounts running ads for that Page.  Read its comments with GET /v1/ads/{adId}/comments using the same id.  ### Status freshness  `status`, `configuredStatus`, `platformStatus`, `platformAdSetStatus` and `platformCampaignStatus` are the values Zernio last stored.  Background sync refreshes them, typically within 15 to 60 minutes (Google up to about 3 hours), and ended or long-paused objects may be refreshed less often.  Zernio's own status writes re-read the switches they change. A change made in the platform's own ads manager therefore shows up here only after the next sync.  Controllers that act on a switch should pass `live=true`. It reads the switches from the platform now, stores them, and returns `statusReadAt` (null when the read failed and the stored values were returned).  With `live=true` these are read live:  - the ad's own switch (`configuredStatus`) - its delivery status (`status`, `platformStatus`) - its ad set and campaign switches (`platformAdSetStatus`, `platformCampaignStatus`)  ### Meta ads that are not synced yet  Pass `accountId` with a Meta `platformAdId` to read an ad Zernio has not synced (for example one created in Ads Manager on an ad account reached only through a Facebook connection).  The ad is read live from Meta and mapped exactly like a synced row: name, `status`, `platformStatus`, `configuredStatus`, `platformAdSetId`, `platformCampaignId`, campaign and ad set names, budgets, and `creative` with its `id`, body, link, image and video.  It comes back with `synced: false`, no `id` (it has no Zernio row) and `statusReadAt` set to the time of the read. Synced ads answer `synced: true`.  Only a numeric id takes this path, so dark post ids (`{pageId}_{postId}`) keep the dark post lookup above.
pub async fn get_ad(
    configuration: &configuration::Configuration,
    ad_id: &str,
    live: Option<bool>,
    account_id: Option<&str>,
) -> Result<models::GetAd200Response, Error<GetAdError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_ad_id = ad_id;
    let p_query_live = live;
    let p_query_account_id = account_id;

    let uri_str = format!(
        "{}/v1/ads/{adId}",
        configuration.base_path,
        adId = crate::apis::urlencode(p_path_ad_id)
    );
    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);

    if let Some(ref param_value) = p_query_live {
        req_builder = req_builder.query(&[("live", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_account_id {
        req_builder = req_builder.query(&[("accountId", &param_value.to_string())]);
    }
    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetAd200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetAd200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<GetAdError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Shows a Meta campaign's current settings straight from Meta, such as its objective, budget, bid strategy, schedule and delivery issues.  It reads one campaign live from Meta, returned verbatim, so a caller that knows a campaign id no longer has to page `GET /v1/ads/campaigns` to find it.  The default projection covers name, status, objective, buying type, bid strategy, budgets, spend cap, schedule and `issues_info`.  ### Fields and errors  - `fields` is a raw-passthrough override; unknown fields return Meta's 400 verbatim. - A campaign the resolved connection cannot see comes back as Meta's own 400, not a 404.
pub async fn get_ad_campaign_details(
    configuration: &configuration::Configuration,
    campaign_id: &str,
    account_id: &str,
    fields: Option<&str>,
) -> Result<models::GetAdCampaignDetails200Response, Error<GetAdCampaignDetailsError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_campaign_id = campaign_id;
    let p_query_account_id = account_id;
    let p_query_fields = fields;

    let uri_str = format!(
        "{}/v1/ads/campaigns/{campaignId}",
        configuration.base_path,
        campaignId = crate::apis::urlencode(p_path_campaign_id)
    );
    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);

    req_builder = req_builder.query(&[("accountId", &p_query_account_id.to_string())]);
    if let Some(ref param_value) = p_query_fields {
        req_builder = req_builder.query(&[("fields", &param_value.to_string())]);
    }
    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetAdCampaignDetails200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetAdCampaignDetails200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<GetAdCampaignDetailsError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Shows whether the platform approved an ad, where it may not deliver, and every rejection reason, without re-enabling a paused ad.  It reads the ad's review verdict from the platform now, including every rejection reason with TikTok's suggestion and the piece of content it refers to. It is read-only, so it works on a paused ad without re-enabling it.  Supported on TikTok, Google and Meta. Other platforms return 501.  ### Google  Reads `ad_group_ad.policy_summary` live. `approvalStatus` and `reviewStatus` are Google's verbatim:  - `approvalStatus`: APPROVED, APPROVED_LIMITED, AREA_OF_INTEREST_ONLY, DISAPPROVED, UNKNOWN. - `reviewStatus`: REVIEW_IN_PROGRESS, REVIEWED, UNDER_APPEAL, ELIGIBLE_MAY_SERVE. - `approved`: true for the three approved statuses, false for DISAPPROVED, null otherwise.  `policyTopics` carries every policy topic entry with its `type` (PROHIBITED, LIMITED, ...) and Google's `evidences` and `constraints` verbatim. Each PROHIBITED topic is also listed in `rejections` (reason = the topic).  The `forbidden*` arrays are TikTok-only and always empty on Google.  ### Meta (Facebook and Instagram ads)  Reads the Ad's `ad_review_feedback`, `effective_status` and `issues_info` live.  - `reviewStatus`: Meta's `effective_status` verbatim (ACTIVE, PAUSED, PENDING_REVIEW, DISAPPROVED, PREAPPROVED, WITH_ISSUES, IN_PROCESS, ...). - `approved`: true for ACTIVE and PREAPPROVED, false for DISAPPROVED, null otherwise. - `reviewFeedback`: Meta's feedback verbatim, as `global` (reason -> explanation) and `placementSpecific` (placement -> reason -> explanation). - `issues`: Meta's `issues_info` verbatim.  Each global reason is listed in `rejections`, and so is each placement-specific reason, with that placement in its `forbiddenPlacements`. The review's `forbiddenPlacements` lists every placement with feedback.  `forbiddenAges`, `forbiddenLocations` and `forbiddenOperatingSystems` are always empty on Meta.  When Meta returns no feedback (usually an ad in review or approved everywhere), the status comes back with empty `rejections` and empty `reviewFeedback` maps. An ACTIVE ad rejected on one placement still carries that placement's feedback.  The `effective_status` read is also stored on the ad, so `GET /v1/ads/{adId}` returns it next. A deleted ad answers 404.  ### Meta ads that are not synced yet  Pass `accountId` with a Meta platform ad id that is not in Zernio's store to read its review live through that connection. The response then has `adId: null`, `synced: false`, and nothing is stored. Synced ads answer `synced: true`.  ### TikTok  TikTok uses `/ad/review_info/`. Use it alongside the ad's `platformStatus`:  - `AD_STATUS_AUDIT`: the ad is in review (maps to `status: pending_review`). - `AD_STATUS_AD_PRE_ONLINE`: it passed and is about to deliver (also maps to `status: pending_review`). - `AD_STATUS_AUDIT_DENY`: maps to `rejected`.
pub async fn get_ad_review(
    configuration: &configuration::Configuration,
    ad_id: &str,
    account_id: Option<&str>,
) -> Result<models::GetAdReview200Response, Error<GetAdReviewError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_ad_id = ad_id;
    let p_query_account_id = account_id;

    let uri_str = format!(
        "{}/v1/ads/{adId}/review",
        configuration.base_path,
        adId = crate::apis::urlencode(p_path_ad_id)
    );
    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);

    if let Some(ref param_value) = p_query_account_id {
        req_builder = req_builder.query(&[("accountId", &param_value.to_string())]);
    }
    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetAdReview200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetAdReview200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<GetAdReviewError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Shows a Meta ad set's current settings straight from Meta, including its learning phase, budget, schedule and targeting.  The ad set is read live from Meta and returned verbatim. The default projection includes:  - `learning_stage_info`: learning-phase status, LEARNING / SUCCESS / FAIL / WAIVING. Meta omits its `status` key on paused ad sets. - delivery settings, budgets and schedule - dayparting (`adset_schedule`, `pacing_type`) - targeting  `fields` is a raw-passthrough override; unknown fields return Meta's 400 verbatim.
pub async fn get_ad_set_details(
    configuration: &configuration::Configuration,
    ad_set_id: &str,
    account_id: &str,
    fields: Option<&str>,
) -> Result<models::GetAdSetDetails200Response, Error<GetAdSetDetailsError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_ad_set_id = ad_set_id;
    let p_query_account_id = account_id;
    let p_query_fields = fields;

    let uri_str = format!(
        "{}/v1/ads/ad-sets/{adSetId}",
        configuration.base_path,
        adSetId = crate::apis::urlencode(p_path_ad_set_id)
    );
    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);

    req_builder = req_builder.query(&[("accountId", &p_query_account_id.to_string())]);
    if let Some(ref param_value) = p_query_fields {
        req_builder = req_builder.query(&[("fields", &param_value.to_string())]);
    }
    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetAdSetDetails200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetAdSetDetails200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<GetAdSetDetailsError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Shows a Reddit ad group's live targeting and schedule in the same shape PUT /v1/ads/ad-sets/{adSetId} takes, so you can prefill an editor.  It is read live from Reddit on every call. Reddit only; every other platform returns 501.  ### How fields come back  - Location and interest names are resolved with Reddit's targeting taxonomy. When Reddit cannot resolve them the ids stand in as names, and a location that is not a two-letter country is listed under `regions`. - Excluded DMAs are listed under `excludedLocations.regions`, since excluded locations have no metro list. - Languages come back as lowercase ISO 639-1 codes. - Targeting Zernio cannot edit (devices, platforms, carriers, automated expansion) is left out and kept on every edit.
pub async fn get_ad_set_targeting(
    configuration: &configuration::Configuration,
    ad_set_id: &str,
    platform: Option<&str>,
) -> Result<models::GetAdSetTargeting200Response, Error<GetAdSetTargetingError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_ad_set_id = ad_set_id;
    let p_query_platform = platform;

    let uri_str = format!(
        "{}/v1/ads/ad-sets/{adSetId}/targeting",
        configuration.base_path,
        adSetId = crate::apis::urlencode(p_path_ad_set_id)
    );
    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);

    if let Some(ref param_value) = p_query_platform {
        req_builder = req_builder.query(&[("platform", &param_value.to_string())]);
    }
    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetAdSetTargeting200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetAdSetTargeting200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<GetAdSetTargetingError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Shows your campaigns with their ad sets and ads nested inside, with spend and results rolled up at every level.  ### How it aggregates  Uses a two-stage aggregation: ads are grouped into ad sets, then ad sets into campaigns. Metrics are computed over an optional date range, then rolled up from ad level to ad set and campaign levels.  - Pagination is at the campaign level. - Ads without a campaign or ad set ID are grouped into synthetic \"Ungrouped\" buckets. - If no date range is provided, defaults to the last 90 days. Date range is capped at 730 days max.  ### History  When an ad account connects, Zernio imports its last 90 days of metrics, so the metrics hold no data for days before that.  When `accountId` or `adAccountId` resolves to a Meta ad account, a range reaching further back answers `202` with `backfillPending: true` and the covered part.  The older days (up to 730 days back) are imported in the background; repeat the request until it returns 200. A request scoped to no Meta account never returns `202`.  ### Daily breakdown  Pass `timeIncrement=1` to also get a daily breakdown: each node gains a `daily[]` array of per-day metrics (same fields as the aggregated `metrics`) in the same call.  Use `dailyLevel` (`campaign` default, or `adset` / `ad`) to choose which levels carry the series. This replaces calling the tree once per day for per-campaign daily trends.  ### Deleted objects stay in the tree  Deleting an ad or a campaign is a soft delete: the Ad documents move to `status: cancelled` and are kept indefinitely. Their historical spend still counts toward the metrics of any date range they fall in. There is no pruning job and no retention window.  Filter on `status` if your view should hide them, but do that after reading the totals, not before.
pub async fn get_ad_tree(
    configuration: &configuration::Configuration,
    page: Option<i32>,
    limit: Option<i32>,
    source: Option<&str>,
    platform: Option<&str>,
    status: Option<models::AdStatus>,
    ad_account_id: Option<&str>,
    page_id: Option<&str>,
    account_id: Option<&str>,
    profile_id: Option<&str>,
    campaign_id: Option<&str>,
    updated_since: Option<String>,
    search: Option<&str>,
    from_date: Option<String>,
    to_date: Option<String>,
    has_delivery: Option<bool>,
    min_spend: Option<f64>,
    sort: Option<&str>,
    time_increment: Option<i32>,
    daily_level: Option<&str>,
    compare: Option<&str>,
) -> Result<models::AdTreeResponse, Error<GetAdTreeError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_query_page = page;
    let p_query_limit = limit;
    let p_query_source = source;
    let p_query_platform = platform;
    let p_query_status = status;
    let p_query_ad_account_id = ad_account_id;
    let p_query_page_id = page_id;
    let p_query_account_id = account_id;
    let p_query_profile_id = profile_id;
    let p_query_campaign_id = campaign_id;
    let p_query_updated_since = updated_since;
    let p_query_search = search;
    let p_query_from_date = from_date;
    let p_query_to_date = to_date;
    let p_query_has_delivery = has_delivery;
    let p_query_min_spend = min_spend;
    let p_query_sort = sort;
    let p_query_time_increment = time_increment;
    let p_query_daily_level = daily_level;
    let p_query_compare = compare;

    let uri_str = format!("{}/v1/ads/tree", configuration.base_path);
    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);

    if let Some(ref param_value) = p_query_page {
        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_limit {
        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_source {
        req_builder = req_builder.query(&[("source", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_platform {
        req_builder = req_builder.query(&[("platform", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_status {
        req_builder = req_builder.query(&[("status", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_ad_account_id {
        req_builder = req_builder.query(&[("adAccountId", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_page_id {
        req_builder = req_builder.query(&[("pageId", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_account_id {
        req_builder = req_builder.query(&[("accountId", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_profile_id {
        req_builder = req_builder.query(&[("profileId", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_campaign_id {
        req_builder = req_builder.query(&[("campaignId", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_updated_since {
        req_builder = req_builder.query(&[("updatedSince", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_search {
        req_builder = req_builder.query(&[("search", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_from_date {
        req_builder = req_builder.query(&[("fromDate", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_to_date {
        req_builder = req_builder.query(&[("toDate", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_has_delivery {
        req_builder = req_builder.query(&[("hasDelivery", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_min_spend {
        req_builder = req_builder.query(&[("minSpend", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_sort {
        req_builder = req_builder.query(&[("sort", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_time_increment {
        req_builder = req_builder.query(&[("timeIncrement", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_daily_level {
        req_builder = req_builder.query(&[("dailyLevel", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_compare {
        req_builder = req_builder.query(&[("compare", &param_value.to_string())]);
    }
    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AdTreeResponse`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::AdTreeResponse`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<GetAdTreeError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Returns an ads account's spend, results and other metrics day by day, ready for a daily performance chart.  The result is a single time series of daily aggregate metrics across all ads in a SocialAccount: one row per calendar day and currency in the requested range (one row per day unless the account's ad accounts bill in different currencies).  Use this for dashboards that draw a daily-spend or daily-conversions chart, instead of calling `/v1/ads/tree` once per day.  ### Parameters  - `accountId` is required. The lookup is sibling-expanded, so passing the `metaads` ID also includes ads under the linked `facebook` / `instagram` posting account (and vice-versa), the same convention as `/v1/ads/tree` and `/v1/ads`. - Date range defaults to the last 90 days. Capped at 730 days. - With adAccountId set to a Google customer id this is the customer-level performance report (clicks, cost, impressions, conversions, all conversions per day).  ### History  When an ad account connects, Zernio imports its last 90 days of metrics, so `rows` hold no data for days before that.  When `accountId` or `adAccountId` resolves to a Meta ad account, a range reaching further back answers `202` with `backfillPending: true` and the covered part. The older days (up to 730 days back) are imported in the background; repeat the request until it returns 200.  Other platforms never return `202`.
pub async fn get_ads_timeline(
    configuration: &configuration::Configuration,
    account_id: &str,
    ad_account_id: Option<&str>,
    from_date: Option<String>,
    to_date: Option<String>,
    platform: Option<&str>,
    compare: Option<&str>,
) -> Result<models::AdsTimelineResponse, Error<GetAdsTimelineError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_query_account_id = account_id;
    let p_query_ad_account_id = ad_account_id;
    let p_query_from_date = from_date;
    let p_query_to_date = to_date;
    let p_query_platform = platform;
    let p_query_compare = compare;

    let uri_str = format!("{}/v1/ads/timeline", configuration.base_path);
    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);

    req_builder = req_builder.query(&[("accountId", &p_query_account_id.to_string())]);
    if let Some(ref param_value) = p_query_ad_account_id {
        req_builder = req_builder.query(&[("adAccountId", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_from_date {
        req_builder = req_builder.query(&[("fromDate", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_to_date {
        req_builder = req_builder.query(&[("toDate", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_platform {
        req_builder = req_builder.query(&[("platform", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_compare {
        req_builder = req_builder.query(&[("compare", &param_value.to_string())]);
    }
    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AdsTimelineResponse`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::AdsTimelineResponse`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<GetAdsTimelineError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Shows the days and hours a Google campaign runs and its bid adjustments, optionally with performance by day and hour.  The windows a Google campaign serves in, with the bid modifier on each, plus the criterion ids Google minted for them.  An EMPTY `schedule` is meaningful and is not a failed lookup: Google has no \"all day\" criterion, so a campaign with no ad schedule serves around the clock. `servesAroundTheClock` states that explicitly.  Set `includePerformance=true` to also get delivery split by day of week and by hour, which is the evidence for deciding what the schedule should be. It is one extra Google call segmented by both dimensions at once, so the two views always agree.  Google Ads only. The response carries `cachedAt` and `stale`, set when a quota-exhausted call falls back to the last-good copy instead of a live read.
pub async fn get_campaign_ad_schedule(
    configuration: &configuration::Configuration,
    campaign_id: &str,
    platform: Option<&str>,
    include_performance: Option<bool>,
    window_days: Option<i32>,
    from_date: Option<String>,
    to_date: Option<String>,
) -> Result<models::GetCampaignAdSchedule200Response, Error<GetCampaignAdScheduleError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_campaign_id = campaign_id;
    let p_query_platform = platform;
    let p_query_include_performance = include_performance;
    let p_query_window_days = window_days;
    let p_query_from_date = from_date;
    let p_query_to_date = to_date;

    let uri_str = format!(
        "{}/v1/ads/campaigns/{campaignId}/ad-schedule",
        configuration.base_path,
        campaignId = crate::apis::urlencode(p_path_campaign_id)
    );
    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);

    if let Some(ref param_value) = p_query_platform {
        req_builder = req_builder.query(&[("platform", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_include_performance {
        req_builder = req_builder.query(&[("includePerformance", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_window_days {
        req_builder = req_builder.query(&[("windowDays", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_from_date {
        req_builder = req_builder.query(&[("fromDate", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_to_date {
        req_builder = req_builder.query(&[("toDate", &param_value.to_string())]);
    }
    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetCampaignAdSchedule200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetCampaignAdSchedule200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<GetCampaignAdScheduleError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Shows a Google campaign's current bidding strategy and targets, ready to prefill an edit.  Reads the campaign's bidding strategy on Google, cached for the quota window, for pre-filling the bid strategy block before a PUT to /v1/ads/campaigns/{campaignId}.  Google Ads only. `platform` is required and rejected when it is anything else, since a `campaignId` is not globally unique.  The response carries `cachedAt` and `stale`, set when a quota-exhausted call falls back to the last-good copy instead of a live read.  ### Strategy mapping  Maps Google's bidding strategy onto the same triplet PUT accepts:  - `LOWEST_COST_WITHOUT_CAP`: Maximize Conversions, no target - `COST_CAP` + `bidAmount`: Target CPA - `LOWEST_COST_WITH_MIN_ROAS` + `roasAverageFloor`: Target ROAS - `LOWEST_COST_WITH_BID_CAP` + `bidAmount`: Maximize Clicks with a CPC ceiling  A campaign on a portfolio strategy returns `portfolio` (id + name) and `bidSpec.portfolioBidStrategyId` instead of the triplet.  Anything else (Manual CPC, Target Impression Share, ...) returns `bidSpec: null`; show `biddingStrategyType` as-is.
pub async fn get_campaign_bidding(
    configuration: &configuration::Configuration,
    campaign_id: &str,
    account_id: &str,
    platform: &str,
    ad_account_id: Option<&str>,
    customer_id: Option<&str>,
) -> Result<models::GetCampaignBidding200Response, Error<GetCampaignBiddingError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_campaign_id = campaign_id;
    let p_query_account_id = account_id;
    let p_query_platform = platform;
    let p_query_ad_account_id = ad_account_id;
    let p_query_customer_id = customer_id;

    let uri_str = format!(
        "{}/v1/ads/campaigns/{campaignId}/bidding",
        configuration.base_path,
        campaignId = crate::apis::urlencode(p_path_campaign_id)
    );
    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);

    req_builder = req_builder.query(&[("accountId", &p_query_account_id.to_string())]);
    req_builder = req_builder.query(&[("platform", &p_query_platform.to_string())]);
    if let Some(ref param_value) = p_query_ad_account_id {
        req_builder = req_builder.query(&[("adAccountId", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_customer_id {
        req_builder = req_builder.query(&[("customerId", &param_value.to_string())]);
    }
    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetCampaignBidding200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetCampaignBidding200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<GetCampaignBiddingError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Shows which conversion goals a Google campaign bids on, and whether it follows the account defaults or uses its own or a custom goal.  A Google campaign's conversion goals (CampaignConversionGoal, `biddable` per category and origin) and its goal config (ConversionGoalCampaignConfig): `goalConfigLevel` CUSTOMER means the campaign follows the account-default goals, CAMPAIGN means it uses its own goals or `customConversionGoalId`.
pub async fn get_campaign_conversion_goals(
    configuration: &configuration::Configuration,
    campaign_id: &str,
) -> Result<models::GetCampaignConversionGoals200Response, Error<GetCampaignConversionGoalsError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_campaign_id = campaign_id;

    let uri_str = format!(
        "{}/v1/ads/campaigns/{campaignId}/conversion-goals",
        configuration.base_path,
        campaignId = crate::apis::urlencode(p_path_campaign_id)
    );
    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetCampaignConversionGoals200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetCampaignConversionGoals200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<GetCampaignConversionGoalsError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Shows a Google campaign's device, location, excluded location and language targeting so you can build an editor for it.  Google Ads compliance requires geo, language, budget, and bidding targeting set at creation to stay editable afterwards. This reads the campaign state so an integrator can build an editor around it.  - Cached for the quota window (10 minutes fresh, up to 7 days last-good), not always a live read. - Google only; every other platform returns 501.  ### Devices  `devices` lists the device criteria the campaign carries, which depends on its channel:  - Search campaigns have MOBILE, DESKTOP and TABLET. - Display campaigns also have CONNECTED_TV.  `bidModifier` is Google's bid adjustment for that device: `null` when it has none, and `0` when the device is switched off. `included` is false for exactly that case.  ### Locations  `excludedLocations` lists the campaign's negative location criteria (the places it never serves in).  `locations` still lists every location criterion, each flagged with `negative`, so a client reading the targeted set filters `negative: false`.
pub async fn get_campaign_targeting(
    configuration: &configuration::Configuration,
    campaign_id: &str,
    platform: Option<&str>,
) -> Result<models::GetCampaignTargeting200Response, Error<GetCampaignTargetingError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_campaign_id = campaign_id;
    let p_query_platform = platform;

    let uri_str = format!(
        "{}/v1/ads/campaigns/{campaignId}/targeting",
        configuration.base_path,
        campaignId = crate::apis::urlencode(p_path_campaign_id)
    );
    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);

    if let Some(ref param_value) = p_query_platform {
        req_builder = req_builder.query(&[("platform", &param_value.to_string())]);
    }
    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetCampaignTargeting200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetCampaignTargeting200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<GetCampaignTargetingError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Shows one Performance Max asset group with its linked assets, ad strength, status and product targeting tree.  One asset group with its linked assets, ad strength, primary status and listing-group tree. Uses a 10-minute cache, served stale when Google quota is exhausted; any write below clears it.
pub async fn get_google_asset_group(
    configuration: &configuration::Configuration,
    campaign_id: &str,
    asset_group_id: &str,
) -> Result<models::GetGoogleAssetGroup200Response, Error<GetGoogleAssetGroupError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_campaign_id = campaign_id;
    let p_path_asset_group_id = asset_group_id;

    let uri_str = format!(
        "{}/v1/ads/campaigns/{campaignId}/asset-groups/{assetGroupId}",
        configuration.base_path,
        campaignId = crate::apis::urlencode(p_path_campaign_id),
        assetGroupId = crate::apis::urlencode(p_path_asset_group_id)
    );
    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetGoogleAssetGroup200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetGoogleAssetGroup200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<GetGoogleAssetGroupError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Shows which Spark post, video or carousel of an Upgraded Smart+ ad TikTok approved or rejected, with every rejection reason, keyed by the TikTok post id for a Spark post.  It reads TikTok's `/smart_plus/ad/review_info/` live (read-only, works on a paused ad) for the Smart+ ad that holds `adId`. It returns the ad-level verdict plus one entry per creative.  ### Which ad is read  `adId` may be the Smart+ ad itself or any creative of it synced as its own ad. Zernio finds the Smart+ ad in the ad's ad group through `/smart_plus/ad/get/`, and uses the ad group's only Smart+ ad when no creative list names the ad.  ### Creative fields  `materialType`, `tiktokItemId`, `videoId`, `name` and `operationStatus` come from the Smart+ ad's `creative_list`. Some entries come back with the review verdict and null descriptive fields:  - creatives TikTok added on its own, which it leaves out of that list (creator content, authorized TikTok posts, Creative Library content) - each image of a carousel, which TikTok lists under its own material id  TikTok returns no review timestamp; `readAt` is when Zernio read it.  ### Quota and caching  TikTok's review endpoint has a strict quota of its own (TikTok documents neither the quota nor its scope). One TikTok call reads the review of the live Smart+ ads of the ad group, up to 50 creatives in total (TikTok refuses more).  Each review is stored per connection, advertiser and Smart+ ad. A review read in the last 10 minutes is served from the store, so sibling ads are answered without a TikTok call and `readAt` can be up to 10 minutes old. An older one is read again.  Read reviews when you need them instead of sweeping every ad on a loop.  ### Over quota  When TikTok answers over quota, Zernio returns 429. It then answers 429 for that advertiser and connection without calling TikTok:  - for about 60 seconds at first - then 120, and up to 240, while TikTok keeps refusing - about 60 again after a successful call  Each pause has up to 10% of random jitter, with the time left as `Retry-After`. Reviews read in the last 10 minutes are still served.
pub async fn get_tik_tok_smart_plus_ad_review(
    configuration: &configuration::Configuration,
    ad_id: &str,
) -> Result<models::GetTikTokSmartPlusAdReview200Response, Error<GetTikTokSmartPlusAdReviewError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_ad_id = ad_id;

    let uri_str = format!(
        "{}/v1/ads/{adId}/tiktok-smart-plus-review",
        configuration.base_path,
        adId = crate::apis::urlencode(p_path_ad_id)
    );
    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetTikTokSmartPlusAdReview200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetTikTokSmartPlusAdReview200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<GetTikTokSmartPlusAdReviewError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Lists your campaigns with spend, impressions and clicks summed across their ads, plus each campaign's status and budget.  Campaigns are virtual aggregations over ad documents grouped by platform campaign ID. Metrics (spend, impressions, clicks, etc.) are summed across all ads in each campaign.  Campaign status is derived from child ad statuses: active > pending_review > paused > error > completed > cancelled > rejected.  Google campaign budgets include amountMicros, explicitlyShared, resourceName and deliveryMethod after the next successful sync. This endpoint does not fetch Google live.  **Status freshness.** `status`, `configuredStatus`, `platformStatus`, `platformAdSetStatus` and `platformCampaignStatus` are the values Zernio last stored.  Background sync refreshes them, typically within 15 to 60 minutes (Google up to about 3 hours), and ended or long-paused objects may be refreshed less often.  Zernio's own status writes re-read the switches they change. A change made in the platform's own ads manager therefore shows up here only after the next sync.  ### Live status reads  Controllers that act on a switch should pass `live=true`. It reads the switches from the platform now, stores them, and returns `statusReadAt` (null when the read failed and the stored values were returned).  - `live=true` needs `limit` of 20 or less. - Each returned campaign's own switch (`platformCampaignStatus`) is read live. - Live reads cover TikTok, Meta, Google, OpenAI and Reddit. - The rolled-up `status` is not re-derived by a live read.  **Budgets here are SYNCED**, never read live, including with `live=true`. To read the current budgets (and status) of every campaign and ad set of a Meta ad account live in one call, for example as a pre-write spend gate, use GET /v1/ads/accounts/live.
pub async fn list_ad_campaigns(
    configuration: &configuration::Configuration,
    include_empty: Option<bool>,
    page: Option<i32>,
    limit: Option<i32>,
    source: Option<&str>,
    platform: Option<&str>,
    status: Option<models::AdStatus>,
    ad_account_id: Option<&str>,
    campaign_id: Option<&str>,
    page_id: Option<&str>,
    account_id: Option<&str>,
    profile_id: Option<&str>,
    from_date: Option<String>,
    to_date: Option<String>,
    has_delivery: Option<bool>,
    min_spend: Option<f64>,
    live: Option<bool>,
) -> Result<models::ListAdCampaigns200Response, Error<ListAdCampaignsError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_query_include_empty = include_empty;
    let p_query_page = page;
    let p_query_limit = limit;
    let p_query_source = source;
    let p_query_platform = platform;
    let p_query_status = status;
    let p_query_ad_account_id = ad_account_id;
    let p_query_campaign_id = campaign_id;
    let p_query_page_id = page_id;
    let p_query_account_id = account_id;
    let p_query_profile_id = profile_id;
    let p_query_from_date = from_date;
    let p_query_to_date = to_date;
    let p_query_has_delivery = has_delivery;
    let p_query_min_spend = min_spend;
    let p_query_live = live;

    let uri_str = format!("{}/v1/ads/campaigns", configuration.base_path);
    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);

    if let Some(ref param_value) = p_query_include_empty {
        req_builder = req_builder.query(&[("includeEmpty", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_page {
        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_limit {
        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_source {
        req_builder = req_builder.query(&[("source", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_platform {
        req_builder = req_builder.query(&[("platform", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_status {
        req_builder = req_builder.query(&[("status", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_ad_account_id {
        req_builder = req_builder.query(&[("adAccountId", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_campaign_id {
        req_builder = req_builder.query(&[("campaignId", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_page_id {
        req_builder = req_builder.query(&[("pageId", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_account_id {
        req_builder = req_builder.query(&[("accountId", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_profile_id {
        req_builder = req_builder.query(&[("profileId", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_from_date {
        req_builder = req_builder.query(&[("fromDate", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_to_date {
        req_builder = req_builder.query(&[("toDate", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_has_delivery {
        req_builder = req_builder.query(&[("hasDelivery", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_min_spend {
        req_builder = req_builder.query(&[("minSpend", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_live {
        req_builder = req_builder.query(&[("live", &param_value.to_string())]);
    }
    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ListAdCampaigns200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ListAdCampaigns200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<ListAdCampaignsError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Lists the sitelinks, callouts, snippets and images attached directly to a Google ad group, not those inherited from the campaign or account.  Fresh reads are cached for 10 minutes; exhausted quota may return the last successful read with stale=true. Inherited assets are not included.
pub async fn list_ad_group_assets(
    configuration: &configuration::Configuration,
    ad_set_id: &str,
    account_id: &str,
    ad_account_id: Option<&str>,
    customer_id: Option<&str>,
) -> Result<models::ListAdGroupAssets200Response, Error<ListAdGroupAssetsError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_ad_set_id = ad_set_id;
    let p_query_account_id = account_id;
    let p_query_ad_account_id = ad_account_id;
    let p_query_customer_id = customer_id;

    let uri_str = format!(
        "{}/v1/ads/ad-sets/{adSetId}/assets",
        configuration.base_path,
        adSetId = crate::apis::urlencode(p_path_ad_set_id)
    );
    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);

    req_builder = req_builder.query(&[("accountId", &p_query_account_id.to_string())]);
    if let Some(ref param_value) = p_query_ad_account_id {
        req_builder = req_builder.query(&[("adAccountId", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_customer_id {
        req_builder = req_builder.query(&[("customerId", &param_value.to_string())]);
    }
    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ListAdGroupAssets200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ListAdGroupAssets200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<ListAdGroupAssetsError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Lists the keywords and negative keywords in your Google Search ad groups.  Returns the Google Search keyword criteria (positive and negative) synced from connected Google Ads accounts, one row per ad-group keyword.  Campaign-level negative keywords are not included; only ad-group-level criteria are.  ### Freshness  Keywords are refreshed about once a day per Google Ads customer (the keyword sweep rides the ads discovery pass on a slower slot). So keywords added on Google can take up to a day to appear.  - A customer synced for the first time is populated on the next discovery pass rather than waiting for its daily slot. - Connecting an account or triggering a manual sync refreshes it immediately.
pub async fn list_ad_keywords(
    configuration: &configuration::Configuration,
    page: Option<i32>,
    limit: Option<i32>,
    account_id: Option<&str>,
    ad_account_id: Option<&str>,
    profile_id: Option<&str>,
    campaign_id: Option<&str>,
    ad_set_id: Option<&str>,
    status: Option<&str>,
    match_type: Option<&str>,
    negative: Option<bool>,
    search: Option<&str>,
) -> Result<models::ListAdKeywords200Response, Error<ListAdKeywordsError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_query_page = page;
    let p_query_limit = limit;
    let p_query_account_id = account_id;
    let p_query_ad_account_id = ad_account_id;
    let p_query_profile_id = profile_id;
    let p_query_campaign_id = campaign_id;
    let p_query_ad_set_id = ad_set_id;
    let p_query_status = status;
    let p_query_match_type = match_type;
    let p_query_negative = negative;
    let p_query_search = search;

    let uri_str = format!("{}/v1/ads/keywords", configuration.base_path);
    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);

    if let Some(ref param_value) = p_query_page {
        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_limit {
        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_account_id {
        req_builder = req_builder.query(&[("accountId", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_ad_account_id {
        req_builder = req_builder.query(&[("adAccountId", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_profile_id {
        req_builder = req_builder.query(&[("profileId", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_campaign_id {
        req_builder = req_builder.query(&[("campaignId", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_ad_set_id {
        req_builder = req_builder.query(&[("adSetId", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_status {
        req_builder = req_builder.query(&[("status", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_match_type {
        req_builder = req_builder.query(&[("matchType", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_negative {
        req_builder = req_builder.query(&[("negative", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_search {
        req_builder = req_builder.query(&[("search", &param_value.to_string())]);
    }
    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ListAdKeywords200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ListAdKeywords200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<ListAdKeywordsError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Lists ad sets (ad groups on Google) with their targeting, bidding and optimization settings, optionally for one campaign.  Returns the ad sets (Google ad groups) synced for the connection, optionally filtered by platform and campaignId.  It reads the `ad_sets` table directly, independent of the `ads` rollup GET /v1/ads/tree uses. So a newly created standalone ad group with no ad yet (POST /v1/ads/ad-sets, Google only) is visible here. It stays invisible in the tree until an ad joins it via `adSetId` on POST /v1/ads/create.  ### Paging  Rows come newest first (by platform creation time, then id, so pages never overlap), 500 per page unless `limit` says otherwise. `pagination.total` counts every matching ad set and `page` reaches the rest.  ### Synced config  **This list is SYNCED, not live** (refreshed by background sync, see below). Each row also carries the ad set's config: `targeting`, `bidStrategy`, `bidAmount`, `optimizationGoal`, `billingEvent`, `promotedObject`.  So `?accountId=...&adAccountId=act_...` returns the config of every ad set of an ad account in one call, without a `campaignId`.  To read budgets, status, targeting, promoted object and bid strategy of every campaign and ad set of a Meta ad account LIVE in one call (for example as a pre-write spend gate), use GET /v1/ads/accounts/live instead.  ### Status freshness  `status`, `configuredStatus`, `platformStatus`, `platformAdSetStatus` and `platformCampaignStatus` are the values Zernio last stored.  Background sync refreshes them, typically within 15 to 60 minutes (Google up to about 3 hours). Ended or long-paused objects may be refreshed less often. Zernio's own status writes re-read the switches they change.  A change made in the platform's own ads manager therefore shows up here only after the next sync.  ### Live reads (`live=true`)  Controllers that act on a switch should pass `live=true`. It reads the switches from the platform now, stores them, and returns `statusReadAt` (null when the read failed and the stored values were returned).  - `live=true` needs a `campaignId` or `adSetId` filter. - Each listed ad set's own switch (`platformAdSetStatus`) is read live for the first 20 rows of the page. Later rows keep their synced value with `statusReadAt: null`. - To read more ad sets live, page with `limit=20`. - Live reads cover TikTok, Meta, Google, OpenAI and Reddit. - The rolled-up `status` is not re-derived by a live read.  ### TikTok live reads  On TikTok the same live read also returns the ad group's applied `optimizationGoal` and `billingEvent`, as TikTok's adgroup/get reports them. So you can verify the goal TikTok applied rather than the one you requested.  It also returns `nativeSettings`: a fixed subset of TikTok's own adgroup/get record for the ad group, with TikTok's own values, read in that same call. It covers budget, budget_mode, schedule, placements, locations, ages, gender, languages, interests, actions, audiences and exclusions, plus the advertiser's currency and timezone.  TikTok's `schedule_start_time` / `schedule_end_time` are UTC wall clocks (\"YYYY-MM-DD HH:MM:SS\", no offset); Ads Manager displays them in `advertiser_timezone`.  `configReadAt` says when it was read. It is null on every row whose native settings were not read now, so never treat a null as a match.  These are read, not retained create payloads, and are not stored.
pub async fn list_ad_sets(
    configuration: &configuration::Configuration,
    account_id: Option<&str>,
    ad_account_id: Option<&str>,
    campaign_id: Option<&str>,
    ad_set_id: Option<&str>,
    platform: Option<&str>,
    status: Option<models::AdStatus>,
    page: Option<i32>,
    limit: Option<i32>,
    live: Option<bool>,
) -> Result<models::ListAdSets200Response, Error<ListAdSetsError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_query_account_id = account_id;
    let p_query_ad_account_id = ad_account_id;
    let p_query_campaign_id = campaign_id;
    let p_query_ad_set_id = ad_set_id;
    let p_query_platform = platform;
    let p_query_status = status;
    let p_query_page = page;
    let p_query_limit = limit;
    let p_query_live = live;

    let uri_str = format!("{}/v1/ads/ad-sets", configuration.base_path);
    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);

    if let Some(ref param_value) = p_query_account_id {
        req_builder = req_builder.query(&[("accountId", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_ad_account_id {
        req_builder = req_builder.query(&[("adAccountId", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_campaign_id {
        req_builder = req_builder.query(&[("campaignId", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_ad_set_id {
        req_builder = req_builder.query(&[("adSetId", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_platform {
        req_builder = req_builder.query(&[("platform", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_status {
        req_builder = req_builder.query(&[("status", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_page {
        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_limit {
        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_live {
        req_builder = req_builder.query(&[("live", &param_value.to_string())]);
    }
    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ListAdSets200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ListAdSets200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<ListAdSetsError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Lists your ads with their performance over a date range, including ads created directly in each platform's ads manager.  Returns a paginated list of ads with metrics computed over an optional date range. Use source=all to include externally-synced ads from platform ad managers.  If no date range is provided, it defaults to the last 90 days. The date range is capped at 730 days max.  ### History  When an ad account connects, Zernio imports its last 90 days of metrics, so the metrics hold no data for days before that.  When `accountId` or `adAccountId` resolves to a Meta ad account, a range reaching further back answers `202` with `backfillPending: true` and the covered part. The older days (up to 730 days back) are imported in the background; repeat the request until it returns 200.  A request scoped to no Meta account never returns `202`.  ### Finding the ad behind a comment  To find the Zernio ad behind a comment you see in Meta Business Manager:  1. Filter by platformAdId (the Meta ad ID), effectiveObjectStoryId (Facebook), or effectiveInstagramMediaId (Instagram). Those are the post/media the ad's engagement lives on, and are also returned on each ad's `creative` object. 2. Call GET /v1/ads/{adId}/comments with the returned ad id.
pub async fn list_ads(
    configuration: &configuration::Configuration,
    page: Option<i32>,
    limit: Option<i32>,
    source: Option<&str>,
    status: Option<models::AdStatus>,
    platform: Option<&str>,
    account_id: Option<&str>,
    ad_account_id: Option<&str>,
    page_id: Option<&str>,
    profile_id: Option<&str>,
    campaign_id: Option<&str>,
    ad_set_id: Option<&str>,
    platform_ad_id: Option<&str>,
    effective_object_story_id: Option<&str>,
    effective_instagram_media_id: Option<&str>,
    from_date: Option<String>,
    to_date: Option<String>,
) -> Result<models::AdsListResponse, Error<ListAdsError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_query_page = page;
    let p_query_limit = limit;
    let p_query_source = source;
    let p_query_status = status;
    let p_query_platform = platform;
    let p_query_account_id = account_id;
    let p_query_ad_account_id = ad_account_id;
    let p_query_page_id = page_id;
    let p_query_profile_id = profile_id;
    let p_query_campaign_id = campaign_id;
    let p_query_ad_set_id = ad_set_id;
    let p_query_platform_ad_id = platform_ad_id;
    let p_query_effective_object_story_id = effective_object_story_id;
    let p_query_effective_instagram_media_id = effective_instagram_media_id;
    let p_query_from_date = from_date;
    let p_query_to_date = to_date;

    let uri_str = format!("{}/v1/ads", configuration.base_path);
    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);

    if let Some(ref param_value) = p_query_page {
        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_limit {
        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_source {
        req_builder = req_builder.query(&[("source", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_status {
        req_builder = req_builder.query(&[("status", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_platform {
        req_builder = req_builder.query(&[("platform", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_account_id {
        req_builder = req_builder.query(&[("accountId", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_ad_account_id {
        req_builder = req_builder.query(&[("adAccountId", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_page_id {
        req_builder = req_builder.query(&[("pageId", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_profile_id {
        req_builder = req_builder.query(&[("profileId", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_campaign_id {
        req_builder = req_builder.query(&[("campaignId", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_ad_set_id {
        req_builder = req_builder.query(&[("adSetId", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_platform_ad_id {
        req_builder = req_builder.query(&[("platformAdId", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_effective_object_story_id {
        req_builder = req_builder.query(&[("effectiveObjectStoryId", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_effective_instagram_media_id {
        req_builder = req_builder.query(&[("effectiveInstagramMediaId", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_from_date {
        req_builder = req_builder.query(&[("fromDate", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_to_date {
        req_builder = req_builder.query(&[("toDate", &param_value.to_string())]);
    }
    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AdsListResponse`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::AdsListResponse`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<ListAdsError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Lists what needs attention across your ads, most severe first:  - ads created in the last 90 days that were rejected - campaigns the platform reports delivery issues on - Meta ad accounts with a failed or overdue payment, or disabled while holding live ads - campaigns that spent on 3 or more of the last 7 days without a result (conversion, lead, purchase or conversation goals) - budgets spent to their daily cap yesterday  Built from stored data and the last 7 days of synced metrics, so it costs no platform call.  Each alert has a stable `id`. Dismiss one with `POST /v1/ads/alerts/{alertId}/dismiss` to hide it for 30 days.
pub async fn list_ads_alerts(
    configuration: &configuration::Configuration,
    account_id: Option<&str>,
    include_dismissed: Option<bool>,
) -> Result<models::ListAdsAlerts200Response, Error<ListAdsAlertsError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_query_account_id = account_id;
    let p_query_include_dismissed = include_dismissed;

    let uri_str = format!("{}/v1/ads/alerts", configuration.base_path);
    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);

    if let Some(ref param_value) = p_query_account_id {
        req_builder = req_builder.query(&[("accountId", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_include_dismissed {
        req_builder = req_builder.query(&[("includeDismissed", &param_value.to_string())]);
    }
    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ListAdsAlerts200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ListAdsAlerts200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<ListAdsAlertsError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Lists a Google Ads account's shared bid strategies with how many campaigns use each and how they performed.  The bidding strategy report covers type, status, campaign count, clicks, cost, cost per conversion, impressions, average CPC and conversions over the date range (default last 30 days).  ### Data source  It reads Google's `bidding_strategy` resource, cached for the quota window, and draws on the shared Google Ads operations budget.  The response carries `cachedAt` and `stale`, set when a quota-exhausted call falls back to the last-good copy instead of a live read.
pub async fn list_bid_strategies(
    configuration: &configuration::Configuration,
    account_id: &str,
    ad_account_id: Option<&str>,
    customer_id: Option<&str>,
    from_date: Option<String>,
    to_date: Option<String>,
) -> Result<models::ListBidStrategies200Response, Error<ListBidStrategiesError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_query_account_id = account_id;
    let p_query_ad_account_id = ad_account_id;
    let p_query_customer_id = customer_id;
    let p_query_from_date = from_date;
    let p_query_to_date = to_date;

    let uri_str = format!("{}/v1/ads/bid-strategies", configuration.base_path);
    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);

    req_builder = req_builder.query(&[("accountId", &p_query_account_id.to_string())]);
    if let Some(ref param_value) = p_query_ad_account_id {
        req_builder = req_builder.query(&[("adAccountId", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_customer_id {
        req_builder = req_builder.query(&[("customerId", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_from_date {
        req_builder = req_builder.query(&[("fromDate", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_to_date {
        req_builder = req_builder.query(&[("toDate", &param_value.to_string())]);
    }
    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ListBidStrategies200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ListBidStrategies200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<ListBidStrategiesError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Lists the sitelinks, callouts and other assets attached directly to a Google campaign.  Fresh reads are cached for 10 minutes; exhausted quota may return the last successful read with stale=true. Inherited assets are not included.
pub async fn list_campaign_assets(
    configuration: &configuration::Configuration,
    campaign_id: &str,
    account_id: &str,
    ad_account_id: Option<&str>,
    customer_id: Option<&str>,
) -> Result<models::ListCampaignAssets200Response, Error<ListCampaignAssetsError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_campaign_id = campaign_id;
    let p_query_account_id = account_id;
    let p_query_ad_account_id = ad_account_id;
    let p_query_customer_id = customer_id;

    let uri_str = format!(
        "{}/v1/ads/campaigns/{campaignId}/assets",
        configuration.base_path,
        campaignId = crate::apis::urlencode(p_path_campaign_id)
    );
    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);

    req_builder = req_builder.query(&[("accountId", &p_query_account_id.to_string())]);
    if let Some(ref param_value) = p_query_ad_account_id {
        req_builder = req_builder.query(&[("adAccountId", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_customer_id {
        req_builder = req_builder.query(&[("customerId", &param_value.to_string())]);
    }
    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ListCampaignAssets200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ListCampaignAssets200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<ListCampaignAssetsError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Lists the shared negative keyword lists attached to a Google campaign, separate from its own campaign-level negatives.  Google Ads shared negative keyword lists (shared_set type NEGATIVE_KEYWORDS). Reads are cached for 10 minutes; quota exhaustion may return the last successful result for up to 7 days with stale=true. Customer selection is limited to this connection and its account scope.
pub async fn list_campaign_negative_keyword_lists(
    configuration: &configuration::Configuration,
    campaign_id: &str,
    platform: Option<&str>,
) -> Result<
    models::ListAdNegativeKeywordLists200Response,
    Error<ListCampaignNegativeKeywordListsError>,
> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_campaign_id = campaign_id;
    let p_query_platform = platform;

    let uri_str = format!(
        "{}/v1/ads/campaigns/{campaignId}/negative-keyword-lists",
        configuration.base_path,
        campaignId = crate::apis::urlencode(p_path_campaign_id)
    );
    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);

    if let Some(ref param_value) = p_query_platform {
        req_builder = req_builder.query(&[("platform", &param_value.to_string())]);
    }
    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ListAdNegativeKeywordLists200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ListAdNegativeKeywordLists200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<ListCampaignNegativeKeywordListsError> =
            serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Lists the negative keywords set on a whole Google campaign, separate from ad group negatives.  It returns the campaign-level negative keywords (`campaign_criterion.negative`), distinct from the ad-group-level negatives under `GET /v1/ads/keywords`.  ### Caching and quota  Results are cached for the quota window (not synced to Postgres) and gated by the shared Google Ads operations budget, like every other on-demand Google surface.  The response carries `cachedAt` and `stale`, set when a quota-exhausted call falls back to the last-good copy instead of a live read.  ### Platform  The platform is always discovered from the campaign itself. A non-Google campaign returns 501 rather than 404, whether or not `platform` was passed.
pub async fn list_campaign_negative_keywords(
    configuration: &configuration::Configuration,
    campaign_id: &str,
    platform: Option<&str>,
) -> Result<models::ListCampaignNegativeKeywords200Response, Error<ListCampaignNegativeKeywordsError>>
{
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_campaign_id = campaign_id;
    let p_query_platform = platform;

    let uri_str = format!(
        "{}/v1/ads/campaigns/{campaignId}/negative-keywords",
        configuration.base_path,
        campaignId = crate::apis::urlencode(p_path_campaign_id)
    );
    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);

    if let Some(ref param_value) = p_query_platform {
        req_builder = req_builder.query(&[("platform", &param_value.to_string())]);
    }
    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ListCampaignNegativeKeywords200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ListCampaignNegativeKeywords200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<ListCampaignNegativeKeywordsError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Lists a Performance Max campaign's asset groups with their linked text, image and YouTube assets.  campaignId is the platform campaign id returned by creation or the campaign list. The campaign must be visible to the caller.  ### Caching  Uses a 10-minute cache, with the last successful response served as stale when Google quota is exhausted.  ### What is left out  - Removed groups and asset links are excluded. - Campaign-level brand assets on campaigns with brand guidelines enabled are not included.
pub async fn list_google_asset_groups(
    configuration: &configuration::Configuration,
    campaign_id: &str,
) -> Result<models::ListGoogleAssetGroups200Response, Error<ListGoogleAssetGroupsError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_campaign_id = campaign_id;

    let uri_str = format!(
        "{}/v1/ads/campaigns/{campaignId}/asset-groups",
        configuration.base_path,
        campaignId = crate::apis::urlencode(p_path_campaign_id)
    );
    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ListGoogleAssetGroups200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ListGoogleAssetGroups200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<ListGoogleAssetGroupsError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Lists Google's optimization suggestions for an ad account, with the estimated impact of each.  ### What each recommendation includes  - type - estimated impact (base vs potential metrics, cost in account currency units) - the campaign, ad group or budget they target - the type-specific payload Google returns (`details`, in Google's own shape with micros)  Filter by campaignId and types.  Cached for 10 minutes and cleared by apply or dismiss. Served stale when Google quota is exhausted.
pub async fn list_google_recommendations(
    configuration: &configuration::Configuration,
    account_id: &str,
    ad_account_id: Option<&str>,
    customer_id: Option<&str>,
    campaign_id: Option<&str>,
    types: Option<&str>,
) -> Result<models::ListGoogleRecommendations200Response, Error<ListGoogleRecommendationsError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_query_account_id = account_id;
    let p_query_ad_account_id = ad_account_id;
    let p_query_customer_id = customer_id;
    let p_query_campaign_id = campaign_id;
    let p_query_types = types;

    let uri_str = format!("{}/v1/ads/recommendations", configuration.base_path);
    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);

    req_builder = req_builder.query(&[("accountId", &p_query_account_id.to_string())]);
    if let Some(ref param_value) = p_query_ad_account_id {
        req_builder = req_builder.query(&[("adAccountId", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_customer_id {
        req_builder = req_builder.query(&[("customerId", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_campaign_id {
        req_builder = req_builder.query(&[("campaignId", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_types {
        req_builder = req_builder.query(&[("types", &param_value.to_string())]);
    }
    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ListGoogleRecommendations200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ListGoogleRecommendations200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<ListGoogleRecommendationsError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Lists a Google Ads account's shared budgets and how many campaigns draw from each.  Lists the Google Ads customer's shared campaign budgets (`campaign_budget.explicitly_shared` = true, not removed), with how many campaigns use each. Move a campaign onto one with `sharedBudgetId` on PUT /v1/ads/campaigns/{campaignId}. Google only; other platforms return 501.
pub async fn list_shared_budgets(
    configuration: &configuration::Configuration,
    account_id: &str,
    ad_account_id: Option<&str>,
) -> Result<models::ListSharedBudgets200Response, Error<ListSharedBudgetsError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_query_account_id = account_id;
    let p_query_ad_account_id = ad_account_id;

    let uri_str = format!("{}/v1/ads/shared-budgets", configuration.base_path);
    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);

    req_builder = req_builder.query(&[("accountId", &p_query_account_id.to_string())]);
    if let Some(ref param_value) = p_query_ad_account_id {
        req_builder = req_builder.query(&[("adAccountId", &param_value.to_string())]);
    }
    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ListSharedBudgets200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ListSharedBudgets200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<ListSharedBudgetsError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Returns the review verdict of every Upgraded Smart+ ad of one TikTok advertiser, with each creative's verdict, in one paginated read.  Use it to refresh reviews periodically: one call (plus its pages) per advertiser per refresh, instead of `GET /v1/ads/{adId}/tiktok-smart-plus-review` per ad.  ### How Zernio reads TikTok  1. Zernio lists the advertiser's Smart+ ads with `/smart_plus/ad/get/` (deleted ones only with `includeDeleted=true`). 2. It reads `/smart_plus/ad/review_info/` for Smart+ ads holding up to 50 creatives in total per call (TikTok refuses more). A Smart+ ad with more than 50 creatives is read alone. 3. Calls run across ad groups, one after another while TikTok accepts them, for up to 20 seconds per request. Ads not reached are read by the next request, which can come right away.  One request per advertiser and connection refreshes at a time. A parallel request sends no review call and answers what is stored with `refreshState: paused` and `retryAfterSeconds: 20`.  A full refresh of N Smart+ ads with C creatives in total costs about `ceil(N / 100)` listing calls and `ceil(C / 50)` review calls on TikTok.  When TikTok still refuses a call for its creative count, Zernio lowers the creative cap for that advertiser and reads the same ads again in smaller calls, never resending the refused size.  ### Stale while refreshing  Every review is stored for 24 hours per connection, advertiser and Smart+ ad (shared with the single-ad read). `readAt` is always the time TikTok answered, never rewritten when served from the store.  `maxAgeSeconds` (default 3600) is the freshness window:  - A review read within it is fresh and costs no TikTok call. - An older one is still returned in `items` but is read again. - A Smart+ ad never read is also read.  Each request alternates one batch of Smart+ ads never read (live, then deleted with `includeDeleted=true`) with one batch of stale ones, oldest `readAt` first.  So a quota pause starves neither, progress carries over between requests, and an ad already read never goes back to pending. A stored review is replaced only by a successful read.  ### Response fields  - `counts`: splits the Smart+ ads on this page into `fresh`, `stale`, `pending` and `failed`. - `oldestReadAt`: the oldest `readAt` of `items`. - `incomplete`: true only while some Smart+ ad of the page has never been read (`pending > 0`). - `allFresh`: staleness is reported apart. True when every item and refusal of the page is within `maxAgeSeconds` and nothing is pending. - `refreshState`: `paused` or `refused` when Zernio could not refresh some due ads of the page because review reads are held or TikTok refused them over quota. - `retryAfterSeconds` (also in the `Retry-After` header): when that later read can reach TikTok, even with nothing pending.  A page with stale items and nothing pending is complete (`incomplete: false`). Move on, and a later read refreshes it oldest first.  On 2026-10-25 TikTok's quota allowed about 130 to 230 Smart+ ads per advertiser per hour (about 11.5 ads and 4 creatives per successful call). A larger advertiser cannot be fully refreshed within one hour, so its pages stay complete but not `allFresh`.  ### Listing freshness  The listing is stored with the time it was read (`listing.readAt`) and listed again when it is older than `maxAgeSeconds`. So it can be up to `maxAgeSeconds` old: a Smart+ ad created on TikTok appears after at most that long (one hour by default).  - `listing.source: fresh`: the listing was read within `maxAgeSeconds`. - `listing.source: fallback`: relisting failed, so Zernio serves the stored listing, with the relist error in `listing.error`, instead of failing the request.  Only when no listing was ever stored does the listing error fail the request.  ### Review quota  TikTok's review endpoint has a strict quota of its own (TikTok documents neither the quota nor its scope). One request keeps reading batches (up to 50 creatives each) while TikTok accepts them.  Zernio may hold review reads after an overage: about 60 seconds, then 120 and up to 240 while TikTok keeps refusing, and about 60 again after a successful call, each with up to 10% of random jitter.  When TikTok is over quota (or reads are held), Zernio stops calling TikTok and answers 200 with the reviews it has:  - stale reviews in `items` - the Smart+ ads never read in `pendingSmartPlusAdIds` - `incomplete: true` when any are pending - `refreshState` (`paused` or `refused`) with `retryAfterSeconds` (also in the `Retry-After` header) whenever due ads were left unread  Every Smart+ ad of the page is in `items`, `failedSmartPlusAds` or `pendingSmartPlusAdIds`. Wait `retryAfterSeconds` and read the same page again: only the stale and pending ads reach TikTok.  ### Refused ads  A Smart+ ad whose review TikTok refuses on its own (for example one deleted on TikTok since the listing was read) is returned in `failedSmartPlusAds` with TikTok's error and `refusedAt`. The rest of the page is still read.  Zernio finds it by splitting the refused batch in halves, at most 16 extra TikTok calls per page. Ads still unresolved after that keep their stored review, or stay in `pendingSmartPlusAdIds` when they have none, and are read again by the next request, in turn with the other due ads.  A refusal of a single ad is stored for 24 hours and read again once it is older than `maxAgeSeconds`. When an ad has both a stored review and a stored refusal, the more recent one is returned.  When both halves of a refused batch are refused with the same TikTok error (for example a permission error), Zernio stops calling TikTok for that page:  - If every Smart+ ad of the page has a stored review or refusal, it serves them and returns the refusal in `reviewError`. - If some ad was never read, the whole request fails with that error.  ### Paging  Items are sorted by `adGroupId`, then `smartPlusAdId`, so pages are stable.  Keep one page in flight per advertiser and read its pages one after another. Parallel pages of one advertiser spend its review quota at the same time and come back incomplete.  Production logs suggest the quota is counted per advertiser (not confirmed by TikTok), so different advertisers have been read in parallel without throttling each other.
pub async fn list_tik_tok_smart_plus_reviews(
    configuration: &configuration::Configuration,
    account_id: &str,
    ad_account_id: &str,
    include_deleted: Option<bool>,
    max_age_seconds: Option<i32>,
    page: Option<i32>,
    page_size: Option<i32>,
) -> Result<models::ListTikTokSmartPlusReviews200Response, Error<ListTikTokSmartPlusReviewsError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_query_account_id = account_id;
    let p_query_ad_account_id = ad_account_id;
    let p_query_include_deleted = include_deleted;
    let p_query_max_age_seconds = max_age_seconds;
    let p_query_page = page;
    let p_query_page_size = page_size;

    let uri_str = format!(
        "{}/v1/ads/tiktok-smart-plus-reviews",
        configuration.base_path
    );
    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);

    req_builder = req_builder.query(&[("accountId", &p_query_account_id.to_string())]);
    req_builder = req_builder.query(&[("adAccountId", &p_query_ad_account_id.to_string())]);
    if let Some(ref param_value) = p_query_include_deleted {
        req_builder = req_builder.query(&[("includeDeleted", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_max_age_seconds {
        req_builder = req_builder.query(&[("maxAgeSeconds", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_page {
        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_page_size {
        req_builder = req_builder.query(&[("pageSize", &param_value.to_string())]);
    }
    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ListTikTokSmartPlusReviews200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ListTikTokSmartPlusReviews200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<ListTikTokSmartPlusReviewsError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Detaches assets from a Google ad group without deleting them, so they stay in the account and on anything else they are attached to.  Google assets cannot be deleted. Other attachments remain. assetResourceNames is retained for compatibility. Fields go in the query string. A JSON body with the same fields is also accepted and, when sent, the query string is ignored.
pub async fn remove_ad_group_assets(
    configuration: &configuration::Configuration,
    ad_set_id: &str,
    account_id: &str,
    asset_resource_names: Vec<String>,
    ad_group_asset_resource_names: Vec<String>,
    ad_account_id: Option<&str>,
    customer_id: Option<&str>,
) -> Result<models::RemoveCampaignAssets200Response, Error<RemoveAdGroupAssetsError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_ad_set_id = ad_set_id;
    let p_query_account_id = account_id;
    let p_query_asset_resource_names = asset_resource_names;
    let p_query_ad_group_asset_resource_names = ad_group_asset_resource_names;
    let p_query_ad_account_id = ad_account_id;
    let p_query_customer_id = customer_id;

    let uri_str = format!(
        "{}/v1/ads/ad-sets/{adSetId}/assets",
        configuration.base_path,
        adSetId = crate::apis::urlencode(p_path_ad_set_id)
    );
    let mut req_builder = configuration
        .client
        .request(reqwest::Method::DELETE, &uri_str);

    req_builder = req_builder.query(&[("accountId", &p_query_account_id.to_string())]);
    if let Some(ref param_value) = p_query_ad_account_id {
        req_builder = req_builder.query(&[("adAccountId", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_customer_id {
        req_builder = req_builder.query(&[("customerId", &param_value.to_string())]);
    }
    req_builder = match "multi" {
        "multi" => req_builder.query(
            &p_query_asset_resource_names
                .into_iter()
                .map(|p| ("assetResourceNames".to_owned(), p.to_string()))
                .collect::<Vec<(std::string::String, std::string::String)>>(),
        ),
        _ => req_builder.query(&[(
            "assetResourceNames",
            &p_query_asset_resource_names
                .into_iter()
                .map(|p| p.to_string())
                .collect::<Vec<String>>()
                .join(",")
                .to_string(),
        )]),
    };
    req_builder = match "multi" {
        "multi" => req_builder.query(
            &p_query_ad_group_asset_resource_names
                .into_iter()
                .map(|p| ("adGroupAssetResourceNames".to_owned(), p.to_string()))
                .collect::<Vec<(std::string::String, std::string::String)>>(),
        ),
        _ => req_builder.query(&[(
            "adGroupAssetResourceNames",
            &p_query_ad_group_asset_resource_names
                .into_iter()
                .map(|p| p.to_string())
                .collect::<Vec<String>>()
                .join(",")
                .to_string(),
        )]),
    };
    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RemoveCampaignAssets200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RemoveCampaignAssets200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<RemoveAdGroupAssetsError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Removes a single keyword or negative keyword from a Google Search ad group.  Removes one keyword criterion (positive or negative) from its ad group (M.140).
pub async fn remove_ad_keyword(
    configuration: &configuration::Configuration,
    keyword_id: &str,
) -> Result<models::RemoveAdKeyword200Response, Error<RemoveAdKeywordError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_keyword_id = keyword_id;

    let uri_str = format!(
        "{}/v1/ads/keywords/{keywordId}",
        configuration.base_path,
        keywordId = crate::apis::urlencode(p_path_keyword_id)
    );
    let mut req_builder = configuration
        .client
        .request(reqwest::Method::DELETE, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RemoveAdKeyword200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RemoveAdKeyword200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<RemoveAdKeywordError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Detaches assets from a Google campaign without deleting them, so they stay in the account and on anything else they are attached to.  Google assets cannot be deleted. Other attachments remain. assetResourceNames is retained for compatibility. Fields go in the query string. A JSON body with the same fields is also accepted and, when sent, the query string is ignored.
pub async fn remove_campaign_assets(
    configuration: &configuration::Configuration,
    campaign_id: &str,
    account_id: &str,
    asset_resource_names: Vec<String>,
    campaign_asset_resource_names: Vec<String>,
    ad_account_id: Option<&str>,
    customer_id: Option<&str>,
) -> Result<models::RemoveCampaignAssets200Response, Error<RemoveCampaignAssetsError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_campaign_id = campaign_id;
    let p_query_account_id = account_id;
    let p_query_asset_resource_names = asset_resource_names;
    let p_query_campaign_asset_resource_names = campaign_asset_resource_names;
    let p_query_ad_account_id = ad_account_id;
    let p_query_customer_id = customer_id;

    let uri_str = format!(
        "{}/v1/ads/campaigns/{campaignId}/assets",
        configuration.base_path,
        campaignId = crate::apis::urlencode(p_path_campaign_id)
    );
    let mut req_builder = configuration
        .client
        .request(reqwest::Method::DELETE, &uri_str);

    req_builder = req_builder.query(&[("accountId", &p_query_account_id.to_string())]);
    if let Some(ref param_value) = p_query_ad_account_id {
        req_builder = req_builder.query(&[("adAccountId", &param_value.to_string())]);
    }
    if let Some(ref param_value) = p_query_customer_id {
        req_builder = req_builder.query(&[("customerId", &param_value.to_string())]);
    }
    req_builder = match "multi" {
        "multi" => req_builder.query(
            &p_query_asset_resource_names
                .into_iter()
                .map(|p| ("assetResourceNames".to_owned(), p.to_string()))
                .collect::<Vec<(std::string::String, std::string::String)>>(),
        ),
        _ => req_builder.query(&[(
            "assetResourceNames",
            &p_query_asset_resource_names
                .into_iter()
                .map(|p| p.to_string())
                .collect::<Vec<String>>()
                .join(",")
                .to_string(),
        )]),
    };
    req_builder = match "multi" {
        "multi" => req_builder.query(
            &p_query_campaign_asset_resource_names
                .into_iter()
                .map(|p| ("campaignAssetResourceNames".to_owned(), p.to_string()))
                .collect::<Vec<(std::string::String, std::string::String)>>(),
        ),
        _ => req_builder.query(&[(
            "campaignAssetResourceNames",
            &p_query_campaign_asset_resource_names
                .into_iter()
                .map(|p| p.to_string())
                .collect::<Vec<String>>()
                .join(",")
                .to_string(),
        )]),
    };
    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RemoveCampaignAssets200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RemoveCampaignAssets200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<RemoveCampaignAssetsError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Permanently removes an asset group from a Performance Max campaign (this cannot be undone).  Removes the asset group on Google (status REMOVED, not reversible). Pass validateOnly=true to validate without removing.
pub async fn remove_google_asset_group(
    configuration: &configuration::Configuration,
    campaign_id: &str,
    asset_group_id: &str,
    validate_only: Option<bool>,
) -> Result<models::RemoveGoogleAssetGroup200Response, Error<RemoveGoogleAssetGroupError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_campaign_id = campaign_id;
    let p_path_asset_group_id = asset_group_id;
    let p_query_validate_only = validate_only;

    let uri_str = format!(
        "{}/v1/ads/campaigns/{campaignId}/asset-groups/{assetGroupId}",
        configuration.base_path,
        campaignId = crate::apis::urlencode(p_path_campaign_id),
        assetGroupId = crate::apis::urlencode(p_path_asset_group_id)
    );
    let mut req_builder = configuration
        .client
        .request(reqwest::Method::DELETE, &uri_str);

    if let Some(ref param_value) = p_query_validate_only {
        req_builder = req_builder.query(&[("validateOnly", &param_value.to_string())]);
    }
    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RemoveGoogleAssetGroup200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RemoveGoogleAssetGroup200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<RemoveGoogleAssetGroupError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Sets exactly which shared negative keyword lists apply to a Google campaign, or detaches them all, without changing the lists themselves.  Send listIds=[] to detach all negative keyword lists. Only campaign_shared_set links are changed; the lists and their keywords are preserved. Every list must belong to the campaign customer and have type NEGATIVE_KEYWORDS.
pub async fn replace_campaign_negative_keyword_lists(
    configuration: &configuration::Configuration,
    campaign_id: &str,
    replace_campaign_negative_keyword_lists_request: models::ReplaceCampaignNegativeKeywordListsRequest,
) -> Result<
    models::ReplaceAdNegativeKeywordListKeywords200Response,
    Error<ReplaceCampaignNegativeKeywordListsError>,
> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_campaign_id = campaign_id;
    let p_body_replace_campaign_negative_keyword_lists_request =
        replace_campaign_negative_keyword_lists_request;

    let uri_str = format!(
        "{}/v1/ads/campaigns/{campaignId}/negative-keyword-lists",
        configuration.base_path,
        campaignId = crate::apis::urlencode(p_path_campaign_id)
    );
    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };
    req_builder = req_builder.json(&p_body_replace_campaign_negative_keyword_lists_request);

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ReplaceAdNegativeKeywordListKeywords200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ReplaceAdNegativeKeywordListKeywords200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<ReplaceCampaignNegativeKeywordListsError> =
            serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Replaces a Google campaign's full list of campaign-level negative keywords, or clears it.  Replaces the FULL set of campaign-level negative keywords (C.270): the desired list is diffed against what Google already has, and the difference is applied as one `create`/`remove` mutate. Send an empty array to clear every campaign negative.  The platform is always discovered from the campaign itself; a non-Google campaign returns 501 rather than 404, whether or not `platform` was sent.
pub async fn replace_campaign_negative_keywords(
    configuration: &configuration::Configuration,
    campaign_id: &str,
    replace_campaign_negative_keywords_request: models::ReplaceCampaignNegativeKeywordsRequest,
) -> Result<
    models::ReplaceCampaignNegativeKeywords200Response,
    Error<ReplaceCampaignNegativeKeywordsError>,
> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_campaign_id = campaign_id;
    let p_body_replace_campaign_negative_keywords_request =
        replace_campaign_negative_keywords_request;

    let uri_str = format!(
        "{}/v1/ads/campaigns/{campaignId}/negative-keywords",
        configuration.base_path,
        campaignId = crate::apis::urlencode(p_path_campaign_id)
    );
    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };
    req_builder = req_builder.json(&p_body_replace_campaign_negative_keywords_request);

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ReplaceCampaignNegativeKeywords200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ReplaceCampaignNegativeKeywords200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<ReplaceCampaignNegativeKeywordsError> =
            serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Replaces the product targeting tree of a Performance Max retail asset group; only works on campaigns linked to Merchant Center.  The current product (listing-group) tree is removed and the new one created in one atomic request. Read the current tree with GET on the asset group.  - Requires a campaign linked to Merchant Center. Other campaigns return 400 LISTING_SOURCE_NOT_ALLOWED from Google. - validateOnly: true validates without writing.
pub async fn replace_google_listing_group_filters(
    configuration: &configuration::Configuration,
    campaign_id: &str,
    asset_group_id: &str,
    replace_google_listing_group_filters_request: models::ReplaceGoogleListingGroupFiltersRequest,
) -> Result<
    models::ReplaceGoogleListingGroupFilters200Response,
    Error<ReplaceGoogleListingGroupFiltersError>,
> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_campaign_id = campaign_id;
    let p_path_asset_group_id = asset_group_id;
    let p_body_replace_google_listing_group_filters_request =
        replace_google_listing_group_filters_request;

    let uri_str = format!(
        "{}/v1/ads/campaigns/{campaignId}/asset-groups/{assetGroupId}/listing-group-filters",
        configuration.base_path,
        campaignId = crate::apis::urlencode(p_path_campaign_id),
        assetGroupId = crate::apis::urlencode(p_path_asset_group_id)
    );
    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };
    req_builder = req_builder.json(&p_body_replace_google_listing_group_filters_request);

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ReplaceGoogleListingGroupFilters200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ReplaceGoogleListingGroupFilters200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<ReplaceGoogleListingGroupFiltersError> =
            serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Changes an ad's status, budget, targeting or creative and applies the change on the platform.  Patch one or more fields on an ad. Status, budget, targeting, and creative changes are propagated to the platform.  ### Per-platform support  - **Meta** (Facebook + Instagram): all fields supported. - **TikTok**: status, budget, `name` (renames the ad), targeting (via `/v2/adgroup/update/`), and creative (via `/v2/ad/update/` patch-style: `headline` is ignored, `body` becomes `ad_text`). - **Google**: see the Google sections below. - **LinkedIn**: status, budget, targeting and creative (details below). - **Pinterest / X / OpenAI Ads**: status + budget only. Sending `targeting` or `creative` returns 501 with code `feature_not_available`. OpenAI Ads budget is the campaign's spend cap, daily or lifetime (see `budget.type` below). - **Reddit Ads**: status, budget, `name` (renames the ad) and targeting (details below).  ### Google  Supported: status, budget, and these targeting edits:  - KEYWORD edits via `targeting.keywords` / `targeting.negativeKeywords` - DEVICE bid adjustments via `targeting.devices` - LOCATION edits via `targeting.locations` (or the equivalent top-level `targeting.countries` / `regions` / `cities` / `zips` / `metros`) - LANGUAGE edits via `targeting.languages`  Each list you send becomes the FULL new set of its kind: criteria not in the list are removed. Devices are the exception: Google cannot remove them, so they are switched off with a bid modifier of 0 instead. A kind left out is untouched.  Any other `targeting` field returns 400: Google cannot mutate it post-create without recreating the campaign.  Creative edits are dispatched on the ad's `advertisingChannelType`. Every supported field replaces a whole set; a field you omit is preserved.  - **Search**: top-level `headlines`, `descriptions` and `finalUrls`. Use 3-15 headlines (1-30 characters) and 2-4 descriptions (1-90 characters). Omit an asset to remove it; omit pinnedField on an included asset to unpin it. Updates do not pad or truncate text. The legacy creative fields remain unsupported. - **Display**: top-level `headlines` (1-5, no pinnedField, display ads have no pinned positions), `descriptions` (1-5) and `finalUrls`, plus `creative.longHeadline`, `creative.businessName`, `creative.imageUrl` (the landscape marketing image) and `creative.squareImageUrl`. - **Performance Max**: top-level `assetGroup`, which swaps asset roles on the ad's asset group. The other creative fields return 422 for this channel, and `assetGroup` returns 422 on any other channel. - **Demand Gen**: top-level `demandGen` (see GoogleDemandGenUpdate): creative, channel and audience changes in one atomic Google request. The other creative fields return 422 for this channel.  For Display, each image URL is uploaded as a new Google asset and the ad is pointed at it.  Google assets are immutable, so the previous asset stays in the account's asset library. A new landscape image also updates `creative.assetResourceName` to the new asset, and each replaced image updates its own role in `creative.assets`.  For Demand Gen, `targeting` takes locations, languages, `locationTargetingType` and `devices`. Locations and languages are written to the ad's ad group, which Demand Gen requires, so they apply to every ad in that ad group. Campaigns migrated from Discovery that still target on the campaign keep being written there.  ### LinkedIn  - **Status and budget**: supported. - **Targeting**: countries or regions, excludedLocations (countries), the B2B facets, and audience segments. Applied to the LinkedIn Campaign via PARTIAL_UPDATE, and REPLACES the campaign's entire targetingCriteria, not a merge. - **Creative**: uploads new media, creates a replacement inline creative on the same campaign, and pauses the old one.  ### Reddit Ads  - `budget` goes to the ad's ad group, or to its campaign when the ad group spends a campaign budget. It keeps its daily or lifetime type (422 to switch). - `targeting` REPLACES the ad group's whole targeting (geo, communities, conversation keywords, interests, audiences, languages, gender), so it applies to every ad in the ad group. - `creative` returns 501: a Reddit ad runs a post, so create a new ad with the new creative instead.  ### Google location and language replacement  Locations, languages and devices are campaign-level criteria on Google, so these edits apply to every ad group and ad in the ad's campaign. Send the complete list you want to keep.  Zernio diffs it against the campaign's live criteria and sends the removes and the creates in ONE `googleAds:mutate`, so the campaign is never left with a half-applied set. Criteria already in the list keep their criterion ID and history. Excluded (negative) locations are left untouched.  - An empty location list returns 400. A Google campaign with no location criteria targets every country, which is never what \"remove my locations\" means, so omit the field instead. - Send either `targeting.locations` or the top-level geo fields, not both: mixing them returns 400.  ### Google radius targeting  `customLocations` is editable and is replaced the same way, but as its OWN set. Google models a place (LOCATION) and a point plus radius (PROXIMITY) as different criterion types, so the two are independent:  - Sending `customLocations` replaces every radius and leaves the cities and countries alone. - Sending places replaces those and leaves the radius alone. - Send `customLocations: []` to drop radius targeting entirely.  A circle you re-send unchanged keeps its criterion ID rather than being removed and recreated.  ### Google keyword replacement  These edits affect the ad's entire ad group, including sibling ads. Positive (`targeting.keywords`) and negative (`targeting.negativeKeywords`) sets are independent: omit a field to leave that set unchanged, or send `[]` to remove every keyword of that kind.  Zernio compares each supplied set with Google's live criteria by case-insensitive keyword text and match type. Text comparison does not trim whitespace.  A matching criterion is left untouched, retaining its criterion ID, enabled/paused status, keyword-level bid overrides, labels, and criterion-associated history/statistics. Zernio does not reset its quality score; Google continues to calculate scores and statistics normally.  A bare string or an object without `matchType` means `broad`, not the existing criterion's match type. For example, resending an existing `{ \"text\": \"plumber\", \"matchType\": \"exact\" }` preserves it; sending `\"plumber\"` instead removes that EXACT criterion and requests a BROAD one.  Changing text or match type removes criteria no longer requested and creates any missing criteria. New criteria get new IDs and do not inherit removed criteria's bid overrides, labels, or history. Historical reporting for a removed criterion is not transferred to its replacement.  ### Other keyword endpoints  - To add keywords without replacing a set, use [POST /v1/ads/keywords](https://docs.zernio.com/ad-campaigns/add-ad-keywords). - Use `PATCH /v1/ads/keywords/{keywordId}` to pause/enable one keyword. - Use `DELETE /v1/ads/keywords/{keywordId}` to remove it.
pub async fn update_ad(
    configuration: &configuration::Configuration,
    ad_id: &str,
    update_ad_request: models::UpdateAdRequest,
) -> Result<models::UpdateAd200Response, Error<UpdateAdError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_ad_id = ad_id;
    let p_body_update_ad_request = update_ad_request;

    let uri_str = format!(
        "{}/v1/ads/{adId}",
        configuration.base_path,
        adId = crate::apis::urlencode(p_path_ad_id)
    );
    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };
    req_builder = req_builder.json(&p_body_update_ad_request);

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UpdateAd200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::UpdateAd200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<UpdateAdError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Changes a campaign's settings, such as its name, budget, bidding or tracking URLs.  Send at least one of `budget`, `bidStrategy`, `portfolioBidStrategyId`, `targetImpressionShare`, `manualCpc`, `networkSettings`, `trackingUrlTemplate`, `finalUrlSuffix`, `sharedBudgetId`, `name` or `platformSpecificData`. An unsupported field is always an error, never a silent drop.  | Body field | Meta | Google | Others | |---|---|---|---| | `bidStrategy` | Yes | Yes | 501 | | `bidAmount`, `roasAverageFloor` | 400 (ad-set level) | Yes | 400 | | `portfolioBidStrategyId` | 400 | Yes | 400 | | `targetImpressionShare` | 400 | Search only | 400 | | `manualCpc` | 400 | Search and Display | 400 | | `networkSettings` | 400 | Search only | 400 | | `trackingUrlTemplate`, `finalUrlSuffix` | 400 | Yes | 400 | | `sharedBudgetId` | 400 | Yes | 400 | | `budget` (CBO; ABO returns 409) | Yes | Daily only | OpenAI and Reddit: daily or lifetime; others 501 | | `name` | Yes | 501 | Reddit: Yes; others 501 | | `platformSpecificData.spendCap` | Yes | 400 | 400 | | `accountId` (empty campaigns) | Yes | - | - |  ### Meta  Meta budget edits check the live campaign budget, so an older local ABO stamp cannot block a CBO campaign. A successful edit repairs local ad budget fields. A live ABO campaign still returns 409 with the ad-set budget endpoint.  `accountId` forwards the update straight to Meta for a campaign with zero ads, which would otherwise 404. The response then carries `updated: 0`.  ### Google bidding  - `LOWEST_COST_WITHOUT_CAP` = Maximize Conversions - `COST_CAP` + `bidAmount` = Target CPA - `LOWEST_COST_WITH_MIN_ROAS` + `roasAverageFloor` = Target ROAS - `LOWEST_COST_WITH_BID_CAP` + `bidAmount` = Maximize Clicks with a CPC ceiling - `portfolioBidStrategyId` attaches a portfolio strategy instead (exclusive with `bidStrategy`) - `targetImpressionShare` switches the campaign to Target impression share - `manualCpc: { maxCpc }` switches to Manual CPC: every ad group of the campaign gets `maxCpc` as its bid, in the same mutate  `targetImpressionShare` and `manualCpc` are each exclusive with every other strategy field.  Setting the standard triplet on a campaign that is currently on a PORTFOLIO strategy is rejected. Detach it in Google Ads first, since it is shared across campaigns.  ### Google network and tracking URLs  `networkSettings`, `trackingUrlTemplate` and `finalUrlSuffix` go out in one campaign update. Each field is sent written on its own leaf, so an omitted one keeps its current value. An empty string clears a URL field.  ### Google budgets  Google budget updates read the current budget before mutation. Shared budgets return 409 unless allowSharedBudgetUpdate=true is explicitly supplied, because the change affects every campaign using that budget.  A budget counts as shared when Google flags it as shared or when more than one campaign uses it (older budgets can serve several campaigns without the flag). Unknown sharing state also returns 409.  ### Google shared budgets (`sharedBudgetId`)  - `sharedBudgetId` moves the campaign onto a shared budget from GET /v1/ads/shared-budgets. It also needs `allowSharedBudgetUpdate: true` (409 otherwise), because the campaign then splits that budget with every campaign on it. `budget` cannot ride along. - `sharedBudgetId: null` moves it back onto a new budget of its own, sized by `budget` (required, daily). The new budget and the switch go out in one atomic Google mutate. - A campaign that already has its own budget returns 409 for null.  The budget a campaign leaves is not removed. The response carries the budget the campaign now uses.  ### OpenAI Ads  Campaigns carry exactly one spend cap. `budget.type` daily or lifetime replaces whichever cap the campaign had, with a minimum of 1 in the ad account's currency (422 below it).  Lifetime can switch to daily, but OpenAI never switches a daily cap back to lifetime (422).  ### Reddit Ads  - `budget` changes the amount of a campaign budget (Reddit campaign budget optimization). - A campaign whose ad groups carry the budget returns 409 or 422; use PUT /v1/ads/ad-sets/{adSetId} there. - Reddit cannot switch a published budget between daily and lifetime, so `budget.type` must match the current one (422 otherwise). - `bidStrategy` is set per ad group on Reddit (PUT /v1/ads/ad-sets/{adSetId}).
pub async fn update_ad_campaign(
    configuration: &configuration::Configuration,
    campaign_id: &str,
    update_ad_campaign_request: models::UpdateAdCampaignRequest,
) -> Result<models::UpdateAdCampaign200Response, Error<UpdateAdCampaignError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_campaign_id = campaign_id;
    let p_body_update_ad_campaign_request = update_ad_campaign_request;

    let uri_str = format!(
        "{}/v1/ads/campaigns/{campaignId}",
        configuration.base_path,
        campaignId = crate::apis::urlencode(p_path_campaign_id)
    );
    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };
    req_builder = req_builder.json(&p_body_update_ad_campaign_request);

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UpdateAdCampaign200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::UpdateAdCampaign200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<UpdateAdCampaignError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Pauses or resumes a campaign, leaving the on/off switches of its ad sets and ads as they are.  It writes the campaign's own on/off switch and nothing else, on every platform: Meta, TikTok, Google, LinkedIn campaign group, Pinterest, X, ChatGPT (OpenAI).  Its ad sets and ads keep their own switches:  - Pausing stops their delivery through the campaign. - Resuming lets each of them deliver again only if its own switch is on.  An ad set or ad you paused individually stays paused. Resume it with PUT /v1/ads/ad-sets/{adSetId}/status or PUT /v1/ads/{adId}/status. See the Status model in the Ad Campaigns tag.  ### Live read, then write  The campaign's switch is read from the platform first.  - **Already in the requested state:** nothing is written (`updated: 0`, `skipped: 1`, with the reason). - **Otherwise:** the switch is written (`updated: 1`), read back and stored. The delivery status of the ads under it (up to 20) is re-read and stored, so an immediate GET returns what the platform now reports.  When the campaign delivers in the requested state but some of its ads are stored in the other state, those ads are re-read and stored (up to 20, at most once every 10 minutes per campaign).  An example is ads switched on in the platform's own UI and still stored `paused`.  A stored switch never skips a write, and when the platform cannot be read the write always goes out.  On Meta the check reads the campaign's own `status`, so a delivery status such as `IN_PROCESS` or `WITH_ISSUES` does not force a write.
pub async fn update_ad_campaign_status(
    configuration: &configuration::Configuration,
    campaign_id: &str,
    update_ad_campaign_status_request: models::UpdateAdCampaignStatusRequest,
) -> Result<models::UpdateAdCampaignStatus200Response, Error<UpdateAdCampaignStatusError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_campaign_id = campaign_id;
    let p_body_update_ad_campaign_status_request = update_ad_campaign_status_request;

    let uri_str = format!(
        "{}/v1/ads/campaigns/{campaignId}/status",
        configuration.base_path,
        campaignId = crate::apis::urlencode(p_path_campaign_id)
    );
    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };
    req_builder = req_builder.json(&p_body_update_ad_campaign_status_request);

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UpdateAdCampaignStatus200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::UpdateAdCampaignStatus200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<UpdateAdCampaignStatusError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Edits a Google ad group's existing assets in place; the change applies everywhere that asset is used.  Send updates with assetResourceName and the fields to change. An asset is shared: changes affect every attachment using it. Omitted fields stay unchanged. The operation consumes the Google operations budget and invalidates affected cached lists.
pub async fn update_ad_group_assets(
    configuration: &configuration::Configuration,
    ad_set_id: &str,
    update_campaign_assets_request: models::UpdateCampaignAssetsRequest,
) -> Result<models::UpdateCampaignAssets200Response, Error<UpdateAdGroupAssetsError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_ad_set_id = ad_set_id;
    let p_body_update_campaign_assets_request = update_campaign_assets_request;

    let uri_str = format!(
        "{}/v1/ads/ad-sets/{adSetId}/assets",
        configuration.base_path,
        adSetId = crate::apis::urlencode(p_path_ad_set_id)
    );
    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };
    req_builder = req_builder.json(&p_body_update_campaign_assets_request);

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UpdateCampaignAssets200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::UpdateCampaignAssets200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<UpdateAdGroupAssetsError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Pauses or re-enables a single Google Search keyword.  Changes `ad_group_criterion.status` for one keyword criterion (M.140). Negative keywords have no status on Google and cannot be paused or enabled.
pub async fn update_ad_keyword(
    configuration: &configuration::Configuration,
    keyword_id: &str,
    update_ad_keyword_request: models::UpdateAdKeywordRequest,
) -> Result<models::UpdateAdKeyword200Response, Error<UpdateAdKeywordError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_keyword_id = keyword_id;
    let p_body_update_ad_keyword_request = update_ad_keyword_request;

    let uri_str = format!(
        "{}/v1/ads/keywords/{keywordId}",
        configuration.base_path,
        keywordId = crate::apis::urlencode(p_path_keyword_id)
    );
    let mut req_builder = configuration
        .client
        .request(reqwest::Method::PATCH, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };
    req_builder = req_builder.json(&p_body_update_ad_keyword_request);

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UpdateAdKeyword200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::UpdateAdKeyword200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<UpdateAdKeywordError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Changes an ad set's settings, such as its budget, bid strategy, status or delivery options. At least one updatable field is required.  Use it for:  - ABO budget updates. - Ad-set-scoped pause/resume. - Bid-strategy edits. - Meta value-rule-set attach/detach. - Meta beneficiary and payer: `dsaBeneficiary` / `dsaPayor` for the EU, `regionalRegulatedCategories` / `regionalRegulationIdentities` for the regional regimes. - Meta-only post-launch delivery settings via `platformSpecificData`.  ### Value rule sets (Meta only)  See `/v1/ads/value-rule-sets`.  - ATTACH or REPLACE: send `valueRuleSetId`. Attachment is driven by the id's presence, so `valueRulesApplied: true` is optional. Sending a different id replaces the previous association; there is no separate replace call. - DETACH: send `valueRulesApplied: false` and OMIT `valueRuleSetId`. - Sending `valueRulesApplied: false` TOGETHER with `valueRuleSetId` returns 400 `mutually_exclusive_fields`. - Eligibility: only ad sets on `LOWEST_COST_WITHOUT_CAP` or `COST_CAP`. Meta rejects the rest server-side. - Read back with `GET /v1/ads/ad-sets/{adSetId}?fields=value_rule_set_id`. Meta does not document `value_rules_applied` as a readable ad-set field, so the boolean cannot be read back.  The `mutually_exclusive_fields` error is deliberate. Meta attaches the rule set whenever `value_rule_set_id` is present, even with `value_rules_applied` false, so echoing stored state while asking to detach would silently keep the bid adjustments live.  ### Bid strategy compatibility (per Meta's spec)  - `LOWEST_COST_WITHOUT_CAP`: no `bidAmount`, no `roasAverageFloor`. - `LOWEST_COST_WITH_BID_CAP` / `COST_CAP`: `bidAmount` REQUIRED (whole currency units). - `LOWEST_COST_WITH_MIN_ROAS`: `roasAverageFloor` REQUIRED (decimal multiplier, e.g. 2.0 = 2.0x ROAS).  Meta only: send `bidAmount` WITHOUT `bidStrategy` to change the cap amount on an ad set whose strategy (its own, or the campaign's under CBO) is COST_CAP / LOWEST_COST_WITH_BID_CAP, leaving the strategy untouched.  Send `roasAverageFloor` WITHOUT `bidStrategy` the same way to change the floor of a LOWEST_COST_WITH_MIN_ROAS ad set. Either field against an incompatible current strategy is a 400.  Meta CBO (the campaign holds the budget): the campaign also holds the bid strategy, so only `bidAmount` or `roasAverageFloor` is written on the ad set. A `bidStrategy` equal to the campaign's is accepted; a different one is a 409 (change it with PUT /v1/ads/campaigns/{campaignId}).  ### Delivery settings and budget  Delivery settings are validated by Meta against the campaign objective. Incompatible combinations (e.g. a billingEvent the optimization goal doesn't allow) surface as 400s from Meta.  When updating `budget` on an ad set whose campaign holds the budget (CBO), the response is 409 with code `invalid_field_value`. Send it to PUT /v1/ads/campaigns/{campaignId} instead.  ### Status  `status` behaves exactly as PUT /v1/ads/ad-sets/{adSetId}/status describes. Only the ad set's own switch is written and its ads keep theirs. `statusUpdated` / `statusSkipped` report whether that switch was written or a live read showed it already in place.  ### Placements and targeting (Meta only)  `placements` and `targeting` take the same shapes as POST /v1/ads/create. Meta replaces an ad set's targeting wholesale, so Zernio reads the live targeting first, changes only what the request names and writes the merged spec back.  Custom audiences, geo, age, interest groups and `targeting_automation` you do not send are kept.  - `placements` replaces the whole placement set. - `placements: null` returns the ad set to automatic placements. - Omitting it leaves placements as they are.  Other platforms return 400 for either field before anything in the request is written (use PUT /v1/ads/{adId} with `targeting` where that platform supports it).  The live read and the `incomeTier` lookup run before any other field is written, so a 502 or 422 from them leaves the ad set unchanged.  ### Reddit Ads: budget, name and bidding  - `budget` changes the ad group's amount. An ad group that spends its campaign budget returns 422 (update the campaign instead). - Reddit cannot switch a published budget between daily and lifetime, so `budget.type` must match the current one (422 otherwise). - `name` renames the ad group.  `bidStrategy` maps to the ad group's `bid_strategy`:  - LOWEST_COST_WITHOUT_CAP: automatic bidding (BIDLESS). - LOWEST_COST_WITH_BID_CAP: MANUAL_BIDDING with `bidAmount` as the bid. - COST_CAP: MAXIMIZE_VOLUME with `bidAmount` as the cap. - LOWEST_COST_WITH_MIN_ROAS: returns 422.  ### Reddit Ads: targeting and schedule  `targeting` (same shape as on create; `placements` is a 400) and `startDate` / `endDate` change the ad group with one PATCH to Reddit. Read the current values with GET /v1/ads/ad-sets/{adSetId}/targeting.  Zernio reads the live ad group first and replaces only the targeting groups the request names:  - The included locations (`countries`, `regions`, `metros`, `cities`, `zips`) are one list on Reddit, so sending any of them replaces all included locations. - Devices, platforms, carriers and automated expansion set in Reddit Ads Manager are kept.  The schedule is checked against the campaign before anything in the request is written. Each of these returns 400 naming `startDate` or `endDate`:  - The ad group starts before a campaign that starts in the future. - The ad group ends after the campaign's end. - Under campaign budget optimization, it must end by the campaign end (and has no end date when the campaign has none).  Zernio never resends the PATCH on its own, so after a 5xx read the ad group back before retrying.
pub async fn update_ad_set(
    configuration: &configuration::Configuration,
    ad_set_id: &str,
    update_ad_set_request: models::UpdateAdSetRequest,
) -> Result<models::UpdateAdSet200Response, Error<UpdateAdSetError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_ad_set_id = ad_set_id;
    let p_body_update_ad_set_request = update_ad_set_request;

    let uri_str = format!(
        "{}/v1/ads/ad-sets/{adSetId}",
        configuration.base_path,
        adSetId = crate::apis::urlencode(p_path_ad_set_id)
    );
    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };
    req_builder = req_builder.json(&p_body_update_ad_set_request);

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UpdateAdSet200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::UpdateAdSet200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<UpdateAdSetError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Pauses or resumes one ad set without touching its campaign, its sibling ad sets or the switches of its ads.  It is a thin wrapper over PUT /v1/ads/ad-sets/{adSetId} for callers that only want the status toggle and prefer a symmetric URL to /v1/ads/campaigns/{campaignId}/status.  ### What is written  It writes the ad set's own on/off switch and nothing else, on every platform:  - Meta: `configured_status` - TikTok: ad group `operation_status` - Google: ad group status - LinkedIn: campaign - Pinterest: ad group - X: line item - ChatGPT (OpenAI): ad group - Reddit: ad group `configured_status`  Its ads keep their own switches: an ad you paused individually stays paused when the ad set resumes.  The campaign above is not touched either, so an ad set resumed under a paused campaign reads `status: paused` until the campaign is resumed too. See the Status model in the Ad Campaigns tag.  ### Live read, then write  The ad set's switch is read from the platform first.  - When that live read shows it already in the requested state, nothing is written (`updated: 0`, `skipped: 1`, with the reason). - In that case, when the ad set delivers in that state but some of its ads are stored in the other state, those ads (up to 20, at most once every 10 minutes per ad set) are re-read and stored. - Otherwise the switch is written (`updated: 1`), read back and stored. The delivery status of its ads (up to 20) is re-read and stored, so an immediate GET returns what the platform now reports.  A stored switch never skips a write, and when the platform cannot be read the write always goes out.  On Meta and Reddit the check reads the ad set's own switch (`status` / `configured_status`). So a repeated request skips even while `platformAdSetStatus` reads `CAMPAIGN_PAUSED`, `WITH_ISSUES` or `IN_PROCESS`.
pub async fn update_ad_set_status(
    configuration: &configuration::Configuration,
    ad_set_id: &str,
    update_ad_campaign_status_request: models::UpdateAdCampaignStatusRequest,
) -> Result<models::UpdateAdSetStatus200Response, Error<UpdateAdSetStatusError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_ad_set_id = ad_set_id;
    let p_body_update_ad_campaign_status_request = update_ad_campaign_status_request;

    let uri_str = format!(
        "{}/v1/ads/ad-sets/{adSetId}/status",
        configuration.base_path,
        adSetId = crate::apis::urlencode(p_path_ad_set_id)
    );
    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };
    req_builder = req_builder.json(&p_body_update_ad_campaign_status_request);

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UpdateAdSetStatus200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::UpdateAdSetStatus200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<UpdateAdSetStatusError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Pauses or resumes a single ad without touching its ad set, campaign or sibling ads.  ### What it flips  Ad-scoped pause/resume flips ONLY this ad's own switch, never its parent ad set or campaign, so sibling ads keep running:  - Meta `configured_status` - TikTok `operation_status` - Google ad group ad status - LinkedIn creative - Pinterest ad - Reddit ad `configured_status`  X is the exception: its smallest switch is the line item.  It is a thin wrapper over the `status` field of PUT /v1/ads/{adId}, for callers that want a URL symmetric to /v1/ads/campaigns/{campaignId}/status and /v1/ads/ad-sets/{adSetId}/status.  ### Own switch vs delivery status  The ad's own switch is independent of its delivery status.  - An ad paused only because its campaign or ad set is off (`status: paused`, `configuredStatus: ACTIVE`) can still be switched off here. - Switching an ad on under a paused campaign leaves it `paused` until the campaign is resumed.  After the write the switch is read back from the platform and returned as `configuredStatus`, together with the resulting delivery `status`.  ### Identifiers  `{adId}` accepts the same identifier dialects as GET/PUT /v1/ads/{adId}: Zernio hex `_id`, Meta numeric `platformAdId`, or the creative's effective story/media IDs.  `platform` is inferred from the ad, so it's not required in the body.  ### Skips  These requests are skipped:  - Ads in terminal statuses (rejected, completed, cancelled). - A request whose target already matches the ad's own switch as read LIVE from the platform. A stored value is never trusted alone, since the switch may have been changed in the platform's own UI.  A skip also returns that live read. The rolled-up `status` never decides a skip.
pub async fn update_ad_status(
    configuration: &configuration::Configuration,
    ad_id: &str,
    update_ad_keyword_request: models::UpdateAdKeywordRequest,
) -> Result<models::UpdateAdStatus200Response, Error<UpdateAdStatusError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_ad_id = ad_id;
    let p_body_update_ad_keyword_request = update_ad_keyword_request;

    let uri_str = format!(
        "{}/v1/ads/{adId}/status",
        configuration.base_path,
        adId = crate::apis::urlencode(p_path_ad_id)
    );
    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };
    req_builder = req_builder.json(&p_body_update_ad_keyword_request);

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UpdateAdStatus200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::UpdateAdStatus200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<UpdateAdStatusError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Renames a shared Google Ads bid strategy or changes its target CPA or ROAS.  The strategy's status is output only on Google's side, so it cannot be changed here; remove a strategy in Google Ads.  ### When to send `type`  `type` is only needed alongside `targetCpa`/`targetRoas`, to disambiguate the field Google writes to:  - TARGET_CPA and MAXIMIZE_CONVERSIONS both take a target CPA. - TARGET_ROAS and MAXIMIZE_CONVERSION_VALUE both take a target ROAS.  The strategy's family is otherwise immutable once created.
pub async fn update_bid_strategy(
    configuration: &configuration::Configuration,
    strategy_id: &str,
    update_bid_strategy_request: models::UpdateBidStrategyRequest,
) -> Result<models::UpdateBidStrategy200Response, Error<UpdateBidStrategyError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_strategy_id = strategy_id;
    let p_body_update_bid_strategy_request = update_bid_strategy_request;

    let uri_str = format!(
        "{}/v1/ads/bid-strategies/{strategyId}",
        configuration.base_path,
        strategyId = crate::apis::urlencode(p_path_strategy_id)
    );
    let mut req_builder = configuration
        .client
        .request(reqwest::Method::PATCH, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };
    req_builder = req_builder.json(&p_body_update_bid_strategy_request);

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UpdateBidStrategy200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::UpdateBidStrategy200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<UpdateBidStrategyError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Replaces the days and hours a Google campaign runs, or clears them so it serves around the clock.  This is a REPLACE, not a merge: windows you leave out stop serving. Send `schedule: []` to clear dayparting, which returns the campaign to serving around the clock.  ### Rules  Google rules are enforced here, so you get a named field instead of a criterion error:  - at most 6 windows per day - a window must end after it starts - windows on the same day may not overlap - `endHour` 24 is midnight and cannot carry minutes - minutes are quarter-hours only (0, 15, 30, 45) - `bidModifier` is 0.1-10.0. Google's 0 means \"off\" for devices only, so a window is switched off by leaving it out.  Windows are half-open (Google is exclusive of the end minute), so 09:00-12:00 and 12:00-17:00 on the same day are adjacent and both valid.  ### How it is applied  Google cannot edit an ad schedule in place (every AdScheduleInfo field is prohibited on update). So this removes the live criteria and creates the new ones in a single atomic mutate.  The response is read back from Google and carries the new criterion ids.
pub async fn update_campaign_ad_schedule(
    configuration: &configuration::Configuration,
    campaign_id: &str,
    update_campaign_ad_schedule_request: models::UpdateCampaignAdScheduleRequest,
) -> Result<models::UpdateCampaignAdSchedule200Response, Error<UpdateCampaignAdScheduleError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_campaign_id = campaign_id;
    let p_body_update_campaign_ad_schedule_request = update_campaign_ad_schedule_request;

    let uri_str = format!(
        "{}/v1/ads/campaigns/{campaignId}/ad-schedule",
        configuration.base_path,
        campaignId = crate::apis::urlencode(p_path_campaign_id)
    );
    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };
    req_builder = req_builder.json(&p_body_update_campaign_ad_schedule_request);

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UpdateCampaignAdSchedule200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::UpdateCampaignAdSchedule200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<UpdateCampaignAdScheduleError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Edits a Google campaign's existing assets, such as sitelinks or callouts, in place; the change applies everywhere that asset is used.  Send updates with assetResourceName and the fields to change. An asset is shared: changes affect every attachment using it. Omitted fields stay unchanged. The operation consumes the Google operations budget and invalidates affected cached lists.
pub async fn update_campaign_assets(
    configuration: &configuration::Configuration,
    campaign_id: &str,
    update_campaign_assets_request: models::UpdateCampaignAssetsRequest,
) -> Result<models::UpdateCampaignAssets200Response, Error<UpdateCampaignAssetsError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_campaign_id = campaign_id;
    let p_body_update_campaign_assets_request = update_campaign_assets_request;

    let uri_str = format!(
        "{}/v1/ads/campaigns/{campaignId}/assets",
        configuration.base_path,
        campaignId = crate::apis::urlencode(p_path_campaign_id)
    );
    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };
    req_builder = req_builder.json(&p_body_update_campaign_assets_request);

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UpdateCampaignAssets200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::UpdateCampaignAssets200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<UpdateCampaignAssetsError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Changes which conversions a Google campaign bids on, switching between account-default goals, its own goals or a custom goal.  In one mutate, it can:  - set `biddable` on campaign goals - switch `goalConfigLevel` - point the campaign at a custom conversion goal  `customConversionGoalId: null` clears it. Google refuses that (400) while the campaign stays at CAMPAIGN level with no biddable goals, so send `goalConfigLevel: CUSTOMER` with it to fall back to the account goals.  Returns the re-read campaign goals.
pub async fn update_campaign_conversion_goals(
    configuration: &configuration::Configuration,
    campaign_id: &str,
    update_campaign_conversion_goals_request: models::UpdateCampaignConversionGoalsRequest,
) -> Result<
    models::UpdateCampaignConversionGoals200Response,
    Error<UpdateCampaignConversionGoalsError>,
> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_campaign_id = campaign_id;
    let p_body_update_campaign_conversion_goals_request = update_campaign_conversion_goals_request;

    let uri_str = format!(
        "{}/v1/ads/campaigns/{campaignId}/conversion-goals",
        configuration.base_path,
        campaignId = crate::apis::urlencode(p_path_campaign_id)
    );
    let mut req_builder = configuration
        .client
        .request(reqwest::Method::PATCH, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };
    req_builder = req_builder.json(&p_body_update_campaign_conversion_goals_request);

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UpdateCampaignConversionGoals200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::UpdateCampaignConversionGoals200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<UpdateCampaignConversionGoalsError> =
            serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Changes a Google campaign's device, location, excluded location or language targeting after it was created. Google only; every other platform returns 501.  Google Ads compliance row M.10: geo and language targeting set at creation must stay editable afterwards.  Send at least one of `devices`, `locations`, `excludedLocations`, `languages`, `locationTargetingType`. Each provided field REPLACES that field's existing criteria on the campaign (a full set, not a delta). Fields left out of the body are untouched.  ### Fields  - `devices`: the full set of device bid modifiers. A supported device you leave out is switched off with a bid modifier of 0, since Google cannot remove a device criterion. A device the campaign's channel does not carry, and a set that switches every device off, both return 422. - `locations`: see below. - `excludedLocations`: see below. - `languages`: an array of Google's language codes (ISO 639-1, plus variants such as `zh_CN`). An unknown code returns 400. - `locationTargetingType`: switches who the location targeting reaches. `presence` (people in or regularly in the locations) or `presence_or_interest` (also people searching for or interested in them). Example: `{ \"platform\": \"google\", \"targeting\": { \"locationTargetingType\": \"presence\" } }`.  ### Locations  `locations` accepts the same shapes as campaign creation: a bare array of ISO country codes, or an object with `countries`/`regions`/`cities`/`zips`/`metros` key lists (`key` from GET /v1/ads/targeting/search?dimension=geo).  Excluded locations are left untouched by `locations`. An empty location list returns 400 instead of removing every criterion: a Google campaign with no location criteria targets every country, so omit `locations` to leave targeting alone.  ### Excluded locations  `excludedLocations` takes the same two shapes and replaces the campaign's negative location criteria (the places it never serves in), leaving the targeted `locations` untouched.  - An empty list (or `{}`) removes every exclusion. - Radius exclusions are not supported. - A place cannot be both targeted and excluded: a request whose result would leave one on both sides returns 400 before anything is written. - Moving a place from one side to the other in the same request is applied atomically.  Example: `{ \"platform\": \"google\", \"targeting\": { \"excludedLocations\": { \"countries\": [\"CA\"], \"regions\": [\"21137\"] } } }`.  ### Atomic writes and response  The removes and the creates go out in ONE Google `googleAds:mutate`, so a failed edit leaves the campaign's previous set intact rather than a half-applied one.  The response includes the refreshed `devices`/`locations`/`excludedLocations`/`languages` state read back from Google after the edit. It also invalidates the cached copy `GET` on this campaign would otherwise keep serving.  ### Demand Gen  Google keeps a Demand Gen campaign's locations and languages on its ad groups and refuses them on the campaign.  - With one ad group, they are written there and the response carries its `adGroupId` (the campaign-level `locations`/`languages` read back then stay empty). - With several ad groups, the call returns 400 naming them. Edit each one with PUT /v1/ads/{adId} `targeting` on an ad of that ad group. - Campaigns migrated from Discovery that still target on the campaign keep being written there. - `devices` and `locationTargetingType` stay campaign-level. - `excludedLocations` is not available on Demand Gen yet and returns 400.
pub async fn update_campaign_targeting(
    configuration: &configuration::Configuration,
    campaign_id: &str,
    update_campaign_targeting_request: models::UpdateCampaignTargetingRequest,
) -> Result<models::UpdateCampaignTargeting200Response, Error<UpdateCampaignTargetingError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_campaign_id = campaign_id;
    let p_body_update_campaign_targeting_request = update_campaign_targeting_request;

    let uri_str = format!(
        "{}/v1/ads/campaigns/{campaignId}/targeting",
        configuration.base_path,
        campaignId = crate::apis::urlencode(p_path_campaign_id)
    );
    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };
    req_builder = req_builder.json(&p_body_update_campaign_targeting_request);

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UpdateCampaignTargeting200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::UpdateCampaignTargeting200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<UpdateCampaignTargetingError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}

/// Changes a Performance Max asset group's name, status, final URLs or display paths.  Change the name, status (ENABLED or PAUSED), final URLs or display paths. Only the fields sent are written; null on path1 or path2 clears it. Change assets with the /assets endpoint and product targeting with /listing-group-filters. validateOnly: true validates without writing.
pub async fn update_google_asset_group(
    configuration: &configuration::Configuration,
    campaign_id: &str,
    asset_group_id: &str,
    update_google_asset_group_request: models::UpdateGoogleAssetGroupRequest,
) -> Result<models::UpdateGoogleAssetGroup200Response, Error<UpdateGoogleAssetGroupError>> {
    // add a prefix to parameters to efficiently prevent name collisions
    let p_path_campaign_id = campaign_id;
    let p_path_asset_group_id = asset_group_id;
    let p_body_update_google_asset_group_request = update_google_asset_group_request;

    let uri_str = format!(
        "{}/v1/ads/campaigns/{campaignId}/asset-groups/{assetGroupId}",
        configuration.base_path,
        campaignId = crate::apis::urlencode(p_path_campaign_id),
        assetGroupId = crate::apis::urlencode(p_path_asset_group_id)
    );
    let mut req_builder = configuration
        .client
        .request(reqwest::Method::PATCH, &uri_str);

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }
    if let Some(ref token) = configuration.bearer_access_token {
        req_builder = req_builder.bearer_auth(token.to_owned());
    };
    req_builder = req_builder.json(&p_body_update_google_asset_group_request);

    let req = req_builder.build()?;
    let resp = configuration.client.execute(req).await?;

    let status = resp.status();
    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);

    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UpdateGoogleAssetGroup200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::UpdateGoogleAssetGroup200Response`")))),
        }
    } else {
        let content = resp.text().await?;
        let entity: Option<UpdateGoogleAssetGroupError> = serde_json::from_str(&content).ok();
        Err(Error::ResponseError(ResponseContent {
            status,
            content,
            entity,
        }))
    }
}