1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
// DO NOT EDIT
// This file was @generated by Stone

#![allow(
    clippy::too_many_arguments,
    clippy::large_enum_variant,
    clippy::doc_markdown,
)]

//! This namespace contains endpoints and data types for managing docs and folders in Dropbox Paper.
//! New Paper users will see docs they create in their filesystem as '.paper' files alongside their
//! other Dropbox content. The /paper endpoints are being deprecated and you'll need to use /files
//! and /sharing endpoints to interact with their Paper content. Read more in the [Paper Migration
//! Guide](https://www.dropbox.com/lp/developers/reference/paper-migration-guide).

pub type PaperDocId = String;

/// Marks the given Paper doc as archived. This action can be performed or undone by anyone with
/// edit permissions to the doc. Note that this endpoint will continue to work for content created
/// by users on the older version of Paper. To check which version of Paper a user is on, use
/// /users/features/get_values. If the paper_as_files feature is enabled, then the user is running
/// the new version of Paper. This endpoint will be retired in September 2020. Refer to the [Paper
/// Migration Guide](https://www.dropbox.com/lp/developers/reference/paper-migration-guide) for more
/// information.
pub fn docs_archive(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &RefPaperDoc,
) -> crate::Result<Result<(), DocLookupError>> {
    crate::client_helpers::request(
        client,
        crate::client_trait::Endpoint::Api,
        crate::client_trait::Style::Rpc,
        "paper/docs/archive",
        arg,
        None)
}

/// Creates a new Paper doc with the provided content. Note that this endpoint will continue to work
/// for content created by users on the older version of Paper. To check which version of Paper a
/// user is on, use /users/features/get_values. If the paper_as_files feature is enabled, then the
/// user is running the new version of Paper. This endpoint will be retired in September 2020. Refer
/// to the [Paper Migration
/// Guide](https://www.dropbox.com/lp/developers/reference/paper-migration-guide) for more
/// information.
pub fn docs_create(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &PaperDocCreateArgs,
    body: &[u8],
) -> crate::Result<Result<PaperDocCreateUpdateResult, PaperDocCreateError>> {
    crate::client_helpers::request(
        client,
        crate::client_trait::Endpoint::Api,
        crate::client_trait::Style::Upload,
        "paper/docs/create",
        arg,
        Some(body))
}

/// Exports and downloads Paper doc either as HTML or markdown. Note that this endpoint will
/// continue to work for content created by users on the older version of Paper. To check which
/// version of Paper a user is on, use /users/features/get_values. If the paper_as_files feature is
/// enabled, then the user is running the new version of Paper. Refer to the [Paper Migration
/// Guide](https://www.dropbox.com/lp/developers/reference/paper-migration-guide) for migration
/// information.
pub fn docs_download(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &PaperDocExport,
    range_start: Option<u64>,
    range_end: Option<u64>,
) -> crate::Result<Result<crate::client_trait::HttpRequestResult<PaperDocExportResult>, DocLookupError>> {
    crate::client_helpers::request_with_body(
        client,
        crate::client_trait::Endpoint::Api,
        crate::client_trait::Style::Download,
        "paper/docs/download",
        arg,
        None,
        range_start,
        range_end)
}

/// Lists the users who are explicitly invited to the Paper folder in which the Paper doc is
/// contained. For private folders all users (including owner) shared on the folder are listed and
/// for team folders all non-team users shared on the folder are returned. Note that this endpoint
/// will continue to work for content created by users on the older version of Paper. To check which
/// version of Paper a user is on, use /users/features/get_values. If the paper_as_files feature is
/// enabled, then the user is running the new version of Paper. Refer to the [Paper Migration
/// Guide](https://www.dropbox.com/lp/developers/reference/paper-migration-guide) for migration
/// information.
pub fn docs_folder_users_list(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &ListUsersOnFolderArgs,
) -> crate::Result<Result<ListUsersOnFolderResponse, DocLookupError>> {
    crate::client_helpers::request(
        client,
        crate::client_trait::Endpoint::Api,
        crate::client_trait::Style::Rpc,
        "paper/docs/folder_users/list",
        arg,
        None)
}

/// Once a cursor has been retrieved from [`docs_folder_users_list()`](docs_folder_users_list), use
/// this to paginate through all users on the Paper folder. Note that this endpoint will continue to
/// work for content created by users on the older version of Paper. To check which version of Paper
/// a user is on, use /users/features/get_values. If the paper_as_files feature is enabled, then the
/// user is running the new version of Paper. Refer to the [Paper Migration
/// Guide](https://www.dropbox.com/lp/developers/reference/paper-migration-guide) for migration
/// information.
pub fn docs_folder_users_list_continue(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &ListUsersOnFolderContinueArgs,
) -> crate::Result<Result<ListUsersOnFolderResponse, ListUsersCursorError>> {
    crate::client_helpers::request(
        client,
        crate::client_trait::Endpoint::Api,
        crate::client_trait::Style::Rpc,
        "paper/docs/folder_users/list/continue",
        arg,
        None)
}

/// Retrieves folder information for the given Paper doc. This includes:   - folder sharing policy;
/// permissions for subfolders are set by the top-level folder.   - full 'filepath', i.e. the list
/// of folders (both folderId and folderName) from     the root folder to the folder directly
/// containing the Paper doc.
///
/// If the Paper doc is not in any folder (aka unfiled) the response will be empty. Note that this
/// endpoint will continue to work for content created by users on the older version of Paper. To
/// check which version of Paper a user is on, use /users/features/get_values. If the paper_as_files
/// feature is enabled, then the user is running the new version of Paper. Refer to the [Paper
/// Migration Guide](https://www.dropbox.com/lp/developers/reference/paper-migration-guide) for
/// migration information.
pub fn docs_get_folder_info(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &RefPaperDoc,
) -> crate::Result<Result<FoldersContainingPaperDoc, DocLookupError>> {
    crate::client_helpers::request(
        client,
        crate::client_trait::Endpoint::Api,
        crate::client_trait::Style::Rpc,
        "paper/docs/get_folder_info",
        arg,
        None)
}

/// Return the list of all Paper docs according to the argument specifications. To iterate over
/// through the full pagination, pass the cursor to [`docs_list_continue()`](docs_list_continue).
/// Note that this endpoint will continue to work for content created by users on the older version
/// of Paper. To check which version of Paper a user is on, use /users/features/get_values. If the
/// paper_as_files feature is enabled, then the user is running the new version of Paper. Refer to
/// the [Paper Migration
/// Guide](https://www.dropbox.com/lp/developers/reference/paper-migration-guide) for migration
/// information.
pub fn docs_list(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &ListPaperDocsArgs,
) -> crate::Result<Result<ListPaperDocsResponse, ()>> {
    crate::client_helpers::request(
        client,
        crate::client_trait::Endpoint::Api,
        crate::client_trait::Style::Rpc,
        "paper/docs/list",
        arg,
        None)
}

/// Once a cursor has been retrieved from [`docs_list()`](docs_list), use this to paginate through
/// all Paper doc. Note that this endpoint will continue to work for content created by users on the
/// older version of Paper. To check which version of Paper a user is on, use
/// /users/features/get_values. If the paper_as_files feature is enabled, then the user is running
/// the new version of Paper. Refer to the [Paper Migration
/// Guide](https://www.dropbox.com/lp/developers/reference/paper-migration-guide) for migration
/// information.
pub fn docs_list_continue(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &ListPaperDocsContinueArgs,
) -> crate::Result<Result<ListPaperDocsResponse, ListDocsCursorError>> {
    crate::client_helpers::request(
        client,
        crate::client_trait::Endpoint::Api,
        crate::client_trait::Style::Rpc,
        "paper/docs/list/continue",
        arg,
        None)
}

/// Permanently deletes the given Paper doc. This operation is final as the doc cannot be recovered.
/// This action can be performed only by the doc owner. Note that this endpoint will continue to
/// work for content created by users on the older version of Paper. To check which version of Paper
/// a user is on, use /users/features/get_values. If the paper_as_files feature is enabled, then the
/// user is running the new version of Paper. Refer to the [Paper Migration
/// Guide](https://www.dropbox.com/lp/developers/reference/paper-migration-guide) for migration
/// information.
pub fn docs_permanently_delete(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &RefPaperDoc,
) -> crate::Result<Result<(), DocLookupError>> {
    crate::client_helpers::request(
        client,
        crate::client_trait::Endpoint::Api,
        crate::client_trait::Style::Rpc,
        "paper/docs/permanently_delete",
        arg,
        None)
}

/// Gets the default sharing policy for the given Paper doc. Note that this endpoint will continue
/// to work for content created by users on the older version of Paper. To check which version of
/// Paper a user is on, use /users/features/get_values. If the paper_as_files feature is enabled,
/// then the user is running the new version of Paper. Refer to the [Paper Migration
/// Guide](https://www.dropbox.com/lp/developers/reference/paper-migration-guide) for migration
/// information.
pub fn docs_sharing_policy_get(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &RefPaperDoc,
) -> crate::Result<Result<SharingPolicy, DocLookupError>> {
    crate::client_helpers::request(
        client,
        crate::client_trait::Endpoint::Api,
        crate::client_trait::Style::Rpc,
        "paper/docs/sharing_policy/get",
        arg,
        None)
}

/// Sets the default sharing policy for the given Paper doc. The default 'team_sharing_policy' can
/// be changed only by teams, omit this field for personal accounts. The 'public_sharing_policy'
/// policy can't be set to the value 'disabled' because this setting can be changed only via the
/// team admin console. Note that this endpoint will continue to work for content created by users
/// on the older version of Paper. To check which version of Paper a user is on, use
/// /users/features/get_values. If the paper_as_files feature is enabled, then the user is running
/// the new version of Paper. Refer to the [Paper Migration
/// Guide](https://www.dropbox.com/lp/developers/reference/paper-migration-guide) for migration
/// information.
pub fn docs_sharing_policy_set(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &PaperDocSharingPolicy,
) -> crate::Result<Result<(), DocLookupError>> {
    crate::client_helpers::request(
        client,
        crate::client_trait::Endpoint::Api,
        crate::client_trait::Style::Rpc,
        "paper/docs/sharing_policy/set",
        arg,
        None)
}

/// Updates an existing Paper doc with the provided content. Note that this endpoint will continue
/// to work for content created by users on the older version of Paper. To check which version of
/// Paper a user is on, use /users/features/get_values. If the paper_as_files feature is enabled,
/// then the user is running the new version of Paper. This endpoint will be retired in September
/// 2020. Refer to the [Paper Migration
/// Guide](https://www.dropbox.com/lp/developers/reference/paper-migration-guide) for more
/// information.
pub fn docs_update(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &PaperDocUpdateArgs,
    body: &[u8],
) -> crate::Result<Result<PaperDocCreateUpdateResult, PaperDocUpdateError>> {
    crate::client_helpers::request(
        client,
        crate::client_trait::Endpoint::Api,
        crate::client_trait::Style::Upload,
        "paper/docs/update",
        arg,
        Some(body))
}

/// Allows an owner or editor to add users to a Paper doc or change their permissions using their
/// email address or Dropbox account ID. The doc owner's permissions cannot be changed. Note that
/// this endpoint will continue to work for content created by users on the older version of Paper.
/// To check which version of Paper a user is on, use /users/features/get_values. If the
/// paper_as_files feature is enabled, then the user is running the new version of Paper. Refer to
/// the [Paper Migration
/// Guide](https://www.dropbox.com/lp/developers/reference/paper-migration-guide) for migration
/// information.
pub fn docs_users_add(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &AddPaperDocUser,
) -> crate::Result<Result<Vec<AddPaperDocUserMemberResult>, DocLookupError>> {
    crate::client_helpers::request(
        client,
        crate::client_trait::Endpoint::Api,
        crate::client_trait::Style::Rpc,
        "paper/docs/users/add",
        arg,
        None)
}

/// Lists all users who visited the Paper doc or users with explicit access. This call excludes
/// users who have been removed. The list is sorted by the date of the visit or the share date. The
/// list will include both users, the explicitly shared ones as well as those who came in using the
/// Paper url link. Note that this endpoint will continue to work for content created by users on
/// the older version of Paper. To check which version of Paper a user is on, use
/// /users/features/get_values. If the paper_as_files feature is enabled, then the user is running
/// the new version of Paper. Refer to the [Paper Migration
/// Guide](https://www.dropbox.com/lp/developers/reference/paper-migration-guide) for migration
/// information.
pub fn docs_users_list(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &ListUsersOnPaperDocArgs,
) -> crate::Result<Result<ListUsersOnPaperDocResponse, DocLookupError>> {
    crate::client_helpers::request(
        client,
        crate::client_trait::Endpoint::Api,
        crate::client_trait::Style::Rpc,
        "paper/docs/users/list",
        arg,
        None)
}

/// Once a cursor has been retrieved from [`docs_users_list()`](docs_users_list), use this to
/// paginate through all users on the Paper doc. Note that this endpoint will continue to work for
/// content created by users on the older version of Paper. To check which version of Paper a user
/// is on, use /users/features/get_values. If the paper_as_files feature is enabled, then the user
/// is running the new version of Paper. Refer to the [Paper Migration
/// Guide](https://www.dropbox.com/lp/developers/reference/paper-migration-guide) for migration
/// information.
pub fn docs_users_list_continue(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &ListUsersOnPaperDocContinueArgs,
) -> crate::Result<Result<ListUsersOnPaperDocResponse, ListUsersCursorError>> {
    crate::client_helpers::request(
        client,
        crate::client_trait::Endpoint::Api,
        crate::client_trait::Style::Rpc,
        "paper/docs/users/list/continue",
        arg,
        None)
}

/// Allows an owner or editor to remove users from a Paper doc using their email address or Dropbox
/// account ID. The doc owner cannot be removed. Note that this endpoint will continue to work for
/// content created by users on the older version of Paper. To check which version of Paper a user
/// is on, use /users/features/get_values. If the paper_as_files feature is enabled, then the user
/// is running the new version of Paper. Refer to the [Paper Migration
/// Guide](https://www.dropbox.com/lp/developers/reference/paper-migration-guide) for migration
/// information.
pub fn docs_users_remove(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &RemovePaperDocUser,
) -> crate::Result<Result<(), DocLookupError>> {
    crate::client_helpers::request(
        client,
        crate::client_trait::Endpoint::Api,
        crate::client_trait::Style::Rpc,
        "paper/docs/users/remove",
        arg,
        None)
}

/// Create a new Paper folder with the provided info. Note that this endpoint will continue to work
/// for content created by users on the older version of Paper. To check which version of Paper a
/// user is on, use /users/features/get_values. If the paper_as_files feature is enabled, then the
/// user is running the new version of Paper. Refer to the [Paper Migration
/// Guide](https://www.dropbox.com/lp/developers/reference/paper-migration-guide) for migration
/// information.
pub fn folders_create(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &PaperFolderCreateArg,
) -> crate::Result<Result<PaperFolderCreateResult, PaperFolderCreateError>> {
    crate::client_helpers::request(
        client,
        crate::client_trait::Endpoint::Api,
        crate::client_trait::Style::Rpc,
        "paper/folders/create",
        arg,
        None)
}

#[derive(Debug)]
pub struct AddMember {
    /// User which should be added to the Paper doc. Specify only email address or Dropbox account
    /// ID.
    pub member: super::sharing::MemberSelector,
    /// Permission for the user.
    pub permission_level: PaperDocPermissionLevel,
}

impl AddMember {
    pub fn new(member: super::sharing::MemberSelector) -> Self {
        AddMember {
            member,
            permission_level: PaperDocPermissionLevel::Edit,
        }
    }

    pub fn with_permission_level(mut self, value: PaperDocPermissionLevel) -> Self {
        self.permission_level = value;
        self
    }

}

const ADD_MEMBER_FIELDS: &[&str] = &["member",
                                     "permission_level"];
impl AddMember {
    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
        map: V,
    ) -> Result<AddMember, V::Error> {
        Self::internal_deserialize_opt(map, false).map(Option::unwrap)
    }

    pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
        mut map: V,
        optional: bool,
    ) -> Result<Option<AddMember>, V::Error> {
        let mut field_member = None;
        let mut field_permission_level = None;
        let mut nothing = true;
        while let Some(key) = map.next_key::<&str>()? {
            nothing = false;
            match key {
                "member" => {
                    if field_member.is_some() {
                        return Err(::serde::de::Error::duplicate_field("member"));
                    }
                    field_member = Some(map.next_value()?);
                }
                "permission_level" => {
                    if field_permission_level.is_some() {
                        return Err(::serde::de::Error::duplicate_field("permission_level"));
                    }
                    field_permission_level = Some(map.next_value()?);
                }
                _ => {
                    // unknown field allowed and ignored
                    map.next_value::<::serde_json::Value>()?;
                }
            }
        }
        if optional && nothing {
            return Ok(None);
        }
        let result = AddMember {
            member: field_member.ok_or_else(|| ::serde::de::Error::missing_field("member"))?,
            permission_level: field_permission_level.unwrap_or(PaperDocPermissionLevel::Edit),
        };
        Ok(Some(result))
    }

    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
        &self,
        s: &mut S::SerializeStruct,
    ) -> Result<(), S::Error> {
        use serde::ser::SerializeStruct;
        s.serialize_field("member", &self.member)?;
        s.serialize_field("permission_level", &self.permission_level)
    }
}

impl<'de> ::serde::de::Deserialize<'de> for AddMember {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // struct deserializer
        use serde::de::{MapAccess, Visitor};
        struct StructVisitor;
        impl<'de> Visitor<'de> for StructVisitor {
            type Value = AddMember;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a AddMember struct")
            }
            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
                AddMember::internal_deserialize(map)
            }
        }
        deserializer.deserialize_struct("AddMember", ADD_MEMBER_FIELDS, StructVisitor)
    }
}

impl ::serde::ser::Serialize for AddMember {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // struct serializer
        use serde::ser::SerializeStruct;
        let mut s = serializer.serialize_struct("AddMember", 2)?;
        self.internal_serialize::<S>(&mut s)?;
        s.end()
    }
}

#[derive(Debug)]
pub struct AddPaperDocUser {
    /// The Paper doc ID.
    pub doc_id: PaperDocId,
    /// User which should be added to the Paper doc. Specify only email address or Dropbox account
    /// ID.
    pub members: Vec<AddMember>,
    /// A personal message that will be emailed to each successfully added member.
    pub custom_message: Option<String>,
    /// Clients should set this to true if no email message shall be sent to added users.
    pub quiet: bool,
}

impl AddPaperDocUser {
    pub fn new(doc_id: PaperDocId, members: Vec<AddMember>) -> Self {
        AddPaperDocUser {
            doc_id,
            members,
            custom_message: None,
            quiet: false,
        }
    }

    pub fn with_custom_message(mut self, value: Option<String>) -> Self {
        self.custom_message = value;
        self
    }

    pub fn with_quiet(mut self, value: bool) -> Self {
        self.quiet = value;
        self
    }

}

const ADD_PAPER_DOC_USER_FIELDS: &[&str] = &["doc_id",
                                             "members",
                                             "custom_message",
                                             "quiet"];
impl AddPaperDocUser {
    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
        map: V,
    ) -> Result<AddPaperDocUser, V::Error> {
        Self::internal_deserialize_opt(map, false).map(Option::unwrap)
    }

    pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
        mut map: V,
        optional: bool,
    ) -> Result<Option<AddPaperDocUser>, V::Error> {
        let mut field_doc_id = None;
        let mut field_members = None;
        let mut field_custom_message = None;
        let mut field_quiet = None;
        let mut nothing = true;
        while let Some(key) = map.next_key::<&str>()? {
            nothing = false;
            match key {
                "doc_id" => {
                    if field_doc_id.is_some() {
                        return Err(::serde::de::Error::duplicate_field("doc_id"));
                    }
                    field_doc_id = Some(map.next_value()?);
                }
                "members" => {
                    if field_members.is_some() {
                        return Err(::serde::de::Error::duplicate_field("members"));
                    }
                    field_members = Some(map.next_value()?);
                }
                "custom_message" => {
                    if field_custom_message.is_some() {
                        return Err(::serde::de::Error::duplicate_field("custom_message"));
                    }
                    field_custom_message = Some(map.next_value()?);
                }
                "quiet" => {
                    if field_quiet.is_some() {
                        return Err(::serde::de::Error::duplicate_field("quiet"));
                    }
                    field_quiet = Some(map.next_value()?);
                }
                _ => {
                    // unknown field allowed and ignored
                    map.next_value::<::serde_json::Value>()?;
                }
            }
        }
        if optional && nothing {
            return Ok(None);
        }
        let result = AddPaperDocUser {
            doc_id: field_doc_id.ok_or_else(|| ::serde::de::Error::missing_field("doc_id"))?,
            members: field_members.ok_or_else(|| ::serde::de::Error::missing_field("members"))?,
            custom_message: field_custom_message,
            quiet: field_quiet.unwrap_or(false),
        };
        Ok(Some(result))
    }

    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
        &self,
        s: &mut S::SerializeStruct,
    ) -> Result<(), S::Error> {
        use serde::ser::SerializeStruct;
        s.serialize_field("doc_id", &self.doc_id)?;
        s.serialize_field("members", &self.members)?;
        s.serialize_field("custom_message", &self.custom_message)?;
        s.serialize_field("quiet", &self.quiet)
    }
}

