apifreaks 1.0.0

Rust SDK for APIFreaks
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
//! Service clients and API endpoints
//!
//! This module provides the client implementations for all available services.

use crate::api::*;
use crate::{ApiError, ByteStream, ClientConfig, HttpClient, QueryBuilder, RequestOptions};
use reqwest::Method;

pub struct ApiFreaks {
    pub config: ClientConfig,
    pub http_client: HttpClient,
}

impl ApiFreaks {
    pub fn new(config: ClientConfig) -> Result<Self, ApiError> {
        Ok(Self {
            config: config.clone(),
            http_client: HttpClient::new(config.clone())?,
        })
    }

    /// Get detailed geolocation data for an IP address including country, city, timezone, currency, and optional security and user-agent information
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `ip` - IPv4, IPv6, or hostname for geolocation lookup
    /// * `lang` - Response language for location fields
    /// * `fields` - Comma separated list of fields to include in response
    /// * `excludes` - Comma separated list of fields to exclude from response
    /// * `include` - Additional data to include (location, network, security, currency, time_zone, user_agent, country_metadata , hostname, liveHostname, hostnameFallbackLivet)
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn geolocation_lookup(
        &self,
        request: &GeolocationLookupQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<GeolocationLookupResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/geolocation/lookup",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("ip", request.ip.clone())
                    .serialize("lang", request.lang.clone())
                    .string("fields", request.fields.clone())
                    .string("excludes", request.excludes.clone())
                    .string("include", request.include.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Retrieve detailed geolocation data for multiple IP addresses in a single request.
    /// Supports up to `50,000` IP-addresses/host-names per request.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `lang` - Language of the response.
    /// * `fields` - Comma-separated list of fields to include in the response. Can include "geo".
    /// * `excludes` - Comma-separated list of fields to exclude from the response (except "ip").
    /// * `include` - Comma-separated list of additional information to include in the response.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn bulk_geolocation_lookup(
        &self,
        request: &BulkGeolocationLookupRequest,
        options: Option<RequestOptions>,
    ) -> Result<Vec<BulkGeolocationLookupResponseItem>, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1.0/geolocation/lookup",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("lang", request.lang.clone())
                    .string("fields", request.fields.clone())
                    .string("excludes", request.excludes.clone())
                    .string("include", request.include.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Get comprehensive security information for a given IP address. Detects VPNs, proxies, Tor nodes, and other security threats.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `ip` - A valid IPv4 or IPv6 address to look up. If omitted, the API uses the public IP of the requesting client.
    /// * `fields` - Comma-separated list of fields to return. Supports dot notation (e.g. security.threat_score).
    /// * `excludes` - Comma-separated list of fields to remove from the response. Supports dot notation (e.g. security.is_tor).
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn ip_security_lookup(
        &self,
        request: &IpSecurityLookupQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<IpSecurityLookupResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/ip/security",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("ip", request.ip.clone())
                    .string("fields", request.fields.clone())
                    .string("excludes", request.excludes.clone())
                    .build(),
                options,
            )
            .await
    }

    /// The Bulk IP Security Lookup API allows you to retrieve security details for up to `50,000` IP-addresses in a single request.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `fields` - Comma-separated list of fields to return. Supports dot notation (e.g. security.threat_score).
    /// * `excludes` - Comma-separated list of fields to remove from the response. Supports dot notation (e.g. security.is_tor).
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn bulk_ip_security_lookup(
        &self,
        request: &BulkIpSecurityLookupRequest,
        options: Option<RequestOptions>,
    ) -> Result<Vec<BulkIpSecurityLookupResponseItem>, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1.0/ip/security",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("fields", request.fields.clone())
                    .string("excludes", request.excludes.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Convert a given address or place name into geographic coordinates (latitude and longitude).
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `query` - Free-form search query, e.g. Wembley Stadium, London
    /// * `limit` - Max number of results to return (1–40). May return fewer if matches are weak.
    /// * `min_lat` - Minimum latitude for the viewbox. Must be ≤ max_lat and between -90 and 90.
    /// * `max_lat` - Maximum latitude for the viewbox. Must be ≥ min_lat and between -90 and 90.
    /// * `min_lon` - Minimum longitude for the viewbox. Must be ≤ max_lon and between -180 and 180.
    /// * `max_lon` - Maximum longitude for the viewbox. Must be ≥ min_lon and between -180 and 180.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn geocoder_search(
        &self,
        request: &GeocoderSearchQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<Vec<GeocoderSearchResponseItem>, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/geocoder/search",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .structured_query("query", request.query.clone())
                    .int("limit", request.limit.clone())
                    .float("min_lat", request.min_lat.clone())
                    .float("max_lat", request.max_lat.clone())
                    .float("min_lon", request.min_lon.clone())
                    .float("max_lon", request.max_lon.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Convert geographic coordinates (latitude and longitude) into a human-readable address or place name.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `lat` - WGS84 latitude value ranging from -90 to 90.
    /// * `lon` - WGS84 longitude value ranging from -180 to 180.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn geocoder_reverse(
        &self,
        request: &GeocoderReverseQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<GeocoderReverseResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/geocoder/reverse",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .float("lat", request.lat.clone())
                    .float("lon", request.lon.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Retrieve current WHOIS information for a domain name.
    /// This endpoint provides detailed registration information including registrar details,
    /// dates, nameservers, and registrant information.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Response format (defaults to json)
    /// * `domain_name` - Domain name for WHOIS lookup
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn domain_whois_lookup(
        &self,
        request: &DomainWhoisLookupQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<DomainWhoisLookupResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/domain/whois/live",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("domainName", request.domain_name.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Retrieve WHOIS information for `100 Domains per Request`.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn bulk_domain_whois_lookup(
        &self,
        request: &BulkDomainWhoisLookupRequest,
        options: Option<RequestOptions>,
    ) -> Result<BulkDomainWhoisLookupResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1.0/domain/whois/live",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Returns WHOIS registration details for a specified IP address (IPv4 or IPv6).
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `ip` - The IP address (IPv4 or IPv6) for which WHOIS data is requested.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn ip_whois_lookup(
        &self,
        request: &IpWhoisLookupQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<IpWhoisLookupResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/ip/whois/live",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("ip", request.ip.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Returns WHOIS registration details for a specified ASN, with or without the 'as' prefix.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `asn` - The Autonomous System Number (ASN) to retrieve WHOIS data for. Can be prefixed with 'as' or not.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn asn_whois_lookup(
        &self,
        request: &AsnWhoisLookupQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<AsnWhoisLookupResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/asn/whois/live",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("asn", request.asn.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Retrieve historical WHOIS records for a domain name.
    /// This endpoint provides a timeline of all recorded changes in domain registration information.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `domain_name` - Domain name for historical WHOIS lookup
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn domain_whois_history(
        &self,
        request: &DomainWhoisHistoryQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<DomainWhoisHistoryResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/domain/whois/history",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("domainName", request.domain_name.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Performs a reverse WHOIS search using one or more search parameters like keyword, email, owner, or company.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `keyword` - Keyword search term for reverse WHOIS by keyword (case-insensitive pattern matching).
    /// * `email` - Email search term for reverse WHOIS by email address (case-insensitive exact or regex match; * wildcard supported).
    /// * `owner` - Registrant or owner name for reverse WHOIS (a full-text search phrase matching technique to retrieve results).
    /// * `company` - Organization or company name for reverse WHOIS (full-text search phrase matching technique to retrieve results).
    /// * `exact` - Accepts 'true' or 'false'. "true" returns only records that exactly match the input (keyword, owner/registrant, or company). "false" returns all matches and is the default when omitted.
    /// * `page` - Page number for paginated results.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn domain_whois_reverse(
        &self,
        request: &DomainWhoisReverseQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<DomainWhoisReverseResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/domain/whois/reverse",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("keyword", request.keyword.clone())
                    .string("email", request.email.clone())
                    .string("owner", request.owner.clone())
                    .string("company", request.company.clone())
                    .bool("exact", request.exact.clone())
                    .serialize("mode", request.mode.clone())
                    .int("page", request.page.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Retrieve real-time DNS records for any hostname. Supports multiple record types including A, AAAA, MX, NS, SOA, SPF, TXT, and CNAME records.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `host_name` - Hostname or URL whose DNS records are required.
    /// * `ip_address` - The IP address for requested DNS's PTR record. 'type' parameter must be set to 'all'.
    /// * `type_` - A comma-separated list of DNS record types for lookup. Possible values: A, AAAA, MX, NS, SOA, SPF, TXT, CNAME, or all. When ipAddress is provided, type must be "all".
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn domain_dns_lookup(
        &self,
        request: &DomainDnsLookupQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<DomainDnsLookupResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/domain/dns/live",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("host-name", request.host_name.clone())
                    .string("ipAddress", request.ip_address.clone())
                    .string_array("type", request.r#type.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Perform DNS lookups for multiple hostnames in a single request. Supports up to `100 host-names per request`
    /// and returns DNS records including A, AAAA, MX, NS, SOA, SPF, TXT, and CNAME records.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `type_` - A comma-separated list of DNS record types for lookup.
    /// Possible values: A, AAAA, MX, NS, SOA, SPF, TXT, CNAME, or all
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn bulk_domain_dns_lookup(
        &self,
        request: &BulkDomainDnsLookupRequest,
        options: Option<RequestOptions>,
    ) -> Result<BulkDomainDnsLookupResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1.0/domain/dns/live",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string_array("type", request.r#type.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Retrieve historical DNS records for any hostname. Access unique historical data for A, AAAA, MX, NS, SOA, SPF, TXT, and CNAME records,
    /// including subdomains. Results are paginated with up to 100 unique records per page.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `host_name` - Hostname or URL whose historical DNS records are required
    /// * `type_` - A comma-separated list of DNS record types for lookup.
    /// Possible values: A, AAAA, MX, NS, SOA, SPF, TXT, CNAME, or all
    /// * `page` - Page number for paginated results
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn domain_dns_history(
        &self,
        request: &DomainDnsHistoryQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<DomainDnsHistoryResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/domain/dns/history",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("host-name", request.host_name.clone())
                    .string_array("type", request.r#type.clone())
                    .int("page", request.page.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Retrieve all the hostnames associated with any particular A, AAAA, MX, NS, SOA, SPF, TXT, and CNAME DNS records. For instance, you can access all the hostnames hosted on any IP/CIDR notation, all the domain names using Cloudflare name servers, and all the domain names using Google Mailbox
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `type_` - The type of reverse DNS lookup to perform. Determines how the value parameter is interpreted:
    /// - A: IPv4 CIDR block
    /// - AAAA: IPv6 CIDR block
    /// - MX: Mail provider domain
    /// - NS: Name server provider hostname
    /// - SOA: SOA record admin domain
    /// - SPF/TXT: Target verification strings
    /// - CNAME: Target hostname
    /// * `value` - Provide an IP or CIDR for A/AAAA lookups, or a hostname/selector for MX, NS, SOA, SPF, TXT, and CNAME queries. Wildcard regex patterns are also supported (e.g., mail.google.com, m*.google.com, _spf.g*.com, s*.g*.com).
    /// * `exact` - Accepts 'true' or 'false'. "true" returns only records that exactly match the input (NS, MX, CNAME, SOA, SPF, TXT). "false" returns all matches (default when omitted).
    /// * `page` - Page number to paginate through results (defaults to 1).
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn domain_dns_reverse(
        &self,
        request: &DomainDnsReverseQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<DomainDnsReverseResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/domain/dns/reverse",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .serialize("type", Some(request.r#type.clone()))
                    .string("value", request.value.clone())
                    .bool("exact", request.exact.clone())
                    .int("page", request.page.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Execute a series of web scraping instructions on a target URL.
    /// Supports various operations like form filling, clicking, data extraction, and CAPTCHA solving.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Response format returned by the API.
    /// * `url` - Target URL to scrape
    /// * `text` - Set to `true` to return the data in text format else `false` for data in html format with tags.
    /// * `js_enabled` - Set  `true` to handle websites with JavaScript. Set `false` to handle static html websites.
    ///
    ///
    /// Default value is `true`.
    /// * `proxy` - Use proxy for requests
    /// * `ssl_ignore` - Ignore SSL certificate errors.
    ///
    ///
    /// Only works if **jsEnabled** is **true**.
    /// * `window_size` - Specify the browser window size in the format 'width,height' (e.g., "1920w,1080h"). Default value is the default resolutions provided by web/browser.
    ///
    ///
    /// Only works if **jsEnabled** is **true**.
    /// * `ad_block` - Set to `true` to apply ad-blocker to the specified URL else false or ignore to not apply.
    ///
    ///
    /// Only works if **jsEnabled** is **true**.
    /// * `captcha` - if true user can provide captcha instructions in the instructions to solve image captchas.
    ///
    ///
    /// Only works if **jsEnabled** is **true**.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn web_scrape(
        &self,
        request: &WebScrapeRequest,
        options: Option<RequestOptions>,
    ) -> Result<WebScrapeResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1.0/scraping",
                Some(serde_json::to_value(&request.body).map_err(ApiError::Serialization)?),
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("url", request.url.clone())
                    .bool("text", request.text.clone())
                    .bool("jsEnabled", request.js_enabled.clone())
                    .serialize("proxy", request.proxy.clone())
                    .bool("sslIgnore", request.ssl_ignore.clone())
                    .string("windowSize", request.window_size.clone())
                    .bool("adBlock", request.ad_block.clone())
                    .bool("captcha", request.captcha.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Validates a single email address and returns result.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn email_validate(
        &self,
        request: &EmailValidateRequest,
        options: Option<RequestOptions>,
    ) -> Result<EmailValidateResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1.0/email-validation/single",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Validates a bulk of email addresses and returns result for each. Maximum `10` email addresses per request.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn bulk_email_validate(
        &self,
        request: &BulkEmailValidateRequest,
        options: Option<RequestOptions>,
    ) -> Result<BulkEmailValidateResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1.0/email-validation/bulk",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Validates a single phone number and returns detailed metadata including carrier, line type, geolocation, time zones, and standardized formats.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Specifies the desired format for the API response. Choose 'json' for a JSON object. If not provided, the API defaults to JSON format.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn phone_validate(
        &self,
        request: &PhoneValidateRequest,
        options: Option<RequestOptions>,
    ) -> Result<PhoneValidateResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1.0/phone/validation",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Validates up to 100 phone numbers in a single request. Each number is processed independently — invalid entries return per-number errors without affecting the rest of the batch.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Specifies the desired format for the API response. Choose 'json' for a JSON object. If not provided, the API defaults to JSON format.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn bulk_phone_validate(
        &self,
        request: &BulkPhoneValidateRequest,
        options: Option<RequestOptions>,
    ) -> Result<Vec<BulkPhoneValidateResponseItem>, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1.0/phone/validation/bulk",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Retrieve comprehensive SSL certificate information without the certificate chain.
    /// This endpoint provides detailed information about the SSL certificate including expiry dates, issuer details, and encryption methods.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `domain_name` - Domain name or URL whose SSL certificate lookup is required
    /// * `ssl_raw` - Set to true to get the raw openSSL response of the domain
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn domain_ssl_lookup(
        &self,
        request: &DomainSslLookupQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<DomainSslLookupResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/domain/ssl/live",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("domainName", request.domain_name.clone())
                    .bool("sslRaw", request.ssl_raw.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Retrieve the complete SSL certificate chain from root Certificate Authority (CA) to end-user certificate.
    /// This endpoint provides comprehensive information about each certificate in the chain.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `domain_name` - Domain name or URL whose SSL certificate chain lookup is required
    /// * `ssl_raw` - Set to true to get the raw openSSL response for each certificate in the chain
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn domain_ssl_chain_lookup(
        &self,
        request: &DomainSslChainLookupQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<DomainSslChainLookupResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/domain/ssl/live/chain",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("domainName", request.domain_name.clone())
                    .bool("sslRaw", request.ssl_raw.clone())
                    .build(),
                options,
            )
            .await
    }

    /// The Domain Search API is designed to simplify the process of finding available domain names across all top-level domains (TLDs) and second-level domains (SLDs).
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `domain` - Domain name whose availability is to be checked.
    /// * `source` - Specify the data source for domain availability checks. Use "dns" for DNS-based lookups or "whois" for WHOIS-based lookups. By default, "dns" is used.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn domain_availability_check(
        &self,
        request: &DomainAvailabilityCheckQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<DomainAvailabilityCheckResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/domain/availability",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("domain", request.domain.clone())
                    .serialize("source", request.source.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Perform Bulk Domain Availability checks using a list of domains. Supports upto `100 Domains Per Request`.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `source` - Specify the data source for domain availability checks. Use "dns" for DNS-based lookups or "whois" for WHOIS-based lookups. By default, "dns" is used.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn bulk_domain_availability_check(
        &self,
        request: &BulkDomainAvailabilityCheckRequest,
        options: Option<RequestOptions>,
    ) -> Result<BulkDomainAvailabilityCheckResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1.0/domain/availability",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .serialize("source", request.source.clone())
                    .build(),
                options,
            )
            .await
    }

    /// The Domain Search API is designed to simplify the process of finding available domain names across all top-level domains (TLDs) and second-level domains (SLDs).
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `domain` - Domain name for availability and suggestions.
    /// * `source` - Specify the data source for domain availability checks. Use "dns" for DNS-based lookups or "whois" for WHOIS-based lookups. By default, "dns" is used.
    /// * `count` - Number of suggestions to retrieve.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn domain_availability_suggestions(
        &self,
        request: &DomainAvailabilitySuggestionsQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<DomainAvailabilitySuggestionsResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/domain/availability/suggestions",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("domain", request.domain.clone())
                    .serialize("source", request.source.clone())
                    .int("count", request.count.clone())
                    .build(),
                options,
            )
            .await
    }

    /// The Subdomain Lookup API is designed to retrieve subdomains related to the given domain name. It helps you explore subdomains that are available for registration or usage.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `domain` - Domain name for availability and suggestions.
    /// * `after` - Filter subdomains seen after this date (format YYYY-MM-DD).
    /// * `before` - Filter subdomains seen before this date( format YYYY-MM-DD).
    /// * `status` - Filter subdomains by status (active or inactive).
    /// * `page` - Page number for paginated results.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn subdomains_lookup(
        &self,
        request: &SubdomainsLookupQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<SubdomainsLookupResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/subdomains/lookup",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("domain", request.domain.clone())
                    .date("after", request.after.clone())
                    .date("before", request.before.clone())
                    .serialize("status", request.status.clone())
                    .string("page", request.page.clone())
                    .build(),
                options,
            )
            .await
    }

    /// This API merges multiple PDF files into a single PDF, in the order they are provided
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Specifies the desired format for the API response. Choose 'json' for a JSON object or 'xml' for an XML structure.
    /// * `file_id` - An array of unique file IDs referencing PDF files previously uploaded to the API Freaks server. Use this parameter to merge existing files without re-uploading them. Provide multiple IDs to merge files in the specified order.
    /// * `destroy` - If set to `true`, the input file(s) will be permanently deleted from the server immediately after the output PDF is generated.
    /// * `output` - Specifies the desired name for the resulting merged PDF file. If not provided, a default name will be assigned.
    /// * `webhook_url` - The URL to which the webhook notification will be sent after the task is completed.
    /// * `webhook_failure_notification` - If true, a notification will also be sent by email in case the webhook request fails all the retries.  The email notification will be sent to the requesting user or their organization’s admin if part of one.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn pdf_merge(
        &self,
        request: &PdfMergeRequest,
        options: Option<RequestOptions>,
    ) -> Result<PdfMergeResponse, ApiError> {
        self.http_client
            .execute_multipart_request(
                Method::POST,
                "v1.0/pdf/merge",
                request.clone().to_multipart(),
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string_array("file_id", request.file_id.clone())
                    .bool("destroy", request.destroy.clone())
                    .string("output", request.output.clone())
                    .string("webhook_url", request.webhook_url.clone())
                    .bool(
                        "webhook_failure_notification",
                        request.webhook_failure_notification.clone(),
                    )
                    .build(),
                options,
            )
            .await
    }

    /// This API removes a selection or range of pages from a PDF file.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Specifies the desired format for the API response. Choose 'json' for a JSON object or 'xml' for an XML structure.
    /// * `file_id` - The unique identifier of a PDF file already uploaded to the API Freaks server. Use this as an alternative to uploading a new file directly.
    /// * `destroy` - If set to `true`, the input file(s) will be permanently deleted from the server immediately after the output PDF is generated.
    /// * `output` - The desired name for the output PDF file after pages have been removed. If not provided, a default name will be assigned.
    /// * `pages` - Specifies which pages to remove from the PDF. Accepts individual page numbers (e.g., '1,7') and/or ascending page ranges (e.g., '3-5'). Use commas to separate entries and hyphens for ranges. Reverse ranges (e.g., '5-3') are not allowed. Alternatively, you may provide only one of the following keywords: 'even' (removes all even-numbered pages), 'odd' (removes all odd-numbered pages), or 'last' (removes only the last page). The keyword 'all' is not supported for this operation. Examples: '1,3-5', 'even'. Mixing special keywords with specific pages/ranges is not allowed.
    /// * `webhook_url` - The URL to which the webhook notification will be sent after the task is completed.
    /// * `webhook_failure_notification` - If true, a notification will also be sent by email in case the webhook request fails all the retries.  The email notification will be sent to the requesting user or their organization’s admin if part of one.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn pdf_remove_pages(
        &self,
        request: &PdfRemovePagesRequest,
        options: Option<RequestOptions>,
    ) -> Result<PdfRemovePagesResponse, ApiError> {
        self.http_client
            .execute_multipart_request(
                Method::POST,
                "v1.0/pdf/remove-pages",
                request.clone().to_multipart(),
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("file_id", request.file_id.clone())
                    .bool("destroy", request.destroy.clone())
                    .string("output", request.output.clone())
                    .string("pages", request.pages.clone())
                    .string("webhook_url", request.webhook_url.clone())
                    .bool(
                        "webhook_failure_notification",
                        request.webhook_failure_notification.clone(),
                    )
                    .build(),
                options,
            )
            .await
    }

    /// This API splits a PDF into multiple parts based on specified page numbers or ranges.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Specifies the desired format for the API response. Choose 'json' for a JSON object or 'xml' for an XML structure.
    /// * `file_id` - The unique ID of a PDF file already uploaded to the API Freaks server. Use this as an alternative to uploading a new file directly.
    /// * `destroy` - If set to `true`, the input file(s) will be permanently deleted from the server immediately after the output PDF is generated.
    /// * `output` - The desired base name for the output PDF files after splitting. If not provided, a default naming convention will be used.
    /// * `pages` - Defines the page numbers or ranges where the PDF should be split. Provide individual pages and/or ranges in any order (for example: "1-4,9-5,16-last"). Separate entries with commas and use hyphens for ranges.
    ///
    /// Special keywords (use alone):
    ///
    /// • `even` — split at every even-numbered page
    ///
    /// • `odd` — split at every odd-numbered page
    ///
    /// • `all` — split the PDF into single-page files
    ///
    /// The keyword `last` can be used anywhere in the string, in combination with page numbers or ranges (for example: "5-last", "last-2", "1,last,9").
    ///
    /// Examples:
    /// - "1,4-2,last"
    /// - "odd"
    /// - "all"
    /// - "last,2-5"
    ///
    /// Invalid example: "1,odd" (mixing a keyword other than "last" with specific pages/ranges is not allowed). You can pass multiple pages entries to produce multiple output files.
    /// * `webhook_url` - The URL to which the webhook notification will be sent after the task is completed.
    /// * `webhook_failure_notification` - If true, a notification will also be sent by email in case the webhook request fails all the retries.  The email notification will be sent to the requesting user or their organization’s admin if part of one.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn pdf_split(
        &self,
        request: &PdfSplitRequest,
        options: Option<RequestOptions>,
    ) -> Result<PdfSplitResponse, ApiError> {
        self.http_client
            .execute_multipart_request(
                Method::POST,
                "v1.0/pdf/split",
                request.clone().to_multipart(),
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("file_id", request.file_id.clone())
                    .bool("destroy", request.destroy.clone())
                    .string("output", request.output.clone())
                    .string_array("pages", request.pages.clone())
                    .string("webhook_url", request.webhook_url.clone())
                    .bool(
                        "webhook_failure_notification",
                        request.webhook_failure_notification.clone(),
                    )
                    .build(),
                options,
            )
            .await
    }

    /// This API rotates pages of a PDF by a specified angle (in multiples of 90 degrees).
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Specifies the desired format for the API response. Choose 'json' for a JSON object or 'xml' for an XML structure.
    /// * `file_id` - The unique ID of a PDF file already uploaded to the API Freaks server. Use this as an alternative to uploading a new file directly.
    /// * `destroy` - If set to `true`, the input file(s) will be permanently deleted from the server immediately after the output PDF is generated.
    /// * `output` - The desired name for the output PDF file after rotation. If not provided, a default name will be assigned.
    /// * `pages` - Specifies which pages to rotate. Accepts individual page numbers (e.g., '1,7') and/or ascending page ranges (e.g., '3-5'). Use commas to separate entries and hyphens for ranges. Reverse ranges (e.g., '5-3') are not allowed. Alternatively, provide only one of the following keywords: 'even' (rotate all even-numbered pages), 'odd' (rotate all odd-numbered pages), 'last' (rotate only the last page), or 'all' (rotate all pages). Examples: '1,3-5', 'odd', 'all'. Mixing special keywords with specific pages/ranges is not allowed.
    /// * `rotate` - The angle in degrees to rotate the selected pages. Must be one of the following values: 0, 90, 180, 270, -90, -180, or -270. All rotations are applied clockwise.
    /// * `webhook_url` - The URL to which the webhook notification will be sent after the task is completed.
    /// * `webhook_failure_notification` - If true, a notification will also be sent by email in case the webhook request fails all the retries.  The email notification will be sent to the requesting user or their organization’s admin if part of one.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn pdf_rotate(
        &self,
        request: &PdfRotateRequest,
        options: Option<RequestOptions>,
    ) -> Result<PdfRotateResponse, ApiError> {
        self.http_client
            .execute_multipart_request(
                Method::POST,
                "v1.0/pdf/rotate",
                request.clone().to_multipart(),
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("file_id", request.file_id.clone())
                    .bool("destroy", request.destroy.clone())
                    .string("output", request.output.clone())
                    .string("pages", request.pages.clone())
                    .int("rotate", request.rotate.clone())
                    .string("webhook_url", request.webhook_url.clone())
                    .bool(
                        "webhook_failure_notification",
                        request.webhook_failure_notification.clone(),
                    )
                    .build(),
                options,
            )
            .await
    }

    /// This API compresses a given PDF file to reduce its file size.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Specifies the desired format for the API response. Choose 'json' for a JSON object or 'xml' for an XML structure.
    /// * `file_id` - The unique ID of a PDF file already uploaded to the API Freaks server. Use this as an alternative to uploading a new file.
    /// * `output` - Name of the output PDF.
    /// * `compression_level` - Controls how aggressively the PDF is compressed. Lower levels preserve more quality, while higher levels reduce file size more.
    /// * `destroy` - If set to true, the input file(s) will be deleted from the server immediately after the output is generated.
    /// * `webhook_url` - The URL to which the webhook notification will be sent after the task is completed.
    /// * `webhook_failure_notification` - If true, a notification will also be sent by email in case the webhook request fails all the retries.  The email notification will be sent to the requesting user or their organization’s admin if part of one.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn pdf_compress(
        &self,
        request: &PdfCompressRequest,
        options: Option<RequestOptions>,
    ) -> Result<PdfCompressResponse, ApiError> {
        self.http_client
            .execute_multipart_request(
                Method::POST,
                "v1.0/pdf/compress",
                request.clone().to_multipart(),
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("file_id", request.file_id.clone())
                    .string("output", request.output.clone())
                    .serialize("compression_level", Some(request.compression_level.clone()))
                    .bool("destroy", request.destroy.clone())
                    .string("webhook_url", request.webhook_url.clone())
                    .bool(
                        "webhook_failure_notification",
                        request.webhook_failure_notification.clone(),
                    )
                    .build(),
                options,
            )
            .await
    }

    /// This API extracts specific pages or page ranges from a PDF file and returns them as a new PDF.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Specifies the desired format for the API response. Choose 'json' for a JSON object or 'xml' for an XML structure.
    /// * `file_id` - The unique ID of a PDF file already uploaded to the API Freaks server. Use this as an alternative to uploading a new file directly.
    /// * `destroy` - If set to `true`, the input file(s) will be permanently deleted from the server immediately after the output PDF is generated.
    /// * `output` - The desired name for the output PDF file after pages have been extracted. If not provided, a default name will be assigned.
    /// * `pages` - Specifies which pages to extract from the PDF. You can provide individual page numbers (e.g., '2') and/or page ranges in any order, including descending (e.g., '9-5', '16-last'). Use commas to separate entries and hyphens for ranges. You may alternatively pass only one of the special keywords: 'even' (extracts all even-numbered pages), 'odd' (extracts all odd-numbered pages), 'last' (extracts only the last page), or 'all' (extracts all pages into individual files). Examples: '2,6-3', 'even', 'all'. Mixing special keywords with specific pages/ranges is not allowed.
    /// * `separated` - If set to `true`, each of the specified pages will be extracted and returned as a separate PDF file.
    /// * `webhook_url` - The URL to which the webhook notification will be sent after the task is completed.
    /// * `webhook_failure_notification` - If true, a notification will also be sent by email in case the webhook request fails all the retries.  The email notification will be sent to the requesting user or their organization’s admin if part of one.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn pdf_extract_pages(
        &self,
        request: &PdfExtractPagesRequest,
        options: Option<RequestOptions>,
    ) -> Result<PdfExtractPagesResponse, ApiError> {
        self.http_client
            .execute_multipart_request(
                Method::POST,
                "v1.0/pdf/extract-pages",
                request.clone().to_multipart(),
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("file_id", request.file_id.clone())
                    .bool("destroy", request.destroy.clone())
                    .string("output", request.output.clone())
                    .string("pages", request.pages.clone())
                    .bool("separated", request.separated.clone())
                    .string("webhook_url", request.webhook_url.clone())
                    .bool(
                        "webhook_failure_notification",
                        request.webhook_failure_notification.clone(),
                    )
                    .build(),
                options,
            )
            .await
    }

    /// API endpoint that linearizes any given PDF, restructuring it for faster loading and page-by-page viewing in web browsers.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Specifies the desired format for the API response. Choose 'json' for a JSON object or 'xml' for an XML structure.
    /// * `file_id` - The unique ID of a PDF file already uploaded to the API Freaks server. Use this as an alternative to uploading a new file directly.
    /// * `destroy` - If set to `true`, the input file(s) will be permanently deleted from the server immediately after the output PDF is generated.
    /// * `output` - The desired name for the output PDF file after pages have been extracted. If not provided, a default name will be assigned.
    /// * `webhook_url` - The URL to which the webhook notification will be sent after the task is completed.
    /// * `webhook_failure_notification` - If true, a notification will also be sent by email in case the webhook request fails all the retries.  The email notification will be sent to the requesting user or their organization’s admin if part of one.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn pdf_linearize(
        &self,
        request: &PdfLinearizeRequest,
        options: Option<RequestOptions>,
    ) -> Result<PdfLinearizeResponse, ApiError> {
        self.http_client
            .execute_multipart_request(
                Method::POST,
                "v1.0/pdf/linearize",
                request.clone().to_multipart(),
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("file_id", request.file_id.clone())
                    .bool("destroy", request.destroy.clone())
                    .string("output", request.output.clone())
                    .string("webhook_url", request.webhook_url.clone())
                    .bool(
                        "webhook_failure_notification",
                        request.webhook_failure_notification.clone(),
                    )
                    .build(),
                options,
            )
            .await
    }