impl<'de> ::serde::de::Deserialize<'de> for AddPaperDocUser {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // struct deserializer
        use serde::de::{MapAccess, Visitor};
        struct StructVisitor;
        impl<'de> Visitor<'de> for StructVisitor {
            type Value = AddPaperDocUser;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a AddPaperDocUser struct")
            }
            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
                AddPaperDocUser::internal_deserialize(map)
            }
        }
        deserializer.deserialize_struct("AddPaperDocUser", ADD_PAPER_DOC_USER_FIELDS, StructVisitor)
    }
}

impl ::serde::ser::Serialize for AddPaperDocUser {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // struct serializer
        use serde::ser::SerializeStruct;
        let mut s = serializer.serialize_struct("AddPaperDocUser", 4)?;
        self.internal_serialize::<S>(&mut s)?;
        s.end()
    }
}

/// Per-member result for [`docs_users_add()`](docs_users_add).
#[derive(Debug)]
pub struct AddPaperDocUserMemberResult {
    /// One of specified input members.
    pub member: super::sharing::MemberSelector,
    /// The outcome of the action on this member.
    pub result: AddPaperDocUserResult,
}

impl AddPaperDocUserMemberResult {
    pub fn new(member: super::sharing::MemberSelector, result: AddPaperDocUserResult) -> Self {
        AddPaperDocUserMemberResult {
            member,
            result,
        }
    }

}

const ADD_PAPER_DOC_USER_MEMBER_RESULT_FIELDS: &[&str] = &["member",
                                                           "result"];
impl AddPaperDocUserMemberResult {
    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
        map: V,
    ) -> Result<AddPaperDocUserMemberResult, V::Error> {
        Self::internal_deserialize_opt(map, false).map(Option::unwrap)
    }

    pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
        mut map: V,
        optional: bool,
    ) -> Result<Option<AddPaperDocUserMemberResult>, V::Error> {
        let mut field_member = None;
        let mut field_result = None;
        let mut nothing = true;
        while let Some(key) = map.next_key::<&str>()? {
            nothing = false;
            match key {
                "member" => {
                    if field_member.is_some() {
                        return Err(::serde::de::Error::duplicate_field("member"));
                    }
                    field_member = Some(map.next_value()?);
                }
                "result" => {
                    if field_result.is_some() {
                        return Err(::serde::de::Error::duplicate_field("result"));
                    }
                    field_result = Some(map.next_value()?);
                }
                _ => {
                    // unknown field allowed and ignored
                    map.next_value::<::serde_json::Value>()?;
                }
            }
        }
        if optional && nothing {
            return Ok(None);
        }
        let result = AddPaperDocUserMemberResult {
            member: field_member.ok_or_else(|| ::serde::de::Error::missing_field("member"))?,
            result: field_result.ok_or_else(|| ::serde::de::Error::missing_field("result"))?,
        };
        Ok(Some(result))
    }

    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
        &self,
        s: &mut S::SerializeStruct,
    ) -> Result<(), S::Error> {
        use serde::ser::SerializeStruct;
        s.serialize_field("member", &self.member)?;
        s.serialize_field("result", &self.result)
    }
}

impl<'de> ::serde::de::Deserialize<'de> for AddPaperDocUserMemberResult {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // struct deserializer
        use serde::de::{MapAccess, Visitor};
        struct StructVisitor;
        impl<'de> Visitor<'de> for StructVisitor {
            type Value = AddPaperDocUserMemberResult;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a AddPaperDocUserMemberResult struct")
            }
            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
                AddPaperDocUserMemberResult::internal_deserialize(map)
            }
        }
        deserializer.deserialize_struct("AddPaperDocUserMemberResult", ADD_PAPER_DOC_USER_MEMBER_RESULT_FIELDS, StructVisitor)
    }
}

impl ::serde::ser::Serialize for AddPaperDocUserMemberResult {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // struct serializer
        use serde::ser::SerializeStruct;
        let mut s = serializer.serialize_struct("AddPaperDocUserMemberResult", 2)?;
        self.internal_serialize::<S>(&mut s)?;
        s.end()
    }
}

#[derive(Debug)]
pub enum AddPaperDocUserResult {
    /// User was successfully added to the Paper doc.
    Success,
    /// Something unexpected happened when trying to add the user to the Paper doc.
    UnknownError,
    /// The Paper doc can be shared only with team members.
    SharingOutsideTeamDisabled,
    /// The daily limit of how many users can be added to the Paper doc was reached.
    DailyLimitReached,
    /// Owner's permissions cannot be changed.
    UserIsOwner,
    /// User data could not be retrieved. Clients should retry.
    FailedUserDataRetrieval,
    /// This user already has the correct permission to the Paper doc.
    PermissionAlreadyGranted,
    /// Catch-all used for unrecognized values returned from the server. Encountering this value
    /// typically indicates that this SDK version is out of date.
    Other,
}

impl<'de> ::serde::de::Deserialize<'de> for AddPaperDocUserResult {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // union deserializer
        use serde::de::{self, MapAccess, Visitor};
        struct EnumVisitor;
        impl<'de> Visitor<'de> for EnumVisitor {
            type Value = AddPaperDocUserResult;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a AddPaperDocUserResult structure")
            }
            fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
                let tag: &str = match map.next_key()? {
                    Some(".tag") => map.next_value()?,
                    _ => return Err(de::Error::missing_field(".tag"))
                };
                match tag {
                    "success" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(AddPaperDocUserResult::Success)
                    }
                    "unknown_error" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(AddPaperDocUserResult::UnknownError)
                    }
                    "sharing_outside_team_disabled" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(AddPaperDocUserResult::SharingOutsideTeamDisabled)
                    }
                    "daily_limit_reached" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(AddPaperDocUserResult::DailyLimitReached)
                    }
                    "user_is_owner" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(AddPaperDocUserResult::UserIsOwner)
                    }
                    "failed_user_data_retrieval" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(AddPaperDocUserResult::FailedUserDataRetrieval)
                    }
                    "permission_already_granted" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(AddPaperDocUserResult::PermissionAlreadyGranted)
                    }
                    _ => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(AddPaperDocUserResult::Other)
                    }
                }
            }
        }
        const VARIANTS: &[&str] = &["success",
                                    "unknown_error",
                                    "sharing_outside_team_disabled",
                                    "daily_limit_reached",
                                    "user_is_owner",
                                    "failed_user_data_retrieval",
                                    "permission_already_granted",
                                    "other"];
        deserializer.deserialize_struct("AddPaperDocUserResult", VARIANTS, EnumVisitor)
    }
}

impl ::serde::ser::Serialize for AddPaperDocUserResult {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // union serializer
        use serde::ser::SerializeStruct;
        match *self {
            AddPaperDocUserResult::Success => {
                // unit
                let mut s = serializer.serialize_struct("AddPaperDocUserResult", 1)?;
                s.serialize_field(".tag", "success")?;
                s.end()
            }
            AddPaperDocUserResult::UnknownError => {
                // unit
                let mut s = serializer.serialize_struct("AddPaperDocUserResult", 1)?;
                s.serialize_field(".tag", "unknown_error")?;
                s.end()
            }
            AddPaperDocUserResult::SharingOutsideTeamDisabled => {
                // unit
                let mut s = serializer.serialize_struct("AddPaperDocUserResult", 1)?;
                s.serialize_field(".tag", "sharing_outside_team_disabled")?;
                s.end()
            }
            AddPaperDocUserResult::DailyLimitReached => {
                // unit
                let mut s = serializer.serialize_struct("AddPaperDocUserResult", 1)?;
                s.serialize_field(".tag", "daily_limit_reached")?;
                s.end()
            }
            AddPaperDocUserResult::UserIsOwner => {
                // unit
                let mut s = serializer.serialize_struct("AddPaperDocUserResult", 1)?;
                s.serialize_field(".tag", "user_is_owner")?;
                s.end()
            }
            AddPaperDocUserResult::FailedUserDataRetrieval => {
                // unit
                let mut s = serializer.serialize_struct("AddPaperDocUserResult", 1)?;
                s.serialize_field(".tag", "failed_user_data_retrieval")?;
                s.end()
            }
            AddPaperDocUserResult::PermissionAlreadyGranted => {
                // unit
                let mut s = serializer.serialize_struct("AddPaperDocUserResult", 1)?;
                s.serialize_field(".tag", "permission_already_granted")?;
                s.end()
            }
            AddPaperDocUserResult::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
        }
    }
}

#[derive(Debug)]
pub struct Cursor {
    /// The actual cursor value.
    pub value: String,
    /// Expiration time of `value`. Some cursors might have expiration time assigned. This is a UTC
    /// value after which the cursor is no longer valid and the API starts returning an error. If
    /// cursor expires a new one needs to be obtained and pagination needs to be restarted. Some
    /// cursors might be short-lived some cursors might be long-lived. This really depends on the
    /// sorting type and order, e.g.: 1. on one hand, listing docs created by the user, sorted by
    /// the created time ascending will have undefinite expiration because the results cannot change
    /// while the iteration is happening. This cursor would be suitable for long term polling. 2. on
    /// the other hand, listing docs sorted by the last modified time will have a very short
    /// expiration as docs do get modified very often and the modified time can be changed while the
    /// iteration is happening thus altering the results.
    pub expiration: Option<super::common::DropboxTimestamp>,
}

impl Cursor {
    pub fn new(value: String) -> Self {
        Cursor {
            value,
            expiration: None,
        }
    }

    pub fn with_expiration(mut self, value: Option<super::common::DropboxTimestamp>) -> Self {
        self.expiration = value;
        self
    }

}

const CURSOR_FIELDS: &[&str] = &["value",
                                 "expiration"];
impl Cursor {
    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
        map: V,
    ) -> Result<Cursor, V::Error> {
        Self::internal_deserialize_opt(map, false).map(Option::unwrap)
    }

    pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
        mut map: V,
        optional: bool,
    ) -> Result<Option<Cursor>, V::Error> {
        let mut field_value = None;
        let mut field_expiration = None;
        let mut nothing = true;
        while let Some(key) = map.next_key::<&str>()? {
            nothing = false;
            match key {
                "value" => {
                    if field_value.is_some() {
                        return Err(::serde::de::Error::duplicate_field("value"));
                    }
                    field_value = Some(map.next_value()?);
                }
                "expiration" => {
                    if field_expiration.is_some() {
                        return Err(::serde::de::Error::duplicate_field("expiration"));
                    }
                    field_expiration = Some(map.next_value()?);
                }
                _ => {
                    // unknown field allowed and ignored
                    map.next_value::<::serde_json::Value>()?;
                }
            }
        }
        if optional && nothing {
            return Ok(None);
        }
        let result = Cursor {
            value: field_value.ok_or_else(|| ::serde::de::Error::missing_field("value"))?,
            expiration: field_expiration,
        };
        Ok(Some(result))
    }

    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
        &self,
        s: &mut S::SerializeStruct,
    ) -> Result<(), S::Error> {
        use serde::ser::SerializeStruct;
        s.serialize_field("value", &self.value)?;
        s.serialize_field("expiration", &self.expiration)
    }
}

impl<'de> ::serde::de::Deserialize<'de> for Cursor {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // struct deserializer
        use serde::de::{MapAccess, Visitor};
        struct StructVisitor;
        impl<'de> Visitor<'de> for StructVisitor {
            type Value = Cursor;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a Cursor struct")
            }
            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
                Cursor::internal_deserialize(map)
            }
        }
        deserializer.deserialize_struct("Cursor", CURSOR_FIELDS, StructVisitor)
    }
}

impl ::serde::ser::Serialize for Cursor {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // struct serializer
        use serde::ser::SerializeStruct;
        let mut s = serializer.serialize_struct("Cursor", 2)?;
        self.internal_serialize::<S>(&mut s)?;
        s.end()
    }
}

#[derive(Debug)]
pub enum DocLookupError {
    /// Your account does not have permissions to perform this action. This may be due to it only
    /// having access to Paper as files in the Dropbox filesystem. For more information, refer to
    /// the [Paper Migration
    /// Guide](https://www.dropbox.com/lp/developers/reference/paper-migration-guide).
    InsufficientPermissions,
    /// The required doc was not found.
    DocNotFound,
    /// Catch-all used for unrecognized values returned from the server. Encountering this value
    /// typically indicates that this SDK version is out of date.
    Other,
}

impl<'de> ::serde::de::Deserialize<'de> for DocLookupError {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // union deserializer
        use serde::de::{self, MapAccess, Visitor};
        struct EnumVisitor;
        impl<'de> Visitor<'de> for EnumVisitor {
            type Value = DocLookupError;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a DocLookupError structure")
            }
            fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
                let tag: &str = match map.next_key()? {
                    Some(".tag") => map.next_value()?,
                    _ => return Err(de::Error::missing_field(".tag"))
                };
                match tag {
                    "insufficient_permissions" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(DocLookupError::InsufficientPermissions)
                    }
                    "doc_not_found" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(DocLookupError::DocNotFound)
                    }
                    _ => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(DocLookupError::Other)
                    }
                }
            }
        }
        const VARIANTS: &[&str] = &["insufficient_permissions",
                                    "other",
                                    "doc_not_found"];
        deserializer.deserialize_struct("DocLookupError", VARIANTS, EnumVisitor)
    }
}

impl ::serde::ser::Serialize for DocLookupError {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // union serializer
        use serde::ser::SerializeStruct;
        match *self {
            DocLookupError::InsufficientPermissions => {
                // unit
                let mut s = serializer.serialize_struct("DocLookupError", 1)?;
                s.serialize_field(".tag", "insufficient_permissions")?;
                s.end()
            }
            DocLookupError::DocNotFound => {
                // unit
                let mut s = serializer.serialize_struct("DocLookupError", 1)?;
                s.serialize_field(".tag", "doc_not_found")?;
                s.end()
            }
            DocLookupError::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
        }
    }
}

impl ::std::error::Error for DocLookupError {
    fn description(&self) -> &str {
        "DocLookupError"
    }
}

impl ::std::fmt::Display for DocLookupError {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        write!(f, "{:?}", *self)
    }
}

/// The subscription level of a Paper doc.
#[derive(Debug)]
pub enum DocSubscriptionLevel {
    /// No change email messages unless you're the creator.
    Default,
    /// Ignored: Not shown in pad lists or activity and no email message is sent.
    Ignore,
    /// Subscribed: Shown in pad lists and activity and change email messages are sent.
    Every,
    /// Unsubscribed: Shown in pad lists, but not in activity and no change email messages are sent.
    NoEmail,
}

impl<'de> ::serde::de::Deserialize<'de> for DocSubscriptionLevel {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // union deserializer
        use serde::de::{self, MapAccess, Visitor};
        struct EnumVisitor;
        impl<'de> Visitor<'de> for EnumVisitor {
            type Value = DocSubscriptionLevel;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a DocSubscriptionLevel structure")
            }
            fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
                let tag: &str = match map.next_key()? {
                    Some(".tag") => map.next_value()?,
                    _ => return Err(de::Error::missing_field(".tag"))
                };
                match tag {
                    "default" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(DocSubscriptionLevel::Default)
                    }
                    "ignore" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(DocSubscriptionLevel::Ignore)
                    }
                    "every" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(DocSubscriptionLevel::Every)
                    }
                    "no_email" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(DocSubscriptionLevel::NoEmail)
                    }
                    _ => Err(de::Error::unknown_variant(tag, VARIANTS))
                }
            }
        }
        const VARIANTS: &[&str] = &["default",
                                    "ignore",
                                    "every",
                                    "no_email"];
        deserializer.deserialize_struct("DocSubscriptionLevel", VARIANTS, EnumVisitor)
    }
}

impl ::serde::ser::Serialize for DocSubscriptionLevel {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // union serializer
        use serde::ser::SerializeStruct;
        match *self {
            DocSubscriptionLevel::Default => {
                // unit
                let mut s = serializer.serialize_struct("DocSubscriptionLevel", 1)?;
                s.serialize_field(".tag", "default")?;
                s.end()
            }
            DocSubscriptionLevel::Ignore => {
                // unit
                let mut s = serializer.serialize_struct("DocSubscriptionLevel", 1)?;
                s.serialize_field(".tag", "ignore")?;
                s.end()
            }
            DocSubscriptionLevel::Every => {
                // unit
                let mut s = serializer.serialize_struct("DocSubscriptionLevel", 1)?;
                s.serialize_field(".tag", "every")?;
                s.end()
            }
            DocSubscriptionLevel::NoEmail => {
                // unit
                let mut s = serializer.serialize_struct("DocSubscriptionLevel", 1)?;
                s.serialize_field(".tag", "no_email")?;
                s.end()
            }
        }
    }
}

/// The desired export format of the Paper doc.
#[derive(Debug)]
pub enum ExportFormat {
    /// The HTML export format.
    Html,
    /// The markdown export format.
    Markdown,
    /// Catch-all used for unrecognized values returned from the server. Encountering this value
    /// typically indicates that this SDK version is out of date.
    Other,
}

impl<'de> ::serde::de::Deserialize<'de> for ExportFormat {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // union deserializer
        use serde::de::{self, MapAccess, Visitor};
        struct EnumVisitor;
        impl<'de> Visitor<'de> for EnumVisitor {
            type Value = ExportFormat;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a ExportFormat structure")
            }
            fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
                let tag: &str = match map.next_key()? {
                    Some(".tag") => map.next_value()?,
                    _ => return Err(de::Error::missing_field(".tag"))
                };
                match tag {
                    "html" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(ExportFormat::Html)
                    }
                    "markdown" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(ExportFormat::Markdown)
                    }
                    _ => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(ExportFormat::Other)
                    }
                }
            }
        }
        const VARIANTS: &[&str] = &["html",
                                    "markdown",
                                    "other"];
        deserializer.deserialize_struct("ExportFormat", VARIANTS, EnumVisitor)
    }
}

impl ::serde::ser::Serialize for ExportFormat {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // union serializer
        use serde::ser::SerializeStruct;
        match *self {
            ExportFormat::Html => {
                // unit
                let mut s = serializer.serialize_struct("ExportFormat", 1)?;
                s.serialize_field(".tag", "html")?;
                s.end()
            }
            ExportFormat::Markdown => {
                // unit
                let mut s = serializer.serialize_struct("ExportFormat", 1)?;
                s.serialize_field(".tag", "markdown")?;
                s.end()
            }
            ExportFormat::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
        }
    }
}

/// Data structure representing a Paper folder.
#[derive(Debug)]
pub struct Folder {
    /// Paper folder ID. This ID uniquely identifies the folder.
    pub id: String,
    /// Paper folder name.
    pub name: String,
}

impl Folder {
    pub fn new(id: String, name: String) -> Self {
        Folder {
            id,
            name,
        }
    }

}

const FOLDER_FIELDS: &[&str] = &["id",
                                 "name"];
impl Folder {
    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
        map: V,
    ) -> Result<Folder, V::Error> {
        Self::internal_deserialize_opt(map, false).map(Option::unwrap)
    }

    pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
        mut map: V,
        optional: bool,
    ) -> Result<Option<Folder>, V::Error> {
        let mut field_id = None;
        let mut field_name = None;
        let mut nothing = true;
        while let Some(key) = map.next_key::<&str>()? {
            nothing = false;
            match key {
                "id" => {
                    if field_id.is_some() {
                        return Err(::serde::de::Error::duplicate_field("id"));
                    }
                    field_id = Some(map.next_value()?);
                }
                "name" => {
                    if field_name.is_some() {
                        return Err(::serde::de::Error::duplicate_field("name"));
                    }
                    field_name = Some(map.next_value()?);
                }
                _ => {
                    // unknown field allowed and ignored
                    map.next_value::<::serde_json::Value>()?;
                }
            }
        }
        if optional && nothing {
            return Ok(None);
        }
        let result = Folder {
            id: field_id.ok_or_else(|| ::serde::de::Error::missing_field("id"))?,
            name: field_name.ok_or_else(|| ::serde::de::Error::missing_field("name"))?,
        };
        Ok(Some(result))
    }

    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
        &self,
        s: &mut S::SerializeStruct,
    ) -> Result<(), S::Error> {
        use serde::ser::SerializeStruct;
        s.serialize_field("id", &self.id)?;
        s.serialize_field("name", &self.name)
    }
}

impl<'de> ::serde::de::Deserialize<'de> for Folder {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // struct deserializer
        use serde::de::{MapAccess, Visitor};
        struct StructVisitor;
        impl<'de> Visitor<'de> for StructVisitor {
            type Value = Folder;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a Folder struct")
            }
            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
                Folder::internal_deserialize(map)
            }
        }
        deserializer.deserialize_struct("Folder", FOLDER_FIELDS, StructVisitor)
    }
}

impl ::serde::ser::Serialize for Folder {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // struct serializer
        use serde::ser::SerializeStruct;
        let mut s = serializer.serialize_struct("Folder", 2)?;
        self.internal_serialize::<S>(&mut s)?;
        s.end()
    }
}

/// The sharing policy of a Paper folder. The sharing policy of subfolders is inherited from the
/// root folder.
#[derive(Debug)]
pub enum FolderSharingPolicyType {
    /// Everyone in your team and anyone directly invited can access this folder.
    Team,
    /// Only people directly invited can access this folder.
    InviteOnly,
}

impl<'de> ::serde::de::Deserialize<'de> for FolderSharingPolicyType {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // union deserializer
        use serde::de::{self, MapAccess, Visitor};
        struct EnumVisitor;
        impl<'de> Visitor<'de> for EnumVisitor {
            type Value = FolderSharingPolicyType;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a FolderSharingPolicyType structure")
            }
            fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
                let tag: &str = match map.next_key()? {
                    Some(".tag") => map.next_value()?,
                    _ => return Err(de::Error::missing_field(".tag"))
                };
                match tag {
                    "team" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(FolderSharingPolicyType::Team)
                    }
                    "invite_only" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(FolderSharingPolicyType::InviteOnly)
                    }
                    _ => Err(de::Error::unknown_variant(tag, VARIANTS))
                }
            }
        }
        const VARIANTS: &[&str] = &["team",
                                    "invite_only"];
        deserializer.deserialize_struct("FolderSharingPolicyType", VARIANTS, EnumVisitor)
    }
}

impl ::serde::ser::Serialize for FolderSharingPolicyType {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // union serializer
        use serde::ser::SerializeStruct;
        match *self {
            FolderSharingPolicyType::Team => {
                // unit
                let mut s = serializer.serialize_struct("FolderSharingPolicyType", 1)?;
                s.serialize_field(".tag", "team")?;
                s.end()
            }
            FolderSharingPolicyType::InviteOnly => {
                // unit
                let mut s = serializer.serialize_struct("FolderSharingPolicyType", 1)?;
                s.serialize_field(".tag", "invite_only")?;
                s.end()
            }
        }
    }
}

/// The subscription level of a Paper folder.
#[derive(Debug)]
pub enum FolderSubscriptionLevel {
    /// Not shown in activity, no email messages.
    None,
    /// Shown in activity, no email messages.
    ActivityOnly,
    /// Shown in activity, daily email messages.
    DailyEmails,
    /// Shown in activity, weekly email messages.
    WeeklyEmails,
}

impl<'de> ::serde::de::Deserialize<'de> for FolderSubscriptionLevel {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // union deserializer
        use serde::de::{self, MapAccess, Visitor};
        struct EnumVisitor;
        impl<'de> Visitor<'de> for EnumVisitor {
            type Value = FolderSubscriptionLevel;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a FolderSubscriptionLevel structure")
            }
            fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
                let tag: &str = match map.next_key()? {
                    Some(".tag") => map.next_value()?,
                    _ => return Err(de::Error::missing_field(".tag"))
                };
                match tag {
                    "none" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(FolderSubscriptionLevel::None)
                    }
                    "activity_only" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(FolderSubscriptionLevel::ActivityOnly)
                    }
                    "daily_emails" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(FolderSubscriptionLevel::DailyEmails)
                    }
                    "weekly_emails" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(FolderSubscriptionLevel::WeeklyEmails)
                    }
                    _ => Err(de::Error::unknown_variant(tag, VARIANTS))
                }
            }
        }
        const VARIANTS: &[&str] = &["none",
                                    "activity_only",
                                    "daily_emails",
                                    "weekly_emails"];
        deserializer.deserialize_struct("FolderSubscriptionLevel", VARIANTS, EnumVisitor)
    }
}

impl ::serde::ser::Serialize for FolderSubscriptionLevel {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // union serializer
        use serde::ser::SerializeStruct;
        match *self {
            FolderSubscriptionLevel::None => {
                // unit
                let mut s = serializer.serialize_struct("FolderSubscriptionLevel", 1)?;
                s.serialize_field(".tag", "none")?;
                s.end()
            }
            FolderSubscriptionLevel::ActivityOnly => {
                // unit
                let mut s = serializer.serialize_struct("FolderSubscriptionLevel", 1)?;
                s.serialize_field(".tag", "activity_only")?;
                s.end()
            }
            FolderSubscriptionLevel::DailyEmails => {
                // unit
                let mut s = serializer.serialize_struct("FolderSubscriptionLevel", 1)?;
                s.serialize_field(".tag", "daily_emails")?;
                s.end()
            }
            FolderSubscriptionLevel::WeeklyEmails => {
                // unit
                let mut s = serializer.serialize_struct("FolderSubscriptionLevel", 1)?;
                s.serialize_field(".tag", "weekly_emails")?;
                s.end()
            }
        }
    }
}

/// Metadata about Paper folders containing the specififed Paper doc.
#[derive(Debug)]
pub struct FoldersContainingPaperDoc {
    /// The sharing policy of the folder containing the Paper doc.
    pub folder_sharing_policy_type: Option<FolderSharingPolicyType>,
    /// The folder path. If present the first folder is the root folder.
    pub folders: Option<Vec<Folder>>,
}

impl Default for FoldersContainingPaperDoc {
    fn default() -> Self {
        FoldersContainingPaperDoc {
            folder_sharing_policy_type: None,
            folders: None,
        }
    }
}

const FOLDERS_CONTAINING_PAPER_DOC_FIELDS: &[&str] = &["folder_sharing_policy_type",
                                                       "folders"];
impl FoldersContainingPaperDoc {
    // no _opt deserializer
    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
        mut map: V,
    ) -> Result<FoldersContainingPaperDoc, V::Error> {
        let mut field_folder_sharing_policy_type = None;
        let mut field_folders = None;
        while let Some(key) = map.next_key::<&str>()? {
            match key {
                "folder_sharing_policy_type" => {
                    if field_folder_sharing_policy_type.is_some() {
                        return Err(::serde::de::Error::duplicate_field("folder_sharing_policy_type"));
                    }
                    field_folder_sharing_policy_type = Some(map.next_value()?);
                }
                "folders" => {
                    if field_folders.is_some() {
                        return Err(::serde::de::Error::duplicate_field("folders"));
                    }
                    field_folders = Some(map.next_value()?);
                }
                _ => {
                    // unknown field allowed and ignored
                    map.next_value::<::serde_json::Value>()?;
                }
            }
        }
        let result = FoldersContainingPaperDoc {
            folder_sharing_policy_type: field_folder_sharing_policy_type,
            folders: field_folders,
        };
        Ok(result)
    }

    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
        &self,
        s: &mut S::SerializeStruct,
    ) -> Result<(), S::Error> {
        use serde::ser::SerializeStruct;
        s.serialize_field("folder_sharing_policy_type", &self.folder_sharing_policy_type)?;
        s.serialize_field("folders", &self.folders)
    }
}

impl<'de> ::serde::de::Deserialize<'de> for FoldersContainingPaperDoc {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // struct deserializer
        use serde::de::{MapAccess, Visitor};
        struct StructVisitor;
        impl<'de> Visitor<'de> for StructVisitor {
            type Value = FoldersContainingPaperDoc;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a FoldersContainingPaperDoc struct")
            }
            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
                FoldersContainingPaperDoc::internal_deserialize(map)
            }
        }
        deserializer.deserialize_struct("FoldersContainingPaperDoc", FOLDERS_CONTAINING_PAPER_DOC_FIELDS, StructVisitor)
    }
}

impl ::serde::ser::Serialize for FoldersContainingPaperDoc {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // struct serializer
        use serde::ser::SerializeStruct;
        let mut s = serializer.serialize_struct("FoldersContainingPaperDoc", 2)?;
        self.internal_serialize::<S>(&mut s)?;
        s.end()
    }
}

/// The import format of the incoming data.
#[derive(Debug)]
pub enum ImportFormat {
    /// The provided data is interpreted as standard HTML.
    Html,
    /// The provided data is interpreted as markdown. The first line of the provided document will
    /// be used as the doc title.
    Markdown,
    /// The provided data is interpreted as plain text. The first line of the provided document will
    /// be used as the doc title.
    PlainText,
    /// Catch-all used for unrecognized values returned from the server. Encountering this value
    /// typically indicates that this SDK version is out of date.
    Other,
}

impl<'de> ::serde::de::Deserialize<'de> for ImportFormat {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // union deserializer
        use serde::de::{self, MapAccess, Visitor};
        struct EnumVisitor;
        impl<'de> Visitor<'de> for EnumVisitor {
            type Value = ImportFormat;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a ImportFormat structure")
            }
            fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
                let tag: &str = match map.next_key()? {
                    Some(".tag") => map.next_value()?,
                    _ => return Err(de::Error::missing_field(".tag"))
                };
                match tag {
                    "html" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(ImportFormat::Html)
                    }
                    "markdown" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(ImportFormat::Markdown)
                    }
                    "plain_text" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(ImportFormat::PlainText)
                    }
                    _ => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(ImportFormat::Other)
                    }
                }
            }
        }
        const VARIANTS: &[&str] = &["html",
                                    "markdown",
                                    "plain_text",
                                    "other"];
        deserializer.deserialize_struct("ImportFormat", VARIANTS, EnumVisitor)
    }
}

impl ::serde::ser::Serialize for ImportFormat {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // union serializer
        use serde::ser::SerializeStruct;
        match *self {
            ImportFormat::Html => {
                // unit
                let mut s = serializer.serialize_struct("ImportFormat", 1)?;
                s.serialize_field(".tag", "html")?;
                s.end()
            }
            ImportFormat::Markdown => {
                // unit
                let mut s = serializer.serialize_struct("ImportFormat", 1)?;
                s.serialize_field(".tag", "markdown")?;
                s.end()
            }
            ImportFormat::PlainText => {
                // unit
                let mut s = serializer.serialize_struct("ImportFormat", 1)?;
                s.serialize_field(".tag", "plain_text")?;
                s.end()
            }
            ImportFormat::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
        }
    }
}

#[derive(Debug)]
pub struct InviteeInfoWithPermissionLevel {
    /// Email address invited to the Paper doc.
    pub invitee: super::sharing::InviteeInfo,
    /// Permission level for the invitee.
    pub permission_level: PaperDocPermissionLevel,
}

impl InviteeInfoWithPermissionLevel {
    pub fn new(
        invitee: super::sharing::InviteeInfo,
        permission_level: PaperDocPermissionLevel,
    ) -> Self {
        InviteeInfoWithPermissionLevel {
            invitee,
            permission_level,
        }
    }

}

const INVITEE_INFO_WITH_PERMISSION_LEVEL_FIELDS: &[&str] = &["invitee",
                                                             "permission_level"];
impl InviteeInfoWithPermissionLevel {
    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
        map: V,
    ) -> Result<InviteeInfoWithPermissionLevel, V::Error> {
        Self::internal_deserialize_opt(map, false).map(Option::unwrap)
    }

    pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
        mut map: V,
        optional: bool,
    ) -> Result<Option<InviteeInfoWithPermissionLevel>, V::Error> {
        let mut field_invitee = None;
        let mut field_permission_level = None;
        let mut nothing = true;
        while let Some(key) = map.next_key::<&str>()? {
            nothing = false;
            match key {
                "invitee" => {
                    if field_invitee.is_some() {
                        return Err(::serde::de::Error::duplicate_field("invitee"));
                    }
                    field_invitee = Some(map.next_value()?);
                }
                "permission_level" => {
                    if field_permission_level.is_some() {
                        return Err(::serde::de::Error::duplicate_field("permission_level"));
                    }
                    field_permission_level = Some(map.next_value()?);
                }
                _ => {
                    // unknown field allowed and ignored
                    map.next_value::<::serde_json::Value>()?;
                }
            }
        }
        if optional && nothing {
            return Ok(None);
        }
        let result = InviteeInfoWithPermissionLevel {
            invitee: field_invitee.ok_or_else(|| ::serde::de::Error::missing_field("invitee"))?,
            permission_level: field_permission_level.ok_or_else(|| ::serde::de::Error::missing_field("permission_level"))?,
        };
        Ok(Some(result))
    }

    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
        &self,
        s: &mut S::SerializeStruct,
    ) -> Result<(), S::Error> {
        use serde::ser::SerializeStruct;
        s.serialize_field("invitee", &self.invitee)?;
        s.serialize_field("permission_level", &self.permission_level)
    }
}

impl<'de> ::serde::de::Deserialize<'de> for InviteeInfoWithPermissionLevel {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // struct deserializer
        use serde::de::{MapAccess, Visitor};
        struct StructVisitor;
        impl<'de> Visitor<'de> for StructVisitor {
            type Value = InviteeInfoWithPermissionLevel;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a InviteeInfoWithPermissionLevel struct")
            }
            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
                InviteeInfoWithPermissionLevel::internal_deserialize(map)
            }
        }
        deserializer.deserialize_struct("InviteeInfoWithPermissionLevel", INVITEE_INFO_WITH_PERMISSION_LEVEL_FIELDS, StructVisitor)
    }
}

impl ::serde::ser::Serialize for InviteeInfoWithPermissionLevel {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // struct serializer
        use serde::ser::SerializeStruct;
        let mut s = serializer.serialize_struct("InviteeInfoWithPermissionLevel", 2)?;
        self.internal_serialize::<S>(&mut s)?;
        s.end()
    }
}

#[derive(Debug)]
pub enum ListDocsCursorError {
    CursorError(PaperApiCursorError),
    /// Catch-all used for unrecognized values returned from the server. Encountering this value
    /// typically indicates that this SDK version is out of date.
    Other,
}

impl<'de> ::serde::de::Deserialize<'de> for ListDocsCursorError {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // union deserializer
        use serde::de::{self, MapAccess, Visitor};
        struct EnumVisitor;
        impl<'de> Visitor<'de> for EnumVisitor {
            type Value = ListDocsCursorError;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a ListDocsCursorError structure")
            }
            fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
                let tag: &str = match map.next_key()? {
                    Some(".tag") => map.next_value()?,
                    _ => return Err(de::Error::missing_field(".tag"))
                };
                match tag {
                    "cursor_error" => {
                        match map.next_key()? {
                            Some("cursor_error") => Ok(ListDocsCursorError::CursorError(map.next_value()?)),
                            None => Err(de::Error::missing_field("cursor_error")),
                            _ => Err(de::Error::unknown_field(tag, VARIANTS))
                        }
                    }
                    _ => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(ListDocsCursorError::Other)
                    }
                }
            }
        }
        const VARIANTS: &[&str] = &["cursor_error",
                                    "other"];
        deserializer.deserialize_struct("ListDocsCursorError", VARIANTS, EnumVisitor)
    }
}

impl ::serde::ser::Serialize for ListDocsCursorError {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // union serializer
        use serde::ser::SerializeStruct;
        match *self {
            ListDocsCursorError::CursorError(ref x) => {
                // union or polymporphic struct
                let mut s = serializer.serialize_struct("ListDocsCursorError", 2)?;
                s.serialize_field(".tag", "cursor_error")?;
                s.serialize_field("cursor_error", x)?;
                s.end()
            }
            ListDocsCursorError::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
        }
    }
}

impl ::std::error::Error for ListDocsCursorError {
    fn description(&self) -> &str {
        "ListDocsCursorError"
    }
}

impl ::std::fmt::Display for ListDocsCursorError {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        write!(f, "{:?}", *self)
    }
}

#[derive(Debug)]
pub struct ListPaperDocsArgs {
    /// Allows user to specify how the Paper docs should be filtered.
    pub filter_by: ListPaperDocsFilterBy,
    /// Allows user to specify how the Paper docs should be sorted.
    pub sort_by: ListPaperDocsSortBy,
    /// Allows user to specify the sort order of the result.
    pub sort_order: ListPaperDocsSortOrder,
    /// Size limit per batch. The maximum number of docs that can be retrieved per batch is 1000.
    /// Higher value results in invalid arguments error.
    pub limit: i32,
}

impl Default for ListPaperDocsArgs {
    fn default() -> Self {
        ListPaperDocsArgs {
            filter_by: ListPaperDocsFilterBy::DocsAccessed,
            sort_by: ListPaperDocsSortBy::Accessed,
            sort_order: ListPaperDocsSortOrder::Ascending,
            limit: 1000,
        }
    }
}

const LIST_PAPER_DOCS_ARGS_FIELDS: &[&str] = &["filter_by",
                                               "sort_by",
                                               "sort_order",
                                               "limit"];
impl ListPaperDocsArgs {
    // no _opt deserializer
    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
        mut map: V,
    ) -> Result<ListPaperDocsArgs, V::Error> {
        let mut field_filter_by = None;
        let mut field_sort_by = None;
        let mut field_sort_order = None;
        let mut field_limit = None;
        while let Some(key) = map.next_key::<&str>()? {
            match key {
                "filter_by" => {
                    if field_filter_by.is_some() {
                        return Err(::serde::de::Error::duplicate_field("filter_by"));
                    }
                    field_filter_by = Some(map.next_value()?);
                }
                "sort_by" => {
                    if field_sort_by.is_some() {
                        return Err(::serde::de::Error::duplicate_field("sort_by"));
                    }
                    field_sort_by = Some(map.next_value()?);
                }
                "sort_order" => {
                    if field_sort_order.is_some() {
                        return Err(::serde::de::Error::duplicate_field("sort_order"));
                    }
                    field_sort_order = Some(map.next_value()?);
                }
                "limit" => {
                    if field_limit.is_some() {
                        return Err(::serde::de::Error::duplicate_field("limit"));
                    }
                    field_limit = Some(map.next_value()?);
                }
                _ => {
                    // unknown field allowed and ignored
                    map.next_value::<::serde_json::Value>()?;
                }
            }
        }
        let result = ListPaperDocsArgs {
            filter_by: field_filter_by.unwrap_or(ListPaperDocsFilterBy::DocsAccessed),
            sort_by: field_sort_by.unwrap_or(ListPaperDocsSortBy::Accessed),
            sort_order: field_sort_order.unwrap_or(ListPaperDocsSortOrder::Ascending),
            limit: field_limit.unwrap_or(1000),
        };
        Ok(result)
    }

    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
        &self,
        s: &mut S::SerializeStruct,
    ) -> Result<(), S::Error> {
        use serde::ser::SerializeStruct;
        s.serialize_field("filter_by", &self.filter_by)?;
        s.serialize_field("sort_by", &self.sort_by)?;
        s.serialize_field("sort_order", &self.sort_order)?;
        s.serialize_field("limit", &self.limit)
    }
}

impl<'de> ::serde::de::Deserialize<'de> for ListPaperDocsArgs {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // struct deserializer
        use serde::de::{MapAccess, Visitor};
        struct StructVisitor;
        impl<'de> Visitor<'de> for StructVisitor {
            type Value = ListPaperDocsArgs;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a ListPaperDocsArgs struct")
            }
            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
                ListPaperDocsArgs::internal_deserialize(map)
            }
        }
        deserializer.deserialize_struct("ListPaperDocsArgs", LIST_PAPER_DOCS_ARGS_FIELDS, StructVisitor)
    }
}

impl ::serde::ser::Serialize for ListPaperDocsArgs {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // struct serializer
        use serde::ser::SerializeStruct;
        let mut s = serializer.serialize_struct("ListPaperDocsArgs", 4)?;
        self.internal_serialize::<S>(&mut s)?;
        s.end()
    }
}

#[derive(Debug)]
pub struct ListPaperDocsContinueArgs {
    /// The cursor obtained from [`docs_list()`](docs_list) or
    /// [`docs_list_continue()`](docs_list_continue). Allows for pagination.
    pub cursor: String,
}

impl ListPaperDocsContinueArgs {
    pub fn new(cursor: String) -> Self {
        ListPaperDocsContinueArgs {
            cursor,
        }
    }

}

const LIST_PAPER_DOCS_CONTINUE_ARGS_FIELDS: &[&str] = &["cursor"];
impl ListPaperDocsContinueArgs {
    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
        map: V,
    ) -> Result<ListPaperDocsContinueArgs, V::Error> {
        Self::internal_deserialize_opt(map, false).map(Option::unwrap)
    }

    pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
        mut map: V,
        optional: bool,
    ) -> Result<Option<ListPaperDocsContinueArgs>, V::Error> {
        let mut field_cursor = None;
        let mut nothing = true;
        while let Some(key) = map.next_key::<&str>()? {
            nothing = false;
            match key {
                "cursor" => {
                    if field_cursor.is_some() {
                        return Err(::serde::de::Error::duplicate_field("cursor"));
                    }
                    field_cursor = Some(map.next_value()?);
                }
                _ => {
                    // unknown field allowed and ignored
                    map.next_value::<::serde_json::Value>()?;
                }
            }
        }
        if optional && nothing {
            return Ok(None);
        }
        let result = ListPaperDocsContinueArgs {
            cursor: field_cursor.ok_or_else(|| ::serde::de::Error::missing_field("cursor"))?,
        };
        Ok(Some(result))
    }

    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
        &self,
        s: &mut S::SerializeStruct,
    ) -> Result<(), S::Error> {
        use serde::ser::SerializeStruct;
        s.serialize_field("cursor", &self.cursor)
    }
}

impl<'de> ::serde::de::Deserialize<'de> for ListPaperDocsContinueArgs {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // struct deserializer
        use serde::de::{MapAccess, Visitor};
        struct StructVisitor;
        impl<'de> Visitor<'de> for StructVisitor {
            type Value = ListPaperDocsContinueArgs;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a ListPaperDocsContinueArgs struct")
            }
            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
                ListPaperDocsContinueArgs::internal_deserialize(map)
            }
        }
        deserializer.deserialize_struct("ListPaperDocsContinueArgs", LIST_PAPER_DOCS_CONTINUE_ARGS_FIELDS, StructVisitor)
    }
}