    /// This API encrypts a PDF file by setting a password required to open it.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Specifies the desired format for the API response. Choose 'json' for a JSON object or 'xml' for an XML structure.
    /// * `file_id` - The unique ID of a PDF file already uploaded to the API Freaks server. Use this as an alternative to uploading a new file directly.
    /// * `destroy` - If set to `true`, the input file(s) will be permanently deleted from the server immediately after the output PDF is generated.
    /// * `output` - The desired name for the output encrypted PDF file. If not provided, a default name will be assigned.
    /// * `file_password` - The password to unlock the input file if it is already protected. Either the owner password or user password can be provided. The owner password takes precedence. Password Length should be between 6 and 128 characters.
    /// * `user_password` - Sets the user password required to open and view the encrypted PDF file. Password Length should be between 6 and 128 characters.
    /// * `owner_password` - Sets the owner password for the PDF file. This password provides full access, including the ability to remove restrictions. If not provided, the `user_password` will also be used as the owner password. Password Length should be between 6 and 128 characters.
    /// * `webhook_url` - The URL to which the webhook notification will be sent after the task is completed.
    /// * `webhook_failure_notification` - If true, a notification will also be sent by email in case the webhook request fails all the retries.  The email notification will be sent to the requesting user or their organization’s admin if part of one.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn pdf_encrypt(
        &self,
        request: &PdfEncryptRequest,
        options: Option<RequestOptions>,
    ) -> Result<PdfEncryptResponse, ApiError> {
        self.http_client
            .execute_multipart_request(
                Method::POST,
                "v1.0/pdf/encrypt",
                request.clone().to_multipart(),
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("file_id", request.file_id.clone())
                    .bool("destroy", request.destroy.clone())
                    .string("output", request.output.clone())
                    .string("file_password", request.file_password.clone())
                    .string("user_password", request.user_password.clone())
                    .string("owner_password", request.owner_password.clone())
                    .string("webhook_url", request.webhook_url.clone())
                    .bool(
                        "webhook_failure_notification",
                        request.webhook_failure_notification.clone(),
                    )
                    .build(),
                options,
            )
            .await
    }

    /// This API decrypts PDF files, removing all encryption, including open passwords and permission restrictions.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Specifies the desired format for the API response. Choose 'json' for a JSON object or 'xml' for an XML structure.
    /// * `file_id` - The unique ID of a PDF file already uploaded to the API Freaks server. Use this as an alternative to uploading a new file directly.
    /// * `destroy` - If set to `true`, the input file(s) will be permanently deleted from the server immediately after the output PDF is generated.
    /// * `output` - The desired name for the output decrypted PDF file. If not provided, a default name will be assigned.
    /// * `file_password` - The password to unlock the input file if it is protected. Either the owner password or user password can be provided. The owner password takes precedence. Password Length should be between 6 and 128 characters.
    /// * `webhook_url` - The URL to which the webhook notification will be sent after the task is completed.
    /// * `webhook_failure_notification` - If true, a notification will also be sent by email in case the webhook request fails all the retries.  The email notification will be sent to the requesting user or their organization’s admin if part of one.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn pdf_decrypt(
        &self,
        request: &PdfDecryptRequest,
        options: Option<RequestOptions>,
    ) -> Result<PdfDecryptResponse, ApiError> {
        self.http_client
            .execute_multipart_request(
                Method::POST,
                "v1.0/pdf/decrypt",
                request.clone().to_multipart(),
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("file_id", request.file_id.clone())
                    .bool("destroy", request.destroy.clone())
                    .string("output", request.output.clone())
                    .string("file_password", request.file_password.clone())
                    .string("webhook_url", request.webhook_url.clone())
                    .bool(
                        "webhook_failure_notification",
                        request.webhook_failure_notification.clone(),
                    )
                    .build(),
                options,
            )
            .await
    }

    /// This API applies permission restrictions on a PDF file, such as disabling printing, copying, or editing. This can include password protection to enforce restrictions.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Specifies the desired format for the API response. Choose 'json' for a JSON object or 'xml' for an XML structure.
    /// * `file_id` - The unique ID of a PDF file already uploaded to the API Freaks server. Use this as an alternative to uploading a new file directly.
    /// * `destroy` - If set to `true`, the input file(s) will be permanently deleted from the server immediately after the output PDF is generated.
    /// * `output` - The desired name for the output restricted PDF file. If not provided, a default name will be assigned.
    /// * `file_password` - The password to unlock the input file if it is already secured. Provide the owner password if available; otherwise, the user password. The owner password takes precedence. Password Length should be between 6 and 128 characters.
    /// * `user_password` - Sets the password users will use to open the PDF. If this is not set, only the owner password will be configured, and anyone can open the PDF file with the provided restrictions enabled. Password Length should be between 6 and 128 characters.
    /// * `owner_password` - Sets the password that allows full access to the PDF (e.g., removing restrictions). If not provided, the `user_password` (if set) will also be used as the owner password. Password Length should be between 6 and 128 characters.
    /// * `restrictions` - A comma-separated list of restrictions to apply to the PDF. These define what the end-user is *not* allowed to do with the PDF. Available options are:
    ///
    ///
    /// * **print_high** – Disables high-quality printing.
    /// * **print_low** – Disables low-resolution printing.
    /// * **edit_document_assembly** – Prevents reordering or inserting pages.
    /// * **fill_form_fields** – Disallows filling in PDF form fields.
    /// * **edit_annotations** – Disables adding or modifying annotations or comments.
    /// * **modify_content** – Prevents modifying existing content in the PDF.
    /// * **copy_and_extract_content** – Disables copying text or images from the PDF.
    /// * **use_accessibility** – Prevents screen readers or accessibility tools from accessing content.
    /// * `webhook_url` - The URL to which the webhook notification will be sent after the task is completed.
    /// * `webhook_failure_notification` - If true, a notification will also be sent by email in case the webhook request fails all the retries.  The email notification will be sent to the requesting user or their organization’s admin if part of one.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn pdf_restrict(
        &self,
        request: &PdfRestrictRequest,
        options: Option<RequestOptions>,
    ) -> Result<PdfRestrictResponse, ApiError> {
        self.http_client
            .execute_multipart_request(
                Method::POST,
                "v1.0/pdf/restrict",
                request.clone().to_multipart(),
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("file_id", request.file_id.clone())
                    .bool("destroy", request.destroy.clone())
                    .string("output", request.output.clone())
                    .string("file_password", request.file_password.clone())
                    .string("user_password", request.user_password.clone())
                    .string("owner_password", request.owner_password.clone())
                    .serialize_array("restrictions", request.restrictions.clone())
                    .string("webhook_url", request.webhook_url.clone())
                    .bool(
                        "webhook_failure_notification",
                        request.webhook_failure_notification.clone(),
                    )
                    .build(),
                options,
            )
            .await
    }

    /// This API removes permission restrictions from a PDF while keeping it encrypted. If you want to remove all security (including encryption), use the `/pdf/decrypt` endpoint instead.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Specifies the desired format for the API response. Choose 'json' for a JSON object or 'xml' for an XML structure.
    /// * `file_id` - The unique ID of a PDF file already uploaded to the API Freaks server. Use this as an alternative to uploading a new file directly.
    /// * `destroy` - If set to `true`, the input file(s) will be permanently deleted from the server immediately after the output PDF is generated.
    /// * `output` - The desired name for the output unrestricted PDF file. If not provided, a default name will be assigned.
    /// * `file_password` - The password to unlock the input file. Either the owner password or user password can be provided. The owner password takes precedence. Password Length should be between 6 and 128 characters.
    /// * `user_password` - Sets the user password for the PDF file. Password Length should be between 6 and 128 characters.
    /// * `owner_password` - Sets the owner password for the PDF file. If the owner password is not provided, the `user_password` will also be used as the owner password. Password Length should be between 6 and 128 characters.
    /// * `webhook_url` - The URL to which the webhook notification will be sent after the task is completed.
    /// * `webhook_failure_notification` - If true, a notification will also be sent by email in case the webhook request fails all the retries.  The email notification will be sent to the requesting user or their organization’s admin if part of one.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn pdf_unrestrict(
        &self,
        request: &PdfUnrestrictRequest,
        options: Option<RequestOptions>,
    ) -> Result<PdfUnrestrictResponse, ApiError> {
        self.http_client
            .execute_multipart_request(
                Method::POST,
                "v1.0/pdf/unrestrict",
                request.clone().to_multipart(),
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("file_id", request.file_id.clone())
                    .bool("destroy", request.destroy.clone())
                    .string("output", request.output.clone())
                    .string("file_password", request.file_password.clone())
                    .string("user_password", request.user_password.clone())
                    .string("owner_password", request.owner_password.clone())
                    .string("webhook_url", request.webhook_url.clone())
                    .bool(
                        "webhook_failure_notification",
                        request.webhook_failure_notification.clone(),
                    )
                    .build(),
                options,
            )
            .await
    }

    /// This API converts a given PDF file into a sequence of PNG images.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Specifies the desired format for the API response. Choose 'json' for a JSON object or 'xml' for an XML structure.
    /// * `file_id` - The unique ID of a PDF file already uploaded to the API Freaks server. Use this as an alternative to uploading a new file directly.
    /// * `destroy` - If set to `true`, the input file(s) will be permanently deleted from the server immediately after the output PDF is generated.
    /// * `output` - The desired name for the output unrestricted PDF file. If not provided, a default name will be assigned.
    /// * `pages` - Specifies the pages or ranges at which to split the PDF. Accepts individual page numbers (e.g., '1') and/or page ranges (e.g., '4-2', 'last'). Ranges can be ascending or descending. Use commas to separate entries and hyphens for ranges. Alternatively, provide only one of the following keywords: 'even' (split at every even-numbered page), 'odd' (split at every odd-numbered page), 'last' (split at the last page only), or 'all' (split into single pages). Examples: '1,4-2,last', 'odd', 'all'. Mixing special keywords with specific pages/ranges is not allowed.
    /// * `resolution` - Specifies the resolution (in DPI) for the output images. Acceptable Range is from 20 to 1200.
    /// * `image_smoothing` - Determines the smoothing options to apply during image conversion. Valid values are 'none', 'all' or a combination of 'text', 'line', and 'image' (comma-separated).If not provided, no smoothing will be applied.
    /// * `profile` - Specifies the color profile for the output PNG images. Acceptable values: bw (1-bit black & white, smallest size, no grayscale or color), gray (8-bit grayscale), rgb (24-bit RGB color, default), rgba (32-bit RGB color with alpha channel for transparency), 4-bit (4-bit indexed color, up to 16 colors, smaller size), or 8-bit (8-bit indexed color, up to 256 colors).
    /// * `webhook_url` - The URL to which the webhook notification will be sent after the task is completed.
    /// * `webhook_failure_notification` - If true, a notification will also be sent by email in case the webhook request fails all the retries.  The email notification will be sent to the requesting user or their organization’s admin if part of one.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn pdf_convert_to_png(
        &self,
        request: &PdfConvertToPngRequest,
        options: Option<RequestOptions>,
    ) -> Result<PdfConvertToPngResponse, ApiError> {
        self.http_client
            .execute_multipart_request(
                Method::POST,
                "v1.0/pdf/png",
                request.clone().to_multipart(),
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("file_id", request.file_id.clone())
                    .bool("destroy", request.destroy.clone())
                    .string("output", request.output.clone())
                    .string("pages", request.pages.clone())
                    .int("resolution", request.resolution.clone())
                    .string("image_smoothing", request.image_smoothing.clone())
                    .serialize("profile", request.profile.clone())
                    .string("webhook_url", request.webhook_url.clone())
                    .bool(
                        "webhook_failure_notification",
                        request.webhook_failure_notification.clone(),
                    )
                    .build(),
                options,
            )
            .await
    }

    /// This API converts a given PDF file into a sequence of JPG images.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Specifies the desired format for the API response. Choose 'json' for a JSON object or 'xml' for an XML structure.
    /// * `file_id` - The unique ID of a PDF file already uploaded to the API Freaks server. Use this as an alternative to uploading a new file directly.
    /// * `destroy` - If set to `true`, the input file(s) will be permanently deleted from the server immediately after the output PDF is generated.
    /// * `output` - The desired name for the output unrestricted PDF file. If not provided, a default name will be assigned.
    /// * `quality` - Controls JPG compression quality. Higher values yield sharper images with larger file sizes.
    /// * `pages` - Specifies the pages or ranges at which to split the PDF. Accepts individual page numbers (e.g., '1') and/or page ranges (e.g., '4-2', 'last'). Ranges can be ascending or descending. Use commas to separate entries and hyphens for ranges. Alternatively, provide only one of the following keywords: 'even' (split at every even-numbered page), 'odd' (split at every odd-numbered page), 'last' (split at the last page only), or 'all' (split into single pages). Examples: '1,4-2,last', 'odd', 'all'. Mixing special keywords with specific pages/ranges is not allowed.
    /// * `resolution` - Specifies the resolution (in DPI) for the output images. Acceptable Range is from 20 to 1200.
    /// * `image_smoothing` - Determines the smoothing options to apply during image conversion. Valid values are 'none', 'all' or a combination of 'text', 'line', and 'image' (comma-separated).If not provided, no smoothing will be applied.
    /// * `profile` - Specifies the color profile for the output PNG images. Acceptable values: bw (1-bit black & white, smallest size, no grayscale or color), gray (8-bit grayscale), rgb (24-bit RGB color, default), rgba (32-bit RGB color with alpha channel for transparency), 4-bit (4-bit indexed color, up to 16 colors, smaller size), or 8-bit (8-bit indexed color, up to 256 colors).
    /// * `webhook_url` - The URL to which the webhook notification will be sent after the task is completed.
    /// * `webhook_failure_notification` - If true, a notification will also be sent by email in case the webhook request fails all the retries.  The email notification will be sent to the requesting user or their organization’s admin if part of one.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn pdf_convert_to_jpg(
        &self,
        request: &PdfConvertToJpgRequest,
        options: Option<RequestOptions>,
    ) -> Result<PdfConvertToJpgResponse, ApiError> {
        self.http_client
            .execute_multipart_request(
                Method::POST,
                "v1.0/pdf/jpg",
                request.clone().to_multipart(),
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("file_id", request.file_id.clone())
                    .bool("destroy", request.destroy.clone())
                    .string("output", request.output.clone())
                    .int("quality", request.quality.clone())
                    .string("pages", request.pages.clone())
                    .int("resolution", request.resolution.clone())
                    .string("image_smoothing", request.image_smoothing.clone())
                    .serialize("profile", request.profile.clone())
                    .string("webhook_url", request.webhook_url.clone())
                    .bool(
                        "webhook_failure_notification",
                        request.webhook_failure_notification.clone(),
                    )
                    .build(),
                options,
            )
            .await
    }

    /// This API converts a given PDF file into a sequence of TIFF images. The output images can be saved as a single TIFF file, or as a sequence of TIFF files.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Specifies the desired format for the API response. Choose 'json' for a JSON object or 'xml' for an XML structure.
    /// * `file_id` - The unique ID of a PDF file already uploaded to the API Freaks server. Use this as an alternative to uploading a new file directly.
    /// * `destroy` - If set to `true`, the input file(s) will be permanently deleted from the server immediately after the output PDF is generated.
    /// * `output` - The desired name for the output unrestricted PDF file. If not provided, a default name will be assigned.
    /// * `pages` - Specifies the pages or ranges at which to split the PDF. Accepts individual page numbers (e.g., '1') and/or page ranges (e.g., '4-2', 'last'). Ranges can be ascending or descending. Use commas to separate entries and hyphens for ranges. Alternatively, provide only one of the following keywords: 'even' (split at every even-numbered page), 'odd' (split at every odd-numbered page), 'last' (split at the last page only), or 'all' (split into single pages). Examples: '1,4-2,last', 'odd', 'all'. Mixing special keywords with specific pages/ranges is not allowed.
    /// * `resolution` - Specifies the resolution (in DPI) for the output images. Acceptable Range is from 20 to 1200.
    /// * `image_smoothing` - Determines the smoothing options to apply during image conversion. Valid values are 'none', 'all' or a combination of 'text', 'line', and 'image' (comma-separated).If not provided, no smoothing will be applied.
    /// * `profile` - Specifies the color profile for the output PNG images. Acceptable values: bw (1-bit black & white, smallest size, no grayscale or color), gray (8-bit grayscale), rgb (24-bit RGB color, default), rgba (32-bit RGB color with alpha channel for transparency), 4-bit (4-bit indexed color, up to 16 colors, smaller size), or 8-bit (8-bit indexed color, up to 256 colors).
    /// * `webhook_url` - The URL to which the webhook notification will be sent after the task is completed.
    /// * `webhook_failure_notification` - If true, a notification will also be sent by email in case the webhook request fails all the retries.  The email notification will be sent to the requesting user or their organization’s admin if part of one.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn pdf_convert_to_tiff(
        &self,
        request: &PdfConvertToTiffRequest,
        options: Option<RequestOptions>,
    ) -> Result<PdfConvertToTiffResponse, ApiError> {
        self.http_client
            .execute_multipart_request(
                Method::POST,
                "v1.0/pdf/tif",
                request.clone().to_multipart(),
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("file_id", request.file_id.clone())
                    .bool("destroy", request.destroy.clone())
                    .string("output", request.output.clone())
                    .string("pages", request.pages.clone())
                    .int("resolution", request.resolution.clone())
                    .string("image_smoothing", request.image_smoothing.clone())
                    .serialize("profile", request.profile.clone())
                    .string("webhook_url", request.webhook_url.clone())
                    .bool(
                        "webhook_failure_notification",
                        request.webhook_failure_notification.clone(),
                    )
                    .build(),
                options,
            )
            .await
    }

    /// Converts a PDF file to a BMP image.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Specifies the desired format for the API response. Choose 'json' for a JSON object or 'xml' for an XML structure.
    /// * `file_id` - The unique ID of a PDF file already uploaded to the API Freaks server. Use this as an alternative to uploading a new file directly.
    /// * `destroy` - If set to `true`, the input file(s) will be permanently deleted from the server immediately after the output PDF is generated.
    /// * `output` - The desired name for the output unrestricted PDF file. If not provided, a default name will be assigned.
    /// * `pages` - Specifies the pages or ranges at which to split the PDF. Accepts individual page numbers (e.g., '1') and/or page ranges (e.g., '4-2', 'last'). Ranges can be ascending or descending. Use commas to separate entries and hyphens for ranges. Alternatively, provide only one of the following keywords: 'even' (split at every even-numbered page), 'odd' (split at every odd-numbered page), 'last' (split at the last page only), or 'all' (split into single pages). Examples: '1,4-2,last', 'odd', 'all'. Mixing special keywords with specific pages/ranges is not allowed.
    /// * `resolution` - Specifies the resolution (in DPI) for the output images. Acceptable Range is from 20 to 1200.
    /// * `image_smoothing` - Determines the smoothing options to apply during image conversion. Valid values are 'none', 'all' or a combination of 'text', 'line', and 'image' (comma-separated).If not provided, no smoothing will be applied.
    /// * `profile` - Specifies the color profile for the output PNG images. Acceptable values: bw (1-bit black & white, smallest size, no grayscale or color), gray (8-bit grayscale), rgb (24-bit RGB color, default), rgba (32-bit RGB color with alpha channel for transparency), 4-bit (4-bit indexed color, up to 16 colors, smaller size), or 8-bit (8-bit indexed color, up to 256 colors).
    /// * `webhook_url` - The URL to which the webhook notification will be sent after the task is completed.
    /// * `webhook_failure_notification` - If true, a notification will also be sent by email in case the webhook request fails all the retries.  The email notification will be sent to the requesting user or their organization’s admin if part of one.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn pdf_convert_to_bmp(
        &self,
        request: &PdfConvertToBmpRequest,
        options: Option<RequestOptions>,
    ) -> Result<PdfConvertToBmpResponse, ApiError> {
        self.http_client
            .execute_multipart_request(
                Method::POST,
                "v1.0/pdf/bmp",
                request.clone().to_multipart(),
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("file_id", request.file_id.clone())
                    .bool("destroy", request.destroy.clone())
                    .string("output", request.output.clone())
                    .string("pages", request.pages.clone())
                    .int("resolution", request.resolution.clone())
                    .string("image_smoothing", request.image_smoothing.clone())
                    .serialize("profile", request.profile.clone())
                    .string("webhook_url", request.webhook_url.clone())
                    .bool(
                        "webhook_failure_notification",
                        request.webhook_failure_notification.clone(),
                    )
                    .build(),
                options,
            )
            .await
    }

    /// This API converts a given PDF file into a sequence of GIF images.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Specifies the desired format for the API response. Choose 'json' for a JSON object or 'xml' for an XML structure.
    /// * `file_id` - The unique ID of a PDF file already uploaded to the API Freaks server. Use this as an alternative to uploading a new file directly.
    /// * `destroy` - If set to `true`, the input file(s) will be permanently deleted from the server immediately after the output PDF is generated.
    /// * `output` - The desired name for the output unrestricted PDF file. If not provided, a default name will be assigned.
    /// * `pages` - Specifies the pages or ranges at which to split the PDF. Accepts individual page numbers (e.g., '1') and/or page ranges (e.g., '4-2', 'last'). Ranges can be ascending or descending. Use commas to separate entries and hyphens for ranges. Alternatively, provide only one of the following keywords: 'even' (split at every even-numbered page), 'odd' (split at every odd-numbered page), 'last' (split at the last page only), or 'all' (split into single pages). Examples: '1,4-2,last', 'odd', 'all'. Mixing special keywords with specific pages/ranges is not allowed.
    /// * `resolution` - Specifies the resolution (in DPI) for the output images. Acceptable Range is from 20 to 1200.
    /// * `image_smoothing` - Determines the smoothing options to apply during image conversion. Valid values are 'none', 'all' or a combination of 'text', 'line', and 'image' (comma-separated).If not provided, no smoothing will be applied.
    /// * `profile` - Specifies the color profile for the output PNG images. Acceptable values: bw (1-bit black & white, smallest size, no grayscale or color), gray (8-bit grayscale), rgb (24-bit RGB color, default), rgba (32-bit RGB color with alpha channel for transparency), 4-bit (4-bit indexed color, up to 16 colors, smaller size), or 8-bit (8-bit indexed color, up to 256 colors).
    /// * `webhook_url` - The URL to which the webhook notification will be sent after the task is completed.
    /// * `webhook_failure_notification` - If true, a notification will also be sent by email in case the webhook request fails all the retries.  The email notification will be sent to the requesting user or their organization’s admin if part of one.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn pdf_convert_to_gif(
        &self,
        request: &PdfConvertToGifRequest,
        options: Option<RequestOptions>,
    ) -> Result<PdfConvertToGifResponse, ApiError> {
        self.http_client
            .execute_multipart_request(
                Method::POST,
                "v1.0/pdf/gif",
                request.clone().to_multipart(),
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("file_id", request.file_id.clone())
                    .bool("destroy", request.destroy.clone())
                    .string("output", request.output.clone())
                    .string("pages", request.pages.clone())
                    .int("resolution", request.resolution.clone())
                    .string("image_smoothing", request.image_smoothing.clone())
                    .serialize("profile", request.profile.clone())
                    .string("webhook_url", request.webhook_url.clone())
                    .bool(
                        "webhook_failure_notification",
                        request.webhook_failure_notification.clone(),
                    )
                    .build(),
                options,
            )
            .await
    }

    /// This API uploads multiple PDF files to the API Freaks server and generates their unique file IDs.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Specifies the desired format for the API response. Choose 'json' for a JSON object or 'xml' for an XML structure.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn pdf_upload_resources(
        &self,
        request: &PdfUploadResourcesRequest,
        options: Option<RequestOptions>,
    ) -> Result<PdfUploadResourcesResponse, ApiError> {
        self.http_client
            .execute_multipart_request(
                Method::POST,
                "v1.0/pdf/resource/upload",
                request.clone().to_multipart(),
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .build(),
                options,
            )
            .await
    }

    /// This API uploads PDF files to the API Freaks server in binary format.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Specifies the desired format for the API response. Choose 'json' for a JSON object or 'xml' for an XML structure.
    /// * `file_name` - The desired name for the uploaded PDF file. This name will be used for storage on the server.
    ///
    ///
    /// **NOTE**: Please ensure file_name has extension `.pdf`.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn pdf_upload_binary(
        &self,
        request: &PdfUploadBinaryRequest,
        options: Option<RequestOptions>,
    ) -> Result<PdfUploadBinaryResponse, ApiError> {
        self.http_client
            .execute_bytes_request(
                Method::POST,
                "v1.0/pdf/resource/upload-binary",
                Some(request.body.to_vec()),
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("file_name", request.file_name.clone())
                    .build(),
                options,
            )
            .await
    }

    /// This API downloads PDF files or ZIP archives from the server using their unique resource ID.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `resource_id` - The unique identifier of the file or ZIP archive to download.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// Streaming file download (use .into_bytes() to collect or stream chunks)
    pub async fn pdf_download_resource(
        &self,
        request: &PdfDownloadResourceQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<ByteStream, ApiError> {
        self.http_client
            .execute_stream_request(
                Method::GET,
                "v1.0/pdf/resource/download",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("resource_id", request.resource_id.clone())
                    .build(),
                options,
            )
            .await
    }

    /// This API checks the status of a previously initiated PDF processing task using its unique task ID.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Specifies the desired format for the API response. Choose 'json' for a JSON object or 'xml' for an XML structure.
    /// * `task_id` - The unique ID of the PDF processing task for which the status is requested.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn pdf_get_task_status(
        &self,
        request: &PdfGetTaskStatusQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<PdfGetTaskStatusResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/pdf/task-status",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("task_id", request.task_id.clone())
                    .build(),
                options,
            )
            .await
    }

    /// This API checks the status of a PDF file using its unique file ID, providing information about its creation and potential deletion time.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Specifies the desired format for the API response. Choose 'json' for a JSON object or 'xml' for an XML structure.
    /// * `file_id` - The unique ID of the file whose status is requested.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn pdf_get_file_status(
        &self,
        request: &PdfGetFileStatusQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<PdfGetFileStatusResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/pdf/file-status",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("file_id", request.file_id.clone())
                    .build(),
                options,
            )
            .await
    }

    /// This API retrieves a list of all PDF files uploaded and generated by a specific user. Please note that if the user is part of an organization, only the Organization Administrator can access this endpoint. Organization Members cannot access this endpoint.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Specifies the desired format for the API response. Choose 'json' for a JSON object or 'xml' for an XML structure.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn pdf_list_files(
        &self,
        request: &PdfListFilesQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<PdfListFilesResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/pdf/files",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .build(),
                options,
            )
            .await
    }

    /// This API deletes a PDF file using its unique file ID.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Specifies the desired format for the API response. Choose 'json' for a JSON object or 'xml' for an XML structure.
    /// * `file_id` - The unique ID of the file to be deleted.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn pdf_delete_file(
        &self,
        request: &PdfDeleteFileQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<PdfDeleteFileResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::DELETE,
                "v1.0/pdf/file",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("file_id", request.file_id.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Capture full-page screenshots and videos of websites with advanced options like device simulation, custom code injection, cookie banner blocking, and scrollable content recording.
    /// Supports multiple output formats including JSON, image, GIF, MP4, and WebM.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `output` - Output format for screenshot results
    /// * `file_type` - File type for screenshot output
    /// * `url` - URLs to capture screenshots of
    /// * `width` - Browser viewport width in pixels
    /// * `height` - Browser viewport height in pixels
    /// * `full_page` - Capture a full-page screenshot
    /// * `fresh` - Bypass cache and take a fresh screenshot
    /// * `no_cookie_banners` - Remove cookie banners from the screenshot
    /// * `enable_caching` - Enable caching for repeated requests
    /// * `block_ads` - Block advertisements on the page
    /// * `block_chat_widgets` - Block chat widget scripts from loading
    /// * `extract_text` - Extract visible text from the page
    /// * `extract_html` - Extract HTML content of the page
    /// * `destroy_screenshot` - Auto-destroy screenshot after fetch
    /// * `lazy_load` - Enable lazy-loading content before screenshot
    /// * `retina` - Capture screenshot in high-DPI (Retina) mode
    /// * `dark_mode` - Render page in dark mode
    /// * `block_tracking` - Block common user-tracking scripts
    /// * `enable_incognito` - Enable private/incognito mode for browser session
    /// * `omit_background` - Omit background color (transparent background)
    /// * `thumbnail_width` - Thumbnail width in pixels
    /// * `adjust_top` - Adjust top in pixels
    /// * `wait_for_event` - Wait for a specific load event before capturing the screenshot.
    /// * `grayscale` - Range:0 to 100 for grayscale filter
    /// * `delay` - How many milliseconds to wait before taking the screenshot
    /// * `timeout` - Maximum timeout in milliseconds. Defalut is `10,000`
    /// * `ttl` - Number of seconds the screenshot should be cached
    /// * `clip_x` - X position of the clipping rectangle in pixels
    /// * `clip_y` - Y position of the clipping rectangle in pixels
    /// * `clip_width` - Width of the clipping rectangle in pixels
    /// * `clip_height` - Height of the clipping rectangle in pixels
    /// * `css_url` - URL to CSS file
    /// * `css` - Your custom CSS code
    /// * `js_url` - URL to JS file
    /// * `js` - Your JS code
    /// * `block_js` - Block Scripts
    /// * `block_stylesheets` - Block Stylesheets
    /// * `block_images` - Block Images
    /// * `block_media` - Block Media
    /// * `block_font` - Block Fonts
    /// * `block_text_track` - Block Text Tracks
    /// * `block_xhr` - Block XHR Requests
    /// * `block_fetch` - Block Fetch Requests
    /// * `block_event_source` - Block Event Source
    /// * `block_web_socket` - Block Web Sockets
    /// * `block_manifest` - Block Manifest
    /// * `block_specific_requests` - Comma- or newline-separated list of specific requests to block. Each line and comma are treated as separate requests for processing. Example: https://example.com, https://example.js
    /// * `blur_selector` - Comma-separated list of indexed CSS selectors to blur.
    /// Format: `index:<selector>`, e.g., `0:.banner,1:#ads`.
    /// * `remove_selector` - Comma-separated list of indexed CSS selectors to blur.
    /// Format: `index:<selector>`, e.g., `0:.banner,1:#ads`.
    /// * `result_file_name` - Specify a meaningful & unique file name to easily identify the screenshot result.
    /// Avoid using spaces or special characters; use hyphens or underscores to separate words.
    /// * `scrolling_screenshot` - **`Scrolling Screenshot`**: Capture a long scrolling screenshot. When true, disable `fullPage` and `freshScreenshot`.
    /// * `scroll_speed` - Speed of scrolling during the screenshot.
    /// * `scroll_back` - If true, the scroll will reverse back to the top after reaching the bottom.
    /// * `start_immediately` - If true, the scrolling capture will start immediately upon page load.
    /// * `multiple_scrolling` - If true, multiple scrolling screenshots will be taken at different viewport sizes.
    /// * `sizes` - Comma-separated list of viewport sizes in the format index:XXw:YYh. Example: sizes=0:120w:300h,1:240w:500h
    /// * `duration` - Duration in seconds for the scrolling capture. Acceptable range: 0 to 100 seconds.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// Streaming file download (use .into_bytes() to collect or stream chunks)
    pub async fn screenshot_capture(
        &self,
        request: &ScreenshotCaptureQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<ByteStream, ApiError> {
        self.http_client
            .execute_stream_request(
                Method::GET,
                "v1.0/screenshot",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("output", request.output.clone())
                    .serialize("file_type", request.file_type.clone())
                    .string("url", request.url.clone())
                    .int("width", request.width.clone())
                    .int("height", request.height.clone())
                    .bool("full_page", request.full_page.clone())
                    .bool("fresh", request.fresh.clone())
                    .bool("no_cookie_banners", request.no_cookie_banners.clone())
                    .bool("enable_caching", request.enable_caching.clone())
                    .bool("block_ads", request.block_ads.clone())
                    .bool("block_chat_widgets", request.block_chat_widgets.clone())
                    .bool("extract_text", request.extract_text.clone())
                    .bool("extract_html", request.extract_html.clone())
                    .bool("destroy_screenshot", request.destroy_screenshot.clone())
                    .bool("lazy_load", request.lazy_load.clone())
                    .bool("retina", request.retina.clone())
                    .bool("dark_mode", request.dark_mode.clone())
                    .bool("block_tracking", request.block_tracking.clone())
                    .bool("enable_incognito", request.enable_incognito.clone())
                    .bool("omit_background", request.omit_background.clone())
                    .int("thumbnail_width", request.thumbnail_width.clone())
                    .int("adjust_top", request.adjust_top.clone())
                    .serialize("wait_for_event", request.wait_for_event.clone())
                    .int("grayscale", request.grayscale.clone())
                    .int("delay", request.delay.clone())
                    .int("timeout", request.timeout.clone())
                    .int("ttl", request.ttl.clone())
                    .int("clip[x]", request.clip_x.clone())
                    .int("clip[y]", request.clip_y.clone())
                    .int("clip[width]", request.clip_width.clone())
                    .int("clip[height]", request.clip_height.clone())
                    .string("css_url", request.css_url.clone())
                    .string("css", request.css.clone())
                    .string("js_url", request.js_url.clone())
                    .string("js", request.js.clone())
                    .bool("block_js", request.block_js.clone())
                    .bool("block_stylesheets", request.block_stylesheets.clone())
                    .bool("block_images", request.block_images.clone())
                    .bool("block_media", request.block_media.clone())
                    .bool("block_font", request.block_font.clone())
                    .bool("block_text_track", request.block_text_track.clone())
                    .bool("block_xhr", request.block_xhr.clone())
                    .bool("block_fetch", request.block_fetch.clone())
                    .bool("block_event_source", request.block_event_source.clone())
                    .bool("block_web_socket", request.block_web_socket.clone())
                    .bool("block_manifest", request.block_manifest.clone())
                    .string(
                        "block_specific_requests",
                        request.block_specific_requests.clone(),
                    )
                    .string("blur_selector", request.blur_selector.clone())
                    .string("remove_selector", request.remove_selector.clone())
                    .string("result_file_name", request.result_file_name.clone())
                    .bool("scrolling_screenshot", request.scrolling_screenshot.clone())
                    .serialize("scroll_speed", request.scroll_speed.clone())
                    .bool("scroll_back", request.scroll_back.clone())
                    .bool("start_immediately", request.start_immediately.clone())
                    .bool("multiple_scrolling", request.multiple_scrolling.clone())
                    .string_array("sizes", request.sizes.clone())
                    .float("duration", request.duration.clone())
                    .bool("fail_on_error", request.fail_on_error.clone())
                    .float("longitude", request.longitude.clone())
                    .float("latitude", request.latitude.clone())
                    .string("proxy", request.proxy.clone())
                    .string("headers", request.headers.clone())
                    .string("cookies", request.cookies.clone())
                    .string("scroll_to_element", request.scroll_to_element.clone())
                    .string("selector", request.selector.clone())
                    .string("user_agent", request.user_agent.clone())
                    .string("accept_languages", request.accept_languages.clone())
                    .string("custom_html", request.custom_html.clone())
                    .float("image_quality", request.image_quality.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Our Bulk Screenshot API allows you to capture screenshots of multiple webpages simultaneously, saving you time and effort. Instead of manually capturing each page one by one, you can batch process URLs and receive high-quality screenshots in the format you choose.
    /// Maximum `50 URLs` per request.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn bulk_screenshot_capture(
        &self,
        request: &BulkScreenshotCaptureRequest,
        options: Option<RequestOptions>,
    ) -> Result<BulkScreenshotCaptureResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1.0/screenshot",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Get live forex rates for all world currencies with customizable update frequency
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `base` - Base currency for rate calculations
    /// * `symbols` - Comma separated list of desired currency codes
    /// * `updates` - Exchange rates update period (1d=daily, 1h=hourly, 10m=10 minutes, 1m=1 minute)
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn currency_latest_rates(
        &self,
        request: &CurrencyLatestRatesQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<CurrencyLatestRatesResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/currency/rates/latest",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("base", request.base.clone())
                    .string_array("symbols", request.symbols.clone())
                    .serialize("updates", request.updates.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Get historical exchange rates for any specific date
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `base` - Base currency for rate calculations
    /// * `symbols` - Comma separated list of desired currency codes
    /// * `date` - Specific date in YYYY-MM-DD format
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn currency_historical_rates(
        &self,
        request: &CurrencyHistoricalRatesQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<CurrencyHistoricalRatesResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/currency/rates/historical",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("base", request.base.clone())
                    .string_array("symbols", request.symbols.clone())
                    .date("date", request.date.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Convert amount between currencies using the latest exchange rates
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `from` - Source currency code
    /// * `to` - Target currency code
    /// * `amount` - Amount to convert
    /// * `updates` - Exchange rates update period (1d=daily, 1h=hourly, 10m=10 minutes, 1m=1 minute)
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn currency_convert_latest(
        &self,
        request: &CurrencyConvertLatestQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<CurrencyConvertLatestResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/currency/converter/latest/prices",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("from", request.from.clone())
                    .string("to", request.to.clone())
                    .float("amount", request.amount.clone())
                    .serialize("updates", request.updates.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Convert amount between currencies using historical rates
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `from` - From currency symbol
    /// * `to` - To currency symbol
    /// * `amount` - The Amount to be converted
    /// * `date` - specific date (format YYYY-MM-DD) of which exchange rates is used.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn currency_convert_historical(
        &self,
        request: &CurrencyConvertHistoricalQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<CurrencyConvertHistoricalResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/currency/converter/historical/prices",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("from", request.from.clone())
                    .string("to", request.to.clone())
                    .float("amount", request.amount.clone())
                    .date("date", request.date.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Get exchange rates for a time range
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `start_date` - Start date (format YYYY-MM-DD) of the preferred time frame
    /// * `end_date` - End date (format YYYY-MM-DD) of the preferred time frame
    /// * `base` - Base currency
    /// * `symbols` - comma separated list of desired currencies/ commodities symbols
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn currency_time_series(
        &self,
        request: &CurrencyTimeSeriesQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<CurrencyTimeSeriesResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/currency/time-series",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .date("startDate", request.start_date.clone())
                    .date("endDate", request.end_date.clone())
                    .string("base", request.base.clone())
                    .string_array("symbols", request.symbols.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Get currency fluctuation data for a time period
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `start_date` - Start date (format YYYY-MM-DD) of the preferred time frame
    /// * `end_date` - End date (format YYYY-MM-DD) of the preferred time frame
    /// * `base` - Base currency
    /// * `symbols` - comma separated list of desired currencies/ commodities symbols
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn currency_fluctuation(
        &self,
        request: &CurrencyFluctuationQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<CurrencyFluctuationResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/currency/fluctuation",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .date("startDate", request.start_date.clone())
                    .date("endDate", request.end_date.clone())
                    .string("base", request.base.clone())
                    .string_array("symbols", request.symbols.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Convert amount using user's location
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `updates` - Exchange rates update period (1d=daily, 1h=hourly, 10m=10 minutes, 1m=1 minute)
    /// * `from` - From currency symbol
    /// * `ip` - IPv4 or IPv6 geolocated currency
    /// * `amount` - Amount to convert
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn currency_convert_by_ip(
        &self,
        request: &CurrencyConvertByIpQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<CurrencyConvertByIpResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/currency/converter/ip-to-currency",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .serialize("updates", request.updates.clone())
                    .string("from", request.from.clone())
                    .string("ip", request.ip.clone())
                    .float("amount", request.amount.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Get list of all supported currencies with their metadata
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn currency_supported(
        &self,
        request: &CurrencySupportedQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<CurrencySupportedResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/currency/supported",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Get currency symbols and codes
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn currency_symbols(
        &self,
        request: &CurrencySymbolsQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<CurrencySymbolsResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/currency/symbols",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Get information about historical data availability and limits
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn currency_historical_limits(
        &self,
        request: &CurrencyHistoricalLimitsQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<CurrencyHistoricalLimitsResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/currency/historical/data/limits",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Get live commodity rates with customizable update frequency
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the Response
    /// * `symbols` - Comma separated list of desired commodities symbols *(e.g. XAU,XAG,WTI,BRENT)* **Required**
    /// * `updates` - Exchange rates update period. Possible values are: (1) `10m` - 10 minute update (2) `1m` - 1 minute update **Required**
    /// * `quote` - Specifies the target currency for the exchange rate; default quote currency is the market currency of commodity *(e.g. USD, EUR, INR)*
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn commodity_latest_rates(
        &self,
        request: &CommodityLatestRatesQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<CommodityLatestRatesResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/commodity/rates/latest",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string_array("symbols", request.symbols.clone())
                    .serialize("updates", Some(request.updates.clone()))
                    .string("quote", request.quote.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Get historical commodity rates for a specific date
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `date` - Historical date (YYYY-MM-DD)
    /// * `symbols` - Comma-separated list of commodity symbols
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn commodity_historical_rates(
        &self,
        request: &CommodityHistoricalRatesQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<CommodityHistoricalRatesResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/commodity/rates/historical",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .date("date", request.date.clone())
                    .string_array("symbols", request.symbols.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Get commodity price fluctuation data for a time period
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `symbols` - Comma-separated list of commodity symbols
    /// * `start_date` - Start date (YYYY-MM-DD)
    /// * `end_date` - End date (YYYY-MM-DD)
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn commodity_fluctuation(
        &self,
        request: &CommodityFluctuationQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<CommodityFluctuationResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/commodity/fluctuation",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string_array("symbols", request.symbols.clone())
                    .date("startDate", request.start_date.clone())
                    .date("endDate", request.end_date.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Get commodity rates for a time range
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `symbols` - Comma-separated list of commodity symbols
    /// * `start_date` - Start date (YYYY-MM-DD)
    /// * `end_date` - End date (YYYY-MM-DD)
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn commodity_time_series(
        &self,
        request: &CommodityTimeSeriesQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<CommodityTimeSeriesResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/commodity/time-series",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string_array("symbols", request.symbols.clone())
                    .date("startDate", request.start_date.clone())
                    .date("endDate", request.end_date.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Get list of supported commodities
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn commodity_symbols(
        &self,
        request: &CommoditySymbolsQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<CommoditySymbolsResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/commodity/symbols",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Retrieves a list of supported countries.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response. Default is JSON.
    /// * `type_` - Type of supported country. Supported values: IBAN, SWIFT, VAT. By default, it returns all supported countries for all types.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn vat_supported_countries(
        &self,
        request: &VatSupportedCountriesQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<VatSupportedCountriesResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/vat/supported-countries",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .serialize("type", request.r#type.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Fetches VAT rate based on the specified or originating IP address.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Specify the desired response format. Options: 'json' (default) or 'xml'.
    /// * `ip_address` - IPv4 or IPv6 address to look up VAT rate for. If omitted, the originating IP address will be used.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn vat_rate_by_ip(
        &self,
        request: &VatRateByIpQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<Vec<VatRateByIpResponseItem>, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/vat/rates/ip-address",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("ipAddress", request.ip_address.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Fetches VAT rates for a single country or state provided via query parameters.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Specify the desired response format. Options: 'json' (default) or 'xml'.
    /// * `country` - Country identifier in Alpha-2 (PK), Alpha-3 (PAK), or full name (Pakistan). Combine with the optional "state" query for sub-national VAT; values are case-insensitive and may use underscores instead of spaces.
    /// * `state` - Optional state or region in Alpha-2 (NY) or full name (New_York). Use with "country" for state-level VAT; values are case-insensitive and may use underscores.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn vat_rate_by_country(
        &self,
        request: &VatRateByCountryQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<Vec<VatRateByCountryResponseItem>, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/vat/rates/country",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("country", request.country.clone())
                    .string("state", request.state.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Retrieves VAT details for multiple countries or country-state combinations in a single request. Maximum of `100` entries per request are allowed.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Specify the desired response format. Options: 'json' (default) or 'xml'.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn bulk_vat_rate_by_country(
        &self,
        request: &BulkVatRateByCountryRequest,
        options: Option<RequestOptions>,
    ) -> Result<BulkVatRateByCountryResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1.0/vat/rates/country",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Validates an EU or UK VAT number and returns registration status details.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Specify the desired response format. Options: 'json' (default) or 'xml'.
    /// * `vat_number` - EU or UK VAT number to validate.
    /// * `requester_vat_number` - Requester EU or UK VAT number.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn vat_validate(
        &self,
        request: &VatValidateQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<VatValidateResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/vat/validation",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("vatNumber", request.vat_number.clone())
                    .string("requesterVatNumber", request.requester_vat_number.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Checks an IBAN for structural validity, checksum accuracy, and bank metadata.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Specify the desired response format. Options: 'json' (default) or 'xml'.
    /// * `iban` - IBAN to validate.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn iban_validate(
        &self,
        request: &IbanValidateQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<IbanValidateResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/iban/validation",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("iban", request.iban.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Fetches SWIFT codes for a given country, bank, and city.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Specify the desired response format. Options: 'json' (default) or 'xml'.
    /// * `country` - Country name (accepts full name, e.g., Pakistan, United States). If only the country parameter is supplied, lists all banks in the country.
    /// * `bank` - Bank name (upper case) used to filter SWIFT codes. Should be used together with the country parameter. If only country and bank are provided (without city), returns the list of cities for that bank.
    /// * `city` - Gives SWIFT codes for a bank. Optionally specify the city (upper case) to narrow results to a specific city for that bank.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn swift_code_find(
        &self,
        request: &SwiftCodeFindQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<Vec<String>, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/swift-code/finder",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("country", request.country.clone())
                    .string("bank", request.bank.clone())
                    .string("city", request.city.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Fetches detailed information about a SWIFT code.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Specify the desired response format. Options: 'json' (default) or 'xml'.
    /// * `swift_code` - SWIFT/BIC code to lookup (must be 8 or 11 characters).
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn swift_code_lookup(
        &self,
        request: &SwiftCodeLookupQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<SwiftCodeLookupResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/swift-code/lookup",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("swiftCode", request.swift_code.clone())
                    .build(),
                options,
            )
            .await
    }

    pub async fn zipcode_lookup(
        &self,
        request: &ZipcodeLookupQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<ZipcodeLookupResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/zipcode/lookup",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("code", request.code.clone())
                    .string("country", request.country.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Validates a bulk of ZIP/postal codes and returns result for each. Maximum `100` ZIP/postal codes per request.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn bulk_zipcode_lookup(
        &self,
        request: &BulkZipcodeLookupRequest,
        options: Option<RequestOptions>,
    ) -> Result<BulkZipcodeLookupResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1.0/zipcode/lookup",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .build(),
                options,
            )
            .await
    }

    pub async fn zipcode_search_by_city(
        &self,
        request: &ZipcodeSearchByCityQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<ZipcodeSearchByCityResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/zipcode/search/city",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("city", request.city.clone())
                    .string("country", request.country.clone())
                    .string("state_name", request.state_name.clone())
                    .int("page", request.page.clone())
                    .build(),
                options,
            )
            .await
    }

    pub async fn zipcode_search_by_region(
        &self,
        request: &ZipcodeSearchByRegionQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<ZipcodeSearchByRegionResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/zipcode/search/region",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("country", request.country.clone())
                    .string("region", request.region.clone())
                    .int("page", request.page.clone())
                    .build(),
                options,
            )
            .await
    }

    pub async fn zipcode_search_by_radius(
        &self,
        request: &ZipcodeSearchByRadiusQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<ZipcodeSearchByRadiusResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/zipcode/search/radius",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("code", request.code.clone())
                    .float("lat", request.lat.clone())
                    .float("long", request.long.clone())
                    .string("country", request.country.clone())
                    .float("radius", request.radius.clone())
                    .serialize("unit", request.unit.clone())
                    .int("page", request.page.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Get distance between postal codes. Maximum `100` postal codes per request.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn zipcode_distance(
        &self,
        request: &ZipcodeDistanceRequest,
        options: Option<RequestOptions>,
    ) -> Result<ZipcodeDistanceResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1.0/zipcode/distance",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Get matching ZIP/postal code pairs within a specified distance. Maximum `100` postal codes per request.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn zipcode_distance_match(
        &self,
        request: &ZipcodeDistanceMatchRequest,
        options: Option<RequestOptions>,
    ) -> Result<ZipcodeDistanceMatchResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1.0/zipcode/distance/match",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Get current weather data including temperature, humidity, precipitation, wind conditions, atmospheric pressure, and air quality for any location. Accepts city names, coordinates, or IP addresses. Also includes astronomy data and timezone-aware timestamps.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Response format returned by the API.
    /// * `location` - City name, place name, or full address.
    /// * `lat` - Latitude of the location.
    /// * `long` - Longitude of the location.
    /// * `ip` - IP(v4 or v6) address for location inference.
    /// * `timezone` - Timezone for the results.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn current_weather(
        &self,
        request: &CurrentWeatherQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<CurrentWeatherResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/weather/current",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("location", request.location.clone())
                    .float("lat", request.lat.clone())
                    .float("long", request.long.clone())
                    .string("ip", request.ip.clone())
                    .string("timezone", request.timezone.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Retrieve current weather conditions for up to `50 locations` in a single request. A maximum of 50 locations (city names, IP addresses, or geographic coordinates) can be included in the request body.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Response format returned by the API.
    /// * `timezone` - Timezone for the results.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn bulk_current_weather(
        &self,
        request: &BulkCurrentWeatherRequest,
        options: Option<RequestOptions>,
    ) -> Result<BulkCurrentWeatherResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1.0/weather/current",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("timezone", request.timezone.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Access comprehensive weather forecasts with customizable precision - choose from daily overviews, hourly breakdowns, or even minute-by-minute data. Configure your date ranges or use the default 7-day forecast for standard weather planning.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Response format returned by the API.
    /// * `start_date` - Start date for the forecast in YYYY-MM-DD format. Forecast dates must be current or future dates only. Past dates are not allowed for forecast data. The difference between startDate and endDate must not exceed 16 days.
    /// * `end_date` - End date for the forecast in YYYY-MM-DD format. Forecast dates must be current or future dates only. Past dates are not allowed for forecast data. The difference between startDate and endDate must not exceed 16 days.
    /// * `forecast_days` - Number of days for the forecast, from 1 to 16. Default is 7. Maximum value is 16.
    /// * `location` - City name, place name, or full address.
    /// * `lat` - Latitude of the location.
    /// * `long` - Longitude of the location.
    /// * `ip` - IP(v4 or v6) address for location inference.
    /// * `precision` - Precision of the forecast data.
    /// * `timezone` - Timezone for the results.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn weather_forecast(
        &self,
        request: &WeatherForecastQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<WeatherForecastResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/weather/forecast",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .date("startDate", request.start_date.clone())
                    .date("endDate", request.end_date.clone())
                    .int("forecastDays", request.forecast_days.clone())
                    .string("location", request.location.clone())
                    .float("lat", request.lat.clone())
                    .float("long", request.long.clone())
                    .string("ip", request.ip.clone())
                    .serialize("precision", request.precision.clone())
                    .string("timezone", request.timezone.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Access past weather conditions for specific dates with records going back to 1940. Retrieve comprehensive historical data with both daily and hourly precision options.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Response format returned by the API.
    /// * `date` - Specific date for which to fetch weather data in YYYY-MM-DD format. Historical dates must be past dates only. Current or future dates are not allowed for historical data. Data available from 1940 onwards.
    /// * `location` - City name, place name, or full address.
    /// * `lat` - Latitude of the location.
    /// * `long` - Longitude of the location.
    /// * `ip` - IP(v4 or v6) address for location inference.
    /// * `precision` - Precision of the historical data. **Note:** 'daily' returns daily aggregates, 'hourly' returns hourly data.
    /// * `timezone` - Timezone for the results.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn historical_weather(
        &self,
        request: &HistoricalWeatherQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<HistoricalWeatherResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/weather/historical",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .date("date", request.date.clone())
                    .string("location", request.location.clone())
                    .float("lat", request.lat.clone())
                    .float("long", request.long.clone())
                    .string("ip", request.ip.clone())
                    .serialize("precision", request.precision.clone())
                    .string("timezone", request.timezone.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Pull historical weather information for date ranges up to 90 days (daily data) or 7 days (hourly data). Get consistent formatting across your specified date range with reliable historical weather patterns.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Response format returned by the API.
    /// * `start_date` - Starting date for the data in YYYY-MM-DD format. Historical dates must be past dates only. Current or future dates are not allowed for historical data. Data available from 1940 onwards. For precision=daily, the difference between endDate and startDate must not exceed 90 days. For precision=hourly, the difference must not exceed 7 days.
    /// * `end_date` - End date for the data in YYYY-MM-DD format. Historical dates must be past dates only. Current or future dates are not allowed for historical data. Data available from 1940 onwards. For precision=daily, the difference between endDate and startDate must not exceed 90 days. For precision=hourly, the difference must not exceed 7 days.
    /// * `location` - City name, place name, or full address.
    /// * `lat` - Latitude of the location.
    /// * `long` - Longitude of the location.
    /// * `ip` - IP(v4 or v6) address for location inference.
    /// * `precision` - Precision of the data.
    /// * `timezone` - Timezone for the results.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn weather_time_series(
        &self,
        request: &WeatherTimeSeriesQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<WeatherTimeSeriesResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/weather/time-series",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .date("startDate", request.start_date.clone())
                    .date("endDate", request.end_date.clone())
                    .string("location", request.location.clone())
                    .float("lat", request.lat.clone())
                    .float("long", request.long.clone())
                    .string("ip", request.ip.clone())
                    .serialize("precision", request.precision.clone())
                    .string("timezone", request.timezone.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Provides hourly forecasts of marine conditions including wave heights, wave directions, wave periods, swell info, sea surface temperatures, and ocean currents. Supports multiple geographical points and returns daily max wave statistics for up to 7 days. Ideal for maritime planning, navigation, and coastal activities.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Response format returned by the API.
    /// * `start_date` - Starting date for marine forecast data in YYYY-MM-DD format. Forecast dates must be current or future dates only. Past dates are not allowed for forecast data. The difference between endDate and startDate must not exceed 16 days.
    /// * `end_date` - End date for marine forecast data in YYYY-MM-DD format. Forecast dates must be current or future dates only. Past dates are not allowed for forecast data. The difference between endDate and startDate must not exceed 16 days.
    /// * `location` - City name, place name, or full address.
    /// * `lat` - Latitude of the location.
    /// * `long` - Longitude of the location.
    /// * `ip` - IP(v4 or v6) address for location inference.
    /// * `precision` - Precision of the marine data.
    /// * `timezone` - Timezone for the results.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn marine_weather(
        &self,
        request: &MarineWeatherQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<MarineWeatherResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/weather/marine",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .date("startDate", request.start_date.clone())
                    .date("endDate", request.end_date.clone())
                    .string("location", request.location.clone())
                    .float("lat", request.lat.clone())
                    .float("long", request.long.clone())
                    .string("ip", request.ip.clone())
                    .serialize("precision", request.precision.clone())
                    .string("timezone", request.timezone.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Monitor and predict air quality conditions using European and US AQI standards. Track pollutant concentrations including PM10, PM2.5, carbon monoxide, nitrogen dioxide, sulfur dioxide, ozone, and dust particles. Get current readings plus hourly forecasts up to 5 days ahead, complete with UV index and aerosol measurements for comprehensive air quality assessment.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Response format returned by the API.
    /// * `start_date` - Starting date for AQI forecast data in YYYY-MM-DD format. Forecast dates must be current or future dates only. Past dates are not allowed for forecast data. The difference between endDate and startDate must not exceed 5 days.
    /// * `end_date` - End date for AQI forecast data in YYYY-MM-DD format. Forecast dates must be current or future dates only. Past dates are not allowed for forecast data. The difference between endDate and startDate must not exceed 5 days.
    /// * `location` - City name, place name, or full address.
    /// * `lat` - Latitude of the location.
    /// * `long` - Longitude of the location.
    /// * `ip` - IP(v4 or v6) address for location inference.
    /// * `precision` - Only hourly precision is supported; returns hourly AQI data for the selected date range.
    /// * `timezone` - Timezone for the results.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn air_quality(
        &self,
        request: &AirQualityQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<AirQualityResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/weather/air-quality",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .date("startDate", request.start_date.clone())
                    .date("endDate", request.end_date.clone())
                    .string("location", request.location.clone())
                    .float("lat", request.lat.clone())
                    .float("long", request.long.clone())
                    .string("ip", request.ip.clone())
                    .serialize("precision", request.precision.clone())
                    .string("timezone", request.timezone.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Provides flood forecast data for a given location, including river discharge metrics such as mean, median, maximum, minimum, and percentile values (p25, p75). Requires a startDate and endDate, with the date range limited to 16 days. Location can be specified using city name, latitude/longitude, or IP address.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Response format returned by the API.
    /// * `start_date` - Starting date for flood forecast data in YYYY-MM-DD format. Forecast dates must be current or future dates only. Past dates are not allowed for forecast data. The difference between endDate and startDate must not exceed 16 days.
    /// * `end_date` - End date for flood forecast data in YYYY-MM-DD format. Forecast dates must be current or future dates only. Past dates are not allowed for forecast data. The difference between endDate and startDate must not exceed 16 days.
    /// * `location` - City name, place name, or full address.
    /// * `lat` - Latitude of the location.
    /// * `long` - Longitude of the location.
    /// * `ip` - IP(v4 or v6) address for location inference.
    /// * `precision` - Only daily precision is supported; returns flood forecast data for the selected date range.
    /// * `timezone` - Timezone for the results.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn flood_forecast(
        &self,
        request: &FloodForecastQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<FloodForecastResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/weather/flood",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .date("startDate", request.start_date.clone())
                    .date("endDate", request.end_date.clone())
                    .string("location", request.location.clone())
                    .float("lat", request.lat.clone())
                    .float("long", request.long.clone())
                    .string("ip", request.ip.clone())
                    .serialize("precision", request.precision.clone())
                    .string("timezone", request.timezone.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Retrieve countries, optionally filtered by region or subregion.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response
    /// * `region` - Optional filter to return countries within a specific region from the region endpoint.
    /// * `subregion` - Optional filter to return countries within a specific subregion from the subregion endpoint.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn get_countries(
        &self,
        request: &GetCountriesQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<GetCountriesResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/geo/countries",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("region", request.region.clone())
                    .string("subregion", request.subregion.clone())
                    .build(),
                options,
            )
            .await
    }

    pub async fn get_country_details(
        &self,
        request: &GetCountryDetailsQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<GetCountryDetailsResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/geo/country/details",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("country", request.country.clone())
                    .build(),
                options,
            )
            .await
    }

    pub async fn get_regions(
        &self,
        request: &GetRegionsQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<GetRegionsResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/geo/regions",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .build(),
                options,
            )
            .await
    }

    pub async fn get_subregions(
        &self,
        request: &GetSubregionsQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<GetSubregionsResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/geo/subregions",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("region", request.region.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Retrieve administrative units based on ISO 3166-1 alpha-2 country code.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response
    /// * `country` - Country code in ISO 3166-1 alpha-2 format
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn get_admin_levels(
        &self,
        request: &GetAdminLevelsQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<GetAdminLevelsResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/geo/admin-levels",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("country", request.country.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Retrieve administrative divisions for a given country using ISO 3166-1 alpha-2 country codes. You can optionally filter by administrative levels.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `country` - Country code in ISO 3166-1 alpha-2 format.
    /// * `admin_levels` - Comma-separated list to filter results by one or more administrative levels.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn get_admin_units(
        &self,
        request: &GetAdminUnitsQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<GetAdminUnitsResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/geo/admin-units",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("country", request.country.clone())
                    .string_array("adminLevels", request.admin_levels.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Retrieve detailed administrative unit information by country and optionally filtered by admin code.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `country` - Country code in ISO 3166-1 alpha-2 format.
    /// * `admin_unit` - Optional admin code to fetch details for a specific administrative unit.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn get_admin_unit_details(
        &self,
        request: &GetAdminUnitDetailsQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<GetAdminUnitDetailsResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/geo/admin-unit/details",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("country", request.country.clone())
                    .string("admin_unit", request.admin_unit.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Retrieve a list of cities within a country, optionally filtered by an administrative unit code.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `country` - Country code in ISO 3166-1 alpha-2 format.
    /// * `admin_unit` - Administrative unit code used to filter cities within a specific region.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn get_cities(
        &self,
        request: &GetCitiesQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<GetCitiesResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/geo/cities",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("country", request.country.clone())
                    .string("admin_unit", request.admin_unit.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Get list of all supported flags with their metadata
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn get_supported_flags(
        &self,
        request: &GetSupportedFlagsQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<Vec<GetSupportedFlagsResponseItem>, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/flags/supported",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Retrieve the flag for a specific country
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `name` - Country code in ISO 3166-1 alpha-2 format.
    /// * `shape` - Flag shape. One of: `'flat'` or `'round'`.
    /// * `format` - Flag format. Applicable only for PNG or WEBP formats. Default is png.
    /// * `size` - Flag size in pixels. Valid options: `16px`, `24px`, `32px`, `48px`, `64px`. Applicable only for PNG or WEBP formats.
    /// * `type_` - Type of flag. One of: `country` or `organization`.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// Streaming file download (use .into_bytes() to collect or stream chunks)
    pub async fn get_flags(
        &self,
        request: &GetFlagsQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<ByteStream, ApiError> {
        self.http_client
            .execute_stream_request(
                Method::GET,
                "v1.0/flags",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .string("name", request.name.clone())
                    .serialize("shape", Some(request.shape.clone()))
                    .serialize("format", request.format.clone())
                    .serialize("size", request.size.clone())
                    .serialize("type", Some(request.r#type.clone()))
                    .build(),
                options,
            )
            .await
    }

    /// Retrieve current time, date, and timezone-related information by specifying a timezone name, location address, location coordinates, IP address, or use the client IP address if no parameter is passed.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response
    /// * `ip` - IPv4 or IPv6 address to extract timezone information.
    /// * `tz` - Timezone name (e.g., "Asia/Kolkata") to retrieve information directly.
    /// * `location` - Location string (preferably city and country) to extract timezone.
    /// * `lat` - Latitude for geolocation lookup.
    /// * `long` - Longitude for geolocation lookup.
    /// * `lang` - Language code for response localization (default is "en").
    /// * `iata_code` - 3-letter IATA airport code (e.g., JFK).
    /// * `icao_code` - 4-letter ICAO airport code (e.g., KJFK).
    /// * `lo_code` - 5-letter UN/LO city code.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn timezone_lookup(
        &self,
        request: &TimezoneLookupQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<TimezoneLookupResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/geolocation/timezone",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("ip", request.ip.clone())
                    .string("tz", request.tz.clone())
                    .string("location", request.location.clone())
                    .float("lat", request.lat.clone())
                    .float("long", request.long.clone())
                    .serialize("lang", request.lang.clone())
                    .string("iata_code", request.iata_code.clone())
                    .string("icao_code", request.icao_code.clone())
                    .string("lo_code", request.lo_code.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Converts a given time from one timezone to another using various input types like timezone name, coordinates, location, or codes.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response .
    /// * `time` - Time to convert in `yyyy-MM-dd HH:mm` or `yyyy-MM-dd HH:mm:ss` format.
    /// * `tz_from` - Source timezone name (e.g., `Asia/Kolkata`).
    /// * `tz_to` - Target timezone name (e.g., `America/New_York`).
    /// * `lat_from` - Latitude of source location.
    /// * `long_from` - Longitude of source location.
    /// * `lat_to` - Latitude of target location.
    /// * `long_to` - Longitude of target location.
    /// * `location_from` - From location (city/country).
    /// * `location_to` - To location (city/country).
    /// * `iata_from` - From IATA airport code (e.g., JFK).
    /// * `iata_to` - To IATA airport code.
    /// * `icao_from` - From ICAO airport code (e.g., KJFK).
    /// * `icao_to` - To ICAO airport code.
    /// * `locode_from` - From UN/LO CODE.
    /// * `locode_to` - To UN/LO CODE.
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn timezone_convert(
        &self,
        request: &TimezoneConvertQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<TimezoneConvertResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/timezone/converter",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("time", request.time.clone())
                    .string("tz_from", request.tz_from.clone())
                    .string("tz_to", request.tz_to.clone())
                    .float("lat_from", request.lat_from.clone())
                    .float("long_from", request.long_from.clone())
                    .float("lat_to", request.lat_to.clone())
                    .float("long_to", request.long_to.clone())
                    .string("location_from", request.location_from.clone())
                    .string("location_to", request.location_to.clone())
                    .string("iata_from", request.iata_from.clone())
                    .string("iata_to", request.iata_to.clone())
                    .string("icao_from", request.icao_from.clone())
                    .string("icao_to", request.icao_to.clone())
                    .string("locode_from", request.locode_from.clone())
                    .string("locode_to", request.locode_to.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Parse User Agent string to get detailed browser, device, and operating system information
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn user_agent_lookup(
        &self,
        request: &UserAgentLookupQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<UserAgentLookupResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/user-agent/lookup",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Parse up to `50,000 User-Agent strings` at once in a single request.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn bulk_user_agent_lookup(
        &self,
        request: &BulkUserAgentLookupRequest,
        options: Option<RequestOptions>,
    ) -> Result<Vec<BulkUserAgentLookupResponseItem>, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1.0/user-agent/lookup",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Perform Optical Character Recognition (OCR) on images, PDFs, or ZIP archives. Supports two models: `mini-ocr-v1` for CAPTCHA-optimized OCR and `ocr-v1` for general-purpose document text extraction. Supports zonal OCR to extract text from specific regions of an image.
    ///
    /// **Notes:**
    /// - The `zone` query parameter cannot be given with .pdf and .zip types as it can only be applied to single image query.
    /// - The `page_range` query parameter cannot be given in any other type except .pdf types.
    /// - PDFs containing images in them are allowed only for processing.
    /// - The `mini-ocr-v1` model doesn’t support the following query parameters:
    /// - `page_range` (.pdf types)
    /// - `zone`
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `url` - URL of the image or PDF (required if `file` not provided)
    /// * `model` - OCR model to use.
    /// * `page_range` - Specify page range for multi-page PDFs (e.g., '1,3,5-10' or 'allpages'). **Note:** This parameter can only be used with .pdf file types.
    /// * `zone` - Define OCR zones using coordinates (top:left:height:width). Multiple zones can be defined using commas. Only available for model 'ocr-v1'. **Note:** This parameter cannot be used with .pdf and .zip file types as it can only be applied to single image queries.
    /// * `new_line` - Set to 1 to split output text into individual lines (default: 0)
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn ocr_predict(
        &self,
        request: &OcrPredictRequest,
        options: Option<RequestOptions>,
    ) -> Result<OcrPredictResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1.0/ocr/predict",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .string("url", request.url.clone())
                    .serialize("model", Some(request.model.clone()))
                    .string("page_range", request.page_range.clone())
                    .string("zone", request.zone.clone())
                    .int("new_line", request.new_line.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Analyze text for grammar errors and return the exact words flagged as grammatically incorrect with zero-based word positions.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn grammar_detect(
        &self,
        request: &GrammarDetectRequest,
        options: Option<RequestOptions>,
    ) -> Result<GrammarDetectResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1.0/readability/grammar/detect",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Submit text with grammatical issues and receive a clean grammar-corrected result for proofreading and content workflows.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn grammar_correct(
        &self,
        request: &GrammarCorrectRequest,
        options: Option<RequestOptions>,
    ) -> Result<GrammarCorrectResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1.0/readability/grammar/correct",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Analyze text and return weak, vague, or filler words with zero-based word positions to help writers produce clearer and more concise content.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn weak_words_detect(
        &self,
        request: &WeakWordsDetectRequest,
        options: Option<RequestOptions>,
    ) -> Result<WeakWordsDetectResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1.0/readability/weak-words",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Analyze text readability using industry-standard formulas including Flesch Reading Ease, Flesch-Kincaid Grade Level, Gunning Fog Index, SMOG Index, Coleman-Liau Index, and Automated Readability Index.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `target` - Target audience used to tune sentence difficulty levels
    /// * `exclude` - Comma-separated response sections to omit. Possible values are readability_scores, sentence_readability, readability_grade
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn readability_score(
        &self,
        request: &ReadabilityScoreRequest,
        options: Option<RequestOptions>,
    ) -> Result<ReadabilityScoreResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1.0/readability/score",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("target", request.target.clone())
                    .string("exclude", request.exclude.clone())
                    .build(),
                options,
            )
            .await
    }

    /// Retrieve sunrise and sunset times, current position of the moon, and other related information by specifying a location address, location coordinates, IP address, or using the client IP address if no parameter is passed.
    ///
    /// # Arguments
    ///
    /// * `api_key` - Your API key
    /// * `format` - Format of the response.
    /// * `location` - Location name or address
    /// * `lat` - Latitude for location coordinates
    /// * `long` - Longitude for location coordinates
    /// * `ip` - IP address for location detection
    /// * `date` - Date for astronomy data (YYYY-MM-DD)
    /// * `elevation` - Timezone of the location for which astronomy data is required
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn astronomy_lookup(
        &self,
        request: &AstronomyLookupQueryRequest,
        options: Option<RequestOptions>,
    ) -> Result<AstronomyLookupResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::GET,
                "v1.0/geolocation/astronomy",
                None,
                QueryBuilder::new()
                    .string("apiKey", request.api_key.clone())
                    .serialize("format", request.format.clone())
                    .string("location", request.location.clone())
                    .float("lat", request.lat.clone())
                    .float("long", request.long.clone())
                    .string("ip", request.ip.clone())
                    .string("lang", request.lang.clone())
                    .date("date", request.date.clone())
                    .float("elevation", request.elevation.clone())
                    .string("time_zone", request.time_zone.clone())
                    .build(),
                options,
            )
            .await
    }
}