impl ::serde::ser::Serialize for ListPaperDocsContinueArgs {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // struct serializer
        use serde::ser::SerializeStruct;
        let mut s = serializer.serialize_struct("ListPaperDocsContinueArgs", 1)?;
        self.internal_serialize::<S>(&mut s)?;
        s.end()
    }
}

#[derive(Debug)]
pub enum ListPaperDocsFilterBy {
    /// Fetches all Paper doc IDs that the user has ever accessed.
    DocsAccessed,
    /// Fetches only the Paper doc IDs that the user has created.
    DocsCreated,
    /// Catch-all used for unrecognized values returned from the server. Encountering this value
    /// typically indicates that this SDK version is out of date.
    Other,
}

impl<'de> ::serde::de::Deserialize<'de> for ListPaperDocsFilterBy {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // union deserializer
        use serde::de::{self, MapAccess, Visitor};
        struct EnumVisitor;
        impl<'de> Visitor<'de> for EnumVisitor {
            type Value = ListPaperDocsFilterBy;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a ListPaperDocsFilterBy structure")
            }
            fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
                let tag: &str = match map.next_key()? {
                    Some(".tag") => map.next_value()?,
                    _ => return Err(de::Error::missing_field(".tag"))
                };
                match tag {
                    "docs_accessed" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(ListPaperDocsFilterBy::DocsAccessed)
                    }
                    "docs_created" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(ListPaperDocsFilterBy::DocsCreated)
                    }
                    _ => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(ListPaperDocsFilterBy::Other)
                    }
                }
            }
        }
        const VARIANTS: &[&str] = &["docs_accessed",
                                    "docs_created",
                                    "other"];
        deserializer.deserialize_struct("ListPaperDocsFilterBy", VARIANTS, EnumVisitor)
    }
}

impl ::serde::ser::Serialize for ListPaperDocsFilterBy {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // union serializer
        use serde::ser::SerializeStruct;
        match *self {
            ListPaperDocsFilterBy::DocsAccessed => {
                // unit
                let mut s = serializer.serialize_struct("ListPaperDocsFilterBy", 1)?;
                s.serialize_field(".tag", "docs_accessed")?;
                s.end()
            }
            ListPaperDocsFilterBy::DocsCreated => {
                // unit
                let mut s = serializer.serialize_struct("ListPaperDocsFilterBy", 1)?;
                s.serialize_field(".tag", "docs_created")?;
                s.end()
            }
            ListPaperDocsFilterBy::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
        }
    }
}

#[derive(Debug)]
pub struct ListPaperDocsResponse {
    /// The list of Paper doc IDs that can be used to access the given Paper docs or supplied to
    /// other API methods. The list is sorted in the order specified by the initial call to
    /// [`docs_list()`](docs_list).
    pub doc_ids: Vec<PaperDocId>,
    /// Pass the cursor into [`docs_list_continue()`](docs_list_continue) to paginate through all
    /// files. The cursor preserves all properties as specified in the original call to
    /// [`docs_list()`](docs_list).
    pub cursor: Cursor,
    /// Will be set to True if a subsequent call with the provided cursor to
    /// [`docs_list_continue()`](docs_list_continue) returns immediately with some results. If set
    /// to False please allow some delay before making another call to
    /// [`docs_list_continue()`](docs_list_continue).
    pub has_more: bool,
}

impl ListPaperDocsResponse {
    pub fn new(doc_ids: Vec<PaperDocId>, cursor: Cursor, has_more: bool) -> Self {
        ListPaperDocsResponse {
            doc_ids,
            cursor,
            has_more,
        }
    }

}

const LIST_PAPER_DOCS_RESPONSE_FIELDS: &[&str] = &["doc_ids",
                                                   "cursor",
                                                   "has_more"];
impl ListPaperDocsResponse {
    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
        map: V,
    ) -> Result<ListPaperDocsResponse, V::Error> {
        Self::internal_deserialize_opt(map, false).map(Option::unwrap)
    }

    pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
        mut map: V,
        optional: bool,
    ) -> Result<Option<ListPaperDocsResponse>, V::Error> {
        let mut field_doc_ids = None;
        let mut field_cursor = None;
        let mut field_has_more = None;
        let mut nothing = true;
        while let Some(key) = map.next_key::<&str>()? {
            nothing = false;
            match key {
                "doc_ids" => {
                    if field_doc_ids.is_some() {
                        return Err(::serde::de::Error::duplicate_field("doc_ids"));
                    }
                    field_doc_ids = Some(map.next_value()?);
                }
                "cursor" => {
                    if field_cursor.is_some() {
                        return Err(::serde::de::Error::duplicate_field("cursor"));
                    }
                    field_cursor = Some(map.next_value()?);
                }
                "has_more" => {
                    if field_has_more.is_some() {
                        return Err(::serde::de::Error::duplicate_field("has_more"));
                    }
                    field_has_more = Some(map.next_value()?);
                }
                _ => {
                    // unknown field allowed and ignored
                    map.next_value::<::serde_json::Value>()?;
                }
            }
        }
        if optional && nothing {
            return Ok(None);
        }
        let result = ListPaperDocsResponse {
            doc_ids: field_doc_ids.ok_or_else(|| ::serde::de::Error::missing_field("doc_ids"))?,
            cursor: field_cursor.ok_or_else(|| ::serde::de::Error::missing_field("cursor"))?,
            has_more: field_has_more.ok_or_else(|| ::serde::de::Error::missing_field("has_more"))?,
        };
        Ok(Some(result))
    }

    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
        &self,
        s: &mut S::SerializeStruct,
    ) -> Result<(), S::Error> {
        use serde::ser::SerializeStruct;
        s.serialize_field("doc_ids", &self.doc_ids)?;
        s.serialize_field("cursor", &self.cursor)?;
        s.serialize_field("has_more", &self.has_more)
    }
}

impl<'de> ::serde::de::Deserialize<'de> for ListPaperDocsResponse {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // struct deserializer
        use serde::de::{MapAccess, Visitor};
        struct StructVisitor;
        impl<'de> Visitor<'de> for StructVisitor {
            type Value = ListPaperDocsResponse;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a ListPaperDocsResponse struct")
            }
            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
                ListPaperDocsResponse::internal_deserialize(map)
            }
        }
        deserializer.deserialize_struct("ListPaperDocsResponse", LIST_PAPER_DOCS_RESPONSE_FIELDS, StructVisitor)
    }
}

impl ::serde::ser::Serialize for ListPaperDocsResponse {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // struct serializer
        use serde::ser::SerializeStruct;
        let mut s = serializer.serialize_struct("ListPaperDocsResponse", 3)?;
        self.internal_serialize::<S>(&mut s)?;
        s.end()
    }
}

#[derive(Debug)]
pub enum ListPaperDocsSortBy {
    /// Sorts the Paper docs by the time they were last accessed.
    Accessed,
    /// Sorts the Paper docs by the time they were last modified.
    Modified,
    /// Sorts the Paper docs by the creation time.
    Created,
    /// Catch-all used for unrecognized values returned from the server. Encountering this value
    /// typically indicates that this SDK version is out of date.
    Other,
}

impl<'de> ::serde::de::Deserialize<'de> for ListPaperDocsSortBy {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // union deserializer
        use serde::de::{self, MapAccess, Visitor};
        struct EnumVisitor;
        impl<'de> Visitor<'de> for EnumVisitor {
            type Value = ListPaperDocsSortBy;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a ListPaperDocsSortBy structure")
            }
            fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
                let tag: &str = match map.next_key()? {
                    Some(".tag") => map.next_value()?,
                    _ => return Err(de::Error::missing_field(".tag"))
                };
                match tag {
                    "accessed" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(ListPaperDocsSortBy::Accessed)
                    }
                    "modified" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(ListPaperDocsSortBy::Modified)
                    }
                    "created" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(ListPaperDocsSortBy::Created)
                    }
                    _ => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(ListPaperDocsSortBy::Other)
                    }
                }
            }
        }
        const VARIANTS: &[&str] = &["accessed",
                                    "modified",
                                    "created",
                                    "other"];
        deserializer.deserialize_struct("ListPaperDocsSortBy", VARIANTS, EnumVisitor)
    }
}

impl ::serde::ser::Serialize for ListPaperDocsSortBy {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // union serializer
        use serde::ser::SerializeStruct;
        match *self {
            ListPaperDocsSortBy::Accessed => {
                // unit
                let mut s = serializer.serialize_struct("ListPaperDocsSortBy", 1)?;
                s.serialize_field(".tag", "accessed")?;
                s.end()
            }
            ListPaperDocsSortBy::Modified => {
                // unit
                let mut s = serializer.serialize_struct("ListPaperDocsSortBy", 1)?;
                s.serialize_field(".tag", "modified")?;
                s.end()
            }
            ListPaperDocsSortBy::Created => {
                // unit
                let mut s = serializer.serialize_struct("ListPaperDocsSortBy", 1)?;
                s.serialize_field(".tag", "created")?;
                s.end()
            }
            ListPaperDocsSortBy::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
        }
    }
}

#[derive(Debug)]
pub enum ListPaperDocsSortOrder {
    /// Sorts the search result in ascending order.
    Ascending,
    /// Sorts the search result in descending order.
    Descending,
    /// Catch-all used for unrecognized values returned from the server. Encountering this value
    /// typically indicates that this SDK version is out of date.
    Other,
}

impl<'de> ::serde::de::Deserialize<'de> for ListPaperDocsSortOrder {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // union deserializer
        use serde::de::{self, MapAccess, Visitor};
        struct EnumVisitor;
        impl<'de> Visitor<'de> for EnumVisitor {
            type Value = ListPaperDocsSortOrder;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a ListPaperDocsSortOrder structure")
            }
            fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
                let tag: &str = match map.next_key()? {
                    Some(".tag") => map.next_value()?,
                    _ => return Err(de::Error::missing_field(".tag"))
                };
                match tag {
                    "ascending" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(ListPaperDocsSortOrder::Ascending)
                    }
                    "descending" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(ListPaperDocsSortOrder::Descending)
                    }
                    _ => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(ListPaperDocsSortOrder::Other)
                    }
                }
            }
        }
        const VARIANTS: &[&str] = &["ascending",
                                    "descending",
                                    "other"];
        deserializer.deserialize_struct("ListPaperDocsSortOrder", VARIANTS, EnumVisitor)
    }
}

impl ::serde::ser::Serialize for ListPaperDocsSortOrder {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // union serializer
        use serde::ser::SerializeStruct;
        match *self {
            ListPaperDocsSortOrder::Ascending => {
                // unit
                let mut s = serializer.serialize_struct("ListPaperDocsSortOrder", 1)?;
                s.serialize_field(".tag", "ascending")?;
                s.end()
            }
            ListPaperDocsSortOrder::Descending => {
                // unit
                let mut s = serializer.serialize_struct("ListPaperDocsSortOrder", 1)?;
                s.serialize_field(".tag", "descending")?;
                s.end()
            }
            ListPaperDocsSortOrder::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
        }
    }
}

#[derive(Debug)]
pub enum ListUsersCursorError {
    /// Your account does not have permissions to perform this action. This may be due to it only
    /// having access to Paper as files in the Dropbox filesystem. For more information, refer to
    /// the [Paper Migration
    /// Guide](https://www.dropbox.com/lp/developers/reference/paper-migration-guide).
    InsufficientPermissions,
    /// The required doc was not found.
    DocNotFound,
    CursorError(PaperApiCursorError),
    /// Catch-all used for unrecognized values returned from the server. Encountering this value
    /// typically indicates that this SDK version is out of date.
    Other,
}

impl<'de> ::serde::de::Deserialize<'de> for ListUsersCursorError {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // union deserializer
        use serde::de::{self, MapAccess, Visitor};
        struct EnumVisitor;
        impl<'de> Visitor<'de> for EnumVisitor {
            type Value = ListUsersCursorError;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a ListUsersCursorError structure")
            }
            fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
                let tag: &str = match map.next_key()? {
                    Some(".tag") => map.next_value()?,
                    _ => return Err(de::Error::missing_field(".tag"))
                };
                match tag {
                    "insufficient_permissions" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(ListUsersCursorError::InsufficientPermissions)
                    }
                    "doc_not_found" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(ListUsersCursorError::DocNotFound)
                    }
                    "cursor_error" => {
                        match map.next_key()? {
                            Some("cursor_error") => Ok(ListUsersCursorError::CursorError(map.next_value()?)),
                            None => Err(de::Error::missing_field("cursor_error")),
                            _ => Err(de::Error::unknown_field(tag, VARIANTS))
                        }
                    }
                    _ => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(ListUsersCursorError::Other)
                    }
                }
            }
        }
        const VARIANTS: &[&str] = &["insufficient_permissions",
                                    "other",
                                    "doc_not_found",
                                    "cursor_error"];
        deserializer.deserialize_struct("ListUsersCursorError", VARIANTS, EnumVisitor)
    }
}

impl ::serde::ser::Serialize for ListUsersCursorError {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // union serializer
        use serde::ser::SerializeStruct;
        match *self {
            ListUsersCursorError::InsufficientPermissions => {
                // unit
                let mut s = serializer.serialize_struct("ListUsersCursorError", 1)?;
                s.serialize_field(".tag", "insufficient_permissions")?;
                s.end()
            }
            ListUsersCursorError::DocNotFound => {
                // unit
                let mut s = serializer.serialize_struct("ListUsersCursorError", 1)?;
                s.serialize_field(".tag", "doc_not_found")?;
                s.end()
            }
            ListUsersCursorError::CursorError(ref x) => {
                // union or polymporphic struct
                let mut s = serializer.serialize_struct("ListUsersCursorError", 2)?;
                s.serialize_field(".tag", "cursor_error")?;
                s.serialize_field("cursor_error", x)?;
                s.end()
            }
            ListUsersCursorError::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
        }
    }
}

impl ::std::error::Error for ListUsersCursorError {
    fn description(&self) -> &str {
        "ListUsersCursorError"
    }
}

impl ::std::fmt::Display for ListUsersCursorError {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        write!(f, "{:?}", *self)
    }
}

#[derive(Debug)]
pub struct ListUsersOnFolderArgs {
    /// The Paper doc ID.
    pub doc_id: PaperDocId,
    /// Size limit per batch. The maximum number of users that can be retrieved per batch is 1000.
    /// Higher value results in invalid arguments error.
    pub limit: i32,
}

impl ListUsersOnFolderArgs {
    pub fn new(doc_id: PaperDocId) -> Self {
        ListUsersOnFolderArgs {
            doc_id,
            limit: 1000,
        }
    }

    pub fn with_limit(mut self, value: i32) -> Self {
        self.limit = value;
        self
    }

}

const LIST_USERS_ON_FOLDER_ARGS_FIELDS: &[&str] = &["doc_id",
                                                    "limit"];
impl ListUsersOnFolderArgs {
    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
        map: V,
    ) -> Result<ListUsersOnFolderArgs, V::Error> {
        Self::internal_deserialize_opt(map, false).map(Option::unwrap)
    }

    pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
        mut map: V,
        optional: bool,
    ) -> Result<Option<ListUsersOnFolderArgs>, V::Error> {
        let mut field_doc_id = None;
        let mut field_limit = None;
        let mut nothing = true;
        while let Some(key) = map.next_key::<&str>()? {
            nothing = false;
            match key {
                "doc_id" => {
                    if field_doc_id.is_some() {
                        return Err(::serde::de::Error::duplicate_field("doc_id"));
                    }
                    field_doc_id = Some(map.next_value()?);
                }
                "limit" => {
                    if field_limit.is_some() {
                        return Err(::serde::de::Error::duplicate_field("limit"));
                    }
                    field_limit = Some(map.next_value()?);
                }
                _ => {
                    // unknown field allowed and ignored
                    map.next_value::<::serde_json::Value>()?;
                }
            }
        }
        if optional && nothing {
            return Ok(None);
        }
        let result = ListUsersOnFolderArgs {
            doc_id: field_doc_id.ok_or_else(|| ::serde::de::Error::missing_field("doc_id"))?,
            limit: field_limit.unwrap_or(1000),
        };
        Ok(Some(result))
    }

    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
        &self,
        s: &mut S::SerializeStruct,
    ) -> Result<(), S::Error> {
        use serde::ser::SerializeStruct;
        s.serialize_field("doc_id", &self.doc_id)?;
        s.serialize_field("limit", &self.limit)
    }
}

impl<'de> ::serde::de::Deserialize<'de> for ListUsersOnFolderArgs {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // struct deserializer
        use serde::de::{MapAccess, Visitor};
        struct StructVisitor;
        impl<'de> Visitor<'de> for StructVisitor {
            type Value = ListUsersOnFolderArgs;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a ListUsersOnFolderArgs struct")
            }
            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
                ListUsersOnFolderArgs::internal_deserialize(map)
            }
        }
        deserializer.deserialize_struct("ListUsersOnFolderArgs", LIST_USERS_ON_FOLDER_ARGS_FIELDS, StructVisitor)
    }
}

impl ::serde::ser::Serialize for ListUsersOnFolderArgs {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // struct serializer
        use serde::ser::SerializeStruct;
        let mut s = serializer.serialize_struct("ListUsersOnFolderArgs", 2)?;
        self.internal_serialize::<S>(&mut s)?;
        s.end()
    }
}

#[derive(Debug)]
pub struct ListUsersOnFolderContinueArgs {
    /// The Paper doc ID.
    pub doc_id: PaperDocId,
    /// The cursor obtained from [`docs_folder_users_list()`](docs_folder_users_list) or
    /// [`docs_folder_users_list_continue()`](docs_folder_users_list_continue). Allows for
    /// pagination.
    pub cursor: String,
}

impl ListUsersOnFolderContinueArgs {
    pub fn new(doc_id: PaperDocId, cursor: String) -> Self {
        ListUsersOnFolderContinueArgs {
            doc_id,
            cursor,
        }
    }

}

const LIST_USERS_ON_FOLDER_CONTINUE_ARGS_FIELDS: &[&str] = &["doc_id",
                                                             "cursor"];
impl ListUsersOnFolderContinueArgs {
    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
        map: V,
    ) -> Result<ListUsersOnFolderContinueArgs, V::Error> {
        Self::internal_deserialize_opt(map, false).map(Option::unwrap)
    }

    pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
        mut map: V,
        optional: bool,
    ) -> Result<Option<ListUsersOnFolderContinueArgs>, V::Error> {
        let mut field_doc_id = None;
        let mut field_cursor = None;
        let mut nothing = true;
        while let Some(key) = map.next_key::<&str>()? {
            nothing = false;
            match key {
                "doc_id" => {
                    if field_doc_id.is_some() {
                        return Err(::serde::de::Error::duplicate_field("doc_id"));
                    }
                    field_doc_id = Some(map.next_value()?);
                }
                "cursor" => {
                    if field_cursor.is_some() {
                        return Err(::serde::de::Error::duplicate_field("cursor"));
                    }
                    field_cursor = Some(map.next_value()?);
                }
                _ => {
                    // unknown field allowed and ignored
                    map.next_value::<::serde_json::Value>()?;
                }
            }
        }
        if optional && nothing {
            return Ok(None);
        }
        let result = ListUsersOnFolderContinueArgs {
            doc_id: field_doc_id.ok_or_else(|| ::serde::de::Error::missing_field("doc_id"))?,
            cursor: field_cursor.ok_or_else(|| ::serde::de::Error::missing_field("cursor"))?,
        };
        Ok(Some(result))
    }

    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
        &self,
        s: &mut S::SerializeStruct,
    ) -> Result<(), S::Error> {
        use serde::ser::SerializeStruct;
        s.serialize_field("doc_id", &self.doc_id)?;
        s.serialize_field("cursor", &self.cursor)
    }
}

impl<'de> ::serde::de::Deserialize<'de> for ListUsersOnFolderContinueArgs {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // struct deserializer
        use serde::de::{MapAccess, Visitor};
        struct StructVisitor;
        impl<'de> Visitor<'de> for StructVisitor {
            type Value = ListUsersOnFolderContinueArgs;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a ListUsersOnFolderContinueArgs struct")
            }
            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
                ListUsersOnFolderContinueArgs::internal_deserialize(map)
            }
        }
        deserializer.deserialize_struct("ListUsersOnFolderContinueArgs", LIST_USERS_ON_FOLDER_CONTINUE_ARGS_FIELDS, StructVisitor)
    }
}

impl ::serde::ser::Serialize for ListUsersOnFolderContinueArgs {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // struct serializer
        use serde::ser::SerializeStruct;
        let mut s = serializer.serialize_struct("ListUsersOnFolderContinueArgs", 2)?;
        self.internal_serialize::<S>(&mut s)?;
        s.end()
    }
}

#[derive(Debug)]
pub struct ListUsersOnFolderResponse {
    /// List of email addresses that are invited on the Paper folder.
    pub invitees: Vec<super::sharing::InviteeInfo>,
    /// List of users that are invited on the Paper folder.
    pub users: Vec<super::sharing::UserInfo>,
    /// Pass the cursor into [`docs_folder_users_list_continue()`](docs_folder_users_list_continue)
    /// to paginate through all users. The cursor preserves all properties as specified in the
    /// original call to [`docs_folder_users_list()`](docs_folder_users_list).
    pub cursor: Cursor,
    /// Will be set to True if a subsequent call with the provided cursor to
    /// [`docs_folder_users_list_continue()`](docs_folder_users_list_continue) returns immediately
    /// with some results. If set to False please allow some delay before making another call to
    /// [`docs_folder_users_list_continue()`](docs_folder_users_list_continue).
    pub has_more: bool,
}

impl ListUsersOnFolderResponse {
    pub fn new(
        invitees: Vec<super::sharing::InviteeInfo>,
        users: Vec<super::sharing::UserInfo>,
        cursor: Cursor,
        has_more: bool,
    ) -> Self {
        ListUsersOnFolderResponse {
            invitees,
            users,
            cursor,
            has_more,
        }
    }

}

const LIST_USERS_ON_FOLDER_RESPONSE_FIELDS: &[&str] = &["invitees",
                                                        "users",
                                                        "cursor",
                                                        "has_more"];
impl ListUsersOnFolderResponse {
    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
        map: V,
    ) -> Result<ListUsersOnFolderResponse, V::Error> {
        Self::internal_deserialize_opt(map, false).map(Option::unwrap)
    }

    pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
        mut map: V,
        optional: bool,
    ) -> Result<Option<ListUsersOnFolderResponse>, V::Error> {
        let mut field_invitees = None;
        let mut field_users = None;
        let mut field_cursor = None;
        let mut field_has_more = None;
        let mut nothing = true;
        while let Some(key) = map.next_key::<&str>()? {
            nothing = false;
            match key {
                "invitees" => {
                    if field_invitees.is_some() {
                        return Err(::serde::de::Error::duplicate_field("invitees"));
                    }
                    field_invitees = Some(map.next_value()?);
                }
                "users" => {
                    if field_users.is_some() {
                        return Err(::serde::de::Error::duplicate_field("users"));
                    }
                    field_users = Some(map.next_value()?);
                }
                "cursor" => {
                    if field_cursor.is_some() {
                        return Err(::serde::de::Error::duplicate_field("cursor"));
                    }
                    field_cursor = Some(map.next_value()?);
                }
                "has_more" => {
                    if field_has_more.is_some() {
                        return Err(::serde::de::Error::duplicate_field("has_more"));
                    }
                    field_has_more = Some(map.next_value()?);
                }
                _ => {
                    // unknown field allowed and ignored
                    map.next_value::<::serde_json::Value>()?;
                }
            }
        }
        if optional && nothing {
            return Ok(None);
        }
        let result = ListUsersOnFolderResponse {
            invitees: field_invitees.ok_or_else(|| ::serde::de::Error::missing_field("invitees"))?,
            users: field_users.ok_or_else(|| ::serde::de::Error::missing_field("users"))?,
            cursor: field_cursor.ok_or_else(|| ::serde::de::Error::missing_field("cursor"))?,
            has_more: field_has_more.ok_or_else(|| ::serde::de::Error::missing_field("has_more"))?,
        };
        Ok(Some(result))
    }

    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
        &self,
        s: &mut S::SerializeStruct,
    ) -> Result<(), S::Error> {
        use serde::ser::SerializeStruct;
        s.serialize_field("invitees", &self.invitees)?;
        s.serialize_field("users", &self.users)?;
        s.serialize_field("cursor", &self.cursor)?;
        s.serialize_field("has_more", &self.has_more)
    }
}

impl<'de> ::serde::de::Deserialize<'de> for ListUsersOnFolderResponse {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // struct deserializer
        use serde::de::{MapAccess, Visitor};
        struct StructVisitor;
        impl<'de> Visitor<'de> for StructVisitor {
            type Value = ListUsersOnFolderResponse;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a ListUsersOnFolderResponse struct")
            }
            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
                ListUsersOnFolderResponse::internal_deserialize(map)
            }
        }
        deserializer.deserialize_struct("ListUsersOnFolderResponse", LIST_USERS_ON_FOLDER_RESPONSE_FIELDS, StructVisitor)
    }
}

impl ::serde::ser::Serialize for ListUsersOnFolderResponse {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // struct serializer
        use serde::ser::SerializeStruct;
        let mut s = serializer.serialize_struct("ListUsersOnFolderResponse", 4)?;
        self.internal_serialize::<S>(&mut s)?;
        s.end()
    }
}

#[derive(Debug)]
pub struct ListUsersOnPaperDocArgs {
    /// The Paper doc ID.
    pub doc_id: PaperDocId,
    /// Size limit per batch. The maximum number of users that can be retrieved per batch is 1000.
    /// Higher value results in invalid arguments error.
    pub limit: i32,
    /// Specify this attribute if you want to obtain users that have already accessed the Paper doc.
    pub filter_by: UserOnPaperDocFilter,
}

impl ListUsersOnPaperDocArgs {
    pub fn new(doc_id: PaperDocId) -> Self {
        ListUsersOnPaperDocArgs {
            doc_id,
            limit: 1000,
            filter_by: UserOnPaperDocFilter::Shared,
        }
    }

    pub fn with_limit(mut self, value: i32) -> Self {
        self.limit = value;
        self
    }

    pub fn with_filter_by(mut self, value: UserOnPaperDocFilter) -> Self {
        self.filter_by = value;
        self
    }

}

const LIST_USERS_ON_PAPER_DOC_ARGS_FIELDS: &[&str] = &["doc_id",
                                                       "limit",
                                                       "filter_by"];
impl ListUsersOnPaperDocArgs {
    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
        map: V,
    ) -> Result<ListUsersOnPaperDocArgs, V::Error> {
        Self::internal_deserialize_opt(map, false).map(Option::unwrap)
    }

    pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
        mut map: V,
        optional: bool,
    ) -> Result<Option<ListUsersOnPaperDocArgs>, V::Error> {
        let mut field_doc_id = None;
        let mut field_limit = None;
        let mut field_filter_by = None;
        let mut nothing = true;
        while let Some(key) = map.next_key::<&str>()? {
            nothing = false;
            match key {
                "doc_id" => {
                    if field_doc_id.is_some() {
                        return Err(::serde::de::Error::duplicate_field("doc_id"));
                    }
                    field_doc_id = Some(map.next_value()?);
                }
                "limit" => {
                    if field_limit.is_some() {
                        return Err(::serde::de::Error::duplicate_field("limit"));
                    }
                    field_limit = Some(map.next_value()?);
                }
                "filter_by" => {
                    if field_filter_by.is_some() {
                        return Err(::serde::de::Error::duplicate_field("filter_by"));
                    }
                    field_filter_by = Some(map.next_value()?);
                }
                _ => {
                    // unknown field allowed and ignored
                    map.next_value::<::serde_json::Value>()?;
                }
            }
        }
        if optional && nothing {
            return Ok(None);
        }
        let result = ListUsersOnPaperDocArgs {
            doc_id: field_doc_id.ok_or_else(|| ::serde::de::Error::missing_field("doc_id"))?,
            limit: field_limit.unwrap_or(1000),
            filter_by: field_filter_by.unwrap_or(UserOnPaperDocFilter::Shared),
        };
        Ok(Some(result))
    }

    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
        &self,
        s: &mut S::SerializeStruct,
    ) -> Result<(), S::Error> {
        use serde::ser::SerializeStruct;
        s.serialize_field("doc_id", &self.doc_id)?;
        s.serialize_field("limit", &self.limit)?;
        s.serialize_field("filter_by", &self.filter_by)
    }
}

impl<'de> ::serde::de::Deserialize<'de> for ListUsersOnPaperDocArgs {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // struct deserializer
        use serde::de::{MapAccess, Visitor};
        struct StructVisitor;
        impl<'de> Visitor<'de> for StructVisitor {
            type Value = ListUsersOnPaperDocArgs;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a ListUsersOnPaperDocArgs struct")
            }
            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
                ListUsersOnPaperDocArgs::internal_deserialize(map)
            }
        }
        deserializer.deserialize_struct("ListUsersOnPaperDocArgs", LIST_USERS_ON_PAPER_DOC_ARGS_FIELDS, StructVisitor)
    }
}

impl ::serde::ser::Serialize for ListUsersOnPaperDocArgs {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // struct serializer
        use serde::ser::SerializeStruct;
        let mut s = serializer.serialize_struct("ListUsersOnPaperDocArgs", 3)?;
        self.internal_serialize::<S>(&mut s)?;
        s.end()
    }
}

#[derive(Debug)]
pub struct ListUsersOnPaperDocContinueArgs {
    /// The Paper doc ID.
    pub doc_id: PaperDocId,
    /// The cursor obtained from [`docs_users_list()`](docs_users_list) or
    /// [`docs_users_list_continue()`](docs_users_list_continue). Allows for pagination.
    pub cursor: String,
}

impl ListUsersOnPaperDocContinueArgs {
    pub fn new(doc_id: PaperDocId, cursor: String) -> Self {
        ListUsersOnPaperDocContinueArgs {
            doc_id,
            cursor,
        }
    }

}

const LIST_USERS_ON_PAPER_DOC_CONTINUE_ARGS_FIELDS: &[&str] = &["doc_id",
                                                                "cursor"];
impl ListUsersOnPaperDocContinueArgs {
    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
        map: V,
    ) -> Result<ListUsersOnPaperDocContinueArgs, V::Error> {
        Self::internal_deserialize_opt(map, false).map(Option::unwrap)
    }

    pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
        mut map: V,
        optional: bool,
    ) -> Result<Option<ListUsersOnPaperDocContinueArgs>, V::Error> {
        let mut field_doc_id = None;
        let mut field_cursor = None;
        let mut nothing = true;
        while let Some(key) = map.next_key::<&str>()? {
            nothing = false;
            match key {
                "doc_id" => {
                    if field_doc_id.is_some() {
                        return Err(::serde::de::Error::duplicate_field("doc_id"));
                    }
                    field_doc_id = Some(map.next_value()?);
                }
                "cursor" => {
                    if field_cursor.is_some() {
                        return Err(::serde::de::Error::duplicate_field("cursor"));
                    }
                    field_cursor = Some(map.next_value()?);
                }
                _ => {
                    // unknown field allowed and ignored
                    map.next_value::<::serde_json::Value>()?;
                }
            }
        }
        if optional && nothing {
            return Ok(None);
        }
        let result = ListUsersOnPaperDocContinueArgs {
            doc_id: field_doc_id.ok_or_else(|| ::serde::de::Error::missing_field("doc_id"))?,
            cursor: field_cursor.ok_or_else(|| ::serde::de::Error::missing_field("cursor"))?,
        };
        Ok(Some(result))
    }

    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
        &self,
        s: &mut S::SerializeStruct,
    ) -> Result<(), S::Error> {
        use serde::ser::SerializeStruct;
        s.serialize_field("doc_id", &self.doc_id)?;
        s.serialize_field("cursor", &self.cursor)
    }
}

impl<'de> ::serde::de::Deserialize<'de> for ListUsersOnPaperDocContinueArgs {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // struct deserializer
        use serde::de::{MapAccess, Visitor};
        struct StructVisitor;
        impl<'de> Visitor<'de> for StructVisitor {
            type Value = ListUsersOnPaperDocContinueArgs;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a ListUsersOnPaperDocContinueArgs struct")
            }
            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
                ListUsersOnPaperDocContinueArgs::internal_deserialize(map)
            }
        }
        deserializer.deserialize_struct("ListUsersOnPaperDocContinueArgs", LIST_USERS_ON_PAPER_DOC_CONTINUE_ARGS_FIELDS, StructVisitor)
    }
}

impl ::serde::ser::Serialize for ListUsersOnPaperDocContinueArgs {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // struct serializer
        use serde::ser::SerializeStruct;
        let mut s = serializer.serialize_struct("ListUsersOnPaperDocContinueArgs", 2)?;
        self.internal_serialize::<S>(&mut s)?;
        s.end()
    }
}

#[derive(Debug)]
pub struct ListUsersOnPaperDocResponse {
    /// List of email addresses with their respective permission levels that are invited on the
    /// Paper doc.
    pub invitees: Vec<InviteeInfoWithPermissionLevel>,
    /// List of users with their respective permission levels that are invited on the Paper folder.
    pub users: Vec<UserInfoWithPermissionLevel>,
    /// The Paper doc owner. This field is populated on every single response.
    pub doc_owner: super::sharing::UserInfo,
    /// Pass the cursor into [`docs_users_list_continue()`](docs_users_list_continue) to paginate
    /// through all users. The cursor preserves all properties as specified in the original call to
    /// [`docs_users_list()`](docs_users_list).
    pub cursor: Cursor,
    /// Will be set to True if a subsequent call with the provided cursor to
    /// [`docs_users_list_continue()`](docs_users_list_continue) returns immediately with some
    /// results. If set to False please allow some delay before making another call to
    /// [`docs_users_list_continue()`](docs_users_list_continue).
    pub has_more: bool,
}

impl ListUsersOnPaperDocResponse {
    pub fn new(
        invitees: Vec<InviteeInfoWithPermissionLevel>,
        users: Vec<UserInfoWithPermissionLevel>,
        doc_owner: super::sharing::UserInfo,
        cursor: Cursor,
        has_more: bool,
    ) -> Self {
        ListUsersOnPaperDocResponse {
            invitees,
            users,
            doc_owner,
            cursor,
            has_more,
        }
    }

}

const LIST_USERS_ON_PAPER_DOC_RESPONSE_FIELDS: &[&str] = &["invitees",
                                                           "users",
                                                           "doc_owner",
                                                           "cursor",
                                                           "has_more"];
impl ListUsersOnPaperDocResponse {
    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
        map: V,
    ) -> Result<ListUsersOnPaperDocResponse, V::Error> {
        Self::internal_deserialize_opt(map, false).map(Option::unwrap)
    }

    pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
        mut map: V,
        optional: bool,
    ) -> Result<Option<ListUsersOnPaperDocResponse>, V::Error> {
        let mut field_invitees = None;
        let mut field_users = None;
        let mut field_doc_owner = None;
        let mut field_cursor = None;
        let mut field_has_more = None;
        let mut nothing = true;
        while let Some(key) = map.next_key::<&str>()? {
            nothing = false;
            match key {
                "invitees" => {
                    if field_invitees.is_some() {
                        return Err(::serde::de::Error::duplicate_field("invitees"));
                    }
                    field_invitees = Some(map.next_value()?);
                }
                "users" => {
                    if field_users.is_some() {
                        return Err(::serde::de::Error::duplicate_field("users"));
                    }
                    field_users = Some(map.next_value()?);
                }
                "doc_owner" => {
                    if field_doc_owner.is_some() {
                        return Err(::serde::de::Error::duplicate_field("doc_owner"));
                    }
                    field_doc_owner = Some(map.next_value()?);
                }
                "cursor" => {
                    if field_cursor.is_some() {
                        return Err(::serde::de::Error::duplicate_field("cursor"));
                    }
                    field_cursor = Some(map.next_value()?);
                }
                "has_more" => {
                    if field_has_more.is_some() {
                        return Err(::serde::de::Error::duplicate_field("has_more"));
                    }
                    field_has_more = Some(map.next_value()?);
                }
                _ => {
                    // unknown field allowed and ignored
                    map.next_value::<::serde_json::Value>()?;
                }
            }
        }
        if optional && nothing {
            return Ok(None);
        }
        let result = ListUsersOnPaperDocResponse {
            invitees: field_invitees.ok_or_else(|| ::serde::de::Error::missing_field("invitees"))?,
            users: field_users.ok_or_else(|| ::serde::de::Error::missing_field("users"))?,
            doc_owner: field_doc_owner.ok_or_else(|| ::serde::de::Error::missing_field("doc_owner"))?,
            cursor: field_cursor.ok_or_else(|| ::serde::de::Error::missing_field("cursor"))?,
            has_more: field_has_more.ok_or_else(|| ::serde::de::Error::missing_field("has_more"))?,
        };
        Ok(Some(result))
    }

    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
        &self,
        s: &mut S::SerializeStruct,
    ) -> Result<(), S::Error> {
        use serde::ser::SerializeStruct;
        s.serialize_field("invitees", &self.invitees)?;
        s.serialize_field("users", &self.users)?;
        s.serialize_field("doc_owner", &self.doc_owner)?;
        s.serialize_field("cursor", &self.cursor)?;
        s.serialize_field("has_more", &self.has_more)
    }
}

impl<'de> ::serde::de::Deserialize<'de> for ListUsersOnPaperDocResponse {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // struct deserializer
        use serde::de::{MapAccess, Visitor};
        struct StructVisitor;
        impl<'de> Visitor<'de> for StructVisitor {
            type Value = ListUsersOnPaperDocResponse;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a ListUsersOnPaperDocResponse struct")
            }
            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
                ListUsersOnPaperDocResponse::internal_deserialize(map)
            }
        }
        deserializer.deserialize_struct("ListUsersOnPaperDocResponse", LIST_USERS_ON_PAPER_DOC_RESPONSE_FIELDS, StructVisitor)
    }
}

impl ::serde::ser::Serialize for ListUsersOnPaperDocResponse {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // struct serializer
        use serde::ser::SerializeStruct;
        let mut s = serializer.serialize_struct("ListUsersOnPaperDocResponse", 5)?;
        self.internal_serialize::<S>(&mut s)?;
        s.end()
    }
}

#[derive(Debug)]
pub enum PaperApiBaseError {
    /// Your account does not have permissions to perform this action. This may be due to it only
    /// having access to Paper as files in the Dropbox filesystem. For more information, refer to
    /// the [Paper Migration
    /// Guide](https://www.dropbox.com/lp/developers/reference/paper-migration-guide).
    InsufficientPermissions,
    /// Catch-all used for unrecognized values returned from the server. Encountering this value
    /// typically indicates that this SDK version is out of date.
    Other,
}

impl<'de> ::serde::de::Deserialize<'de> for PaperApiBaseError {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // union deserializer
        use serde::de::{self, MapAccess, Visitor};
        struct EnumVisitor;
        impl<'de> Visitor<'de> for EnumVisitor {
            type Value = PaperApiBaseError;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a PaperApiBaseError structure")
            }
            fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
                let tag: &str = match map.next_key()? {
                    Some(".tag") => map.next_value()?,
                    _ => return Err(de::Error::missing_field(".tag"))
                };
                match tag {
                    "insufficient_permissions" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(PaperApiBaseError::InsufficientPermissions)
                    }
                    _ => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(PaperApiBaseError::Other)
                    }
                }
            }
        }
        const VARIANTS: &[&str] = &["insufficient_permissions",
                                    "other"];
        deserializer.deserialize_struct("PaperApiBaseError", VARIANTS, EnumVisitor)
    }
}

impl ::serde::ser::Serialize for PaperApiBaseError {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // union serializer
        use serde::ser::SerializeStruct;
        match *self {
            PaperApiBaseError::InsufficientPermissions => {
                // unit
                let mut s = serializer.serialize_struct("PaperApiBaseError", 1)?;
                s.serialize_field(".tag", "insufficient_permissions")?;
                s.end()
            }
            PaperApiBaseError::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
        }
    }
}

impl ::std::error::Error for PaperApiBaseError {
    fn description(&self) -> &str {
        "PaperApiBaseError"
    }
}

impl ::std::fmt::Display for PaperApiBaseError {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        write!(f, "{:?}", *self)
    }
}

#[derive(Debug)]
pub enum PaperApiCursorError {
    /// The provided cursor is expired.
    ExpiredCursor,
    /// The provided cursor is invalid.
    InvalidCursor,
    /// The provided cursor contains invalid user.
    WrongUserInCursor,
    /// Indicates that the cursor has been invalidated. Call the corresponding non-continue endpoint
    /// to obtain a new cursor.
    Reset,
    /// Catch-all used for unrecognized values returned from the server. Encountering this value
    /// typically indicates that this SDK version is out of date.
    Other,
}

impl<'de> ::serde::de::Deserialize<'de> for PaperApiCursorError {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // union deserializer
        use serde::de::{self, MapAccess, Visitor};
        struct EnumVisitor;
        impl<'de> Visitor<'de> for EnumVisitor {
            type Value = PaperApiCursorError;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a PaperApiCursorError structure")
            }
            fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
                let tag: &str = match map.next_key()? {
                    Some(".tag") => map.next_value()?,
                    _ => return Err(de::Error::missing_field(".tag"))
                };
                match tag {
                    "expired_cursor" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(PaperApiCursorError::ExpiredCursor)
                    }
                    "invalid_cursor" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(PaperApiCursorError::InvalidCursor)
                    }
                    "wrong_user_in_cursor" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(PaperApiCursorError::WrongUserInCursor)
                    }
                    "reset" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(PaperApiCursorError::Reset)
                    }
                    _ => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(PaperApiCursorError::Other)
                    }
                }
            }
        }
        const VARIANTS: &[&str] = &["expired_cursor",
                                    "invalid_cursor",
                                    "wrong_user_in_cursor",
                                    "reset",
                                    "other"];
        deserializer.deserialize_struct("PaperApiCursorError", VARIANTS, EnumVisitor)
    }
}

impl ::serde::ser::Serialize for PaperApiCursorError {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // union serializer
        use serde::ser::SerializeStruct;
        match *self {
            PaperApiCursorError::ExpiredCursor => {
                // unit
                let mut s = serializer.serialize_struct("PaperApiCursorError", 1)?;
                s.serialize_field(".tag", "expired_cursor")?;
                s.end()
            }
            PaperApiCursorError::InvalidCursor => {
                // unit
                let mut s = serializer.serialize_struct("PaperApiCursorError", 1)?;
                s.serialize_field(".tag", "invalid_cursor")?;
                s.end()
            }
            PaperApiCursorError::WrongUserInCursor => {
                // unit
                let mut s = serializer.serialize_struct("PaperApiCursorError", 1)?;
                s.serialize_field(".tag", "wrong_user_in_cursor")?;
                s.end()
            }
            PaperApiCursorError::Reset => {
                // unit
                let mut s = serializer.serialize_struct("PaperApiCursorError", 1)?;
                s.serialize_field(".tag", "reset")?;
                s.end()
            }
            PaperApiCursorError::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
        }
    }
}

impl ::std::error::Error for PaperApiCursorError {
    fn description(&self) -> &str {
        "PaperApiCursorError"
    }
}

impl ::std::fmt::Display for PaperApiCursorError {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        write!(f, "{:?}", *self)
    }
}

#[derive(Debug)]
pub struct PaperDocCreateArgs {
    /// The format of provided data.
    pub import_format: ImportFormat,
    /// The Paper folder ID where the Paper document should be created. The API user has to have
    /// write access to this folder or error is thrown.
    pub parent_folder_id: Option<String>,
}

impl PaperDocCreateArgs {
    pub fn new(import_format: ImportFormat) -> Self {
        PaperDocCreateArgs {
            import_format,
            parent_folder_id: None,
        }
    }

    pub fn with_parent_folder_id(mut self, value: Option<String>) -> Self {
        self.parent_folder_id = value;
        self
    }

}

const PAPER_DOC_CREATE_ARGS_FIELDS: &[&str] = &["import_format",
                                                "parent_folder_id"];
impl PaperDocCreateArgs {
    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
        map: V,
    ) -> Result<PaperDocCreateArgs, V::Error> {
        Self::internal_deserialize_opt(map, false).map(Option::unwrap)
    }

    pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
        mut map: V,
        optional: bool,
    ) -> Result<Option<PaperDocCreateArgs>, V::Error> {
        let mut field_import_format = None;
        let mut field_parent_folder_id = None;
        let mut nothing = true;
        while let Some(key) = map.next_key::<&str>()? {
            nothing = false;
            match key {
                "import_format" => {
                    if field_import_format.is_some() {
                        return Err(::serde::de::Error::duplicate_field("import_format"));
                    }
                    field_import_format = Some(map.next_value()?);
                }
                "parent_folder_id" => {
                    if field_parent_folder_id.is_some() {
                        return Err(::serde::de::Error::duplicate_field("parent_folder_id"));
                    }
                    field_parent_folder_id = Some(map.next_value()?);
                }
                _ => {
                    // unknown field allowed and ignored
                    map.next_value::<::serde_json::Value>()?;
                }
            }
        }
        if optional && nothing {
            return Ok(None);
        }
        let result = PaperDocCreateArgs {
            import_format: field_import_format.ok_or_else(|| ::serde::de::Error::missing_field("import_format"))?,
            parent_folder_id: field_parent_folder_id,
        };
        Ok(Some(result))
    }

    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
        &self,
        s: &mut S::SerializeStruct,
    ) -> Result<(), S::Error> {
        use serde::ser::SerializeStruct;
        s.serialize_field("import_format", &self.import_format)?;
        s.serialize_field("parent_folder_id", &self.parent_folder_id)
    }
}

impl<'de> ::serde::de::Deserialize<'de> for PaperDocCreateArgs {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // struct deserializer
        use serde::de::{MapAccess, Visitor};
        struct StructVisitor;
        impl<'de> Visitor<'de> for StructVisitor {
            type Value = PaperDocCreateArgs;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a PaperDocCreateArgs struct")
            }
            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
                PaperDocCreateArgs::internal_deserialize(map)
            }
        }
        deserializer.deserialize_struct("PaperDocCreateArgs", PAPER_DOC_CREATE_ARGS_FIELDS, StructVisitor)
    }
}

impl ::serde::ser::Serialize for PaperDocCreateArgs {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // struct serializer
        use serde::ser::SerializeStruct;
        let mut s = serializer.serialize_struct("PaperDocCreateArgs", 2)?;
        self.internal_serialize::<S>(&mut s)?;
        s.end()
    }
}

#[derive(Debug)]
pub enum PaperDocCreateError {
    /// Your account does not have permissions to perform this action. This may be due to it only
    /// having access to Paper as files in the Dropbox filesystem. For more information, refer to
    /// the [Paper Migration
    /// Guide](https://www.dropbox.com/lp/developers/reference/paper-migration-guide).
    InsufficientPermissions,
    /// The provided content was malformed and cannot be imported to Paper.
    ContentMalformed,
    /// The specified Paper folder is cannot be found.
    FolderNotFound,
    /// The newly created Paper doc would be too large. Please split the content into multiple docs.
    DocLengthExceeded,
    /// The imported document contains an image that is too large. The current limit is 1MB. This
    /// only applies to HTML with data URI.
    ImageSizeExceeded,
    /// Catch-all used for unrecognized values returned from the server. Encountering this value
    /// typically indicates that this SDK version is out of date.
    Other,
}

impl<'de> ::serde::de::Deserialize<'de> for PaperDocCreateError {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // union deserializer
        use serde::de::{self, MapAccess, Visitor};
        struct EnumVisitor;
        impl<'de> Visitor<'de> for EnumVisitor {
            type Value = PaperDocCreateError;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a PaperDocCreateError structure")
            }
            fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
                let tag: &str = match map.next_key()? {
                    Some(".tag") => map.next_value()?,
                    _ => return Err(de::Error::missing_field(".tag"))
                };
                match tag {
                    "insufficient_permissions" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(PaperDocCreateError::InsufficientPermissions)
                    }
                    "content_malformed" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(PaperDocCreateError::ContentMalformed)
                    }
                    "folder_not_found" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(PaperDocCreateError::FolderNotFound)
                    }
                    "doc_length_exceeded" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(PaperDocCreateError::DocLengthExceeded)
                    }
                    "image_size_exceeded" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(PaperDocCreateError::ImageSizeExceeded)
                    }
                    _ => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(PaperDocCreateError::Other)
                    }
                }
            }
        }
        const VARIANTS: &[&str] = &["insufficient_permissions",
                                    "other",
                                    "content_malformed",
                                    "folder_not_found",
                                    "doc_length_exceeded",
                                    "image_size_exceeded"];
        deserializer.deserialize_struct("PaperDocCreateError", VARIANTS, EnumVisitor)
    }
}

impl ::serde::ser::Serialize for PaperDocCreateError {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // union serializer
        use serde::ser::SerializeStruct;
        match *self {
            PaperDocCreateError::InsufficientPermissions => {
                // unit
                let mut s = serializer.serialize_struct("PaperDocCreateError", 1)?;
                s.serialize_field(".tag", "insufficient_permissions")?;
                s.end()
            }
            PaperDocCreateError::ContentMalformed => {
                // unit
                let mut s = serializer.serialize_struct("PaperDocCreateError", 1)?;
                s.serialize_field(".tag", "content_malformed")?;
                s.end()
            }
            PaperDocCreateError::FolderNotFound => {
                // unit
                let mut s = serializer.serialize_struct("PaperDocCreateError", 1)?;
                s.serialize_field(".tag", "folder_not_found")?;
                s.end()
            }
            PaperDocCreateError::DocLengthExceeded => {
                // unit
                let mut s = serializer.serialize_struct("PaperDocCreateError", 1)?;
                s.serialize_field(".tag", "doc_length_exceeded")?;
                s.end()
            }
            PaperDocCreateError::ImageSizeExceeded => {
                // unit
                let mut s = serializer.serialize_struct("PaperDocCreateError", 1)?;
                s.serialize_field(".tag", "image_size_exceeded")?;
                s.end()
            }
            PaperDocCreateError::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
        }
    }
}

impl ::std::error::Error for PaperDocCreateError {
    fn description(&self) -> &str {
        "PaperDocCreateError"
    }
}

impl ::std::fmt::Display for PaperDocCreateError {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        write!(f, "{:?}", *self)
    }
}

#[derive(Debug)]
pub struct PaperDocCreateUpdateResult {
    /// Doc ID of the newly created doc.
    pub doc_id: String,
    /// The Paper doc revision. Simply an ever increasing number.
    pub revision: i64,
    /// The Paper doc title.
    pub title: String,
}

impl PaperDocCreateUpdateResult {
    pub fn new(doc_id: String, revision: i64, title: String) -> Self {
        PaperDocCreateUpdateResult {
            doc_id,
            revision,
            title,
        }
    }

}

const PAPER_DOC_CREATE_UPDATE_RESULT_FIELDS: &[&str] = &["doc_id",
                                                         "revision",
                                                         "title"];
impl PaperDocCreateUpdateResult {
    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
        map: V,
    ) -> Result<PaperDocCreateUpdateResult, V::Error> {
        Self::internal_deserialize_opt(map, false).map(Option::unwrap)
    }

    pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
        mut map: V,
        optional: bool,
    ) -> Result<Option<PaperDocCreateUpdateResult>, V::Error> {
        let mut field_doc_id = None;
        let mut field_revision = None;
        let mut field_title = None;
        let mut nothing = true;
        while let Some(key) = map.next_key::<&str>()? {
            nothing = false;
            match key {
                "doc_id" => {
                    if field_doc_id.is_some() {
                        return Err(::serde::de::Error::duplicate_field("doc_id"));
                    }
                    field_doc_id = Some(map.next_value()?);
                }
                "revision" => {
                    if field_revision.is_some() {
                        return Err(::serde::de::Error::duplicate_field("revision"));
                    }
                    field_revision = Some(map.next_value()?);
                }
                "title" => {
                    if field_title.is_some() {
                        return Err(::serde::de::Error::duplicate_field("title"));
                    }
                    field_title = Some(map.next_value()?);
                }
                _ => {
                    // unknown field allowed and ignored
                    map.next_value::<::serde_json::Value>()?;
                }
            }
        }
        if optional && nothing {
            return Ok(None);
        }
        let result = PaperDocCreateUpdateResult {
            doc_id: field_doc_id.ok_or_else(|| ::serde::de::Error::missing_field("doc_id"))?,
            revision: field_revision.ok_or_else(|| ::serde::de::Error::missing_field("revision"))?,
            title: field_title.ok_or_else(|| ::serde::de::Error::missing_field("title"))?,
        };
        Ok(Some(result))
    }

    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
        &self,
        s: &mut S::SerializeStruct,
    ) -> Result<(), S::Error> {
        use serde::ser::SerializeStruct;
        s.serialize_field("doc_id", &self.doc_id)?;
        s.serialize_field("revision", &self.revision)?;
        s.serialize_field("title", &self.title)
    }
}

impl<'de> ::serde::de::Deserialize<'de> for PaperDocCreateUpdateResult {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // struct deserializer
        use serde::de::{MapAccess, Visitor};
        struct StructVisitor;
        impl<'de> Visitor<'de> for StructVisitor {
            type Value = PaperDocCreateUpdateResult;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a PaperDocCreateUpdateResult struct")
            }
            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
                PaperDocCreateUpdateResult::internal_deserialize(map)
            }
        }
        deserializer.deserialize_struct("PaperDocCreateUpdateResult", PAPER_DOC_CREATE_UPDATE_RESULT_FIELDS, StructVisitor)
    }
}

impl ::serde::ser::Serialize for PaperDocCreateUpdateResult {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // struct serializer
        use serde::ser::SerializeStruct;
        let mut s = serializer.serialize_struct("PaperDocCreateUpdateResult", 3)?;
        self.internal_serialize::<S>(&mut s)?;
        s.end()
    }
}

#[derive(Debug)]
pub struct PaperDocExport {
    /// The Paper doc ID.
    pub doc_id: PaperDocId,
    pub export_format: ExportFormat,
}

impl PaperDocExport {
    pub fn new(doc_id: PaperDocId, export_format: ExportFormat) -> Self {
        PaperDocExport {
            doc_id,
            export_format,
        }
    }

}

const PAPER_DOC_EXPORT_FIELDS: &[&str] = &["doc_id",
                                           "export_format"];
impl PaperDocExport {
    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
        map: V,
    ) -> Result<PaperDocExport, V::Error> {
        Self::internal_deserialize_opt(map, false).map(Option::unwrap)
    }

    pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
        mut map: V,
        optional: bool,
    ) -> Result<Option<PaperDocExport>, V::Error> {
        let mut field_doc_id = None;
        let mut field_export_format = None;
        let mut nothing = true;
        while let Some(key) = map.next_key::<&str>()? {
            nothing = false;
            match key {
                "doc_id" => {
                    if field_doc_id.is_some() {
                        return Err(::serde::de::Error::duplicate_field("doc_id"));
                    }
                    field_doc_id = Some(map.next_value()?);
                }
                "export_format" => {
                    if field_export_format.is_some() {
                        return Err(::serde::de::Error::duplicate_field("export_format"));
                    }
                    field_export_format = Some(map.next_value()?);
                }
                _ => {
                    // unknown field allowed and ignored
                    map.next_value::<::serde_json::Value>()?;
                }
            }
        }
        if optional && nothing {
            return Ok(None);
        }
        let result = PaperDocExport {
            doc_id: field_doc_id.ok_or_else(|| ::serde::de::Error::missing_field("doc_id"))?,
            export_format: field_export_format.ok_or_else(|| ::serde::de::Error::missing_field("export_format"))?,
        };
        Ok(Some(result))
    }

    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
        &self,
        s: &mut S::SerializeStruct,
    ) -> Result<(), S::Error> {
        use serde::ser::SerializeStruct;
        s.serialize_field("doc_id", &self.doc_id)?;
        s.serialize_field("export_format", &self.export_format)
    }
}

impl<'de> ::serde::de::Deserialize<'de> for PaperDocExport {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // struct deserializer
        use serde::de::{MapAccess, Visitor};
        struct StructVisitor;
        impl<'de> Visitor<'de> for StructVisitor {
            type Value = PaperDocExport;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a PaperDocExport struct")
            }
            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
                PaperDocExport::internal_deserialize(map)
            }
        }
        deserializer.deserialize_struct("PaperDocExport", PAPER_DOC_EXPORT_FIELDS, StructVisitor)
    }
}

impl ::serde::ser::Serialize for PaperDocExport {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // struct serializer
        use serde::ser::SerializeStruct;
        let mut s = serializer.serialize_struct("PaperDocExport", 2)?;
        self.internal_serialize::<S>(&mut s)?;
        s.end()
    }
}

#[derive(Debug)]
pub struct PaperDocExportResult {
    /// The Paper doc owner's email address.
    pub owner: String,
    /// The Paper doc title.
    pub title: String,
    /// The Paper doc revision. Simply an ever increasing number.
    pub revision: i64,
    /// MIME type of the export. This corresponds to [`ExportFormat`](ExportFormat) specified in the
    /// request.
    pub mime_type: String,
}

impl PaperDocExportResult {
    pub fn new(owner: String, title: String, revision: i64, mime_type: String) -> Self {
        PaperDocExportResult {
            owner,
            title,
            revision,
            mime_type,
        }
    }

}

const PAPER_DOC_EXPORT_RESULT_FIELDS: &[&str] = &["owner",
                                                  "title",
                                                  "revision",
                                                  "mime_type"];
impl PaperDocExportResult {
    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
        map: V,
    ) -> Result<PaperDocExportResult, V::Error> {
        Self::internal_deserialize_opt(map, false).map(Option::unwrap)
    }

    pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
        mut map: V,
        optional: bool,
    ) -> Result<Option<PaperDocExportResult>, V::Error> {
        let mut field_owner = None;
        let mut field_title = None;
        let mut field_revision = None;
        let mut field_mime_type = None;
        let mut nothing = true;
        while let Some(key) = map.next_key::<&str>()? {
            nothing = false;
            match key {
                "owner" => {
                    if field_owner.is_some() {
                        return Err(::serde::de::Error::duplicate_field("owner"));
                    }
                    field_owner = Some(map.next_value()?);
                }
                "title" => {
                    if field_title.is_some() {
                        return Err(::serde::de::Error::duplicate_field("title"));
                    }
                    field_title = Some(map.next_value()?);
                }
                "revision" => {
                    if field_revision.is_some() {
                        return Err(::serde::de::Error::duplicate_field("revision"));
                    }
                    field_revision = Some(map.next_value()?);
                }
                "mime_type" => {
                    if field_mime_type.is_some() {
                        return Err(::serde::de::Error::duplicate_field("mime_type"));
                    }
                    field_mime_type = Some(map.next_value()?);
                }
                _ => {
                    // unknown field allowed and ignored
                    map.next_value::<::serde_json::Value>()?;
                }
            }
        }
        if optional && nothing {
            return Ok(None);
        }
        let result = PaperDocExportResult {
            owner: field_owner.ok_or_else(|| ::serde::de::Error::missing_field("owner"))?,
            title: field_title.ok_or_else(|| ::serde::de::Error::missing_field("title"))?,
            revision: field_revision.ok_or_else(|| ::serde::de::Error::missing_field("revision"))?,
            mime_type: field_mime_type.ok_or_else(|| ::serde::de::Error::missing_field("mime_type"))?,
        };
        Ok(Some(result))
    }

    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
        &self,
        s: &mut S::SerializeStruct,
    ) -> Result<(), S::Error> {
        use serde::ser::SerializeStruct;
        s.serialize_field("owner", &self.owner)?;
        s.serialize_field("title", &self.title)?;
        s.serialize_field("revision", &self.revision)?;
        s.serialize_field("mime_type", &self.mime_type)
    }
}

impl<'de> ::serde::de::Deserialize<'de> for PaperDocExportResult {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // struct deserializer
        use serde::de::{MapAccess, Visitor};
        struct StructVisitor;
        impl<'de> Visitor<'de> for StructVisitor {
            type Value = PaperDocExportResult;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a PaperDocExportResult struct")
            }
            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
                PaperDocExportResult::internal_deserialize(map)
            }
        }
        deserializer.deserialize_struct("PaperDocExportResult", PAPER_DOC_EXPORT_RESULT_FIELDS, StructVisitor)
    }
}

impl ::serde::ser::Serialize for PaperDocExportResult {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // struct serializer
        use serde::ser::SerializeStruct;
        let mut s = serializer.serialize_struct("PaperDocExportResult", 4)?;
        self.internal_serialize::<S>(&mut s)?;
        s.end()
    }
}

#[derive(Debug)]
pub enum PaperDocPermissionLevel {
    /// User will be granted edit permissions.
    Edit,
    /// User will be granted view and comment permissions.
    ViewAndComment,
    /// Catch-all used for unrecognized values returned from the server. Encountering this value
    /// typically indicates that this SDK version is out of date.
    Other,
}

impl<'de> ::serde::de::Deserialize<'de> for PaperDocPermissionLevel {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // union deserializer
        use serde::de::{self, MapAccess, Visitor};
        struct EnumVisitor;
        impl<'de> Visitor<'de> for EnumVisitor {
            type Value = PaperDocPermissionLevel;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a PaperDocPermissionLevel structure")
            }
            fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
                let tag: &str = match map.next_key()? {
                    Some(".tag") => map.next_value()?,
                    _ => return Err(de::Error::missing_field(".tag"))
                };
                match tag {
                    "edit" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(PaperDocPermissionLevel::Edit)
                    }
                    "view_and_comment" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(PaperDocPermissionLevel::ViewAndComment)
                    }
                    _ => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(PaperDocPermissionLevel::Other)
                    }
                }
            }
        }
        const VARIANTS: &[&str] = &["edit",
                                    "view_and_comment",
                                    "other"];
        deserializer.deserialize_struct("PaperDocPermissionLevel", VARIANTS, EnumVisitor)
    }
}

impl ::serde::ser::Serialize for PaperDocPermissionLevel {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // union serializer
        use serde::ser::SerializeStruct;
        match *self {
            PaperDocPermissionLevel::Edit => {
                // unit
                let mut s = serializer.serialize_struct("PaperDocPermissionLevel", 1)?;
                s.serialize_field(".tag", "edit")?;
                s.end()
            }
            PaperDocPermissionLevel::ViewAndComment => {
                // unit
                let mut s = serializer.serialize_struct("PaperDocPermissionLevel", 1)?;
                s.serialize_field(".tag", "view_and_comment")?;
                s.end()
            }
            PaperDocPermissionLevel::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
        }
    }
}

#[derive(Debug)]
pub struct PaperDocSharingPolicy {
    /// The Paper doc ID.
    pub doc_id: PaperDocId,
    /// The default sharing policy to be set for the Paper doc.
    pub sharing_policy: SharingPolicy,
}

impl PaperDocSharingPolicy {
    pub fn new(doc_id: PaperDocId, sharing_policy: SharingPolicy) -> Self {
        PaperDocSharingPolicy {
            doc_id,
            sharing_policy,
        }
    }

}

const PAPER_DOC_SHARING_POLICY_FIELDS: &[&str] = &["doc_id",
                                                   "sharing_policy"];
impl PaperDocSharingPolicy {
    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
        map: V,
    ) -> Result<PaperDocSharingPolicy, V::Error> {
        Self::internal_deserialize_opt(map, false).map(Option::unwrap)
    }

    pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
        mut map: V,
        optional: bool,
    ) -> Result<Option<PaperDocSharingPolicy>, V::Error> {
        let mut field_doc_id = None;
        let mut field_sharing_policy = None;
        let mut nothing = true;
        while let Some(key) = map.next_key::<&str>()? {
            nothing = false;
            match key {
                "doc_id" => {
                    if field_doc_id.is_some() {
                        return Err(::serde::de::Error::duplicate_field("doc_id"));
                    }
                    field_doc_id = Some(map.next_value()?);
                }
                "sharing_policy" => {
                    if field_sharing_policy.is_some() {
                        return Err(::serde::de::Error::duplicate_field("sharing_policy"));
                    }
                    field_sharing_policy = Some(map.next_value()?);
                }
                _ => {
                    // unknown field allowed and ignored
                    map.next_value::<::serde_json::Value>()?;
                }
            }
        }
        if optional && nothing {
            return Ok(None);
        }
        let result = PaperDocSharingPolicy {
            doc_id: field_doc_id.ok_or_else(|| ::serde::de::Error::missing_field("doc_id"))?,
            sharing_policy: field_sharing_policy.ok_or_else(|| ::serde::de::Error::missing_field("sharing_policy"))?,
        };
        Ok(Some(result))
    }

    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
        &self,
        s: &mut S::SerializeStruct,
    ) -> Result<(), S::Error> {
        use serde::ser::SerializeStruct;
        s.serialize_field("doc_id", &self.doc_id)?;
        s.serialize_field("sharing_policy", &self.sharing_policy)
    }
}

impl<'de> ::serde::de::Deserialize<'de> for PaperDocSharingPolicy {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // struct deserializer
        use serde::de::{MapAccess, Visitor};
        struct StructVisitor;
        impl<'de> Visitor<'de> for StructVisitor {
            type Value = PaperDocSharingPolicy;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a PaperDocSharingPolicy struct")
            }
            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
                PaperDocSharingPolicy::internal_deserialize(map)
            }
        }
        deserializer.deserialize_struct("PaperDocSharingPolicy", PAPER_DOC_SHARING_POLICY_FIELDS, StructVisitor)
    }
}

impl ::serde::ser::Serialize for PaperDocSharingPolicy {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // struct serializer
        use serde::ser::SerializeStruct;
        let mut s = serializer.serialize_struct("PaperDocSharingPolicy", 2)?;
        self.internal_serialize::<S>(&mut s)?;
        s.end()
    }
}

#[derive(Debug)]
pub struct PaperDocUpdateArgs {
    /// The Paper doc ID.
    pub doc_id: PaperDocId,
    /// The policy used for the current update call.
    pub doc_update_policy: PaperDocUpdatePolicy,
    /// The latest doc revision. This value must match the head revision or an error code will be
    /// returned. This is to prevent colliding writes.
    pub revision: i64,
    /// The format of provided data.
    pub import_format: ImportFormat,
}

impl PaperDocUpdateArgs {
    pub fn new(
        doc_id: PaperDocId,
        doc_update_policy: PaperDocUpdatePolicy,
        revision: i64,
        import_format: ImportFormat,
    ) -> Self {
        PaperDocUpdateArgs {
            doc_id,
            doc_update_policy,
            revision,
            import_format,
        }
    }

}

const PAPER_DOC_UPDATE_ARGS_FIELDS: &[&str] = &["doc_id",
                                                "doc_update_policy",
                                                "revision",
                                                "import_format"];
impl PaperDocUpdateArgs {
    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
        map: V,
    ) -> Result<PaperDocUpdateArgs, V::Error> {
        Self::internal_deserialize_opt(map, false).map(Option::unwrap)
    }

    pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
        mut map: V,
        optional: bool,
    ) -> Result<Option<PaperDocUpdateArgs>, V::Error> {
        let mut field_doc_id = None;
        let mut field_doc_update_policy = None;
        let mut field_revision = None;
        let mut field_import_format = None;
        let mut nothing = true;
        while let Some(key) = map.next_key::<&str>()? {
            nothing = false;
            match key {
                "doc_id" => {
                    if field_doc_id.is_some() {
                        return Err(::serde::de::Error::duplicate_field("doc_id"));
                    }
                    field_doc_id = Some(map.next_value()?);
                }
                "doc_update_policy" => {
                    if field_doc_update_policy.is_some() {
                        return Err(::serde::de::Error::duplicate_field("doc_update_policy"));
                    }
                    field_doc_update_policy = Some(map.next_value()?);
                }
                "revision" => {
                    if field_revision.is_some() {
                        return Err(::serde::de::Error::duplicate_field("revision"));
                    }
                    field_revision = Some(map.next_value()?);
                }
                "import_format" => {
                    if field_import_format.is_some() {
                        return Err(::serde::de::Error::duplicate_field("import_format"));
                    }
                    field_import_format = Some(map.next_value()?);
                }
                _ => {
                    // unknown field allowed and ignored
                    map.next_value::<::serde_json::Value>()?;
                }
            }
        }
        if optional && nothing {
            return Ok(None);
        }
        let result = PaperDocUpdateArgs {
            doc_id: field_doc_id.ok_or_else(|| ::serde::de::Error::missing_field("doc_id"))?,
            doc_update_policy: field_doc_update_policy.ok_or_else(|| ::serde::de::Error::missing_field("doc_update_policy"))?,
            revision: field_revision.ok_or_else(|| ::serde::de::Error::missing_field("revision"))?,
            import_format: field_import_format.ok_or_else(|| ::serde::de::Error::missing_field("import_format"))?,
        };
        Ok(Some(result))
    }

    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
        &self,
        s: &mut S::SerializeStruct,
    ) -> Result<(), S::Error> {
        use serde::ser::SerializeStruct;
        s.serialize_field("doc_id", &self.doc_id)?;
        s.serialize_field("doc_update_policy", &self.doc_update_policy)?;
        s.serialize_field("revision", &self.revision)?;
        s.serialize_field("import_format", &self.import_format)
    }
}

impl<'de> ::serde::de::Deserialize<'de> for PaperDocUpdateArgs {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // struct deserializer
        use serde::de::{MapAccess, Visitor};
        struct StructVisitor;
        impl<'de> Visitor<'de> for StructVisitor {
            type Value = PaperDocUpdateArgs;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a PaperDocUpdateArgs struct")
            }
            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
                PaperDocUpdateArgs::internal_deserialize(map)
            }
        }
        deserializer.deserialize_struct("PaperDocUpdateArgs", PAPER_DOC_UPDATE_ARGS_FIELDS, StructVisitor)
    }
}

impl ::serde::ser::Serialize for PaperDocUpdateArgs {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // struct serializer
        use serde::ser::SerializeStruct;
        let mut s = serializer.serialize_struct("PaperDocUpdateArgs", 4)?;
        self.internal_serialize::<S>(&mut s)?;
        s.end()
    }
}

#[derive(Debug)]
pub enum PaperDocUpdateError {
    /// Your account does not have permissions to perform this action. This may be due to it only
    /// having access to Paper as files in the Dropbox filesystem. For more information, refer to
    /// the [Paper Migration
    /// Guide](https://www.dropbox.com/lp/developers/reference/paper-migration-guide).
    InsufficientPermissions,
    /// The required doc was not found.
    DocNotFound,
    /// The provided content was malformed and cannot be imported to Paper.
    ContentMalformed,
    /// The provided revision does not match the document head.
    RevisionMismatch,
    /// The newly created Paper doc would be too large, split the content into multiple docs.
    DocLengthExceeded,
    /// The imported document contains an image that is too large. The current limit is 1MB. This
    /// only applies to HTML with data URI.
    ImageSizeExceeded,
    /// This operation is not allowed on archived Paper docs.
    DocArchived,
    /// This operation is not allowed on deleted Paper docs.
    DocDeleted,
    /// Catch-all used for unrecognized values returned from the server. Encountering this value
    /// typically indicates that this SDK version is out of date.
    Other,
}

impl<'de> ::serde::de::Deserialize<'de> for PaperDocUpdateError {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // union deserializer
        use serde::de::{self, MapAccess, Visitor};
        struct EnumVisitor;
        impl<'de> Visitor<'de> for EnumVisitor {
            type Value = PaperDocUpdateError;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a PaperDocUpdateError structure")
            }
            fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
                let tag: &str = match map.next_key()? {
                    Some(".tag") => map.next_value()?,
                    _ => return Err(de::Error::missing_field(".tag"))
                };
                match tag {
                    "insufficient_permissions" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(PaperDocUpdateError::InsufficientPermissions)
                    }
                    "doc_not_found" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(PaperDocUpdateError::DocNotFound)
                    }
                    "content_malformed" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(PaperDocUpdateError::ContentMalformed)
                    }
                    "revision_mismatch" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(PaperDocUpdateError::RevisionMismatch)
                    }
                    "doc_length_exceeded" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(PaperDocUpdateError::DocLengthExceeded)
                    }
                    "image_size_exceeded" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(PaperDocUpdateError::ImageSizeExceeded)
                    }
                    "doc_archived" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(PaperDocUpdateError::DocArchived)
                    }
                    "doc_deleted" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(PaperDocUpdateError::DocDeleted)
                    }
                    _ => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(PaperDocUpdateError::Other)
                    }
                }
            }
        }
        const VARIANTS: &[&str] = &["insufficient_permissions",
                                    "other",
                                    "doc_not_found",
                                    "content_malformed",
                                    "revision_mismatch",
                                    "doc_length_exceeded",
                                    "image_size_exceeded",
                                    "doc_archived",
                                    "doc_deleted"];
        deserializer.deserialize_struct("PaperDocUpdateError", VARIANTS, EnumVisitor)
    }
}

impl ::serde::ser::Serialize for PaperDocUpdateError {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // union serializer
        use serde::ser::SerializeStruct;
        match *self {
            PaperDocUpdateError::InsufficientPermissions => {
                // unit
                let mut s = serializer.serialize_struct("PaperDocUpdateError", 1)?;
                s.serialize_field(".tag", "insufficient_permissions")?;
                s.end()
            }
            PaperDocUpdateError::DocNotFound => {
                // unit
                let mut s = serializer.serialize_struct("PaperDocUpdateError", 1)?;
                s.serialize_field(".tag", "doc_not_found")?;
                s.end()
            }
            PaperDocUpdateError::ContentMalformed => {
                // unit
                let mut s = serializer.serialize_struct("PaperDocUpdateError", 1)?;
                s.serialize_field(".tag", "content_malformed")?;
                s.end()
            }
            PaperDocUpdateError::RevisionMismatch => {
                // unit
                let mut s = serializer.serialize_struct("PaperDocUpdateError", 1)?;
                s.serialize_field(".tag", "revision_mismatch")?;
                s.end()
            }
            PaperDocUpdateError::DocLengthExceeded => {
                // unit
                let mut s = serializer.serialize_struct("PaperDocUpdateError", 1)?;
                s.serialize_field(".tag", "doc_length_exceeded")?;
                s.end()
            }
            PaperDocUpdateError::ImageSizeExceeded => {
                // unit
                let mut s = serializer.serialize_struct("PaperDocUpdateError", 1)?;
                s.serialize_field(".tag", "image_size_exceeded")?;
                s.end()
            }
            PaperDocUpdateError::DocArchived => {
                // unit
                let mut s = serializer.serialize_struct("PaperDocUpdateError", 1)?;
                s.serialize_field(".tag", "doc_archived")?;
                s.end()
            }
            PaperDocUpdateError::DocDeleted => {
                // unit
                let mut s = serializer.serialize_struct("PaperDocUpdateError", 1)?;
                s.serialize_field(".tag", "doc_deleted")?;
                s.end()
            }
            PaperDocUpdateError::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
        }
    }
}

impl ::std::error::Error for PaperDocUpdateError {
    fn description(&self) -> &str {
        "PaperDocUpdateError"
    }
}

impl ::std::fmt::Display for PaperDocUpdateError {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        write!(f, "{:?}", *self)
    }
}

#[derive(Debug)]
pub enum PaperDocUpdatePolicy {
    /// The content will be appended to the doc.
    Append,
    /// The content will be prepended to the doc. The doc title will not be affected.
    Prepend,
    /// The document will be overwitten at the head with the provided content.
    OverwriteAll,
    /// Catch-all used for unrecognized values returned from the server. Encountering this value
    /// typically indicates that this SDK version is out of date.
    Other,
}

impl<'de> ::serde::de::Deserialize<'de> for PaperDocUpdatePolicy {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // union deserializer
        use serde::de::{self, MapAccess, Visitor};
        struct EnumVisitor;
        impl<'de> Visitor<'de> for EnumVisitor {
            type Value = PaperDocUpdatePolicy;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a PaperDocUpdatePolicy structure")
            }
            fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
                let tag: &str = match map.next_key()? {
                    Some(".tag") => map.next_value()?,
                    _ => return Err(de::Error::missing_field(".tag"))
                };
                match tag {
                    "append" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(PaperDocUpdatePolicy::Append)
                    }
                    "prepend" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(PaperDocUpdatePolicy::Prepend)
                    }
                    "overwrite_all" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(PaperDocUpdatePolicy::OverwriteAll)
                    }
                    _ => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(PaperDocUpdatePolicy::Other)
                    }
                }
            }
        }
        const VARIANTS: &[&str] = &["append",
                                    "prepend",
                                    "overwrite_all",
                                    "other"];
        deserializer.deserialize_struct("PaperDocUpdatePolicy", VARIANTS, EnumVisitor)
    }
}

impl ::serde::ser::Serialize for PaperDocUpdatePolicy {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // union serializer
        use serde::ser::SerializeStruct;
        match *self {
            PaperDocUpdatePolicy::Append => {
                // unit
                let mut s = serializer.serialize_struct("PaperDocUpdatePolicy", 1)?;
                s.serialize_field(".tag", "append")?;
                s.end()
            }
            PaperDocUpdatePolicy::Prepend => {
                // unit
                let mut s = serializer.serialize_struct("PaperDocUpdatePolicy", 1)?;
                s.serialize_field(".tag", "prepend")?;
                s.end()
            }
            PaperDocUpdatePolicy::OverwriteAll => {
                // unit
                let mut s = serializer.serialize_struct("PaperDocUpdatePolicy", 1)?;
                s.serialize_field(".tag", "overwrite_all")?;
                s.end()
            }
            PaperDocUpdatePolicy::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
        }
    }
}

#[derive(Debug)]
pub struct PaperFolderCreateArg {
    /// The name of the new Paper folder.
    pub name: String,
    /// The encrypted Paper folder Id where the new Paper folder should be created. The API user has
    /// to have write access to this folder or error is thrown. If not supplied, the new folder will
    /// be created at top level.
    pub parent_folder_id: Option<String>,
    /// Whether the folder to be created should be a team folder. This value will be ignored if
    /// parent_folder_id is supplied, as the new folder will inherit the type (private or team
    /// folder) from its parent. We will by default create a top-level private folder if both
    /// parent_folder_id and is_team_folder are not supplied.
    pub is_team_folder: Option<bool>,
}

impl PaperFolderCreateArg {
    pub fn new(name: String) -> Self {
        PaperFolderCreateArg {
            name,
            parent_folder_id: None,
            is_team_folder: None,
        }
    }

    pub fn with_parent_folder_id(mut self, value: Option<String>) -> Self {
        self.parent_folder_id = value;
        self
    }

    pub fn with_is_team_folder(mut self, value: Option<bool>) -> Self {
        self.is_team_folder = value;
        self
    }

}

const PAPER_FOLDER_CREATE_ARG_FIELDS: &[&str] = &["name",
                                                  "parent_folder_id",
                                                  "is_team_folder"];
impl PaperFolderCreateArg {
    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
        map: V,
    ) -> Result<PaperFolderCreateArg, V::Error> {
        Self::internal_deserialize_opt(map, false).map(Option::unwrap)
    }

    pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
        mut map: V,
        optional: bool,
    ) -> Result<Option<PaperFolderCreateArg>, V::Error> {
        let mut field_name = None;
        let mut field_parent_folder_id = None;
        let mut field_is_team_folder = None;
        let mut nothing = true;
        while let Some(key) = map.next_key::<&str>()? {
            nothing = false;
            match key {
                "name" => {
                    if field_name.is_some() {
                        return Err(::serde::de::Error::duplicate_field("name"));
                    }
                    field_name = Some(map.next_value()?);
                }
                "parent_folder_id" => {
                    if field_parent_folder_id.is_some() {
                        return Err(::serde::de::Error::duplicate_field("parent_folder_id"));
                    }
                    field_parent_folder_id = Some(map.next_value()?);
                }
                "is_team_folder" => {
                    if field_is_team_folder.is_some() {
                        return Err(::serde::de::Error::duplicate_field("is_team_folder"));
                    }
                    field_is_team_folder = Some(map.next_value()?);
                }
                _ => {
                    // unknown field allowed and ignored
                    map.next_value::<::serde_json::Value>()?;
                }
            }
        }
        if optional && nothing {
            return Ok(None);
        }
        let result = PaperFolderCreateArg {
            name: field_name.ok_or_else(|| ::serde::de::Error::missing_field("name"))?,
            parent_folder_id: field_parent_folder_id,
            is_team_folder: field_is_team_folder,
        };
        Ok(Some(result))
    }

    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
        &self,
        s: &mut S::SerializeStruct,
    ) -> Result<(), S::Error> {
        use serde::ser::SerializeStruct;
        s.serialize_field("name", &self.name)?;
        s.serialize_field("parent_folder_id", &self.parent_folder_id)?;
        s.serialize_field("is_team_folder", &self.is_team_folder)
    }
}

impl<'de> ::serde::de::Deserialize<'de> for PaperFolderCreateArg {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // struct deserializer
        use serde::de::{MapAccess, Visitor};
        struct StructVisitor;
        impl<'de> Visitor<'de> for StructVisitor {
            type Value = PaperFolderCreateArg;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a PaperFolderCreateArg struct")
            }
            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
                PaperFolderCreateArg::internal_deserialize(map)
            }
        }
        deserializer.deserialize_struct("PaperFolderCreateArg", PAPER_FOLDER_CREATE_ARG_FIELDS, StructVisitor)
    }
}

impl ::serde::ser::Serialize for PaperFolderCreateArg {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // struct serializer
        use serde::ser::SerializeStruct;
        let mut s = serializer.serialize_struct("PaperFolderCreateArg", 3)?;
        self.internal_serialize::<S>(&mut s)?;
        s.end()
    }
}

#[derive(Debug)]
pub enum PaperFolderCreateError {
    /// Your account does not have permissions to perform this action. This may be due to it only
    /// having access to Paper as files in the Dropbox filesystem. For more information, refer to
    /// the [Paper Migration
    /// Guide](https://www.dropbox.com/lp/developers/reference/paper-migration-guide).
    InsufficientPermissions,
    /// The specified parent Paper folder cannot be found.
    FolderNotFound,
    /// The folder id cannot be decrypted to valid folder id.
    InvalidFolderId,
    /// Catch-all used for unrecognized values returned from the server. Encountering this value
    /// typically indicates that this SDK version is out of date.
    Other,
}

impl<'de> ::serde::de::Deserialize<'de> for PaperFolderCreateError {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // union deserializer
        use serde::de::{self, MapAccess, Visitor};
        struct EnumVisitor;
        impl<'de> Visitor<'de> for EnumVisitor {
            type Value = PaperFolderCreateError;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a PaperFolderCreateError structure")
            }
            fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
                let tag: &str = match map.next_key()? {
                    Some(".tag") => map.next_value()?,
                    _ => return Err(de::Error::missing_field(".tag"))
                };
                match tag {
                    "insufficient_permissions" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(PaperFolderCreateError::InsufficientPermissions)
                    }
                    "folder_not_found" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(PaperFolderCreateError::FolderNotFound)
                    }
                    "invalid_folder_id" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(PaperFolderCreateError::InvalidFolderId)
                    }
                    _ => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(PaperFolderCreateError::Other)
                    }
                }
            }
        }
        const VARIANTS: &[&str] = &["insufficient_permissions",
                                    "other",
                                    "folder_not_found",
                                    "invalid_folder_id"];
        deserializer.deserialize_struct("PaperFolderCreateError", VARIANTS, EnumVisitor)
    }
}

impl ::serde::ser::Serialize for PaperFolderCreateError {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // union serializer
        use serde::ser::SerializeStruct;
        match *self {
            PaperFolderCreateError::InsufficientPermissions => {
                // unit
                let mut s = serializer.serialize_struct("PaperFolderCreateError", 1)?;
                s.serialize_field(".tag", "insufficient_permissions")?;
                s.end()
            }
            PaperFolderCreateError::FolderNotFound => {
                // unit
                let mut s = serializer.serialize_struct("PaperFolderCreateError", 1)?;
                s.serialize_field(".tag", "folder_not_found")?;
                s.end()
            }
            PaperFolderCreateError::InvalidFolderId => {
                // unit
                let mut s = serializer.serialize_struct("PaperFolderCreateError", 1)?;
                s.serialize_field(".tag", "invalid_folder_id")?;
                s.end()
            }
            PaperFolderCreateError::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
        }
    }
}

impl ::std::error::Error for PaperFolderCreateError {
    fn description(&self) -> &str {
        "PaperFolderCreateError"
    }
}

impl ::std::fmt::Display for PaperFolderCreateError {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        write!(f, "{:?}", *self)
    }
}

#[derive(Debug)]
pub struct PaperFolderCreateResult {
    /// Folder ID of the newly created folder.
    pub folder_id: String,
}

impl PaperFolderCreateResult {
    pub fn new(folder_id: String) -> Self {
        PaperFolderCreateResult {
            folder_id,
        }
    }

}

const PAPER_FOLDER_CREATE_RESULT_FIELDS: &[&str] = &["folder_id"];
impl PaperFolderCreateResult {
    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
        map: V,
    ) -> Result<PaperFolderCreateResult, V::Error> {
        Self::internal_deserialize_opt(map, false).map(Option::unwrap)
    }

    pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
        mut map: V,
        optional: bool,
    ) -> Result<Option<PaperFolderCreateResult>, V::Error> {
        let mut field_folder_id = None;
        let mut nothing = true;
        while let Some(key) = map.next_key::<&str>()? {
            nothing = false;
            match key {
                "folder_id" => {
                    if field_folder_id.is_some() {
                        return Err(::serde::de::Error::duplicate_field("folder_id"));
                    }
                    field_folder_id = Some(map.next_value()?);
                }
                _ => {
                    // unknown field allowed and ignored
                    map.next_value::<::serde_json::Value>()?;
                }
            }
        }
        if optional && nothing {
            return Ok(None);
        }
        let result = PaperFolderCreateResult {
            folder_id: field_folder_id.ok_or_else(|| ::serde::de::Error::missing_field("folder_id"))?,
        };
        Ok(Some(result))
    }

    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
        &self,
        s: &mut S::SerializeStruct,
    ) -> Result<(), S::Error> {
        use serde::ser::SerializeStruct;
        s.serialize_field("folder_id", &self.folder_id)
    }
}

impl<'de> ::serde::de::Deserialize<'de> for PaperFolderCreateResult {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // struct deserializer
        use serde::de::{MapAccess, Visitor};
        struct StructVisitor;
        impl<'de> Visitor<'de> for StructVisitor {
            type Value = PaperFolderCreateResult;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a PaperFolderCreateResult struct")
            }
            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
                PaperFolderCreateResult::internal_deserialize(map)
            }
        }
        deserializer.deserialize_struct("PaperFolderCreateResult", PAPER_FOLDER_CREATE_RESULT_FIELDS, StructVisitor)
    }
}

impl ::serde::ser::Serialize for PaperFolderCreateResult {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // struct serializer
        use serde::ser::SerializeStruct;
        let mut s = serializer.serialize_struct("PaperFolderCreateResult", 1)?;
        self.internal_serialize::<S>(&mut s)?;
        s.end()
    }
}

#[derive(Debug)]
pub struct RefPaperDoc {
    /// The Paper doc ID.
    pub doc_id: PaperDocId,
}

impl RefPaperDoc {
    pub fn new(doc_id: PaperDocId) -> Self {
        RefPaperDoc {
            doc_id,
        }
    }

}

const REF_PAPER_DOC_FIELDS: &[&str] = &["doc_id"];
impl RefPaperDoc {
    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
        map: V,
    ) -> Result<RefPaperDoc, V::Error> {
        Self::internal_deserialize_opt(map, false).map(Option::unwrap)
    }

    pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
        mut map: V,
        optional: bool,
    ) -> Result<Option<RefPaperDoc>, V::Error> {
        let mut field_doc_id = None;
        let mut nothing = true;
        while let Some(key) = map.next_key::<&str>()? {
            nothing = false;
            match key {
                "doc_id" => {
                    if field_doc_id.is_some() {
                        return Err(::serde::de::Error::duplicate_field("doc_id"));
                    }
                    field_doc_id = Some(map.next_value()?);
                }
                _ => {
                    // unknown field allowed and ignored
                    map.next_value::<::serde_json::Value>()?;
                }
            }
        }
        if optional && nothing {
            return Ok(None);
        }
        let result = RefPaperDoc {
            doc_id: field_doc_id.ok_or_else(|| ::serde::de::Error::missing_field("doc_id"))?,
        };
        Ok(Some(result))
    }

    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
        &self,
        s: &mut S::SerializeStruct,
    ) -> Result<(), S::Error> {
        use serde::ser::SerializeStruct;
        s.serialize_field("doc_id", &self.doc_id)
    }
}

impl<'de> ::serde::de::Deserialize<'de> for RefPaperDoc {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // struct deserializer
        use serde::de::{MapAccess, Visitor};
        struct StructVisitor;
        impl<'de> Visitor<'de> for StructVisitor {
            type Value = RefPaperDoc;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a RefPaperDoc struct")
            }
            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
                RefPaperDoc::internal_deserialize(map)
            }
        }
        deserializer.deserialize_struct("RefPaperDoc", REF_PAPER_DOC_FIELDS, StructVisitor)
    }
}

impl ::serde::ser::Serialize for RefPaperDoc {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // struct serializer
        use serde::ser::SerializeStruct;
        let mut s = serializer.serialize_struct("RefPaperDoc", 1)?;
        self.internal_serialize::<S>(&mut s)?;
        s.end()
    }
}

#[derive(Debug)]
pub struct RemovePaperDocUser {
    /// The Paper doc ID.
    pub doc_id: PaperDocId,
    /// User which should be removed from the Paper doc. Specify only email address or Dropbox
    /// account ID.
    pub member: super::sharing::MemberSelector,
}

impl RemovePaperDocUser {
    pub fn new(doc_id: PaperDocId, member: super::sharing::MemberSelector) -> Self {
        RemovePaperDocUser {
            doc_id,
            member,
        }
    }

}

const REMOVE_PAPER_DOC_USER_FIELDS: &[&str] = &["doc_id",
                                                "member"];
impl RemovePaperDocUser {
    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
        map: V,
    ) -> Result<RemovePaperDocUser, V::Error> {
        Self::internal_deserialize_opt(map, false).map(Option::unwrap)
    }

    pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
        mut map: V,
        optional: bool,
    ) -> Result<Option<RemovePaperDocUser>, V::Error> {
        let mut field_doc_id = None;
        let mut field_member = None;
        let mut nothing = true;
        while let Some(key) = map.next_key::<&str>()? {
            nothing = false;
            match key {
                "doc_id" => {
                    if field_doc_id.is_some() {
                        return Err(::serde::de::Error::duplicate_field("doc_id"));
                    }
                    field_doc_id = Some(map.next_value()?);
                }
                "member" => {
                    if field_member.is_some() {
                        return Err(::serde::de::Error::duplicate_field("member"));
                    }
                    field_member = Some(map.next_value()?);
                }
                _ => {
                    // unknown field allowed and ignored
                    map.next_value::<::serde_json::Value>()?;
                }
            }
        }
        if optional && nothing {
            return Ok(None);
        }
        let result = RemovePaperDocUser {
            doc_id: field_doc_id.ok_or_else(|| ::serde::de::Error::missing_field("doc_id"))?,
            member: field_member.ok_or_else(|| ::serde::de::Error::missing_field("member"))?,
        };
        Ok(Some(result))
    }

    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
        &self,
        s: &mut S::SerializeStruct,
    ) -> Result<(), S::Error> {
        use serde::ser::SerializeStruct;
        s.serialize_field("doc_id", &self.doc_id)?;
        s.serialize_field("member", &self.member)
    }
}

impl<'de> ::serde::de::Deserialize<'de> for RemovePaperDocUser {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // struct deserializer
        use serde::de::{MapAccess, Visitor};
        struct StructVisitor;
        impl<'de> Visitor<'de> for StructVisitor {
            type Value = RemovePaperDocUser;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a RemovePaperDocUser struct")
            }
            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
                RemovePaperDocUser::internal_deserialize(map)
            }
        }
        deserializer.deserialize_struct("RemovePaperDocUser", REMOVE_PAPER_DOC_USER_FIELDS, StructVisitor)
    }
}

impl ::serde::ser::Serialize for RemovePaperDocUser {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // struct serializer
        use serde::ser::SerializeStruct;
        let mut s = serializer.serialize_struct("RemovePaperDocUser", 2)?;
        self.internal_serialize::<S>(&mut s)?;
        s.end()
    }
}

/// Sharing policy of Paper doc.
#[derive(Debug)]
pub struct SharingPolicy {
    /// This value applies to the non-team members.
    pub public_sharing_policy: Option<SharingPublicPolicyType>,
    /// This value applies to the team members only. The value is null for all personal accounts.
    pub team_sharing_policy: Option<SharingTeamPolicyType>,
}

impl Default for SharingPolicy {
    fn default() -> Self {
        SharingPolicy {
            public_sharing_policy: None,
            team_sharing_policy: None,
        }
    }
}

const SHARING_POLICY_FIELDS: &[&str] = &["public_sharing_policy",
                                         "team_sharing_policy"];
impl SharingPolicy {
    // no _opt deserializer
    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
        mut map: V,
    ) -> Result<SharingPolicy, V::Error> {
        let mut field_public_sharing_policy = None;
        let mut field_team_sharing_policy = None;
        while let Some(key) = map.next_key::<&str>()? {
            match key {
                "public_sharing_policy" => {
                    if field_public_sharing_policy.is_some() {
                        return Err(::serde::de::Error::duplicate_field("public_sharing_policy"));
                    }
                    field_public_sharing_policy = Some(map.next_value()?);
                }
                "team_sharing_policy" => {
                    if field_team_sharing_policy.is_some() {
                        return Err(::serde::de::Error::duplicate_field("team_sharing_policy"));
                    }
                    field_team_sharing_policy = Some(map.next_value()?);
                }
                _ => {
                    // unknown field allowed and ignored
                    map.next_value::<::serde_json::Value>()?;
                }
            }
        }
        let result = SharingPolicy {
            public_sharing_policy: field_public_sharing_policy,
            team_sharing_policy: field_team_sharing_policy,
        };
        Ok(result)
    }

    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
        &self,
        s: &mut S::SerializeStruct,
    ) -> Result<(), S::Error> {
        use serde::ser::SerializeStruct;
        s.serialize_field("public_sharing_policy", &self.public_sharing_policy)?;
        s.serialize_field("team_sharing_policy", &self.team_sharing_policy)
    }
}

impl<'de> ::serde::de::Deserialize<'de> for SharingPolicy {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // struct deserializer
        use serde::de::{MapAccess, Visitor};
        struct StructVisitor;
        impl<'de> Visitor<'de> for StructVisitor {
            type Value = SharingPolicy;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a SharingPolicy struct")
            }
            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
                SharingPolicy::internal_deserialize(map)
            }
        }
        deserializer.deserialize_struct("SharingPolicy", SHARING_POLICY_FIELDS, StructVisitor)
    }
}

impl ::serde::ser::Serialize for SharingPolicy {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // struct serializer
        use serde::ser::SerializeStruct;
        let mut s = serializer.serialize_struct("SharingPolicy", 2)?;
        self.internal_serialize::<S>(&mut s)?;
        s.end()
    }
}

#[derive(Debug)]
pub enum SharingPublicPolicyType {
    /// Users who have a link to this doc can edit it.
    PeopleWithLinkCanEdit,
    /// Users who have a link to this doc can view and comment on it.
    PeopleWithLinkCanViewAndComment,
    /// Users must be explicitly invited to this doc.
    InviteOnly,
    /// Value used to indicate that doc sharing is enabled only within team.
    Disabled,
}

impl<'de> ::serde::de::Deserialize<'de> for SharingPublicPolicyType {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // union deserializer
        use serde::de::{self, MapAccess, Visitor};
        struct EnumVisitor;
        impl<'de> Visitor<'de> for EnumVisitor {
            type Value = SharingPublicPolicyType;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a SharingPublicPolicyType structure")
            }
            fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
                let tag: &str = match map.next_key()? {
                    Some(".tag") => map.next_value()?,
                    _ => return Err(de::Error::missing_field(".tag"))
                };
                match tag {
                    "people_with_link_can_edit" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(SharingPublicPolicyType::PeopleWithLinkCanEdit)
                    }
                    "people_with_link_can_view_and_comment" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(SharingPublicPolicyType::PeopleWithLinkCanViewAndComment)
                    }
                    "invite_only" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(SharingPublicPolicyType::InviteOnly)
                    }
                    "disabled" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(SharingPublicPolicyType::Disabled)
                    }
                    _ => Err(de::Error::unknown_variant(tag, VARIANTS))
                }
            }
        }
        const VARIANTS: &[&str] = &["people_with_link_can_edit",
                                    "people_with_link_can_view_and_comment",
                                    "invite_only",
                                    "disabled"];
        deserializer.deserialize_struct("SharingPublicPolicyType", VARIANTS, EnumVisitor)
    }
}

impl ::serde::ser::Serialize for SharingPublicPolicyType {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // union serializer
        use serde::ser::SerializeStruct;
        match *self {
            SharingPublicPolicyType::PeopleWithLinkCanEdit => {
                // unit
                let mut s = serializer.serialize_struct("SharingPublicPolicyType", 1)?;
                s.serialize_field(".tag", "people_with_link_can_edit")?;
                s.end()
            }
            SharingPublicPolicyType::PeopleWithLinkCanViewAndComment => {
                // unit
                let mut s = serializer.serialize_struct("SharingPublicPolicyType", 1)?;
                s.serialize_field(".tag", "people_with_link_can_view_and_comment")?;
                s.end()
            }
            SharingPublicPolicyType::InviteOnly => {
                // unit
                let mut s = serializer.serialize_struct("SharingPublicPolicyType", 1)?;
                s.serialize_field(".tag", "invite_only")?;
                s.end()
            }
            SharingPublicPolicyType::Disabled => {
                // unit
                let mut s = serializer.serialize_struct("SharingPublicPolicyType", 1)?;
                s.serialize_field(".tag", "disabled")?;
                s.end()
            }
        }
    }
}

/// The sharing policy type of the Paper doc.
#[derive(Debug)]
pub enum SharingTeamPolicyType {
    /// Users who have a link to this doc can edit it.
    PeopleWithLinkCanEdit,
    /// Users who have a link to this doc can view and comment on it.
    PeopleWithLinkCanViewAndComment,
    /// Users must be explicitly invited to this doc.
    InviteOnly,
}

impl<'de> ::serde::de::Deserialize<'de> for SharingTeamPolicyType {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // union deserializer
        use serde::de::{self, MapAccess, Visitor};
        struct EnumVisitor;
        impl<'de> Visitor<'de> for EnumVisitor {
            type Value = SharingTeamPolicyType;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a SharingTeamPolicyType structure")
            }
            fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
                let tag: &str = match map.next_key()? {
                    Some(".tag") => map.next_value()?,
                    _ => return Err(de::Error::missing_field(".tag"))
                };
                match tag {
                    "people_with_link_can_edit" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(SharingTeamPolicyType::PeopleWithLinkCanEdit)
                    }
                    "people_with_link_can_view_and_comment" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(SharingTeamPolicyType::PeopleWithLinkCanViewAndComment)
                    }
                    "invite_only" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(SharingTeamPolicyType::InviteOnly)
                    }
                    _ => Err(de::Error::unknown_variant(tag, VARIANTS))
                }
            }
        }
        const VARIANTS: &[&str] = &["people_with_link_can_edit",
                                    "people_with_link_can_view_and_comment",
                                    "invite_only"];
        deserializer.deserialize_struct("SharingTeamPolicyType", VARIANTS, EnumVisitor)
    }
}

impl ::serde::ser::Serialize for SharingTeamPolicyType {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // union serializer
        use serde::ser::SerializeStruct;
        match *self {
            SharingTeamPolicyType::PeopleWithLinkCanEdit => {
                // unit
                let mut s = serializer.serialize_struct("SharingTeamPolicyType", 1)?;
                s.serialize_field(".tag", "people_with_link_can_edit")?;
                s.end()
            }
            SharingTeamPolicyType::PeopleWithLinkCanViewAndComment => {
                // unit
                let mut s = serializer.serialize_struct("SharingTeamPolicyType", 1)?;
                s.serialize_field(".tag", "people_with_link_can_view_and_comment")?;
                s.end()
            }
            SharingTeamPolicyType::InviteOnly => {
                // unit
                let mut s = serializer.serialize_struct("SharingTeamPolicyType", 1)?;
                s.serialize_field(".tag", "invite_only")?;
                s.end()
            }
        }
    }
}

#[derive(Debug)]
pub struct UserInfoWithPermissionLevel {
    /// User shared on the Paper doc.
    pub user: super::sharing::UserInfo,
    /// Permission level for the user.
    pub permission_level: PaperDocPermissionLevel,
}

impl UserInfoWithPermissionLevel {
    pub fn new(user: super::sharing::UserInfo, permission_level: PaperDocPermissionLevel) -> Self {
        UserInfoWithPermissionLevel {
            user,
            permission_level,
        }
    }

}

const USER_INFO_WITH_PERMISSION_LEVEL_FIELDS: &[&str] = &["user",
                                                          "permission_level"];
impl UserInfoWithPermissionLevel {
    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
        map: V,
    ) -> Result<UserInfoWithPermissionLevel, V::Error> {
        Self::internal_deserialize_opt(map, false).map(Option::unwrap)
    }

    pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
        mut map: V,
        optional: bool,
    ) -> Result<Option<UserInfoWithPermissionLevel>, V::Error> {
        let mut field_user = None;
        let mut field_permission_level = None;
        let mut nothing = true;
        while let Some(key) = map.next_key::<&str>()? {
            nothing = false;
            match key {
                "user" => {
                    if field_user.is_some() {
                        return Err(::serde::de::Error::duplicate_field("user"));
                    }
                    field_user = Some(map.next_value()?);
                }
                "permission_level" => {
                    if field_permission_level.is_some() {
                        return Err(::serde::de::Error::duplicate_field("permission_level"));
                    }
                    field_permission_level = Some(map.next_value()?);
                }
                _ => {
                    // unknown field allowed and ignored
                    map.next_value::<::serde_json::Value>()?;
                }
            }
        }
        if optional && nothing {
            return Ok(None);
        }
        let result = UserInfoWithPermissionLevel {
            user: field_user.ok_or_else(|| ::serde::de::Error::missing_field("user"))?,
            permission_level: field_permission_level.ok_or_else(|| ::serde::de::Error::missing_field("permission_level"))?,
        };
        Ok(Some(result))
    }

    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
        &self,
        s: &mut S::SerializeStruct,
    ) -> Result<(), S::Error> {
        use serde::ser::SerializeStruct;
        s.serialize_field("user", &self.user)?;
        s.serialize_field("permission_level", &self.permission_level)
    }
}

impl<'de> ::serde::de::Deserialize<'de> for UserInfoWithPermissionLevel {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // struct deserializer
        use serde::de::{MapAccess, Visitor};
        struct StructVisitor;
        impl<'de> Visitor<'de> for StructVisitor {
            type Value = UserInfoWithPermissionLevel;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a UserInfoWithPermissionLevel struct")
            }
            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
                UserInfoWithPermissionLevel::internal_deserialize(map)
            }
        }
        deserializer.deserialize_struct("UserInfoWithPermissionLevel", USER_INFO_WITH_PERMISSION_LEVEL_FIELDS, StructVisitor)
    }
}

impl ::serde::ser::Serialize for UserInfoWithPermissionLevel {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // struct serializer
        use serde::ser::SerializeStruct;
        let mut s = serializer.serialize_struct("UserInfoWithPermissionLevel", 2)?;
        self.internal_serialize::<S>(&mut s)?;
        s.end()
    }
}

#[derive(Debug)]
pub enum UserOnPaperDocFilter {
    /// all users who have visited the Paper doc.
    Visited,
    /// All uses who are shared on the Paper doc. This includes all users who have visited the Paper
    /// doc as well as those who have not.
    Shared,
    /// Catch-all used for unrecognized values returned from the server. Encountering this value
    /// typically indicates that this SDK version is out of date.
    Other,
}

impl<'de> ::serde::de::Deserialize<'de> for UserOnPaperDocFilter {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // union deserializer
        use serde::de::{self, MapAccess, Visitor};
        struct EnumVisitor;
        impl<'de> Visitor<'de> for EnumVisitor {
            type Value = UserOnPaperDocFilter;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a UserOnPaperDocFilter structure")
            }
            fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
                let tag: &str = match map.next_key()? {
                    Some(".tag") => map.next_value()?,
                    _ => return Err(de::Error::missing_field(".tag"))
                };
                match tag {
                    "visited" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(UserOnPaperDocFilter::Visited)
                    }
                    "shared" => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(UserOnPaperDocFilter::Shared)
                    }
                    _ => {
                        crate::eat_json_fields(&mut map)?;
                        Ok(UserOnPaperDocFilter::Other)
                    }
                }
            }
        }
        const VARIANTS: &[&str] = &["visited",
                                    "shared",
                                    "other"];
        deserializer.deserialize_struct("UserOnPaperDocFilter", VARIANTS, EnumVisitor)
    }
}

impl ::serde::ser::Serialize for UserOnPaperDocFilter {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // union serializer
        use serde::ser::SerializeStruct;
        match *self {
            UserOnPaperDocFilter::Visited => {
                // unit
                let mut s = serializer.serialize_struct("UserOnPaperDocFilter", 1)?;
                s.serialize_field(".tag", "visited")?;
                s.end()
            }
            UserOnPaperDocFilter::Shared => {
                // unit
                let mut s = serializer.serialize_struct("UserOnPaperDocFilter", 1)?;
                s.serialize_field(".tag", "shared")?;
                s.end()
            }
            UserOnPaperDocFilter::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
        }
    }
}