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 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 7595 7596 7597 7598 7599 7600 7601 7602 7603 7604 7605 7606 7607 7608 7609 7610 7611 7612 7613 7614 7615 7616 7617 7618 7619 7620 7621 7622 7623 7624 7625 7626 7627 7628 7629 7630 7631 7632 7633 7634 7635 7636 7637 7638 7639 7640 7641 7642 7643 7644 7645 7646 7647 7648 7649 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 7694 7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014 8015 8016 8017 8018 8019 8020 8021 8022 8023 8024 8025 8026 8027 8028 8029 8030 8031 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048 8049 8050 8051 8052 8053 8054 8055 8056 8057 8058 8059 8060 8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082 8083 8084 8085 8086 8087 8088 8089 8090 8091 8092 8093 8094 8095 8096 8097 8098 8099 8100 8101 8102 8103 8104 8105 8106 8107 8108 8109 8110 8111 8112 8113 8114 8115 8116 8117 8118 8119 8120 8121 8122 8123 8124 8125 8126 8127 8128 8129 8130 8131 8132 8133 8134 8135 8136 8137 8138 8139 8140 8141 8142 8143 8144 8145 8146 8147 8148 8149 8150 8151 8152 8153 8154 8155 8156 8157 8158 8159 8160 8161 8162 8163 8164 8165 8166 8167 8168 8169 8170 8171 8172 8173 8174 8175 8176 8177 8178 8179 8180 8181 8182 8183 8184 8185 8186 8187 8188 8189 8190 8191 8192 8193 8194 8195 8196 8197 8198 8199 8200 8201 8202 8203 8204 8205 8206 8207 8208 8209 8210 8211 8212 8213 8214 8215 8216 8217 8218 8219 8220 8221 8222 8223 8224 8225 8226 8227 8228 8229 8230 8231 8232 8233 8234 8235 8236 8237 8238 8239 8240 8241 8242 8243 8244 8245 8246 8247 8248 8249 8250 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260 8261 8262 8263 8264 8265 8266 8267 8268 8269 8270 8271 8272 8273 8274 8275 8276 8277 8278 8279 8280 8281 8282 8283 8284 8285 8286 8287 8288 8289 8290 8291 8292 8293 8294 8295 8296 8297 8298 8299 8300 8301 8302 8303 8304 8305 8306 8307 8308 8309 8310 8311 8312 8313 8314 8315 8316 8317 8318 8319 8320 8321 8322 8323 8324 8325 8326 8327 8328 8329 8330 8331 8332 8333 8334 8335 8336 8337 8338 8339 8340 8341 8342 8343 8344 8345 8346 8347 8348 8349 8350 8351 8352 8353 8354 8355 8356 8357 8358 8359 8360 8361 8362 8363 8364 8365 8366 8367 8368 8369 8370 8371 8372 8373 8374 8375 8376 8377 8378 8379 8380 8381 8382 8383 8384 8385 8386 8387 8388 8389 8390 8391 8392 8393 8394 8395 8396 8397 8398 8399 8400 8401 8402 8403 8404 8405 8406 8407 8408 8409 8410 8411 8412 8413 8414 8415 8416 8417 8418 8419 8420 8421 8422 8423 8424 8425 8426 8427 8428 8429 8430 8431 8432 8433 8434 8435 8436 8437 8438 8439 8440 8441 8442 8443 8444 8445 8446 8447 8448 8449 8450 8451 8452 8453 8454 8455 8456 8457 8458 8459 8460 8461 8462 8463 8464 8465 8466 8467 8468 8469 8470 8471 8472 8473 8474 8475 8476 8477 8478 8479 8480 8481 8482 8483 8484 8485 8486 8487 8488 8489 8490 8491 8492 8493 8494 8495 8496 8497 8498 8499 8500 8501 8502 8503 8504 8505 8506 8507 8508 8509 8510 8511 8512 8513 8514 8515 8516 8517 8518 8519 8520 8521 8522 8523 8524 8525 8526 8527 8528 8529 8530 8531 8532 8533 8534 8535 8536 8537 8538 8539 8540 8541 8542 8543 8544 8545 8546 8547 8548 8549 8550 8551 8552 8553 8554 8555 8556 8557 8558 8559 8560 8561 8562 8563 8564 8565 8566 8567 8568 8569 8570 8571 8572 8573 8574 8575 8576 8577 8578 8579 8580 8581 8582 8583 8584 8585 8586 8587 8588 8589 8590 8591 8592 8593 8594 8595 8596 8597 8598 8599 8600 8601 8602 8603 8604 8605 8606 8607 8608 8609 8610 8611 8612 8613 8614 8615 8616 8617 8618 8619 8620 8621 8622 8623 8624 8625 8626 8627 8628 8629 8630 8631 8632 8633 8634 8635 8636 8637 8638 8639 8640 8641 8642 8643 8644 8645 8646 8647 8648 8649 8650 8651 8652 8653 8654 8655 8656 8657 8658 8659 8660 8661 8662 8663 8664 8665 8666 8667 8668 8669 8670 8671 8672 8673 8674 8675 8676 8677 8678 8679 8680 8681 8682 8683 8684 8685 8686 8687 8688 8689 8690 8691 8692 8693 8694 8695 8696 8697 8698 8699 8700 8701 8702 8703 8704 8705 8706 8707 8708 8709 8710 8711 8712 8713 8714 8715 8716 8717 8718 8719 8720 8721 8722 8723 8724 8725 8726 8727 8728 8729 8730 8731 8732 8733 8734 8735 8736 8737 8738 8739 8740 8741 8742 8743 8744 8745 8746 8747 8748 8749 8750 8751 8752 8753 8754 8755 8756 8757 8758 8759 8760 8761 8762 8763 8764 8765 8766 8767 8768 8769 8770 8771 8772 8773 8774 8775 8776 8777 8778 8779 8780 8781 8782 8783 8784 8785 8786 8787 8788 8789 8790 8791 8792 8793 8794 8795 8796 8797 8798 8799 8800 8801 8802 8803 8804 8805 8806 8807 8808 8809 8810 8811 8812 8813 8814 8815 8816 8817 8818 8819 8820 8821 8822 8823 8824 8825 8826 8827 8828 8829 8830 8831 8832 8833 8834 8835 8836 8837 8838 8839 8840 8841 8842 8843 8844 8845 8846 8847 8848 8849 8850 8851 8852 8853 8854 8855 8856 8857 8858 8859 8860 8861 8862 8863 8864 8865 8866 8867 8868 8869 8870 8871 8872 8873 8874 8875 8876 8877 8878 8879 8880 8881 8882 8883 8884 8885 8886 8887 8888 8889 8890 8891 8892 8893 8894 8895 8896 8897 8898 8899 8900 8901 8902 8903 8904 8905 8906 8907 8908 8909 8910 8911 8912 8913 8914 8915 8916 8917 8918 8919 8920 8921 8922 8923 8924 8925 8926 8927 8928 8929 8930 8931 8932 8933 8934 8935 8936 8937 8938 8939 8940 8941 8942 8943 8944 8945 8946 8947 8948 8949 8950 8951 8952 8953 8954 8955 8956 8957 8958 8959 8960 8961 8962 8963 8964 8965 8966 8967 8968 8969 8970 8971 8972 8973 8974 8975 8976 8977 8978 8979 8980 8981 8982 8983 8984 8985 8986 8987 8988 8989 8990 8991 8992 8993 8994 8995 8996 8997 8998 8999 9000 9001 9002 9003 9004 9005 9006 9007 9008 9009 9010 9011 9012 9013 9014 9015 9016 9017 9018 9019 9020 9021 9022 9023 9024 9025 9026 9027 9028 9029 9030 9031 9032 9033 9034 9035 9036 9037 9038 9039 9040 9041 9042 9043 9044 9045 9046 9047 9048 9049 9050 9051 9052 9053 9054 9055 9056 9057 9058 9059 9060 9061 9062 9063 9064 9065 9066 9067 9068 9069 9070 9071 9072 9073 9074 9075 9076 9077 9078 9079 9080 9081 9082 9083 9084 9085 9086 9087 9088 9089 9090 9091 9092 9093 9094 9095 9096 9097 9098 9099 9100 9101 9102 9103 9104 9105 9106 9107 9108 9109 9110 9111 9112 9113 9114 9115 9116 9117 9118 9119 9120 9121 9122 9123 9124 9125 9126 9127 9128 9129 9130 9131 9132 9133 9134 9135 9136 9137 9138 9139 9140 9141 9142 9143 9144 9145 9146 9147 9148 9149 9150 9151 9152 9153 9154 9155 9156 9157 9158 9159 9160 9161 9162 9163 9164 9165 9166 9167 9168 9169 9170 9171 9172 9173 9174 9175 9176 9177 9178 9179 9180 9181 9182 9183 9184 9185 9186 9187 9188 9189 9190 9191 9192 9193 9194 9195 9196 9197 9198 9199 9200 9201 9202 9203 9204 9205 9206 9207 9208 9209 9210 9211 9212 9213 9214 9215 9216 9217 9218 9219 9220 9221 9222 9223 9224 9225 9226 9227 9228 9229 9230 9231 9232 9233 9234 9235 9236 9237 9238 9239 9240 9241 9242 9243 9244 9245 9246 9247 9248 9249 9250 9251 9252 9253 9254 9255 9256 9257 9258 9259 9260 9261 9262 9263 9264 9265 9266 9267 9268 9269 9270 9271 9272 9273 9274 9275 9276 9277 9278 9279 9280 9281 9282 9283 9284 9285 9286 9287 9288 9289 9290 9291 9292 9293 9294 9295 9296 9297 9298 9299 9300 9301 9302 9303 9304 9305 9306 9307 9308 9309 9310 9311 9312 9313 9314 9315 9316 9317 9318 9319 9320 9321 9322 9323 9324 9325 9326 9327 9328 9329 9330 9331 9332 9333 9334 9335 9336 9337 9338 9339 9340 9341 9342 9343 9344 9345 9346 9347 9348 9349 9350 9351 9352 9353 9354 9355 9356 9357 9358 9359 9360 9361 9362 9363 9364 9365 9366 9367 9368 9369 9370 9371 9372 9373 9374 9375 9376 9377 9378 9379 9380 9381 9382 9383 9384 9385 9386 9387 9388 9389 9390 9391 9392 9393 9394 9395 9396 9397 9398 9399 9400 9401 9402 9403 9404 9405 9406 9407 9408 9409 9410 9411 9412 9413 9414 9415 9416 9417 9418 9419 9420 9421 9422 9423 9424 9425 9426 9427 9428 9429 9430 9431 9432 9433 9434 9435 9436 9437 9438 9439 9440 9441 9442 9443 9444 9445 9446 9447 9448 9449 9450 9451 9452 9453 9454 9455 9456 9457 9458 9459 9460 9461 9462 9463 9464 9465 9466 9467 9468 9469 9470 9471 9472 9473 9474 9475 9476 9477 9478 9479 9480 9481 9482 9483 9484 9485 9486 9487 9488 9489 9490 9491 9492 9493 9494 9495 9496 9497 9498 9499 9500 9501 9502 9503 9504 9505 9506 9507 9508 9509 9510 9511 9512 9513 9514 9515 9516 9517 9518 9519 9520 9521 9522 9523 9524 9525 9526 9527 9528 9529 9530 9531 9532 9533 9534 9535 9536 9537 9538 9539 9540 9541 9542 9543 9544 9545 9546 9547 9548 9549 9550 9551 9552 9553 9554 9555 9556 9557 9558 9559 9560 9561 9562 9563 9564 9565 9566 9567 9568 9569 9570 9571 9572 9573 9574 9575 9576 9577 9578 9579 9580 9581 9582 9583 9584 9585 9586 9587 9588 9589 9590 9591 9592 9593 9594 9595 9596 9597 9598 9599 9600 9601 9602 9603 9604 9605 9606 9607 9608 9609 9610 9611 9612 9613 9614 9615 9616 9617 9618 9619 9620 9621 9622 9623 9624 9625 9626 9627 9628 9629 9630 9631 9632 9633 9634 9635 9636 9637 9638 9639 9640 9641 9642 9643 9644 9645 9646 9647 9648 9649 9650 9651 9652 9653 9654 9655 9656 9657 9658 9659 9660 9661 9662 9663 9664 9665 9666 9667 9668 9669 9670 9671 9672 9673 9674 9675 9676 9677 9678 9679 9680 9681 9682 9683 9684 9685 9686 9687 9688 9689 9690 9691 9692 9693 9694 9695 9696 9697 9698 9699 9700 9701 9702 9703 9704 9705 9706 9707 9708 9709 9710 9711 9712 9713 9714 9715 9716 9717 9718 9719 9720 9721 9722 9723 9724 9725 9726 9727 9728 9729 9730 9731 9732 9733 9734 9735 9736 9737 9738 9739 9740 9741 9742 9743 9744 9745 9746 9747 9748 9749 9750 9751 9752 9753 9754 9755 9756 9757 9758 9759 9760 9761 9762 9763 9764 9765 9766 9767 9768 9769 9770 9771 9772 9773 9774 9775 9776 9777 9778 9779 9780 9781 9782 9783 9784 9785 9786 9787 9788 9789 9790 9791 9792 9793 9794 9795 9796 9797 9798 9799 9800 9801 9802 9803 9804 9805 9806 9807 9808 9809 9810 9811 9812 9813 9814 9815 9816 9817 9818 9819 9820 9821 9822 9823 9824 9825 9826 9827 9828 9829 9830 9831 9832 9833 9834 9835 9836 9837 9838 9839 9840 9841 9842 9843 9844 9845 9846 9847 9848 9849 9850 9851 9852 9853 9854 9855 9856 9857 9858 9859 9860 9861 9862 9863 9864 9865 9866 9867 9868 9869 9870 9871 9872 9873 9874 9875 9876 9877 9878 9879 9880 9881 9882 9883 9884 9885 9886 9887 9888 9889 9890 9891 9892 9893 9894 9895 9896 9897 9898 9899 9900 9901 9902 9903 9904 9905 9906 9907 9908 9909 9910 9911 9912 9913 9914 9915 9916 9917 9918 9919 9920 9921 9922 9923 9924 9925 9926 9927 9928 9929 9930 9931 9932 9933 9934 9935 9936 9937 9938 9939 9940 9941 9942 9943 9944 9945 9946 9947 9948 9949 9950 9951 9952 9953 9954 9955 9956 9957 9958 9959 9960 9961 9962 9963 9964 9965 9966 9967 9968 9969 9970 9971 9972 9973 9974 9975 9976 9977 9978 9979 9980 9981 9982 9983 9984 9985 9986 9987 9988 9989 9990 9991 9992 9993 9994 9995 9996 9997 9998 9999 10000 10001 10002 10003 10004 10005 10006 10007 10008 10009 10010 10011 10012 10013 10014 10015 10016 10017 10018 10019 10020 10021 10022 10023 10024 10025 10026 10027 10028 10029 10030 10031 10032 10033 10034 10035 10036 10037 10038 10039 10040 10041 10042 10043 10044 10045 10046 10047 10048 10049 10050 10051 10052 10053 10054 10055 10056 10057 10058 10059 10060 10061 10062 10063 10064 10065 10066 10067 10068 10069 10070 10071 10072 10073 10074 10075 10076 10077 10078 10079 10080 10081 10082 10083 10084 10085 10086 10087 10088 10089 10090 10091 10092 10093 10094 10095 10096 10097 10098 10099 10100 10101 10102 10103 10104 10105 10106 10107 10108 10109 10110 10111 10112 10113 10114 10115 10116 10117 10118 10119 10120 10121 10122 10123 10124 10125 10126 10127 10128 10129 10130 10131 10132 10133 10134 10135 10136 10137 10138 10139 10140 10141 10142 10143 10144 10145 10146 10147 10148 10149 10150 10151 10152 10153 10154 10155 10156 10157 10158 10159 10160 10161 10162 10163 10164 10165 10166 10167 10168 10169 10170 10171 10172 10173 10174 10175 10176 10177 10178 10179 10180 10181 10182 10183 10184 10185 10186 10187 10188 10189 10190 10191 10192 10193 10194 10195 10196 10197 10198 10199 10200 10201 10202 10203 10204 10205 10206 10207 10208 10209 10210 10211 10212 10213 10214 10215 10216 10217 10218 10219 10220 10221 10222 10223 10224 10225 10226 10227 10228 10229 10230 10231 10232 10233 10234 10235 10236 10237 10238 10239 10240 10241 10242 10243 10244 10245 10246 10247 10248 10249 10250 10251 10252 10253 10254 10255 10256 10257 10258 10259 10260 10261 10262 10263 10264 10265 10266 10267 10268 10269 10270 10271 10272 10273 10274 10275 10276 10277 10278 10279 10280 10281 10282 10283 10284 10285 10286 10287 10288 10289 10290 10291 10292 10293 10294 10295 10296 10297 10298 10299 10300 10301 10302 10303 10304 10305 10306 10307 10308 10309 10310 10311 10312 10313 10314 10315 10316 10317 10318 10319 10320 10321 10322 10323 10324 10325 10326 10327 10328 10329 10330 10331 10332 10333 10334 10335 10336 10337 10338 10339 10340 10341 10342 10343 10344 10345 10346 10347 10348 10349 10350 10351 10352 10353 10354 10355 10356 10357 10358 10359 10360 10361 10362 10363 10364 10365 10366 10367 10368 10369 10370 10371 10372 10373 10374 10375 10376 10377 10378 10379 10380 10381 10382 10383 10384 10385 10386 10387 10388 10389 10390 10391 10392 10393 10394 10395 10396 10397 10398 10399 10400 10401 10402 10403 10404 10405 10406 10407 10408 10409 10410 10411 10412 10413 10414 10415 10416 10417 10418 10419 10420 10421 10422 10423 10424 10425 10426 10427 10428 10429 10430 10431 10432 10433 10434 10435 10436 10437 10438 10439 10440 10441 10442 10443 10444 10445 10446 10447 10448 10449 10450 10451 10452 10453 10454 10455 10456 10457 10458 10459 10460 10461 10462 10463 10464 10465 10466 10467 10468 10469 10470 10471 10472 10473 10474 10475 10476 10477 10478 10479 10480 10481 10482 10483 10484 10485 10486 10487 10488 10489 10490 10491 10492 10493 10494 10495 10496 10497 10498 10499 10500 10501 10502 10503 10504 10505 10506 10507 10508 10509 10510 10511 10512 10513 10514 10515 10516 10517 10518 10519 10520 10521 10522 10523 10524 10525 10526 10527 10528 10529 10530 10531 10532 10533 10534 10535 10536 10537 10538 10539 10540 10541 10542 10543 10544 10545 10546 10547 10548 10549 10550 10551 10552 10553 10554 10555 10556 10557 10558 10559 10560 10561 10562 10563 10564 10565 10566 10567 10568 10569 10570 10571 10572 10573 10574 10575 10576 10577 10578 10579 10580 10581 10582 10583 10584 10585 10586 10587 10588 10589 10590 10591 10592 10593 10594 10595 10596 10597 10598 10599 10600 10601 10602 10603 10604 10605 10606 10607 10608 10609 10610 10611 10612 10613 10614 10615 10616 10617 10618 10619 10620 10621 10622 10623 10624 10625 10626 10627 10628 10629 10630 10631 10632 10633 10634 10635 10636 10637 10638 10639 10640 10641 10642 10643 10644 10645 10646 10647 10648 10649 10650 10651 10652 10653 10654 10655 10656 10657 10658 10659 10660 10661 10662 10663 10664 10665 10666 10667 10668 10669 10670 10671 10672 10673 10674 10675 10676 10677 10678 10679 10680 10681 10682 10683 10684 10685 10686 10687 10688 10689 10690 10691 10692 10693 10694 10695 10696 10697 10698 10699 10700 10701 10702 10703 10704 10705 10706 10707 10708 10709 10710 10711 10712 10713 10714 10715 10716 10717 10718 10719 10720 10721 10722 10723 10724 10725 10726 10727 10728 10729 10730 10731 10732 10733 10734 10735 10736 10737 10738 10739 10740 10741 10742 10743 10744 10745 10746 10747 10748 10749 10750 10751 10752 10753 10754 10755 10756 10757 10758 10759 10760 10761 10762 10763 10764 10765 10766 10767 10768 10769 10770 10771 10772 10773 10774 10775 10776 10777 10778 10779 10780 10781 10782 10783 10784 10785 10786 10787 10788 10789 10790 10791 10792 10793 10794 10795 10796 10797 10798 10799 10800 10801 10802 10803 10804 10805 10806 10807 10808 10809 10810 10811 10812 10813 10814 10815 10816 10817 10818 10819 10820 10821 10822 10823 10824 10825 10826 10827 10828 10829 10830 10831 10832 10833 10834 10835 10836 10837 10838 10839 10840 10841 10842 10843 10844 10845 10846 10847 10848 10849 10850 10851 10852 10853 10854 10855 10856 10857 10858 10859 10860 10861 10862 10863 10864 10865 10866 10867 10868 10869 10870 10871 10872 10873 10874 10875 10876 10877 10878 10879 10880 10881 10882 10883 10884 10885 10886 10887 10888 10889 10890 10891 10892 10893 10894 10895 10896 10897 10898 10899 10900 10901 10902 10903 10904 10905 10906 10907 10908 10909 10910 10911 10912 10913 10914 10915 10916 10917 10918 10919 10920 10921 10922 10923 10924 10925 10926 10927 10928 10929 10930 10931 10932 10933 10934 10935 10936 10937 10938 10939 10940 10941 10942 10943 10944 10945 10946 10947 10948 10949 10950 10951 10952 10953 10954 10955 10956 10957 10958 10959 10960 10961 10962 10963 10964 10965 10966 10967 10968 10969 10970 10971 10972 10973 10974 10975 10976 10977 10978 10979 10980 10981 10982 10983 10984 10985 10986 10987 10988 10989 10990 10991 10992 10993 10994 10995 10996 10997 10998 10999 11000 11001 11002 11003 11004 11005 11006 11007 11008 11009 11010 11011 11012 11013 11014 11015 11016 11017 11018 11019 11020 11021 11022 11023 11024 11025 11026 11027 11028 11029 11030 11031 11032 11033 11034 11035 11036 11037 11038 11039 11040 11041 11042 11043 11044 11045 11046 11047 11048 11049 11050 11051 11052 11053 11054 11055 11056 11057 11058 11059 11060 11061 11062 11063 11064 11065 11066 11067 11068 11069 11070 11071 11072 11073 11074 11075 11076 11077 11078 11079 11080 11081 11082 11083 11084 11085 11086 11087 11088 11089 11090 11091 11092 11093 11094 11095 11096 11097 11098 11099 11100 11101 11102 11103 11104 11105 11106 11107 11108 11109 11110 11111 11112 11113 11114 11115 11116 11117 11118 11119 11120 11121 11122 11123 11124 11125 11126 11127 11128 11129 11130 11131 11132 11133 11134 11135 11136 11137 11138 11139 11140 11141 11142 11143 11144 11145 11146 11147 11148 11149 11150 11151 11152 11153 11154 11155 11156 11157 11158 11159 11160 11161 11162 11163 11164 11165 11166 11167 11168 11169 11170 11171 11172 11173 11174 11175 11176 11177 11178 11179 11180 11181 11182 11183 11184 11185 11186 11187 11188 11189 11190 11191 11192 11193 11194 11195 11196 11197 11198 11199 11200 11201 11202 11203 11204 11205 11206 11207 11208 11209 11210 11211 11212 11213 11214 11215 11216 11217 11218 11219 11220 11221 11222 11223 11224 11225 11226 11227 11228 11229 11230 11231 11232 11233 11234 11235 11236 11237 11238 11239 11240 11241 11242 11243 11244 11245 11246 11247 11248 11249 11250 11251 11252 11253 11254 11255 11256 11257 11258 11259 11260 11261 11262 11263 11264 11265 11266 11267 11268 11269 11270 11271 11272 11273 11274 11275 11276 11277 11278 11279 11280 11281 11282 11283 11284 11285 11286 11287 11288 11289 11290 11291 11292 11293 11294 11295 11296 11297 11298 11299 11300 11301 11302 11303 11304 11305 11306 11307 11308 11309 11310 11311 11312 11313 11314 11315 11316 11317 11318 11319 11320 11321 11322 11323 11324 11325 11326 11327 11328 11329 11330 11331 11332 11333 11334 11335 11336 11337 11338 11339 11340 11341 11342 11343 11344 11345 11346 11347 11348 11349 11350 11351 11352 11353 11354 11355 11356 11357 11358 11359 11360 11361 11362 11363 11364 11365 11366 11367 11368 11369 11370 11371 11372 11373 11374 11375 11376 11377 11378 11379 11380 11381 11382 11383 11384 11385 11386 11387 11388 11389 11390 11391 11392 11393 11394 11395 11396 11397 11398 11399 11400 11401 11402 11403 11404 11405 11406 11407 11408 11409 11410 11411 11412 11413 11414 11415 11416 11417 11418 11419 11420 11421 11422 11423 11424 11425 11426 11427 11428 11429 11430 11431 11432 11433 11434 11435 11436 11437 11438 11439 11440 11441 11442 11443 11444 11445 11446 11447 11448 11449 11450 11451 11452 11453 11454 11455 11456 11457 11458 11459 11460 11461 11462 11463 11464 11465 11466 11467 11468 11469 11470 11471 11472 11473 11474 11475 11476 11477 11478 11479 11480 11481 11482 11483 11484 11485 11486 11487 11488 11489 11490 11491 11492 11493 11494 11495 11496 11497 11498 11499 11500 11501 11502 11503 11504 11505 11506 11507 11508 11509 11510 11511 11512 11513 11514 11515 11516 11517 11518 11519 11520 11521 11522 11523 11524 11525 11526 11527 11528 11529 11530 11531 11532 11533 11534 11535 11536 11537 11538 11539 11540 11541 11542 11543 11544 11545 11546 11547 11548 11549 11550 11551 11552 11553 11554 11555 11556 11557 11558 11559 11560 11561 11562 11563 11564 11565 11566 11567 11568 11569 11570 11571 11572 11573 11574 11575 11576 11577 11578 11579 11580 11581 11582 11583 11584 11585 11586 11587 11588 11589 11590 11591 11592 11593 11594 11595 11596 11597 11598 11599 11600 11601 11602 11603 11604 11605 11606 11607 11608 11609 11610 11611 11612 11613 11614 11615 11616 11617 11618 11619 11620 11621 11622 11623 11624 11625 11626 11627 11628 11629 11630 11631 11632 11633 11634 11635 11636 11637 11638 11639 11640 11641 11642 11643 11644 11645 11646 11647 11648 11649 11650 11651 11652 11653 11654 11655 11656 11657 11658 11659 11660 11661 11662 11663 11664 11665 11666 11667 11668 11669 11670 11671 11672 11673 11674 11675 11676 11677 11678 11679 11680 11681 11682 11683 11684 11685 11686 11687 11688 11689 11690 11691 11692 11693 11694 11695 11696 11697 11698 11699 11700 11701 11702 11703 11704 11705 11706 11707 11708 11709 11710 11711 11712 11713 11714 11715 11716 11717 11718 11719 11720 11721 11722 11723 11724 11725 11726 11727 11728 11729 11730 11731 11732 11733 11734 11735 11736 11737 11738 11739 11740 11741 11742 11743 11744 11745 11746 11747 11748 11749 11750 11751 11752 11753 11754 11755 11756 11757 11758 11759 11760 11761 11762 11763 11764 11765 11766 11767 11768 11769 11770 11771 11772 11773 11774 11775 11776 11777 11778 11779 11780 11781 11782 11783 11784 11785 11786 11787 11788 11789 11790 11791 11792 11793 11794 11795 11796 11797 11798 11799 11800 11801 11802 11803 11804 11805 11806 11807 11808 11809 11810 11811 11812 11813 11814 11815 11816 11817 11818 11819 11820 11821 11822 11823 11824 11825 11826 11827 11828 11829 11830 11831 11832 11833 11834 11835 11836 11837 11838 11839 11840 11841 11842 11843 11844 11845 11846 11847 11848 11849 11850 11851 11852 11853 11854 11855 11856 11857 11858 11859 11860 11861 11862 11863 11864 11865 11866 11867 11868 11869 11870 11871 11872 11873 11874 11875 11876 11877 11878 11879 11880 11881 11882 11883 11884 11885 11886 11887 11888 11889 11890 11891 11892 11893 11894 11895 11896 11897 11898 11899 11900 11901 11902 11903 11904 11905 11906 11907 11908 11909 11910 11911 11912 11913 11914 11915 11916 11917 11918 11919 11920 11921 11922 11923 11924 11925 11926 11927 11928 11929 11930 11931 11932 11933 11934 11935 11936 11937 11938 11939 11940 11941 11942 11943 11944 11945 11946 11947 11948 11949 11950 11951 11952 11953 11954 11955 11956 11957 11958 11959 11960 11961 11962 11963 11964 11965 11966 11967 11968 11969 11970 11971 11972 11973 11974 11975 11976 11977 11978 11979 11980 11981 11982 11983 11984 11985 11986 11987 11988 11989 11990 11991 11992 11993 11994 11995 11996 11997 11998 11999 12000 12001 12002 12003 12004 12005 12006 12007 12008 12009 12010 12011 12012 12013 12014 12015 12016 12017 12018 12019 12020 12021 12022 12023 12024 12025 12026 12027 12028 12029 12030 12031 12032 12033 12034 12035 12036 12037 12038 12039 12040 12041 12042 12043 12044 12045 12046 12047 12048 12049 12050 12051 12052 12053 12054 12055 12056 12057 12058 12059 12060 12061 12062 12063 12064 12065 12066 12067 12068 12069 12070 12071 12072 12073 12074 12075 12076 12077 12078 12079 12080 12081 12082 12083 12084 12085 12086 12087 12088 12089 12090 12091 12092 12093 12094 12095 12096 12097 12098 12099 12100 12101 12102 12103 12104 12105 12106 12107 12108 12109 12110 12111 12112 12113 12114 12115 12116 12117 12118 12119 12120 12121 12122 12123 12124 12125 12126 12127 12128 12129 12130 12131 12132 12133 12134 12135 12136 12137 12138 12139 12140 12141 12142 12143 12144 12145 12146 12147 12148 12149 12150 12151 12152 12153 12154 12155 12156 12157 12158 12159 12160 12161 12162 12163 12164 12165 12166 12167 12168 12169 12170 12171 12172 12173 12174 12175 12176 12177 12178 12179 12180 12181 12182 12183 12184 12185 12186 12187 12188 12189 12190 12191 12192 12193 12194 12195 12196 12197 12198 12199 12200 12201 12202 12203 12204 12205 12206 12207 12208 12209 12210 12211 12212 12213 12214 12215 12216 12217 12218 12219 12220 12221 12222 12223 12224 12225 12226 12227 12228 12229 12230 12231 12232 12233 12234 12235 12236 12237 12238 12239 12240 12241 12242 12243 12244 12245 12246 12247 12248 12249 12250 12251 12252 12253 12254 12255 12256 12257 12258 12259 12260 12261 12262 12263 12264 12265 12266 12267 12268 12269 12270 12271 12272 12273 12274 12275 12276 12277 12278 12279 12280 12281 12282 12283 12284 12285 12286 12287 12288 12289 12290 12291 12292 12293 12294 12295 12296 12297 12298 12299 12300 12301 12302 12303 12304 12305 12306 12307 12308 12309 12310 12311 12312 12313 12314 12315 12316 12317 12318 12319 12320 12321 12322 12323 12324 12325 12326 12327 12328 12329 12330 12331 12332 12333 12334 12335 12336 12337 12338 12339 12340 12341 12342 12343 12344 12345 12346 12347 12348 12349 12350 12351 12352 12353 12354 12355 12356 12357 12358 12359 12360 12361 12362 12363 12364 12365 12366 12367 12368 12369 12370 12371 12372 12373 12374 12375 12376 12377 12378 12379 12380 12381 12382 12383 12384 12385 12386 12387 12388 12389 12390 12391 12392 12393 12394 12395 12396 12397 12398 12399 12400 12401 12402 12403 12404 12405 12406 12407 12408 12409 12410 12411 12412 12413 12414 12415 12416 12417 12418 12419 12420 12421 12422 12423 12424 12425 12426 12427 12428 12429 12430 12431 12432 12433 12434 12435 12436 12437 12438 12439 12440 12441 12442 12443 12444 12445 12446 12447 12448 12449 12450 12451 12452 12453 12454 12455 12456 12457 12458 12459 12460 12461 12462 12463 12464 12465 12466 12467 12468 12469 12470 12471 12472 12473 12474 12475 12476 12477 12478 12479 12480 12481 12482 12483 12484 12485 12486 12487 12488 12489 12490 12491 12492 12493 12494 12495 12496 12497 12498 12499 12500 12501 12502 12503 12504 12505 12506 12507 12508 12509 12510 12511 12512 12513 12514 12515 12516 12517 12518 12519 12520 12521 12522 12523 12524 12525 12526 12527 12528 12529 12530 12531 12532 12533 12534 12535 12536 12537 12538 12539 12540 12541 12542 12543 12544 12545 12546 12547 12548 12549 12550 12551 12552 12553 12554 12555 12556 12557 12558 12559 12560 12561 12562 12563 12564 12565 12566 12567 12568 12569 12570 12571 12572 12573 12574 12575 12576 12577 12578 12579 12580 12581 12582 12583 12584 12585 12586 12587 12588 12589 12590 12591 12592 12593 12594 12595 12596 12597 12598 12599 12600 12601 12602 12603 12604 12605 12606 12607 12608 12609 12610 12611 12612 12613 12614 12615 12616 12617 12618 12619 12620 12621 12622 12623 12624 12625 12626 12627 12628 12629 12630 12631 12632 12633 12634 12635 12636 12637 12638 12639 12640 12641 12642 12643 12644 12645 12646 12647 12648 12649 12650 12651 12652 12653 12654 12655 12656 12657 12658 12659 12660 12661 12662 12663 12664 12665 12666 12667 12668 12669 12670 12671 12672 12673 12674 12675 12676 12677 12678 12679 12680 12681 12682 12683 12684 12685 12686 12687 12688 12689 12690 12691 12692 12693 12694 12695 12696 12697 12698 12699 12700 12701 12702 12703 12704 12705 12706 12707 12708 12709 12710 12711 12712 12713 12714 12715 12716 12717 12718 12719 12720 12721 12722 12723 12724 12725 12726 12727 12728 12729 12730 12731 12732 12733 12734 12735 12736 12737 12738 12739 12740 12741 12742 12743 12744 12745 12746 12747 12748 12749 12750 12751 12752 12753 12754 12755 12756 12757 12758 12759 12760 12761 12762 12763 12764 12765 12766 12767 12768 12769 12770 12771 12772 12773 12774 12775 12776 12777 12778 12779 12780 12781 12782 12783 12784 12785 12786 12787 12788 12789 12790 12791 12792 12793 12794 12795 12796 12797 12798 12799 12800 12801 12802 12803 12804 12805 12806 12807 12808 12809 12810 12811 12812 12813 12814 12815 12816 12817 12818 12819 12820 12821 12822 12823 12824 12825 12826 12827 12828 12829 12830 12831 12832 12833 12834 12835 12836 12837 12838 12839 12840 12841 12842 12843 12844 12845 12846 12847 12848 12849 12850 12851 12852 12853 12854 12855 12856 12857 12858 12859 12860 12861 12862 12863 12864 12865 12866 12867 12868 12869 12870 12871 12872 12873 12874 12875 12876 12877 12878 12879 12880 12881 12882 12883 12884 12885 12886 12887 12888 12889 12890 12891 12892 12893 12894 12895 12896 12897 12898 12899 12900 12901 12902 12903 12904 12905 12906 12907 12908 12909 12910 12911 12912 12913 12914 12915 12916 12917 12918 12919 12920 12921 12922 12923 12924 12925 12926 12927 12928 12929 12930 12931 12932 12933 12934 12935 12936 12937 12938 12939 12940 12941 12942 12943 12944 12945 12946 12947 12948 12949 12950 12951 12952 12953 12954 12955 12956 12957 12958 12959 12960 12961 12962 12963 12964 12965 12966 12967 12968 12969 12970 12971 12972 12973 12974 12975 12976 12977 12978 12979 12980 12981 12982 12983 12984 12985 12986 12987 12988 12989 12990 12991 12992 12993 12994 12995 12996 12997 12998 12999 13000 13001 13002 13003 13004 13005 13006 13007 13008 13009 13010 13011 13012 13013 13014 13015 13016 13017 13018 13019 13020 13021 13022 13023 13024 13025 13026 13027 13028 13029 13030 13031 13032 13033 13034 13035 13036 13037 13038 13039 13040 13041 13042 13043 13044 13045 13046 13047 13048 13049 13050 13051 13052 13053 13054 13055 13056 13057 13058 13059 13060 13061 13062 13063 13064 13065 13066 13067 13068 13069 13070 13071 13072 13073 13074 13075 13076 13077 13078 13079 13080 13081 13082 13083 13084 13085 13086 13087 13088 13089 13090 13091 13092 13093 13094 13095 13096 13097 13098 13099 13100 13101 13102 13103 13104 13105 13106 13107 13108 13109 13110 13111 13112 13113 13114 13115 13116 13117 13118 13119 13120 13121 13122 13123 13124 13125 13126 13127 13128 13129 13130 13131 13132 13133 13134 13135 13136 13137 13138 13139 13140 13141 13142 13143 13144 13145 13146 13147 13148 13149 13150 13151 13152 13153 13154 13155 13156 13157 13158 13159 13160 13161 13162 13163 13164 13165 13166 13167 13168 13169 13170 13171 13172 13173 13174 13175 13176 13177 13178 13179 13180 13181 13182 13183 13184 13185 13186 13187 13188 13189 13190 13191 13192 13193 13194 13195 13196 13197 13198 13199 13200 13201 13202 13203 13204 13205 13206 13207 13208 13209 13210 13211 13212 13213 13214 13215 13216 13217 13218 13219 13220 13221 13222 13223 13224 13225 13226 13227 13228 13229 13230 13231 13232 13233 13234 13235 13236 13237 13238 13239 13240 13241 13242 13243 13244 13245 13246 13247 13248 13249 13250 13251 13252 13253 13254 13255 13256 13257 13258 13259 13260 13261 13262 13263 13264 13265 13266 13267 13268 13269 13270 13271 13272 13273 13274 13275 13276 13277 13278 13279 13280 13281 13282 13283 13284 13285 13286 13287 13288 13289 13290 13291 13292 13293 13294 13295 13296 13297 13298 13299 13300 13301 13302 13303 13304 13305 13306 13307 13308 13309 13310 13311 13312 13313 13314 13315 13316 13317 13318 13319 13320 13321 13322 13323 13324 13325 13326 13327 13328 13329 13330 13331 13332 13333 13334 13335 13336 13337 13338 13339 13340 13341 13342 13343 13344 13345 13346 13347 13348 13349 13350 13351 13352 13353 13354 13355 13356 13357 13358 13359 13360 13361 13362 13363 13364 13365 13366 13367 13368 13369 13370 13371 13372 13373 13374 13375 13376 13377 13378 13379 13380 13381 13382 13383 13384 13385 13386 13387 13388 13389 13390 13391 13392 13393 13394 13395 13396 13397 13398 13399 13400 13401 13402 13403 13404 13405 13406 13407 13408 13409 13410 13411 13412 13413 13414 13415 13416 13417 13418 13419 13420 13421 13422 13423 13424 13425 13426 13427 13428 13429 13430 13431 13432 13433 13434 13435 13436 13437 13438 13439 13440 13441 13442 13443 13444 13445 13446 13447 13448 13449 13450 13451 13452 13453 13454 13455 13456 13457 13458 13459 13460 13461 13462 13463 13464 13465 13466 13467 13468 13469 13470 13471 13472 13473 13474 13475 13476 13477 13478 13479 13480 13481 13482 13483 13484 13485 13486 13487 13488 13489 13490 13491 13492 13493 13494 13495 13496 13497 13498 13499 13500 13501 13502 13503 13504 13505 13506 13507 13508 13509 13510 13511 13512 13513 13514 13515 13516 13517 13518 13519 13520 13521 13522 13523 13524 13525 13526 13527 13528 13529 13530 13531 13532 13533 13534 13535 13536 13537 13538 13539 13540 13541 13542 13543 13544 13545 13546 13547 13548 13549 13550 13551 13552 13553 13554 13555 13556 13557 13558 13559 13560 13561 13562 13563 13564 13565 13566 13567 13568 13569 13570 13571 13572 13573 13574 13575 13576 13577 13578 13579 13580 13581 13582 13583 13584 13585 13586 13587 13588 13589 13590 13591 13592 13593 13594 13595 13596 13597 13598 13599 13600 13601 13602 13603 13604 13605 13606 13607 13608 13609 13610 13611 13612 13613 13614 13615 13616 13617 13618 13619 13620 13621 13622 13623 13624 13625 13626 13627 13628 13629 13630 13631 13632 13633 13634 13635 13636 13637 13638 13639 13640 13641 13642 13643 13644 13645 13646 13647 13648 13649 13650 13651 13652 13653 13654 13655 13656 13657 13658 13659 13660 13661 13662 13663 13664 13665 13666 13667 13668 13669 13670 13671 13672 13673 13674 13675 13676 13677 13678 13679 13680 13681 13682 13683 13684 13685 13686 13687 13688 13689 13690 13691 13692 13693 13694 13695 13696 13697 13698 13699 13700 13701 13702 13703 13704 13705 13706 13707 13708 13709 13710 13711 13712 13713 13714 13715 13716 13717 13718 13719 13720 13721 13722 13723 13724 13725 13726 13727 13728 13729 13730 13731 13732 13733 13734 13735 13736 13737 13738 13739 13740 13741 13742 13743 13744 13745 13746 13747 13748 13749 13750 13751 13752 13753 13754 13755 13756 13757 13758 13759 13760 13761 13762 13763 13764 13765 13766 13767 13768 13769 13770 13771 13772 13773 13774 13775 13776 13777 13778 13779 13780 13781 13782 13783 13784 13785 13786 13787 13788 13789 13790 13791 13792 13793 13794 13795 13796 13797 13798 13799 13800 13801 13802 13803 13804 13805 13806 13807 13808 13809 13810 13811 13812 13813 13814 13815 13816 13817 13818 13819 13820 13821 13822 13823 13824 13825 13826 13827 13828 13829 13830 13831 13832 13833 13834 13835 13836 13837 13838 13839 13840 13841 13842 13843 13844 13845 13846 13847 13848 13849 13850 13851 13852 13853 13854 13855 13856 13857 13858 13859 13860 13861 13862 13863 13864 13865 13866 13867 13868 13869 13870 13871 13872 13873 13874 13875 13876 13877 13878 13879 13880 13881 13882 13883 13884 13885 13886 13887 13888 13889 13890 13891 13892 13893 13894 13895 13896 13897 13898 13899 13900 13901 13902 13903 13904 13905 13906 13907 13908 13909 13910 13911 13912 13913 13914 13915 13916 13917 13918 13919 13920 13921 13922 13923 13924 13925 13926 13927 13928 13929 13930 13931 13932 13933 13934 13935 13936 13937 13938 13939 13940 13941 13942 13943 13944 13945 13946 13947 13948 13949 13950 13951 13952 13953 13954 13955 13956 13957 13958 13959 13960 13961 13962 13963 13964 13965 13966 13967 13968 13969 13970 13971 13972 13973 13974 13975 13976 13977 13978 13979 13980 13981 13982 13983 13984 13985 13986 13987 13988 13989 13990 13991 13992 13993 13994 13995 13996 13997 13998 13999 14000 14001 14002 14003 14004 14005 14006 14007 14008 14009 14010 14011 14012 14013 14014 14015 14016 14017 14018 14019 14020 14021 14022 14023 14024 14025 14026 14027 14028 14029 14030 14031 14032 14033 14034 14035 14036 14037 14038 14039 14040 14041 14042 14043 14044 14045 14046 14047 14048 14049 14050 14051 14052 14053 14054 14055 14056 14057 14058 14059 14060 14061 14062 14063 14064 14065 14066 14067 14068 14069 14070 14071 14072 14073 14074 14075 14076 14077 14078 14079 14080 14081 14082 14083 14084 14085 14086 14087 14088 14089 14090 14091 14092 14093 14094 14095 14096 14097 14098 14099 14100 14101 14102 14103 14104 14105 14106 14107 14108 14109 14110 14111 14112 14113 14114 14115 14116 14117 14118 14119 14120 14121 14122 14123 14124 14125 14126 14127 14128 14129 14130 14131 14132 14133 14134 14135 14136 14137 14138 14139 14140 14141 14142 14143 14144 14145 14146 14147 14148 14149 14150 14151 14152 14153 14154 14155 14156 14157 14158 14159 14160 14161 14162 14163 14164 14165 14166 14167 14168 14169 14170 14171 14172 14173 14174 14175 14176 14177 14178 14179 14180 14181 14182 14183 14184 14185 14186 14187 14188 14189 14190 14191 14192 14193 14194 14195 14196 14197 14198 14199 14200 14201 14202 14203 14204 14205 14206 14207 14208 14209 14210 14211 14212 14213 14214 14215 14216 14217 14218 14219 14220 14221 14222 14223 14224 14225 14226 14227 14228 14229 14230 14231 14232 14233 14234 14235 14236 14237 14238 14239 14240 14241 14242 14243 14244 14245 14246 14247 14248 14249 14250 14251 14252 14253 14254 14255 14256 14257 14258 14259 14260 14261 14262 14263 14264 14265 14266 14267 14268 14269 14270 14271 14272 14273 14274 14275 14276 14277 14278 14279 14280 14281 14282 14283 14284 14285 14286 14287 14288 14289 14290 14291 14292 14293 14294 14295 14296 14297 14298 14299 14300 14301 14302 14303 14304 14305 14306 14307 14308 14309 14310 14311 14312 14313 14314 14315 14316 14317 14318 14319 14320 14321 14322 14323 14324 14325 14326 14327 14328 14329 14330 14331 14332 14333 14334 14335 14336 14337 14338 14339 14340 14341 14342 14343 14344 14345 14346 14347 14348 14349 14350 14351 14352 14353 14354 14355 14356 14357 14358 14359 14360 14361 14362 14363 14364 14365 14366 14367 14368 14369 14370 14371 14372 14373 14374 14375 14376 14377 14378 14379 14380 14381 14382 14383 14384 14385 14386 14387 14388 14389 14390 14391 14392 14393 14394 14395 14396 14397 14398 14399 14400 14401 14402 14403 14404 14405 14406 14407 14408 14409 14410 14411 14412 14413 14414 14415 14416 14417 14418 14419 14420 14421 14422 14423 14424 14425 14426 14427 14428 14429 14430 14431 14432 14433 14434 14435 14436 14437 14438 14439 14440 14441 14442 14443 14444 14445 14446 14447 14448 14449 14450 14451 14452 14453 14454 14455 14456 14457 14458 14459 14460 14461 14462 14463 14464 14465 14466 14467 14468 14469 14470 14471 14472 14473 14474 14475 14476 14477 14478 14479 14480 14481 14482 14483 14484 14485 14486 14487 14488 14489 14490 14491 14492 14493 14494 14495 14496 14497 14498 14499 14500 14501 14502 14503 14504 14505 14506 14507 14508 14509 14510 14511 14512 14513 14514 14515 14516 14517 14518 14519 14520 14521 14522 14523 14524 14525 14526 14527 14528 14529 14530 14531 14532 14533 14534 14535 14536 14537 14538 14539 14540 14541 14542 14543 14544 14545 14546 14547 14548 14549 14550 14551 14552 14553 14554 14555 14556 14557 14558 14559 14560 14561 14562 14563 14564 14565 14566 14567 14568 14569 14570 14571 14572 14573 14574 14575 14576 14577 14578 14579 14580 14581 14582 14583 14584 14585 14586 14587 14588 14589 14590 14591 14592 14593 14594 14595 14596 14597 14598 14599 14600 14601 14602 14603 14604 14605 14606 14607 14608 14609 14610 14611 14612 14613 14614 14615 14616 14617 14618 14619 14620 14621 14622 14623 14624 14625 14626 14627 14628 14629 14630 14631 14632 14633 14634 14635 14636 14637 14638 14639 14640 14641 14642 14643 14644 14645 14646 14647 14648 14649 14650 14651 14652 14653 14654 14655 14656 14657 14658 14659 14660 14661 14662 14663 14664 14665 14666 14667 14668 14669 14670 14671 14672 14673 14674 14675 14676 14677 14678 14679 14680 14681 14682 14683 14684 14685 14686 14687 14688 14689 14690 14691 14692 14693 14694 14695 14696 14697 14698 14699 14700 14701 14702 14703 14704 14705 14706 14707 14708 14709 14710 14711 14712 14713 14714 14715 14716 14717 14718 14719 14720 14721 14722 14723 14724 14725 14726 14727 14728 14729 14730 14731 14732 14733 14734 14735 14736 14737 14738 14739 14740 14741 14742 14743 14744 14745 14746 14747 14748 14749 14750 14751 14752 14753 14754 14755 14756 14757 14758 14759 14760 14761 14762 14763 14764 14765 14766 14767 14768 14769 14770 14771 14772 14773 14774 14775 14776 14777 14778 14779 14780 14781 14782 14783 14784 14785 14786 14787 14788 14789 14790 14791 14792 14793 14794 14795 14796 14797 14798 14799 14800 14801 14802 14803 14804 14805 14806 14807 14808 14809 14810 14811 14812 14813 14814 14815 14816 14817 14818 14819 14820 14821 14822 14823 14824 14825 14826 14827 14828 14829 14830 14831 14832 14833 14834 14835 14836 14837 14838 14839 14840 14841 14842 14843 14844 14845 14846 14847 14848 14849 14850 14851 14852 14853 14854 14855 14856 14857 14858 14859 14860 14861 14862 14863 14864 14865 14866 14867 14868 14869 14870 14871 14872 14873 14874 14875 14876 14877 14878 14879 14880 14881 14882 14883 14884 14885 14886 14887 14888 14889 14890 14891 14892 14893 14894 14895 14896 14897 14898 14899 14900 14901 14902 14903 14904 14905 14906 14907 14908 14909 14910 14911 14912 14913 14914 14915 14916 14917 14918 14919 14920 14921 14922 14923 14924 14925 14926 14927 14928 14929 14930 14931 14932 14933 14934 14935 14936 14937 14938 14939 14940 14941 14942 14943 14944 14945 14946 14947 14948 14949 14950 14951 14952 14953 14954 14955 14956 14957 14958 14959 14960 14961 14962 14963 14964 14965 14966 14967 14968 14969 14970 14971 14972 14973 14974 14975 14976 14977 14978 14979 14980 14981 14982 14983 14984 14985 14986 14987 14988 14989 14990 14991 14992 14993 14994 14995 14996 14997 14998 14999 15000 15001 15002 15003 15004 15005 15006 15007 15008 15009 15010 15011 15012 15013 15014 15015 15016 15017 15018 15019 15020 15021 15022 15023 15024 15025 15026 15027 15028 15029 15030 15031 15032 15033 15034 15035 15036 15037 15038 15039 15040 15041 15042 15043 15044 15045 15046 15047 15048 15049 15050 15051 15052 15053 15054 15055 15056 15057 15058 15059 15060 15061 15062 15063 15064 15065 15066 15067 15068 15069 15070 15071 15072 15073 15074 15075 15076 15077 15078 15079 15080 15081 15082 15083 15084 15085 15086 15087 15088 15089 15090 15091 15092 15093 15094 15095 15096 15097 15098 15099 15100 15101 15102 15103 15104 15105 15106 15107 15108 15109 15110 15111 15112 15113 15114 15115 15116 15117 15118 15119 15120 15121 15122 15123 15124 15125 15126 15127 15128 15129 15130 15131 15132 15133 15134 15135 15136 15137 15138 15139 15140 15141 15142 15143 15144 15145 15146 15147 15148 15149 15150 15151 15152 15153 15154 15155 15156 15157 15158 15159 15160 15161 15162 15163 15164 15165 15166 15167 15168 15169 15170 15171 15172 15173 15174 15175 15176 15177 15178 15179 15180 15181 15182 15183 15184 15185 15186 15187 15188 15189 15190 15191 15192 15193 15194 15195 15196 15197 15198 15199 15200 15201 15202 15203 15204 15205 15206 15207 15208 15209 15210 15211 15212 15213 15214 15215 15216 15217 15218 15219 15220 15221 15222 15223 15224 15225 15226 15227 15228 15229 15230 15231 15232 15233 15234 15235 15236 15237 15238 15239 15240 15241 15242 15243 15244 15245 15246 15247 15248 15249 15250 15251 15252 15253 15254 15255 15256 15257 15258 15259 15260 15261 15262 15263 15264 15265 15266 15267 15268 15269 15270 15271 15272 15273 15274 15275 15276 15277 15278 15279 15280 15281 15282 15283 15284 15285 15286 15287 15288 15289 15290 15291 15292 15293 15294 15295 15296 15297 15298 15299 15300 15301 15302 15303 15304 15305 15306 15307 15308 15309 15310 15311 15312 15313 15314 15315 15316 15317 15318 15319 15320 15321 15322 15323 15324 15325 15326 15327 15328 15329 15330 15331 15332 15333 15334 15335 15336 15337 15338 15339 15340 15341 15342 15343 15344 15345 15346 15347 15348 15349 15350 15351 15352 15353 15354 15355 15356 15357 15358 15359 15360 15361 15362 15363 15364 15365 15366 15367 15368 15369 15370 15371 15372 15373 15374 15375 15376 15377 15378 15379 15380 15381 15382 15383 15384 15385 15386 15387 15388 15389 15390 15391 15392 15393 15394 15395 15396 15397 15398 15399 15400 15401 15402 15403 15404 15405 15406 15407 15408 15409 15410 15411 15412 15413 15414 15415 15416 15417 15418 15419 15420 15421 15422 15423 15424 15425 15426 15427 15428 15429 15430 15431 15432 15433 15434 15435 15436 15437 15438 15439 15440 15441 15442 15443 15444 15445 15446 15447 15448 15449 15450 15451 15452 15453 15454 15455 15456 15457 15458 15459 15460 15461 15462 15463 15464 15465 15466 15467 15468 15469 15470 15471 15472 15473 15474 15475 15476 15477 15478 15479 15480 15481 15482 15483 15484 15485 15486 15487 15488 15489 15490 15491 15492 15493 15494 15495 15496 15497 15498 15499 15500 15501 15502 15503 15504 15505 15506 15507 15508 15509 15510 15511 15512 15513 15514 15515 15516 15517 15518 15519 15520 15521 15522 15523 15524 15525 15526 15527 15528 15529 15530 15531 15532 15533 15534 15535 15536 15537 15538 15539 15540 15541 15542 15543 15544 15545 15546 15547 15548 15549 15550 15551 15552 15553 15554 15555 15556 15557 15558 15559 15560 15561 15562 15563 15564 15565 15566 15567 15568 15569 15570 15571 15572 15573 15574 15575 15576 15577 15578 15579 15580 15581 15582 15583 15584 15585 15586 15587 15588 15589 15590 15591 15592 15593 15594 15595 15596 15597 15598 15599 15600 15601 15602 15603 15604 15605 15606 15607 15608 15609 15610 15611 15612 15613 15614 15615 15616 15617 15618 15619 15620 15621 15622 15623 15624 15625 15626 15627 15628 15629 15630 15631 15632 15633 15634 15635 15636 15637 15638 15639 15640 15641 15642 15643 15644 15645 15646 15647 15648 15649 15650 15651 15652 15653 15654 15655 15656 15657 15658 15659 15660 15661 15662 15663 15664 15665 15666 15667 15668 15669 15670 15671 15672 15673 15674 15675 15676 15677 15678 15679 15680 15681 15682 15683 15684 15685 15686 15687 15688 15689 15690 15691 15692 15693 15694 15695 15696 15697 15698 15699 15700 15701 15702 15703 15704 15705 15706 15707 15708 15709 15710 15711 15712 15713 15714 15715 15716 15717 15718 15719 15720 15721 15722 15723 15724 15725 15726 15727 15728 15729 15730 15731 15732 15733 15734 15735 15736 15737 15738 15739 15740 15741 15742 15743 15744 15745 15746 15747 15748 15749 15750 15751 15752 15753 15754 15755 15756 15757 15758 15759 15760 15761 15762 15763 15764 15765 15766 15767 15768 15769 15770 15771 15772 15773 15774 15775 15776 15777 15778 15779 15780 15781 15782 15783 15784 15785 15786 15787 15788 15789 15790 15791 15792 15793 15794 15795 15796 15797 15798 15799 15800 15801 15802 15803 15804 15805 15806 15807 15808 15809 15810 15811 15812 15813 15814 15815 15816 15817 15818 15819 15820 15821 15822 15823 15824 15825 15826 15827 15828 15829 15830 15831 15832 15833 15834 15835 15836 15837 15838 15839 15840 15841 15842 15843 15844 15845 15846 15847 15848 15849 15850 15851 15852 15853 15854 15855 15856 15857 15858 15859 15860 15861 15862 15863 15864 15865 15866 15867 15868 15869 15870 15871 15872 15873 15874 15875 15876 15877 15878 15879 15880 15881 15882 15883 15884 15885 15886 15887 15888 15889 15890 15891 15892 15893 15894 15895 15896 15897 15898 15899 15900 15901 15902 15903 15904 15905 15906 15907 15908 15909 15910 15911 15912 15913 15914 15915 15916 15917 15918 15919 15920 15921 15922 15923 15924 15925 15926 15927 15928 15929 15930 15931 15932 15933 15934 15935 15936 15937 15938 15939 15940 15941 15942 15943 15944 15945 15946 15947 15948 15949 15950 15951 15952 15953 15954 15955 15956 15957 15958 15959 15960 15961 15962 15963 15964 15965 15966 15967 15968 15969 15970 15971 15972 15973 15974 15975 15976 15977 15978 15979 15980 15981 15982 15983 15984 15985 15986 15987 15988 15989 15990 15991 15992 15993 15994 15995 15996 15997 15998 15999 16000 16001 16002 16003 16004 16005 16006 16007 16008 16009 16010 16011 16012 16013 16014 16015 16016 16017 16018 16019 16020 16021 16022 16023 16024 16025 16026 16027 16028 16029 16030 16031 16032 16033 16034 16035 16036 16037 16038 16039 16040 16041 16042 16043 16044 16045 16046 16047 16048 16049 16050 16051 16052 16053 16054 16055 16056 16057 16058 16059 16060 16061 16062 16063 16064 16065 16066 16067 16068 16069 16070 16071 16072 16073 16074 16075 16076 16077 16078 16079 16080 16081 16082 16083 16084 16085 16086 16087 16088 16089 16090 16091 16092 16093 16094 16095 16096 16097 16098 16099 16100 16101 16102 16103 16104 16105 16106 16107 16108 16109 16110 16111 16112 16113 16114 16115 16116 16117 16118 16119 16120 16121 16122 16123 16124 16125 16126 16127 16128 16129 16130 16131 16132 16133 16134 16135 16136 16137 16138 16139 16140 16141 16142 16143 16144 16145 16146 16147 16148 16149 16150 16151 16152 16153 16154 16155 16156 16157 16158 16159 16160 16161 16162 16163 16164 16165 16166 16167 16168 16169 16170 16171 16172 16173 16174 16175 16176 16177 16178 16179 16180 16181 16182 16183 16184 16185 16186 16187 16188 16189 16190 16191 16192 16193 16194 16195 16196 16197 16198 16199 16200 16201 16202 16203 16204 16205 16206 16207 16208 16209 16210 16211 16212 16213 16214 16215 16216 16217 16218 16219 16220 16221 16222 16223 16224 16225 16226 16227 16228 16229 16230 16231 16232 16233 16234 16235 16236 16237 16238 16239 16240 16241 16242 16243 16244 16245 16246 16247 16248 16249 16250 16251 16252 16253 16254 16255 16256 16257 16258 16259 16260 16261 16262 16263 16264 16265 16266 16267 16268 16269 16270 16271 16272 16273 16274 16275 16276 16277 16278 16279 16280 16281 16282 16283 16284 16285 16286 16287 16288 16289 16290 16291 16292 16293 16294 16295 16296 16297 16298 16299 16300 16301 16302 16303 16304 16305 16306 16307 16308 16309 16310 16311 16312 16313 16314 16315 16316 16317 16318 16319 16320 16321 16322 16323 16324 16325 16326 16327 16328 16329 16330 16331 16332 16333 16334 16335 16336 16337 16338 16339 16340 16341 16342 16343 16344 16345 16346 16347 16348 16349 16350 16351 16352 16353 16354 16355 16356 16357 16358 16359 16360 16361 16362 16363 16364 16365 16366 16367 16368 16369 16370 16371 16372 16373 16374 16375 16376 16377 16378 16379 16380 16381 16382 16383 16384 16385 16386 16387 16388 16389 16390 16391 16392 16393 16394 16395 16396 16397 16398 16399 16400 16401 16402 16403 16404 16405 16406 16407 16408 16409 16410 16411 16412 16413 16414 16415 16416 16417 16418 16419 16420 16421 16422 16423 16424 16425 16426 16427 16428 16429 16430 16431 16432 16433 16434 16435 16436 16437 16438 16439 16440 16441 16442 16443 16444 16445 16446 16447 16448 16449 16450 16451 16452 16453 16454 16455 16456 16457 16458 16459 16460 16461 16462 16463 16464 16465 16466 16467 16468 16469 16470 16471 16472 16473 16474 16475 16476 16477 16478 16479 16480 16481 16482 16483 16484 16485 16486 16487 16488 16489 16490 16491 16492 16493 16494 16495 16496 16497 16498 16499 16500 16501 16502 16503 16504 16505 16506 16507 16508 16509 16510 16511 16512 16513 16514 16515 16516 16517 16518 16519 16520 16521 16522 16523 16524 16525 16526 16527 16528 16529 16530 16531 16532 16533 16534 16535 16536 16537 16538 16539 16540 16541 16542 16543 16544 16545 16546 16547 16548 16549 16550 16551 16552 16553 16554 16555 16556 16557 16558 16559 16560 16561 16562 16563 16564 16565 16566 16567 16568 16569 16570 16571 16572 16573 16574 16575 16576 16577 16578 16579 16580 16581 16582 16583 16584 16585 16586 16587 16588 16589 16590 16591 16592 16593 16594 16595 16596 16597 16598 16599 16600 16601 16602 16603 16604 16605 16606 16607 16608 16609 16610 16611 16612 16613 16614 16615 16616 16617 16618 16619 16620 16621 16622 16623 16624 16625 16626 16627 16628 16629 16630 16631 16632 16633 16634 16635 16636 16637 16638 16639 16640 16641 16642 16643 16644 16645 16646 16647 16648 16649 16650 16651 16652 16653 16654 16655 16656 16657 16658 16659 16660 16661 16662 16663 16664 16665 16666 16667 16668 16669 16670 16671 16672 16673 16674 16675 16676 16677 16678 16679 16680 16681 16682 16683 16684 16685 16686 16687 16688 16689 16690 16691 16692 16693 16694 16695 16696 16697 16698 16699 16700 16701 16702 16703 16704 16705 16706 16707 16708 16709 16710 16711 16712 16713 16714 16715 16716 16717 16718 16719 16720 16721 16722 16723 16724 16725 16726 16727 16728 16729 16730 16731 16732 16733 16734 16735 16736 16737 16738 16739 16740 16741 16742 16743 16744 16745 16746 16747 16748 16749 16750 16751 16752 16753 16754 16755 16756 16757 16758 16759 16760 16761 16762 16763 16764 16765 16766 16767 16768 16769 16770 16771 16772 16773 16774 16775 16776 16777 16778 16779 16780 16781 16782 16783 16784 16785 16786 16787 16788 16789 16790 16791 16792 16793 16794 16795 16796 16797 16798 16799 16800 16801 16802 16803 16804 16805 16806 16807 16808 16809 16810 16811 16812 16813 16814 16815 16816 16817 16818 16819 16820 16821 16822 16823 16824 16825 16826 16827 16828 16829 16830 16831 16832 16833 16834 16835 16836 16837 16838 16839 16840 16841 16842 16843 16844 16845 16846 16847 16848 16849 16850 16851 16852 16853 16854 16855 16856 16857 16858 16859 16860 16861 16862 16863 16864 16865 16866 16867 16868 16869 16870 16871 16872 16873 16874 16875 16876 16877 16878 16879 16880 16881 16882 16883 16884 16885 16886 16887 16888 16889 16890 16891 16892 16893 16894 16895 16896 16897 16898 16899 16900 16901 16902 16903 16904 16905 16906 16907 16908 16909 16910 16911 16912 16913 16914 16915 16916 16917 16918 16919 16920 16921 16922 16923 16924 16925 16926 16927 16928 16929 16930 16931 16932 16933 16934 16935 16936 16937 16938 16939 16940 16941 16942 16943 16944 16945 16946 16947 16948 16949 16950 16951 16952 16953 16954 16955 16956 16957 16958 16959 16960 16961 16962 16963 16964 16965 16966 16967 16968 16969 16970 16971 16972 16973 16974 16975 16976 16977 16978 16979 16980 16981 16982 16983 16984 16985 16986 16987 16988 16989 16990 16991 16992 16993 16994 16995 16996 16997 16998 16999 17000 17001 17002 17003 17004 17005 17006 17007 17008 17009 17010 17011 17012 17013 17014 17015 17016 17017 17018 17019 17020 17021 17022 17023 17024 17025 17026 17027 17028 17029 17030 17031 17032 17033 17034 17035 17036 17037 17038 17039 17040 17041 17042 17043 17044 17045 17046 17047 17048 17049 17050 17051 17052 17053 17054 17055 17056 17057 17058 17059 17060 17061 17062 17063 17064 17065 17066 17067 17068 17069 17070 17071 17072 17073 17074 17075 17076 17077 17078 17079 17080 17081 17082 17083 17084 17085 17086 17087 17088 17089 17090 17091 17092 17093 17094 17095 17096 17097 17098 17099 17100 17101 17102 17103 17104 17105 17106 17107 17108 17109 17110 17111 17112 17113 17114 17115 17116 17117 17118 17119 17120 17121 17122 17123 17124 17125 17126 17127 17128 17129 17130 17131 17132 17133 17134 17135 17136 17137 17138 17139 17140 17141 17142 17143 17144 17145 17146 17147 17148 17149 17150 17151 17152 17153 17154 17155 17156 17157 17158 17159 17160 17161 17162 17163 17164 17165 17166 17167 17168 17169 17170 17171 17172 17173 17174 17175 17176 17177 17178 17179 17180 17181 17182 17183 17184 17185 17186 17187 17188 17189 17190 17191 17192 17193 17194 17195 17196 17197 17198 17199 17200 17201 17202 17203 17204 17205 17206 17207 17208 17209 17210 17211 17212 17213 17214 17215 17216 17217 17218 17219 17220 17221 17222 17223 17224 17225 17226 17227 17228 17229 17230 17231 17232 17233 17234 17235 17236 17237 17238 17239 17240 17241 17242 17243 17244 17245 17246 17247 17248 17249 17250 17251 17252 17253 17254 17255 17256 17257 17258 17259 17260 17261 17262 17263 17264 17265 17266 17267 17268 17269 17270 17271 17272 17273 17274 17275 17276 17277 17278 17279 17280 17281 17282 17283 17284 17285 17286 17287 17288 17289 17290 17291 17292 17293 17294 17295 17296 17297 17298 17299 17300 17301 17302 17303 17304 17305 17306 17307 17308 17309 17310 17311 17312 17313 17314 17315 17316 17317 17318 17319 17320 17321 17322 17323 17324 17325 17326 17327 17328 17329 17330 17331 17332 17333 17334 17335 17336 17337 17338 17339 17340 17341 17342 17343 17344 17345 17346 17347 17348 17349 17350 17351 17352 17353 17354 17355 17356 17357 17358 17359 17360 17361 17362 17363 17364 17365 17366 17367 17368 17369 17370 17371 17372 17373 17374 17375 17376 17377 17378 17379 17380 17381 17382 17383 17384 17385 17386 17387 17388 17389 17390 17391 17392 17393 17394 17395 17396 17397 17398 17399 17400 17401 17402 17403 17404 17405 17406 17407 17408 17409 17410 17411 17412 17413 17414 17415 17416 17417 17418 17419 17420 17421 17422 17423 17424 17425 17426 17427 17428 17429 17430 17431 17432 17433 17434 17435 17436 17437 17438 17439 17440 17441 17442 17443 17444 17445 17446 17447 17448 17449 17450 17451 17452 17453 17454 17455 17456 17457 17458 17459 17460 17461 17462 17463 17464 17465 17466 17467 17468 17469 17470 17471 17472 17473 17474 17475 17476 17477 17478 17479 17480 17481 17482 17483 17484 17485 17486 17487 17488 17489 17490 17491 17492 17493 17494 17495 17496 17497 17498 17499 17500 17501 17502 17503 17504 17505 17506 17507 17508 17509 17510 17511 17512 17513 17514 17515 17516 17517 17518 17519 17520 17521 17522 17523 17524 17525 17526 17527 17528 17529 17530 17531 17532 17533 17534 17535 17536 17537 17538 17539 17540 17541 17542 17543 17544 17545 17546 17547 17548 17549 17550 17551 17552 17553 17554 17555 17556 17557 17558 17559 17560 17561 17562 17563 17564 17565 17566 17567 17568 17569 17570 17571 17572 17573 17574 17575 17576 17577 17578 17579 17580 17581 17582 17583 17584 17585 17586 17587 17588 17589 17590 17591 17592 17593 17594 17595 17596 17597 17598 17599 17600 17601 17602 17603 17604 17605 17606 17607 17608 17609 17610 17611 17612 17613 17614 17615 17616 17617 17618 17619 17620 17621 17622 17623 17624 17625 17626 17627 17628 17629 17630 17631 17632 17633 17634 17635 17636 17637 17638 17639 17640 17641 17642 17643 17644 17645 17646 17647 17648 17649 17650 17651 17652 17653 17654 17655 17656 17657 17658 17659 17660 17661 17662 17663 17664 17665 17666 17667 17668 17669 17670 17671 17672 17673 17674 17675 17676 17677 17678 17679 17680 17681 17682 17683 17684 17685 17686 17687 17688 17689 17690 17691 17692 17693 17694 17695 17696 17697 17698 17699 17700 17701 17702 17703 17704 17705 17706 17707 17708 17709 17710 17711 17712 17713 17714 17715 17716 17717 17718 17719 17720 17721 17722 17723 17724 17725 17726 17727 17728 17729 17730 17731 17732 17733 17734 17735 17736 17737 17738 17739 17740 17741 17742 17743 17744 17745 17746 17747 17748 17749 17750 17751 17752 17753 17754 17755 17756 17757 17758 17759 17760 17761 17762 17763 17764 17765 17766 17767 17768 17769 17770 17771 17772 17773 17774 17775 17776 17777 17778 17779 17780 17781 17782 17783 17784 17785 17786 17787 17788 17789 17790 17791 17792 17793 17794 17795 17796 17797 17798 17799 17800 17801 17802 17803 17804 17805 17806 17807 17808 17809 17810 17811 17812 17813 17814 17815 17816 17817 17818 17819 17820 17821 17822 17823 17824 17825 17826 17827 17828 17829 17830 17831 17832 17833 17834 17835 17836 17837 17838 17839 17840 17841 17842 17843 17844 17845 17846 17847 17848 17849 17850 17851 17852 17853 17854 17855 17856 17857 17858 17859 17860 17861 17862 17863 17864 17865 17866 17867 17868 17869 17870 17871 17872 17873 17874 17875 17876 17877 17878 17879 17880 17881 17882 17883 17884 17885 17886 17887 17888 17889 17890 17891 17892 17893 17894 17895 17896 17897 17898 17899 17900 17901 17902 17903 17904 17905 17906 17907 17908 17909 17910 17911 17912 17913 17914 17915 17916 17917 17918 17919 17920 17921 17922 17923 17924 17925 17926 17927 17928 17929 17930 17931 17932 17933 17934 17935 17936 17937 17938 17939 17940 17941 17942 17943 17944 17945 17946 17947 17948 17949 17950 17951 17952 17953 17954 17955 17956 17957 17958 17959 17960 17961 17962 17963 17964 17965 17966 17967 17968 17969 17970 17971 17972 17973 17974 17975 17976 17977 17978 17979 17980 17981 17982 17983 17984 17985 17986 17987 17988 17989 17990 17991 17992 17993 17994 17995 17996 17997 17998 17999 18000 18001 18002 18003 18004 18005 18006 18007 18008 18009 18010 18011 18012 18013 18014 18015 18016 18017 18018 18019 18020 18021 18022 18023 18024 18025 18026 18027 18028 18029 18030 18031 18032 18033 18034 18035 18036 18037 18038 18039 18040 18041 18042 18043 18044 18045 18046 18047 18048 18049 18050 18051 18052 18053 18054 18055 18056 18057 18058 18059 18060 18061 18062 18063 18064 18065 18066 18067 18068 18069 18070 18071 18072 18073 18074 18075 18076 18077 18078 18079 18080 18081 18082 18083 18084 18085 18086 18087 18088 18089 18090 18091 18092 18093 18094 18095 18096 18097 18098 18099 18100 18101 18102 18103 18104 18105 18106 18107 18108 18109 18110 18111 18112 18113 18114 18115 18116 18117 18118 18119 18120 18121 18122 18123 18124 18125 18126 18127 18128 18129 18130 18131 18132 18133 18134 18135 18136 18137 18138 18139 18140 18141 18142 18143 18144 18145 18146 18147 18148 18149 18150 18151 18152 18153 18154 18155 18156 18157 18158 18159 18160 18161 18162 18163 18164 18165 18166 18167 18168 18169 18170 18171 18172 18173 18174 18175 18176 18177 18178 18179 18180 18181 18182 18183 18184 18185 18186 18187 18188 18189 18190 18191 18192 18193 18194 18195 18196 18197 18198 18199 18200 18201 18202 18203 18204 18205 18206 18207 18208 18209 18210 18211 18212 18213 18214 18215 18216 18217 18218 18219 18220 18221 18222 18223 18224 18225 18226 18227 18228 18229 18230 18231 18232 18233 18234 18235 18236 18237 18238 18239 18240 18241 18242 18243 18244 18245 18246 18247 18248 18249 18250 18251 18252 18253 18254 18255 18256 18257 18258 18259 18260 18261 18262 18263 18264 18265 18266 18267 18268 18269 18270 18271 18272 18273 18274 18275 18276 18277 18278 18279 18280 18281 18282 18283 18284 18285 18286 18287 18288 18289 18290 18291 18292 18293 18294 18295 18296 18297 18298 18299 18300 18301 18302 18303 18304 18305 18306 18307 18308 18309 18310 18311 18312 18313 18314 18315 18316 18317 18318 18319 18320 18321 18322 18323 18324 18325 18326 18327 18328 18329 18330 18331 18332 18333 18334 18335 18336 18337 18338 18339 18340 18341 18342 18343 18344 18345 18346 18347 18348 18349 18350 18351 18352 18353 18354 18355 18356 18357 18358 18359 18360 18361 18362 18363 18364 18365 18366 18367 18368 18369 18370 18371 18372 18373 18374 18375 18376 18377 18378 18379 18380 18381 18382 18383 18384 18385 18386 18387 18388 18389 18390 18391 18392 18393 18394 18395 18396 18397 18398 18399 18400 18401 18402 18403 18404 18405 18406 18407 18408 18409 18410 18411 18412 18413 18414 18415 18416 18417 18418 18419 18420 18421 18422 18423 18424 18425 18426 18427 18428 18429 18430 18431 18432 18433 18434 18435 18436 18437 18438 18439 18440 18441 18442 18443 18444 18445 18446 18447 18448 18449 18450 18451 18452 18453 18454 18455 18456 18457 18458 18459 18460 18461 18462 18463 18464 18465 18466 18467 18468 18469 18470 18471 18472 18473 18474 18475 18476 18477 18478 18479 18480 18481 18482 18483 18484 18485 18486 18487 18488 18489 18490 18491 18492 18493 18494 18495 18496 18497 18498 18499 18500 18501 18502 18503 18504 18505 18506 18507 18508 18509 18510 18511 18512 18513 18514 18515 18516 18517 18518 18519 18520 18521 18522 18523 18524 18525 18526 18527 18528 18529 18530 18531 18532 18533 18534 18535 18536 18537 18538 18539 18540 18541 18542 18543 18544 18545 18546 18547 18548 18549 18550 18551 18552 18553 18554 18555 18556 18557 18558 18559 18560 18561 18562 18563 18564 18565 18566 18567 18568 18569 18570 18571 18572 18573 18574 18575 18576 18577 18578 18579 18580 18581 18582 18583 18584 18585 18586 18587 18588 18589 18590 18591 18592 18593 18594 18595 18596 18597 18598 18599 18600 18601 18602 18603 18604 18605 18606 18607 18608 18609 18610 18611 18612 18613 18614 18615 18616 18617 18618 18619 18620 18621 18622 18623 18624 18625 18626 18627 18628 18629 18630 18631 18632 18633 18634 18635 18636 18637 18638 18639 18640 18641 18642 18643 18644 18645 18646 18647 18648 18649 18650 18651 18652 18653 18654 18655 18656 18657 18658 18659 18660 18661 18662 18663 18664 18665 18666 18667 18668 18669 18670 18671 18672 18673 18674 18675 18676 18677 18678 18679 18680 18681 18682 18683 18684 18685 18686 18687 18688 18689 18690 18691 18692 18693 18694 18695 18696 18697 18698 18699 18700 18701 18702 18703 18704 18705 18706 18707 18708 18709 18710 18711 18712 18713 18714 18715 18716 18717 18718 18719 18720 18721 18722 18723 18724 18725 18726 18727 18728 18729 18730 18731 18732 18733 18734 18735 18736 18737 18738 18739 18740 18741 18742 18743 18744 18745 18746 18747 18748 18749 18750 18751 18752 18753 18754 18755 18756 18757 18758 18759 18760 18761 18762 18763 18764 18765 18766 18767 18768 18769 18770 18771 18772 18773 18774 18775 18776 18777 18778 18779 18780 18781 18782 18783 18784 18785 18786 18787 18788 18789 18790 18791 18792 18793 18794 18795 18796 18797 18798 18799 18800 18801 18802 18803 18804 18805 18806 18807 18808 18809 18810 18811 18812 18813 18814 18815 18816 18817 18818 18819 18820 18821 18822 18823 18824 18825 18826 18827 18828 18829 18830 18831 18832 18833 18834 18835 18836 18837 18838 18839 18840 18841 18842 18843 18844 18845 18846 18847 18848 18849 18850 18851 18852 18853 18854 18855 18856 18857 18858 18859 18860 18861 18862 18863 18864 18865 18866 18867 18868 18869 18870 18871 18872 18873 18874 18875 18876 18877 18878 18879 18880 18881 18882 18883 18884 18885 18886 18887 18888 18889 18890 18891 18892 18893 18894 18895 18896 18897 18898 18899 18900 18901 18902 18903 18904 18905 18906 18907 18908 18909 18910 18911 18912 18913 18914 18915 18916 18917 18918 18919 18920 18921 18922 18923 18924 18925 18926 18927 18928 18929 18930 18931 18932 18933 18934 18935 18936 18937 18938 18939 18940 18941 18942 18943 18944 18945 18946 18947 18948 18949 18950 18951 18952 18953 18954 18955 18956 18957 18958 18959 18960 18961 18962 18963 18964 18965 18966 18967 18968 18969 18970 18971 18972 18973 18974 18975 18976 18977 18978 18979 18980 18981 18982 18983 18984 18985 18986 18987 18988 18989 18990 18991 18992 18993 18994 18995 18996 18997 18998 18999 19000 19001 19002 19003 19004 19005 19006 19007 19008 19009 19010 19011 19012 19013 19014 19015 19016 19017 19018 19019 19020 19021 19022 19023 19024 19025 19026 19027 19028 19029 19030 19031 19032 19033 19034 19035 19036 19037 19038 19039 19040 19041 19042 19043 19044 19045 19046 19047 19048 19049 19050 19051 19052 19053 19054 19055 19056 19057 19058 19059 19060 19061 19062 19063 19064 19065 19066 19067 19068 19069 19070 19071 19072 19073 19074 19075 19076 19077 19078 19079 19080 19081 19082 19083 19084 19085 19086 19087 19088 19089 19090 19091 19092 19093 19094 19095 19096 19097 19098 19099 19100 19101 19102 19103 19104 19105 19106 19107 19108 19109 19110 19111 19112 19113 19114 19115 19116 19117 19118 19119 19120 19121 19122 19123 19124 19125 19126 19127 19128 19129 19130 19131 19132 19133 19134 19135 19136 19137 19138 19139 19140 19141 19142 19143 19144 19145 19146 19147 19148 19149 19150 19151 19152 19153 19154 19155 19156 19157 19158 19159 19160 19161 19162 19163 19164 19165 19166 19167 19168 19169 19170 19171 19172 19173 19174 19175 19176 19177 19178 19179 19180 19181 19182 19183 19184 19185 19186 19187 19188 19189 19190 19191 19192 19193 19194 19195 19196 19197 19198 19199 19200 19201 19202 19203 19204 19205 19206 19207 19208 19209 19210 19211 19212 19213 19214 19215 19216 19217 19218 19219 19220 19221 19222 19223 19224 19225 19226 19227 19228 19229 19230 19231 19232 19233 19234 19235 19236 19237 19238 19239 19240 19241 19242 19243 19244 19245 19246 19247 19248 19249 19250 19251 19252 19253 19254 19255 19256 19257 19258 19259 19260 19261 19262 19263 19264 19265 19266 19267 19268 19269 19270 19271 19272 19273 19274 19275 19276 19277 19278 19279 19280 19281 19282 19283 19284 19285 19286 19287 19288 19289 19290 19291 19292 19293 19294 19295 19296 19297 19298 19299 19300 19301 19302 19303 19304 19305 19306 19307 19308 19309 19310 19311 19312 19313 19314 19315 19316 19317 19318 19319 19320 19321 19322 19323 19324 19325 19326 19327 19328 19329 19330 19331 19332 19333 19334 19335 19336 19337 19338 19339 19340 19341 19342 19343 19344 19345 19346 19347 19348 19349 19350 19351 19352 19353 19354 19355 19356 19357 19358 19359 19360 19361 19362 19363 19364 19365 19366 19367 19368 19369 19370 19371 19372 19373 19374 19375 19376 19377 19378 19379 19380 19381 19382 19383 19384 19385 19386 19387 19388 19389 19390 19391 19392 19393 19394 19395 19396 19397 19398 19399 19400 19401 19402 19403 19404 19405 19406 19407 19408 19409 19410 19411 19412 19413 19414 19415 19416 19417 19418 19419 19420 19421 19422 19423 19424 19425 19426 19427 19428 19429 19430 19431 19432 19433 19434 19435 19436 19437 19438 19439 19440 19441 19442 19443 19444 19445 19446 19447 19448 19449 19450 19451 19452 19453 19454 19455 19456 19457 19458 19459 19460 19461 19462 19463 19464 19465 19466 19467 19468 19469 19470 19471 19472 19473 19474 19475 19476 19477 19478 19479 19480 19481 19482 19483 19484 19485 19486 19487 19488 19489 19490 19491 19492 19493 19494 19495 19496 19497 19498 19499 19500 19501 19502 19503 19504 19505 19506 19507 19508 19509 19510 19511 19512 19513 19514 19515 19516 19517 19518 19519 19520 19521 19522 19523 19524 19525 19526 19527 19528 19529 19530 19531 19532 19533 19534 19535 19536 19537 19538 19539 19540 19541 19542 19543 19544 19545 19546 19547 19548 19549 19550 19551 19552 19553 19554 19555 19556 19557 19558 19559 19560 19561 19562 19563 19564 19565 19566 19567 19568 19569 19570 19571 19572 19573 19574 19575 19576 19577 19578 19579 19580 19581 19582 19583 19584 19585 19586 19587 19588 19589 19590 19591 19592 19593 19594 19595 19596 19597 19598 19599 19600 19601 19602 19603 19604 19605 19606 19607 19608 19609 19610 19611 19612 19613 19614 19615 19616 19617 19618 19619 19620 19621 19622 19623 19624 19625 19626 19627 19628 19629 19630 19631 19632 19633 19634 19635 19636 19637 19638 19639 19640 19641 19642 19643 19644 19645 19646 19647 19648 19649 19650 19651 19652 19653 19654 19655 19656 19657 19658 19659 19660 19661 19662 19663 19664 19665 19666 19667 19668 19669 19670 19671 19672 19673 19674 19675 19676 19677 19678 19679 19680 19681 19682 19683 19684 19685 19686 19687 19688 19689 19690 19691 19692 19693 19694 19695 19696 19697 19698 19699 19700 19701 19702 19703 19704 19705 19706 19707 19708 19709 19710 19711 19712 19713 19714 19715 19716 19717 19718 19719 19720 19721 19722 19723 19724 19725 19726 19727 19728 19729 19730 19731 19732 19733 19734 19735 19736 19737 19738 19739 19740 19741 19742 19743 19744 19745 19746 19747 19748 19749 19750 19751 19752 19753 19754 19755 19756 19757 19758 19759 19760 19761 19762 19763 19764 19765 19766 19767 19768 19769 19770 19771 19772 19773 19774 19775 19776 19777 19778 19779 19780 19781 19782 19783 19784 19785 19786 19787 19788 19789 19790 19791 19792 19793 19794 19795 19796 19797 19798 19799 19800 19801 19802 19803 19804 19805 19806 19807 19808 19809 19810 19811 19812 19813 19814 19815 19816 19817 19818 19819 19820 19821 19822 19823 19824 19825 19826 19827 19828 19829 19830 19831 19832 19833 19834 19835 19836 19837 19838 19839 19840 19841 19842 19843 19844 19845 19846 19847 19848 19849 19850 19851 19852 19853 19854 19855 19856 19857 19858 19859 19860 19861 19862 19863 19864 19865 19866 19867 19868 19869 19870 19871 19872 19873 19874 19875 19876 19877 19878 19879 19880 19881 19882 19883 19884 19885 19886 19887 19888 19889 19890 19891 19892 19893 19894 19895 19896 19897 19898 19899 19900 19901 19902 19903 19904 19905 19906 19907 19908 19909 19910 19911 19912 19913 19914 19915 19916 19917 19918 19919 19920 19921 19922 19923 19924 19925 19926 19927 19928 19929 19930 19931 19932 19933 19934 19935 19936 19937 19938 19939 19940 19941 19942 19943 19944 19945 19946 19947 19948 19949 19950 19951 19952 19953 19954 19955 19956 19957 19958 19959 19960 19961 19962 19963 19964 19965 19966 19967 19968 19969 19970 19971 19972 19973 19974 19975 19976 19977 19978 19979 19980 19981 19982 19983 19984 19985 19986 19987 19988 19989 19990 19991 19992 19993 19994 19995 19996 19997 19998 19999 20000 20001 20002 20003 20004 20005 20006 20007 20008 20009 20010 20011 20012 20013 20014 20015 20016 20017 20018 20019 20020 20021 20022 20023 20024 20025 20026 20027 20028 20029 20030 20031 20032 20033 20034 20035 20036 20037 20038 20039 20040 20041 20042 20043 20044 20045 20046 20047 20048 20049 20050 20051 20052 20053 20054 20055 20056 20057 20058 20059 20060 20061 20062 20063 20064 20065 20066 20067 20068 20069 20070 20071 20072 20073 20074 20075 20076 20077 20078 20079 20080 20081 20082 20083 20084 20085 20086 20087 20088 20089 20090 20091 20092 20093 20094 20095 20096 20097 20098 20099 20100 20101 20102 20103 20104 20105 20106 20107 20108 20109 20110 20111 20112 20113 20114 20115 20116 20117 20118 20119 20120 20121 20122 20123 20124 20125 20126 20127 20128 20129 20130 20131 20132 20133 20134 20135 20136 20137 20138 20139 20140 20141 20142 20143 20144 20145 20146 20147 20148 20149 20150 20151 20152 20153 20154 20155 20156 20157 20158 20159 20160 20161 20162 20163 20164 20165 20166 20167 20168 20169 20170 20171 20172 20173 20174 20175 20176 20177 20178 20179 20180 20181 20182 20183 20184 20185 20186 20187 20188 20189 20190 20191 20192 20193 20194 20195 20196 20197 20198 20199 20200 20201 20202 20203 20204 20205 20206 20207 20208 20209 20210 20211 20212 20213 20214 20215 20216 20217 20218 20219 20220 20221 20222 20223 20224 20225 20226 20227 20228 20229 20230 20231 20232 20233 20234 20235 20236 20237 20238 20239 20240 20241 20242 20243 20244 20245 20246 20247 20248 20249 20250 20251 20252 20253 20254 20255 20256 20257 20258 20259 20260 20261 20262 20263 20264 20265 20266 20267 20268 20269 20270 20271 20272 20273 20274 20275 20276 20277 20278 20279 20280 20281 20282 20283 20284 20285 20286 20287 20288 20289 20290 20291 20292 20293 20294 20295 20296 20297 20298 20299 20300 20301 20302 20303 20304 20305 20306 20307 20308 20309 20310 20311 20312 20313 20314 20315 20316 20317 20318 20319 20320 20321 20322 20323 20324 20325 20326 20327 20328 20329 20330 20331 20332 20333 20334 20335 20336 20337 20338 20339 20340 20341 20342 20343 20344 20345 20346 20347 20348 20349 20350 20351 20352 20353 20354 20355 20356 20357 20358 20359 20360 20361 20362 20363 20364 20365 20366 20367 20368 20369 20370 20371 20372 20373 20374 20375 20376 20377 20378 20379 20380 20381 20382 20383 20384 20385 20386 20387 20388 20389 20390 20391 20392 20393 20394 20395 20396 20397 20398 20399 20400 20401 20402 20403 20404 20405 20406 20407 20408 20409 20410 20411 20412 20413 20414 20415 20416 20417 20418 20419 20420 20421 20422 20423 20424 20425 20426 20427 20428 20429 20430 20431 20432 20433 20434 20435 20436 20437 20438 20439 20440 20441 20442 20443 20444 20445 20446 20447 20448 20449 20450 20451 20452 20453 20454 20455 20456 20457 20458 20459 20460 20461 20462 20463 20464 20465 20466 20467 20468 20469 20470 20471 20472 20473 20474 20475 20476 20477 20478 20479 20480 20481 20482 20483 20484 20485 20486 20487 20488 20489 20490 20491 20492 20493 20494 20495 20496 20497 20498 20499 20500 20501 20502 20503 20504 20505 20506 20507 20508 20509 20510 20511 20512 20513 20514 20515 20516 20517 20518 20519 20520 20521 20522 20523 20524 20525 20526 20527 20528 20529 20530 20531 20532 20533 20534 20535 20536 20537 20538 20539 20540 20541 20542 20543 20544 20545 20546 20547 20548 20549 20550 20551 20552 20553 20554 20555 20556 20557 20558 20559 20560 20561 20562 20563 20564 20565 20566 20567 20568 20569 20570 20571 20572 20573 20574 20575 20576 20577 20578 20579 20580 20581 20582 20583 20584 20585 20586 20587 20588 20589 20590 20591 20592 20593 20594 20595 20596 20597 20598 20599 20600 20601 20602 20603 20604 20605 20606 20607 20608 20609 20610 20611 20612 20613 20614 20615 20616 20617 20618 20619 20620 20621 20622 20623 20624 20625 20626 20627 20628 20629 20630 20631 20632 20633 20634 20635 20636 20637 20638 20639 20640 20641 20642 20643 20644 20645 20646 20647 20648 20649 20650 20651 20652 20653 20654 20655 20656 20657 20658 20659 20660 20661 20662 20663 20664 20665 20666 20667 20668 20669 20670 20671 20672 20673 20674 20675 20676 20677 20678 20679 20680 20681 20682 20683 20684 20685 20686 20687 20688 20689 20690 20691 20692 20693 20694 20695 20696 20697 20698 20699 20700 20701 20702 20703 20704 20705 20706 20707 20708 20709 20710 20711 20712 20713 20714 20715 20716 20717 20718 20719 20720 20721 20722 20723 20724 20725 20726 20727 20728 20729 20730 20731 20732 20733 20734 20735 20736 20737 20738 20739 20740 20741 20742 20743 20744 20745 20746 20747 20748 20749 20750 20751 20752 20753 20754 20755 20756 20757 20758 20759 20760 20761 20762 20763 20764 20765 20766 20767 20768 20769 20770 20771 20772 20773 20774 20775 20776 20777 20778 20779 20780 20781 20782 20783 20784 20785 20786 20787 20788 20789 20790 20791 20792 20793 20794 20795 20796 20797 20798 20799 20800 20801 20802 20803 20804 20805 20806 20807 20808 20809 20810 20811 20812 20813 20814 20815 20816 20817 20818 20819 20820 20821 20822 20823 20824 20825 20826 20827 20828 20829 20830 20831 20832 20833 20834 20835 20836 20837 20838 20839 20840 20841 20842 20843 20844 20845 20846 20847 20848 20849 20850 20851 20852 20853 20854 20855 20856 20857 20858 20859 20860 20861 20862 20863 20864 20865 20866 20867 20868 20869 20870 20871 20872 20873 20874 20875 20876 20877 20878 20879 20880 20881 20882 20883 20884 20885 20886 20887 20888 20889 20890 20891 20892 20893 20894 20895 20896 20897 20898 20899 20900 20901 20902 20903 20904 20905 20906 20907 20908 20909 20910 20911 20912 20913 20914 20915 20916 20917 20918 20919 20920 20921 20922 20923 20924 20925 20926 20927 20928 20929 20930 20931 20932 20933 20934 20935 20936 20937 20938 20939 20940 20941 20942 20943 20944 20945 20946 20947 20948 20949 20950 20951 20952 20953 20954 20955 20956 20957 20958 20959 20960 20961 20962 20963 20964 20965 20966 20967 20968 20969 20970 20971 20972 20973 20974 20975 20976 20977 20978 20979 20980 20981 20982 20983 20984 20985 20986 20987 20988 20989 20990 20991 20992 20993 20994 20995 20996 20997 20998 20999 21000 21001 21002 21003 21004 21005 21006 21007 21008 21009 21010 21011 21012 21013 21014 21015 21016 21017 21018 21019 21020 21021 21022 21023 21024 21025 21026 21027 21028 21029 21030 21031 21032 21033 21034 21035 21036 21037 21038 21039 21040 21041 21042 21043 21044 21045 21046 21047 21048 21049 21050 21051 21052 21053 21054 21055 21056 21057 21058 21059 21060 21061 21062 21063 21064 21065 21066 21067 21068 21069 21070 21071 21072 21073 21074 21075 21076 21077 21078 21079 21080 21081 21082 21083 21084 21085 21086 21087 21088 21089 21090 21091 21092 21093 21094 21095 21096 21097 21098 21099 21100 21101 21102 21103 21104 21105 21106 21107 21108 21109 21110 21111 21112 21113 21114 21115 21116 21117 21118 21119 21120 21121 21122 21123 21124 21125 21126 21127 21128 21129 21130 21131 21132 21133 21134 21135 21136 21137 21138 21139 21140 21141 21142 21143 21144 21145 21146 21147 21148 21149 21150 21151 21152 21153 21154 21155 21156 21157 21158 21159 21160 21161 21162 21163 21164 21165 21166 21167 21168 21169 21170 21171 21172 21173 21174 21175 21176 21177 21178 21179 21180 21181 21182 21183 21184 21185 21186 21187 21188 21189 21190 21191 21192 21193 21194 21195 21196 21197 21198 21199 21200 21201 21202 21203 21204 21205 21206 21207 21208 21209 21210 21211 21212 21213 21214 21215 21216 21217 21218 21219 21220 21221 21222 21223 21224 21225 21226 21227 21228 21229 21230 21231 21232 21233 21234 21235 21236 21237 21238 21239 21240 21241 21242 21243 21244 21245 21246 21247 21248 21249 21250 21251 21252 21253 21254 21255 21256 21257 21258 21259 21260 21261 21262 21263 21264 21265 21266 21267 21268 21269 21270 21271 21272 21273 21274 21275 21276 21277 21278 21279 21280 21281 21282 21283 21284 21285 21286 21287 21288 21289 21290 21291 21292 21293 21294 21295 21296 21297 21298 21299 21300 21301 21302 21303 21304 21305 21306 21307 21308 21309 21310 21311 21312 21313 21314 21315 21316 21317 21318 21319 21320 21321 21322 21323 21324 21325 21326 21327 21328 21329 21330 21331 21332 21333 21334 21335 21336 21337 21338 21339 21340 21341 21342 21343 21344 21345 21346 21347 21348 21349 21350 21351 21352 21353 21354 21355 21356 21357 21358 21359 21360 21361 21362 21363 21364 21365 21366 21367 21368 21369 21370 21371 21372 21373 21374 21375 21376 21377 21378 21379 21380 21381 21382 21383 21384 21385 21386 21387 21388 21389 21390 21391 21392 21393 21394 21395 21396 21397 21398 21399 21400 21401 21402 21403 21404 21405 21406 21407 21408 21409 21410 21411 21412 21413 21414 21415 21416 21417 21418 21419 21420 21421 21422 21423 21424 21425 21426 21427 21428 21429 21430 21431 21432 21433 21434 21435 21436 21437 21438 21439 21440 21441 21442 21443 21444 21445 21446 21447 21448 21449 21450 21451 21452 21453 21454 21455 21456 21457 21458 21459 21460 21461 21462 21463 21464 21465 21466 21467 21468 21469 21470 21471 21472 21473 21474 21475 21476 21477 21478 21479 21480 21481 21482 21483 21484 21485 21486 21487 21488 21489 21490 21491 21492 21493 21494 21495 21496 21497 21498 21499 21500 21501 21502 21503 21504 21505 21506 21507 21508 21509 21510 21511 21512 21513 21514 21515 21516 21517 21518 21519 21520 21521 21522 21523 21524 21525 21526 21527 21528 21529 21530 21531 21532 21533 21534 21535 21536 21537 21538 21539 21540 21541 21542 21543 21544 21545 21546 21547 21548 21549 21550 21551 21552 21553 21554 21555 21556 21557 21558 21559 21560 21561 21562 21563 21564 21565 21566 21567 21568 21569 21570 21571 21572 21573 21574 21575 21576 21577 21578 21579 21580 21581 21582 21583 21584 21585 21586 21587 21588 21589 21590 21591 21592 21593 21594 21595 21596 21597 21598 21599 21600 21601 21602 21603 21604 21605 21606 21607 21608 21609 21610 21611 21612 21613 21614 21615 21616 21617 21618 21619 21620 21621 21622 21623 21624 21625 21626 21627 21628 21629 21630 21631 21632 21633 21634 21635 21636 21637 21638 21639 21640 21641 21642 21643 21644 21645 21646 21647 21648 21649 21650 21651 21652 21653 21654 21655 21656 21657 21658 21659 21660 21661 21662 21663 21664 21665 21666 21667 21668 21669 21670 21671 21672 21673 21674 21675 21676 21677 21678 21679 21680 21681 21682 21683 21684 21685 21686 21687 21688 21689 21690 21691 21692 21693 21694 21695 21696 21697 21698 21699 21700 21701 21702 21703 21704 21705 21706 21707 21708 21709 21710 21711 21712 21713 21714 21715 21716 21717 21718 21719 21720 21721 21722 21723 21724 21725 21726 21727 21728 21729 21730 21731 21732 21733 21734 21735 21736 21737 21738 21739 21740 21741 21742 21743 21744 21745 21746 21747 21748 21749 21750 21751 21752 21753 21754 21755 21756 21757 21758 21759 21760 21761 21762 21763 21764 21765 21766 21767 21768 21769 21770 21771 21772 21773 21774 21775 21776 21777 21778 21779 21780 21781 21782 21783 21784 21785 21786 21787 21788 21789 21790 21791 21792 21793 21794 21795 21796 21797 21798 21799 21800 21801 21802 21803 21804 21805 21806 21807 21808 21809 21810 21811 21812 21813 21814 21815 21816 21817 21818 21819 21820 21821 21822 21823 21824 21825 21826 21827 21828 21829 21830 21831 21832 21833 21834 21835 21836 21837 21838 21839 21840 21841 21842 21843 21844 21845 21846 21847 21848 21849 21850 21851 21852 21853 21854 21855 21856 21857 21858 21859 21860 21861 21862 21863 21864 21865 21866 21867 21868 21869 21870 21871 21872 21873 21874 21875 21876 21877 21878 21879 21880 21881 21882 21883 21884 21885 21886 21887 21888 21889 21890 21891 21892 21893 21894 21895 21896 21897 21898 21899 21900 21901 21902 21903 21904 21905 21906 21907 21908 21909 21910 21911 21912 21913 21914 21915 21916 21917 21918 21919 21920 21921 21922 21923 21924 21925 21926 21927 21928 21929 21930 21931 21932 21933 21934 21935 21936 21937 21938 21939 21940 21941 21942 21943 21944 21945 21946 21947 21948 21949 21950 21951 21952 21953 21954 21955 21956 21957 21958 21959 21960 21961 21962 21963 21964 21965 21966 21967 21968 21969 21970 21971 21972 21973 21974 21975 21976 21977 21978 21979 21980 21981 21982 21983 21984 21985 21986 21987 21988 21989 21990 21991 21992 21993 21994 21995 21996 21997 21998 21999 22000 22001 22002 22003 22004 22005 22006 22007 22008 22009 22010 22011 22012 22013 22014 22015 22016 22017 22018 22019 22020 22021 22022 22023 22024 22025 22026 22027 22028 22029 22030 22031 22032 22033 22034 22035 22036 22037 22038 22039 22040 22041 22042 22043 22044 22045 22046 22047 22048 22049 22050 22051 22052 22053 22054 22055 22056 22057 22058 22059 22060 22061 22062 22063 22064 22065 22066 22067 22068 22069 22070 22071 22072 22073 22074 22075 22076 22077 22078 22079 22080 22081 22082 22083 22084 22085 22086 22087 22088 22089 22090 22091 22092 22093 22094 22095 22096 22097 22098 22099 22100 22101 22102 22103 22104 22105 22106 22107 22108 22109 22110 22111 22112 22113 22114 22115 22116 22117 22118 22119 22120 22121 22122 22123 22124 22125 22126 22127 22128 22129 22130 22131 22132 22133 22134 22135 22136 22137 22138 22139 22140 22141 22142 22143 22144 22145 22146 22147 22148 22149 22150 22151 22152 22153 22154 22155 22156 22157 22158 22159 22160 22161 22162 22163 22164 22165 22166 22167 22168 22169 22170 22171 22172 22173 22174 22175 22176 22177 22178 22179 22180 22181 22182 22183 22184 22185 22186 22187 22188 22189 22190 22191 22192 22193 22194 22195 22196 22197 22198 22199 22200 22201 22202 22203 22204 22205 22206 22207 22208 22209 22210 22211 22212 22213 22214 22215 22216 22217 22218 22219 22220 22221 22222 22223 22224 22225 22226 22227 22228 22229 22230 22231 22232 22233 22234 22235 22236 22237 22238 22239 22240 22241 22242 22243 22244 22245 22246 22247 22248 22249 22250 22251 22252 22253 22254 22255 22256 22257 22258 22259 22260 22261 22262 22263 22264 22265 22266 22267 22268 22269 22270 22271 22272 22273 22274 22275 22276 22277 22278 22279 22280 22281 22282 22283 22284 22285 22286 22287 22288 22289 22290 22291 22292 22293 22294 22295 22296 22297 22298 22299 22300 22301 22302 22303 22304 22305 22306 22307 22308 22309 22310 22311 22312 22313 22314 22315 22316 22317 22318 22319 22320 22321 22322 22323 22324 22325 22326 22327 22328 22329 22330 22331 22332 22333 22334 22335 22336 22337 22338 22339 22340 22341 22342 22343 22344 22345 22346 22347 22348 22349 22350 22351 22352 22353 22354 22355 22356 22357 22358 22359 22360 22361 22362 22363 22364 22365 22366 22367 22368 22369 22370 22371 22372 22373 22374 22375 22376 22377 22378 22379 22380 22381 22382 22383 22384 22385 22386 22387 22388 22389 22390 22391 22392 22393 22394 22395 22396 22397 22398 22399 22400 22401 22402 22403 22404 22405 22406 22407 22408 22409 22410 22411 22412 22413 22414 22415 22416 22417 22418 22419 22420 22421 22422 22423 22424 22425 22426 22427 22428 22429 22430 22431 22432 22433 22434 22435 22436 22437 22438 22439 22440 22441 22442 22443 22444 22445 22446 22447 22448 22449 22450 22451 22452 22453 22454 22455 22456 22457 22458 22459 22460 22461 22462 22463 22464 22465 22466 22467 22468 22469 22470 22471 22472 22473 22474 22475 22476 22477 22478 22479 22480 22481 22482 22483 22484 22485 22486 22487 22488 22489 22490 22491 22492 22493 22494 22495 22496 22497 22498 22499 22500 22501 22502 22503 22504 22505 22506 22507 22508 22509 22510 22511 22512 22513 22514 22515 22516 22517 22518 22519 22520 22521 22522 22523 22524 22525 22526 22527 22528 22529 22530 22531 22532 22533 22534 22535 22536 22537 22538 22539 22540 22541 22542 22543 22544 22545 22546 22547 22548 22549 22550 22551 22552 22553 22554 22555 22556 22557 22558 22559 22560 22561 22562 22563 22564 22565 22566 22567 22568 22569 22570 22571 22572 22573 22574 22575 22576 22577 22578 22579 22580 22581 22582 22583 22584 22585 22586 22587 22588 22589 22590 22591 22592 22593 22594 22595 22596 22597 22598 22599 22600 22601 22602 22603 22604 22605 22606 22607 22608 22609 22610 22611 22612 22613 22614 22615 22616 22617 22618 22619 22620 22621 22622 22623 22624 22625 22626 22627 22628 22629 22630 22631 22632 22633 22634 22635 22636 22637 22638 22639 22640 22641 22642 22643 22644 22645 22646 22647 22648 22649 22650 22651 22652 22653 22654 22655 22656 22657 22658 22659 22660 22661 22662 22663 22664 22665 22666 22667 22668 22669 22670 22671 22672 22673 22674 22675 22676 22677 22678 22679 22680 22681 22682 22683 22684 22685 22686 22687 22688 22689 22690 22691 22692 22693 22694 22695 22696 22697 22698 22699 22700 22701 22702 22703 22704 22705 22706 22707 22708 22709 22710 22711 22712 22713 22714 22715 22716 22717 22718 22719 22720 22721 22722 22723 22724 22725 22726 22727 22728 22729 22730 22731 22732 22733 22734 22735 22736 22737 22738 22739 22740 22741 22742 22743 22744 22745 22746 22747 22748 22749 22750 22751 22752 22753 22754 22755 22756 22757 22758 22759 22760 22761 22762 22763 22764 22765 22766 22767 22768 22769 22770 22771 22772 22773 22774 22775 22776 22777 22778 22779 22780 22781 22782 22783 22784 22785 22786 22787 22788 22789 22790 22791 22792 22793 22794 22795 22796 22797 22798 22799 22800 22801 22802 22803 22804 22805 22806 22807 22808 22809 22810 22811 22812 22813 22814 22815 22816 22817 22818 22819 22820 22821 22822 22823 22824 22825 22826 22827 22828 22829 22830 22831 22832 22833 22834 22835 22836 22837 22838 22839 22840 22841 22842 22843 22844 22845 22846 22847 22848 22849 22850 22851 22852 22853 22854 22855 22856 22857 22858 22859 22860 22861 22862 22863 22864 22865 22866 22867 22868 22869 22870 22871 22872 22873 22874 22875 22876 22877 22878 22879 22880 22881 22882 22883 22884 22885 22886 22887 22888 22889 22890 22891 22892 22893 22894 22895 22896 22897 22898 22899 22900 22901 22902 22903 22904 22905 22906 22907 22908 22909 22910 22911 22912 22913 22914 22915 22916 22917 22918 22919 22920 22921 22922 22923 22924 22925 22926 22927 22928 22929 22930 22931 22932 22933 22934 22935 22936 22937 22938 22939 22940 22941 22942 22943 22944 22945 22946 22947 22948 22949 22950 22951 22952 22953 22954 22955 22956 22957 22958 22959 22960 22961 22962 22963 22964 22965 22966 22967 22968 22969 22970 22971 22972 22973 22974 22975 22976 22977 22978 22979 22980 22981 22982 22983 22984 22985 22986 22987 22988 22989 22990 22991 22992 22993 22994 22995 22996 22997 22998 22999 23000 23001 23002 23003 23004 23005 23006 23007 23008 23009 23010 23011 23012 23013 23014 23015 23016 23017 23018 23019 23020 23021 23022 23023 23024 23025 23026 23027 23028 23029 23030 23031 23032 23033 23034 23035 23036 23037 23038 23039 23040 23041 23042 23043 23044 23045 23046 23047 23048 23049 23050 23051 23052 23053 23054 23055 23056 23057 23058 23059 23060 23061 23062 23063 23064 23065 23066 23067 23068 23069 23070 23071 23072 23073 23074 23075 23076 23077 23078 23079 23080 23081 23082 23083 23084 23085 23086 23087 23088 23089 23090 23091 23092 23093 23094 23095 23096 23097 23098 23099 23100 23101 23102 23103 23104 23105 23106 23107 23108 23109 23110 23111 23112 23113 23114 23115 23116 23117 23118 23119 23120 23121 23122 23123 23124 23125 23126 23127 23128 23129 23130 23131 23132 23133 23134 23135 23136 23137 23138 23139 23140 23141 23142 23143 23144 23145 23146 23147 23148 23149 23150 23151 23152 23153 23154 23155 23156 23157 23158 23159 23160 23161 23162 23163 23164 23165 23166 23167 23168 23169 23170 23171 23172 23173 23174 23175 23176 23177 23178 23179 23180 23181 23182 23183 23184 23185 23186 23187 23188 23189 23190 23191 23192 23193 23194 23195 23196 23197 23198 23199 23200 23201 23202 23203 23204 23205 23206 23207 23208 23209 23210 23211 23212 23213 23214 23215 23216 23217 23218 23219 23220 23221 23222 23223 23224 23225 23226 23227 23228 23229 23230 23231 23232 23233 23234 23235 23236 23237 23238 23239 23240 23241 23242 23243 23244 23245 23246 23247 23248 23249 23250 23251 23252 23253 23254 23255 23256 23257 23258 23259 23260 23261 23262 23263 23264 23265 23266 23267 23268 23269 23270 23271 23272 23273 23274 23275 23276 23277 23278 23279 23280 23281 23282 23283 23284 23285 23286 23287 23288 23289 23290 23291 23292 23293 23294 23295 23296 23297 23298 23299 23300 23301 23302 23303 23304 23305 23306 23307 23308 23309 23310 23311 23312 23313 23314 23315 23316 23317 23318 23319 23320 23321 23322 23323 23324 23325 23326 23327 23328 23329 23330 23331 23332 23333 23334 23335 23336 23337 23338 23339 23340 23341 23342 23343 23344 23345 23346 23347 23348 23349 23350 23351 23352 23353 23354 23355 23356 23357 23358 23359 23360 23361 23362 23363 23364 23365 23366 23367 23368 23369 23370 23371 23372 23373 23374 23375 23376 23377 23378 23379 23380 23381 23382 23383 23384 23385 23386 23387 23388 23389 23390 23391 23392 23393 23394 23395 23396 23397 23398 23399 23400 23401 23402 23403 23404 23405 23406 23407 23408 23409 23410 23411 23412 23413 23414 23415 23416 23417 23418 23419 23420 23421 23422 23423 23424 23425 23426 23427 23428 23429 23430 23431 23432 23433 23434 23435 23436 23437 23438 23439 23440 23441 23442 23443 23444 23445 23446 23447 23448 23449 23450 23451 23452 23453 23454 23455 23456 23457 23458 23459 23460 23461 23462 23463 23464 23465 23466 23467 23468 23469 23470 23471 23472 23473 23474 23475 23476 23477 23478 23479 23480 23481 23482 23483 23484 23485 23486 23487 23488 23489 23490 23491 23492 23493 23494 23495 23496 23497 23498 23499 23500 23501 23502 23503 23504 23505 23506 23507 23508 23509 23510 23511 23512 23513 23514 23515 23516 23517 23518 23519 23520 23521 23522 23523 23524 23525 23526 23527 23528 23529 23530 23531 23532 23533 23534 23535 23536 23537 23538 23539 23540 23541 23542 23543 23544 23545 23546 23547 23548 23549 23550 23551 23552 23553 23554 23555 23556 23557 23558 23559 23560 23561 23562 23563 23564 23565 23566 23567 23568 23569 23570 23571 23572 23573 23574 23575 23576 23577 23578 23579 23580 23581 23582 23583 23584 23585 23586 23587 23588 23589 23590 23591 23592 23593 23594 23595 23596 23597 23598 23599 23600 23601 23602 23603 23604 23605 23606 23607 23608 23609 23610 23611 23612 23613 23614 23615 23616 23617 23618 23619 23620 23621 23622 23623 23624 23625 23626 23627 23628 23629 23630 23631 23632 23633 23634 23635 23636 23637 23638 23639 23640 23641 23642 23643 23644 23645 23646 23647 23648 23649 23650 23651 23652 23653 23654 23655 23656 23657 23658 23659 23660 23661 23662 23663 23664 23665 23666 23667 23668 23669 23670 23671 23672 23673 23674 23675 23676 23677 23678 23679 23680 23681 23682 23683 23684 23685 23686 23687 23688 23689 23690 23691 23692 23693 23694 23695 23696 23697 23698 23699 23700 23701 23702 23703 23704 23705 23706 23707 23708 23709 23710 23711 23712 23713 23714 23715 23716 23717 23718 23719 23720 23721 23722 23723 23724 23725 23726 23727 23728 23729 23730 23731 23732 23733 23734 23735 23736 23737 23738 23739 23740 23741 23742 23743 23744 23745 23746 23747 23748 23749 23750 23751 23752 23753 23754 23755 23756 23757 23758 23759 23760 23761 23762 23763 23764 23765 23766 23767 23768 23769 23770 23771 23772 23773 23774 23775 23776 23777 23778 23779 23780 23781 23782 23783 23784 23785 23786 23787 23788 23789 23790 23791 23792 23793 23794 23795 23796 23797 23798 23799 23800 23801 23802 23803 23804 23805 23806 23807 23808 23809 23810 23811 23812 23813 23814 23815 23816 23817 23818 23819 23820 23821 23822 23823 23824 23825 23826 23827 23828 23829 23830 23831 23832 23833 23834 23835 23836 23837 23838 23839 23840 23841 23842 23843 23844 23845 23846 23847 23848 23849 23850 23851 23852 23853 23854 23855 23856 23857 23858 23859 23860 23861 23862 23863 23864 23865 23866 23867 23868 23869 23870 23871 23872 23873 23874 23875 23876 23877 23878 23879 23880 23881 23882 23883 23884 23885 23886 23887 23888 23889 23890 23891 23892 23893 23894 23895 23896 23897 23898 23899 23900 23901 23902 23903 23904 23905 23906 23907 23908 23909 23910 23911 23912 23913 23914 23915 23916 23917 23918 23919 23920 23921 23922 23923 23924 23925 23926 23927 23928 23929 23930 23931 23932 23933 23934 23935 23936 23937 23938 23939 23940 23941 23942 23943 23944 23945 23946 23947 23948 23949 23950 23951 23952 23953 23954 23955 23956 23957 23958 23959 23960 23961 23962 23963 23964 23965 23966 23967 23968 23969 23970 23971 23972 23973 23974 23975 23976 23977 23978 23979 23980 23981 23982 23983 23984 23985 23986 23987 23988 23989 23990 23991 23992 23993 23994 23995 23996 23997 23998 23999 24000 24001 24002 24003 24004 24005 24006 24007 24008 24009 24010 24011 24012 24013 24014 24015 24016 24017 24018 24019 24020 24021 24022 24023 24024 24025 24026 24027 24028 24029 24030 24031 24032 24033 24034 24035 24036 24037 24038 24039 24040 24041 24042 24043 24044 24045 24046 24047 24048 24049 24050 24051 24052 24053 24054 24055 24056 24057 24058 24059 24060 24061 24062 24063 24064 24065 24066 24067 24068 24069 24070 24071 24072 24073 24074 24075 24076 24077 24078 24079 24080 24081 24082 24083 24084 24085 24086 24087 24088 24089 24090 24091 24092 24093 24094 24095 24096 24097 24098 24099 24100 24101 24102 24103 24104 24105 24106 24107 24108 24109 24110 24111 24112 24113 24114 24115 24116 24117 24118 24119 24120 24121 24122 24123 24124 24125 24126 24127 24128 24129 24130 24131 24132 24133 24134 24135 24136 24137 24138 24139 24140 24141 24142 24143 24144 24145 24146 24147 24148 24149 24150 24151 24152 24153 24154 24155 24156 24157 24158 24159 24160 24161 24162 24163 24164 24165 24166 24167 24168 24169 24170 24171 24172 24173 24174 24175 24176 24177 24178 24179 24180 24181 24182 24183 24184 24185 24186 24187 24188 24189 24190 24191 24192 24193 24194 24195 24196 24197 24198 24199 24200 24201 24202 24203 24204 24205 24206 24207 24208 24209 24210 24211 24212 24213 24214 24215 24216 24217 24218 24219 24220 24221 24222 24223 24224 24225 24226 24227 24228 24229 24230 24231 24232 24233 24234 24235 24236 24237 24238 24239 24240 24241 24242 24243 24244 24245 24246 24247 24248 24249 24250 24251 24252 24253 24254 24255 24256 24257 24258 24259 24260 24261 24262 24263 24264 24265 24266 24267 24268 24269 24270 24271 24272 24273 24274 24275 24276 24277 24278 24279 24280 24281 24282 24283 24284 24285 24286 24287 24288 24289 24290 24291 24292 24293 24294 24295 24296 24297 24298 24299 24300 24301 24302 24303 24304 24305 24306 24307 24308 24309 24310 24311 24312 24313 24314 24315 24316 24317 24318 24319 24320 24321 24322 24323 24324 24325 24326 24327 24328 24329 24330 24331 24332 24333 24334 24335 24336 24337 24338 24339 24340 24341 24342 24343 24344 24345 24346 24347 24348 24349 24350 24351 24352 24353 24354 24355 24356 24357 24358 24359 24360 24361 24362 24363 24364 24365 24366 24367 24368 24369 24370 24371 24372 24373 24374 24375 24376 24377 24378 24379 24380 24381 24382 24383 24384 24385 24386 24387 24388 24389 24390 24391 24392 24393 24394 24395 24396 24397 24398 24399 24400 24401 24402 24403 24404 24405 24406 24407 24408 24409 24410 24411 24412 24413 24414 24415 24416 24417 24418 24419 24420 24421 24422 24423 24424 24425 24426 24427 24428 24429 24430 24431 24432 24433 24434 24435 24436 24437 24438 24439 24440 24441 24442 24443 24444 24445 24446 24447 24448 24449 24450 24451 24452 24453 24454 24455 24456 24457 24458 24459 24460 24461 24462 24463 24464 24465 24466 24467 24468 24469 24470 24471 24472 24473 24474 24475 24476 24477 24478 24479 24480 24481 24482 24483 24484 24485 24486 24487 24488 24489 24490 24491 24492 24493 24494 24495 24496 24497 24498 24499 24500 24501 24502 24503 24504 24505 24506 24507 24508 24509 24510 24511 24512 24513 24514 24515 24516 24517 24518 24519 24520 24521 24522 24523 24524 24525 24526 24527 24528 24529 24530 24531 24532 24533 24534 24535 24536 24537 24538 24539 24540 24541 24542 24543 24544 24545 24546 24547 24548 24549 24550 24551 24552 24553 24554 24555 24556 24557 24558 24559 24560 24561 24562 24563 24564 24565 24566 24567 24568 24569 24570 24571 24572 24573 24574 24575 24576 24577 24578 24579 24580 24581 24582 24583 24584 24585 24586 24587 24588 24589 24590 24591 24592 24593 24594 24595 24596 24597 24598 24599 24600 24601 24602 24603 24604 24605 24606 24607 24608 24609 24610 24611 24612 24613 24614 24615 24616 24617 24618 24619 24620 24621 24622 24623 24624 24625 24626 24627 24628 24629 24630 24631 24632 24633 24634 24635 24636 24637 24638 24639 24640 24641 24642 24643 24644 24645 24646 24647 24648 24649 24650 24651 24652 24653 24654 24655 24656 24657 24658 24659 24660 24661 24662 24663 24664 24665 24666 24667 24668 24669 24670 24671 24672 24673 24674 24675 24676 24677 24678 24679 24680 24681 24682 24683 24684 24685 24686 24687 24688 24689 24690 24691 24692 24693 24694 24695 24696 24697 24698 24699 24700 24701 24702 24703 24704 24705 24706 24707 24708 24709 24710 24711 24712 24713 24714 24715 24716 24717 24718 24719 24720 24721 24722 24723 24724 24725 24726 24727 24728 24729 24730 24731 24732 24733 24734 24735 24736 24737 24738 24739 24740 24741 24742 24743 24744 24745 24746 24747 24748 24749 24750 24751 24752 24753 24754 24755 24756 24757 24758 24759 24760 24761 24762 24763 24764 24765 24766 24767 24768 24769 24770 24771 24772 24773 24774 24775 24776 24777 24778 24779 24780 24781 24782 24783 24784 24785 24786 24787 24788 24789 24790 24791 24792 24793 24794 24795 24796 24797 24798 24799 24800 24801 24802 24803 24804 24805 24806 24807 24808 24809 24810 24811 24812 24813 24814 24815 24816 24817 24818 24819 24820 24821 24822 24823 24824 24825 24826 24827 24828 24829 24830 24831 24832 24833 24834 24835 24836 24837 24838 24839 24840 24841 24842 24843 24844 24845 24846 24847 24848 24849 24850 24851 24852 24853 24854 24855 24856 24857 24858 24859 24860 24861 24862 24863 24864 24865 24866 24867 24868 24869 24870 24871 24872 24873 24874 24875 24876 24877 24878 24879 24880 24881 24882 24883 24884 24885 24886 24887 24888 24889 24890 24891 24892 24893 24894 24895 24896 24897 24898 24899 24900 24901 24902 24903 24904 24905 24906 24907 24908 24909 24910 24911 24912 24913 24914 24915 24916 24917 24918 24919 24920 24921 24922 24923 24924 24925 24926 24927 24928 24929 24930 24931 24932 24933 24934 24935 24936 24937 24938 24939 24940 24941 24942 24943 24944 24945 24946 24947 24948 24949 24950 24951 24952 24953 24954 24955 24956 24957 24958 24959 24960 24961 24962 24963 24964 24965 24966 24967 24968 24969 24970 24971 24972 24973 24974 24975 24976 24977 24978 24979 24980 24981 24982 24983 24984 24985 24986 24987 24988 24989 24990 24991 24992 24993 24994 24995 24996 24997 24998 24999 25000 25001 25002 25003 25004 25005 25006 25007 25008 25009 25010 25011 25012 25013 25014 25015 25016 25017 25018 25019 25020 25021 25022 25023 25024 25025 25026 25027 25028 25029 25030 25031 25032 25033 25034 25035 25036 25037 25038 25039 25040 25041 25042 25043 25044 25045 25046 25047 25048 25049 25050 25051 25052 25053 25054 25055 25056 25057 25058 25059 25060 25061 25062 25063 25064 25065 25066 25067 25068 25069 25070 25071 25072 25073 25074 25075 25076 25077 25078 25079 25080 25081 25082 25083 25084 25085 25086 25087 25088 25089 25090 25091 25092 25093 25094 25095 25096 25097 25098 25099 25100 25101 25102 25103 25104 25105 25106 25107 25108 25109 25110 25111 25112 25113 25114 25115 25116 25117 25118 25119 25120 25121 25122 25123 25124 25125 25126 25127 25128 25129 25130 25131 25132 25133 25134 25135 25136 25137 25138 25139 25140 25141 25142 25143 25144 25145 25146 25147 25148 25149 25150 25151 25152 25153 25154 25155 25156 25157 25158 25159 25160 25161 25162 25163 25164 25165 25166 25167 25168 25169 25170 25171 25172 25173 25174 25175 25176 25177 25178 25179 25180 25181 25182 25183 25184 25185 25186 25187 25188 25189 25190 25191 25192 25193 25194 25195 25196 25197 25198 25199 25200 25201 25202 25203 25204 25205 25206 25207 25208 25209 25210 25211 25212 25213 25214 25215 25216 25217 25218 25219 25220 25221 25222 25223 25224 25225 25226 25227 25228 25229 25230 25231 25232 25233 25234 25235 25236 25237 25238 25239 25240 25241 25242 25243 25244 25245 25246 25247 25248 25249 25250 25251 25252 25253 25254 25255 25256 25257 25258 25259 25260 25261 25262 25263 25264 25265 25266 25267 25268 25269 25270 25271 25272 25273 25274 25275 25276 25277 25278 25279 25280 25281 25282 25283 25284 25285 25286 25287 25288 25289 25290 25291 25292 25293 25294 25295 25296 25297 25298 25299 25300 25301 25302 25303 25304 25305 25306 25307 25308 25309 25310 25311 25312 25313 25314 25315 25316 25317 25318 25319 25320 25321 25322 25323 25324 25325 25326 25327 25328 25329 25330 25331 25332 25333 25334 25335 25336 25337 25338 25339 25340 25341 25342 25343 25344 25345 25346 25347 25348 25349 25350 25351 25352 25353 25354 25355 25356 25357 25358 25359 25360 25361 25362 25363 25364 25365 25366 25367 25368 25369 25370 25371 25372 25373 25374 25375 25376 25377 25378 25379 25380 25381 25382 25383 25384 25385 25386 25387 25388 25389 25390 25391 25392 25393 25394 25395 25396 25397 25398 25399 25400 25401 25402 25403 25404 25405 25406 25407 25408 25409 25410 25411 25412 25413 25414 25415 25416 25417 25418 25419 25420 25421 25422 25423 25424 25425 25426 25427 25428 25429 25430 25431 25432 25433 25434 25435 25436 25437 25438 25439 25440 25441 25442 25443 25444 25445 25446 25447 25448 25449 25450 25451 25452 25453 25454 25455 25456 25457 25458 25459 25460 25461 25462 25463 25464 25465 25466 25467 25468 25469 25470 25471 25472 25473 25474 25475 25476 25477 25478 25479 25480 25481 25482 25483 25484 25485 25486 25487 25488 25489 25490 25491 25492 25493 25494 25495 25496 25497 25498 25499 25500 25501 25502 25503 25504 25505 25506 25507 25508 25509 25510 25511 25512 25513 25514 25515 25516 25517 25518 25519 25520 25521 25522 25523 25524 25525 25526 25527 25528 25529 25530 25531 25532 25533 25534 25535 25536 25537 25538 25539 25540 25541 25542 25543 25544 25545 25546 25547 25548 25549 25550 25551 25552 25553 25554 25555 25556 25557 25558 25559 25560 25561 25562 25563 25564 25565 25566 25567 25568 25569 25570 25571 25572 25573 25574 25575 25576 25577 25578 25579 25580 25581 25582 25583 25584 25585 25586 25587 25588 25589 25590 25591 25592 25593 25594 25595 25596 25597 25598 25599 25600 25601 25602 25603 25604 25605 25606 25607 25608 25609 25610 25611 25612 25613 25614 25615 25616 25617 25618 25619 25620 25621 25622 25623 25624 25625 25626 25627 25628 25629 25630 25631 25632 25633 25634 25635 25636 25637 25638 25639 25640 25641 25642 25643 25644 25645 25646 25647 25648 25649 25650 25651 25652 25653 25654 25655 25656 25657 25658 25659 25660 25661 25662 25663 25664 25665 25666 25667 25668 25669 25670 25671 25672 25673 25674 25675 25676 25677 25678 25679 25680 25681 25682 25683 25684 25685 25686 25687 25688 25689 25690 25691 25692 25693 25694 25695 25696 25697 25698 25699 25700 25701 25702 25703 25704 25705 25706 25707 25708 25709 25710 25711 25712 25713 25714 25715 25716 25717 25718 25719 25720 25721 25722 25723 25724 25725 25726 25727 25728 25729 25730 25731 25732 25733 25734 25735 25736 25737 25738 25739 25740 25741 25742 25743 25744 25745 25746 25747 25748 25749 25750 25751 25752 25753 25754 25755 25756 25757 25758 25759 25760 25761 25762 25763 25764 25765 25766 25767 25768 25769 25770 25771 25772 25773 25774 25775 25776 25777 25778 25779 25780 25781 25782 25783 25784 25785 25786 25787 25788 25789 25790 25791 25792 25793 25794 25795 25796 25797 25798 25799 25800 25801 25802 25803 25804 25805 25806 25807 25808 25809 25810 25811 25812 25813 25814 25815 25816 25817 25818 25819 25820 25821 25822 25823 25824 25825 25826 25827 25828 25829 25830 25831 25832 25833 25834 25835 25836 25837 25838 25839 25840 25841 25842 25843 25844 25845 25846 25847 25848 25849 25850 25851 25852 25853 25854 25855 25856 25857 25858 25859 25860 25861 25862 25863 25864 25865 25866 25867 25868 25869 25870 25871 25872 25873 25874 25875 25876 25877 25878 25879 25880 25881 25882 25883 25884 25885 25886 25887 25888 25889 25890 25891 25892 25893 25894 25895 25896 25897 25898 25899 25900 25901 25902 25903 25904 25905 25906 25907 25908 25909 25910 25911 25912 25913 25914 25915 25916 25917 25918 25919 25920 25921 25922 25923 25924 25925 25926 25927 25928 25929 25930 25931 25932 25933 25934 25935 25936 25937 25938 25939 25940 25941 25942 25943 25944 25945 25946 25947 25948 25949 25950 25951 25952 25953 25954 25955 25956 25957 25958 25959 25960 25961 25962 25963 25964 25965 25966 25967 25968 25969 25970 25971 25972 25973 25974 25975 25976 25977 25978 25979 25980 25981 25982 25983 25984 25985 25986 25987 25988 25989 25990 25991 25992 25993 25994 25995 25996 25997 25998 25999 26000 26001 26002 26003 26004 26005 26006 26007 26008 26009 26010 26011 26012 26013 26014 26015 26016 26017 26018 26019 26020 26021 26022 26023 26024 26025 26026 26027 26028 26029 26030 26031 26032 26033 26034 26035 26036 26037 26038 26039 26040 26041 26042 26043 26044 26045 26046 26047 26048 26049 26050 26051 26052 26053 26054 26055 26056 26057 26058 26059 26060 26061 26062 26063 26064 26065 26066 26067 26068 26069 26070 26071 26072 26073 26074 26075 26076 26077 26078 26079 26080 26081 26082 26083 26084 26085 26086 26087 26088 26089 26090 26091 26092 26093 26094 26095 26096 26097 26098 26099 26100 26101 26102 26103 26104 26105 26106 26107 26108 26109 26110 26111 26112 26113 26114 26115 26116 26117 26118 26119 26120 26121 26122 26123 26124 26125 26126 26127 26128 26129 26130 26131 26132 26133 26134 26135 26136 26137 26138 26139 26140 26141 26142 26143 26144 26145 26146 26147 26148 26149 26150 26151 26152 26153 26154 26155 26156 26157 26158 26159 26160 26161 26162 26163 26164 26165 26166 26167 26168 26169 26170 26171 26172 26173 26174 26175 26176 26177 26178 26179 26180 26181 26182 26183 26184 26185 26186 26187 26188 26189 26190 26191 26192 26193 26194 26195 26196 26197 26198 26199 26200 26201 26202 26203 26204 26205 26206 26207 26208 26209 26210 26211 26212 26213 26214 26215 26216 26217 26218 26219 26220 26221 26222 26223 26224 26225 26226 26227 26228 26229 26230 26231 26232 26233 26234 26235 26236 26237 26238 26239 26240 26241 26242 26243 26244 26245 26246 26247 26248 26249 26250 26251 26252 26253 26254 26255 26256 26257 26258 26259 26260 26261 26262 26263 26264 26265 26266 26267 26268 26269 26270 26271 26272 26273 26274 26275 26276 26277 26278 26279 26280 26281 26282 26283 26284 26285 26286 26287 26288 26289 26290 26291 26292 26293 26294 26295 26296 26297 26298 26299 26300 26301 26302 26303 26304 26305 26306 26307 26308 26309 26310 26311 26312 26313 26314 26315 26316 26317 26318 26319 26320 26321 26322 26323 26324 26325 26326 26327 26328 26329 26330 26331 26332 26333 26334 26335 26336 26337 26338 26339 26340 26341 26342 26343 26344 26345 26346 26347 26348 26349 26350 26351 26352 26353 26354 26355 26356 26357 26358 26359 26360 26361 26362 26363 26364 26365 26366 26367 26368 26369 26370 26371 26372 26373 26374 26375 26376 26377 26378 26379 26380 26381 26382 26383 26384 26385 26386 26387 26388 26389 26390 26391 26392 26393 26394 26395 26396 26397 26398 26399 26400 26401 26402 26403 26404 26405 26406 26407 26408 26409 26410 26411 26412 26413 26414 26415 26416 26417 26418 26419 26420 26421 26422 26423 26424 26425 26426 26427 26428 26429 26430 26431 26432 26433 26434 26435 26436 26437 26438 26439 26440 26441 26442 26443 26444 26445 26446 26447 26448 26449 26450 26451 26452 26453 26454 26455 26456 26457 26458 26459 26460 26461 26462 26463 26464 26465 26466 26467 26468 26469 26470 26471 26472 26473 26474 26475 26476 26477 26478 26479 26480 26481 26482 26483 26484 26485 26486 26487 26488 26489 26490 26491 26492 26493 26494 26495 26496 26497 26498 26499 26500 26501 26502 26503 26504 26505 26506 26507 26508 26509 26510 26511 26512 26513 26514 26515 26516 26517 26518 26519 26520 26521 26522 26523 26524 26525 26526 26527 26528 26529 26530 26531 26532 26533 26534 26535 26536 26537 26538 26539 26540 26541 26542 26543 26544 26545 26546 26547 26548 26549 26550 26551 26552 26553 26554 26555 26556 26557 26558 26559 26560 26561 26562 26563 26564 26565 26566 26567 26568 26569 26570 26571 26572 26573 26574 26575 26576 26577 26578 26579 26580 26581 26582 26583 26584 26585 26586 26587 26588 26589 26590 26591 26592 26593 26594 26595 26596 26597 26598 26599 26600 26601 26602 26603 26604 26605 26606 26607 26608 26609 26610 26611 26612 26613 26614 26615 26616 26617 26618 26619 26620 26621 26622 26623 26624 26625 26626 26627 26628 26629 26630 26631 26632 26633 26634 26635 26636 26637 26638 26639 26640 26641 26642 26643 26644 26645 26646 26647 26648 26649 26650 26651 26652 26653 26654 26655 26656 26657 26658 26659 26660 26661 26662 26663 26664 26665 26666 26667 26668 26669 26670 26671 26672 26673 26674 26675 26676 26677 26678 26679 26680 26681 26682 26683 26684 26685 26686 26687 26688 26689 26690 26691 26692 26693 26694 26695 26696 26697 26698 26699 26700 26701 26702 26703 26704 26705 26706 26707 26708 26709 26710 26711 26712 26713 26714 26715 26716 26717 26718 26719 26720 26721 26722 26723 26724 26725 26726 26727 26728 26729 26730 26731 26732 26733 26734 26735 26736 26737 26738 26739 26740 26741 26742 26743 26744 26745 26746 26747 26748 26749 26750 26751 26752 26753 26754 26755 26756 26757 26758 26759 26760 26761 26762 26763 26764 26765 26766 26767 26768 26769 26770 26771 26772 26773 26774 26775 26776 26777 26778 26779 26780 26781 26782 26783 26784 26785 26786 26787 26788 26789 26790 26791 26792 26793 26794 26795 26796 26797 26798 26799 26800 26801 26802 26803 26804 26805 26806 26807 26808 26809 26810 26811 26812 26813 26814 26815 26816 26817 26818 26819 26820 26821 26822 26823 26824 26825 26826 26827 26828 26829 26830 26831 26832 26833 26834 26835 26836 26837 26838 26839 26840 26841 26842 26843 26844 26845 26846 26847 26848 26849 26850 26851 26852 26853 26854 26855 26856 26857 26858 26859 26860 26861 26862 26863 26864 26865 26866 26867 26868 26869 26870 26871 26872 26873 26874 26875 26876 26877 26878 26879 26880 26881 26882 26883 26884 26885 26886 26887 26888 26889 26890 26891 26892 26893 26894 26895 26896 26897 26898 26899 26900 26901 26902 26903 26904 26905 26906 26907 26908 26909 26910 26911 26912 26913 26914 26915 26916 26917 26918 26919 26920 26921 26922 26923 26924 26925 26926 26927 26928 26929 26930 26931 26932 26933 26934 26935 26936 26937 26938 26939 26940 26941 26942 26943 26944 26945 26946 26947 26948 26949 26950 26951 26952 26953 26954 26955 26956 26957 26958 26959 26960 26961 26962 26963 26964 26965 26966 26967 26968 26969 26970 26971 26972 26973 26974 26975 26976 26977 26978 26979 26980 26981 26982 26983 26984 26985 26986 26987 26988 26989 26990 26991 26992 26993 26994 26995 26996 26997 26998 26999 27000 27001 27002 27003 27004 27005 27006 27007 27008 27009 27010 27011 27012 27013 27014 27015 27016 27017 27018 27019 27020 27021 27022 27023 27024 27025 27026 27027 27028 27029 27030 27031 27032 27033 27034 27035 27036 27037 27038 27039 27040 27041 27042 27043 27044 27045 27046 27047 27048 27049 27050 27051 27052 27053 27054 27055 27056 27057 27058 27059 27060 27061 27062 27063 27064 27065 27066 27067 27068 27069 27070 27071 27072 27073 27074 27075 27076 27077 27078 27079 27080 27081 27082 27083 27084 27085 27086 27087 27088 27089 27090 27091 27092 27093 27094 27095 27096 27097 27098 27099 27100 27101 27102 27103 27104 27105 27106 27107 27108 27109 27110 27111 27112 27113 27114 27115 27116 27117 27118 27119 27120 27121 27122 27123 27124 27125 27126 27127 27128 27129 27130 27131 27132 27133 27134 27135 27136 27137 27138 27139 27140 27141 27142 27143 27144 27145 27146 27147 27148 27149 27150 27151 27152 27153 27154 27155 27156 27157 27158 27159 27160 27161 27162 27163 27164 27165 27166 27167 27168 27169 27170 27171 27172 27173 27174 27175 27176 27177 27178 27179 27180 27181 27182 27183 27184 27185 27186 27187 27188 27189 27190 27191 27192 27193 27194 27195 27196 27197 27198 27199 27200 27201 27202 27203 27204 27205 27206 27207 27208 27209 27210 27211 27212 27213 27214 27215 27216 27217 27218 27219 27220 27221 27222 27223 27224 27225 27226 27227 27228 27229 27230 27231 27232 27233 27234 27235 27236 27237 27238 27239 27240 27241 27242 27243 27244 27245 27246 27247 27248 27249 27250 27251 27252 27253 27254 27255 27256 27257 27258 27259 27260 27261 27262 27263 27264 27265 27266 27267 27268 27269 27270 27271 27272 27273 27274 27275 27276 27277 27278 27279 27280 27281 27282 27283 27284 27285 27286 27287 27288 27289 27290 27291 27292 27293 27294 27295 27296 27297 27298 27299 27300 27301 27302 27303 27304 27305 27306 27307 27308 27309 27310 27311 27312 27313 27314 27315 27316 27317 27318 27319 27320 27321 27322 27323 27324 27325 27326 27327 27328 27329 27330 27331 27332 27333 27334 27335 27336 27337 27338 27339 27340 27341 27342 27343 27344 27345 27346 27347 27348 27349 27350 27351 27352 27353 27354 27355 27356 27357 27358 27359 27360 27361 27362 27363 27364 27365 27366 27367 27368 27369 27370 27371 27372 27373 27374 27375 27376 27377 27378 27379 27380 27381 27382 27383 27384 27385 27386 27387 27388 27389 27390 27391 27392 27393 27394 27395 27396 27397 27398 27399 27400 27401 27402 27403 27404 27405 27406 27407 27408 27409 27410 27411 27412 27413 27414 27415 27416 27417 27418 27419 27420 27421 27422 27423 27424 27425 27426 27427 27428 27429 27430 27431 27432 27433 27434 27435 27436 27437 27438 27439 27440 27441 27442 27443 27444 27445 27446 27447 27448 27449 27450 27451 27452 27453 27454 27455 27456 27457 27458 27459 27460 27461 27462 27463 27464 27465 27466 27467 27468 27469 27470 27471 27472 27473 27474 27475 27476 27477 27478 27479 27480 27481 27482 27483 27484 27485 27486 27487 27488 27489 27490 27491 27492 27493 27494 27495 27496 27497 27498 27499 27500 27501 27502 27503 27504 27505 27506 27507 27508 27509 27510 27511 27512 27513 27514 27515 27516 27517 27518 27519 27520 27521 27522 27523 27524 27525 27526 27527 27528 27529 27530 27531 27532
|
/**
* @file megaapi.h
* @brief Public header file of the intermediate layer for the MEGA C++ SDK.
*
* (c) 2013-2014 by Mega Limited, Auckland, New Zealand
*
* This file is part of the MEGA SDK - Client Access Engine.
*
* Applications using the MEGA API must present a valid application key
* and comply with the the rules set forth in the Terms of Service.
*
* The MEGA SDK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* @copyright Simplified (2-clause) BSD License.
*
* You should have received a copy of the license along with this
* program.
*/
#ifndef MEGAAPI_H
#define MEGAAPI_H
#include <cstdint>
#include <inttypes.h>
#include <optional>
#include <string>
#include <vector>
#ifdef __APPLE__
#include <TargetConditionals.h>
#endif
namespace mega
{
typedef uint64_t MegaHandle;
typedef int64_t MegaTimeStamp; // unix timestamp
struct MegaTotpTokenLifetime
{
std::string token;
unsigned remainingLifeTimeSeconds;
};
struct MegaTotpTokenGenResult
{
int errorCode;
MegaTotpTokenLifetime result;
};
#ifdef WIN32
const char MEGA_DEBRIS_FOLDER[] = "Rubbish";
#else
const char MEGA_DEBRIS_FOLDER[] = ".debris";
#endif
/**
* @brief INVALID_HANDLE Invalid value for a handle
*
* This value is used to represent an invalid handle. Several MEGA objects can have
* a handle but it will never be mega::INVALID_HANDLE
*
*/
const MegaHandle INVALID_HANDLE = ~(MegaHandle)0;
const MegaTimeStamp MEGA_INVALID_TIMESTAMP = 0;
class MegaListener;
class MegaRequestListener;
class MegaTransferListener;
class MegaScheduledCopyListener;
class MegaGlobalListener;
class MegaTreeProcessor;
class MegaAccountDetails;
class MegaAchievementsDetails;
class MegaPricing;
class MegaCurrency;
class MegaNode;
class MegaUser;
class MegaUserAlert;
class MegaContactRequest;
class MegaShare;
class MegaError;
class MegaRequest;
class MegaEvent;
class MegaTransfer;
class MegaScheduledCopy;
class MegaSync;
class MegaStringList;
class MegaNodeList;
class MegaUserList;
class MegaUserAlertList;
class MegaContactRequestList;
class MegaShareList;
class MegaTransferList;
class MegaFolderInfo;
class MegaTimeZoneDetails;
class MegaPushNotificationSettings;
class MegaBackgroundMediaUpload;
class MegaCancelToken;
class MegaUploadOptions;
class MegaApi;
class MegaSemaphore;
class MegaScheduledMeeting;
class MegaScheduledMeetingList;
class MegaScheduledFlags;
class MegaScheduledRules;
class MegaIntegerMap;
class MegaIntegerList;
class MegaSyncStall;
class MegaSyncStallList;
class MegaSyncStallMap;
class MegaFuseExecutorFlags;
class MegaFuseFlags;
class MegaFuseInodeCacheFlags;
class MegaMount;
class MegaMountFlags;
class MegaMountList;
class MegaVpnRegionList;
class MegaVpnCredentials;
class MegaNetworkConnectivityTestResults;
class MegaNodeTree;
class MegaCompleteUploadData;
class MegaNotificationList;
class MegaCancelSubscriptionReasonList;
#if defined(SWIG)
#define MEGA_DEPRECATED
#else
#define MEGA_DEPRECATED [[deprecated]]
#endif
/**
* @brief Interface to provide an external GFX processor
*
* You can implement this interface to provide a graphics processor to the SDK
* in the MegaApi::MegaApi constructor. That way, SDK will use your implementation to generate
* thumbnails/previews when needed.
*
* The implementation will receive callbacks from an internal worker thread.
*
* Images will be sequentially processed. At first, the SDK will call MegaGfxProcessor::readBitmap
* with the path of the file. Then, it will call MegaGfxProcessor::getWidth and
* MegaGfxProcessor::getHeight to get the dimensions of the file (in pixels). After that, the SDK
* will call MegaGfxProcessor::getBitmapDataSize and MegaGfxProcessor::getBitmapData in a loop to
* get thumbnails/previews of different sizes. Finally, the SDK will call
* MegaGfxProcessor::freeBitmap to let you free the resources required to process
* the current file.
*
* If the image has EXIF data, it should be rotated/mirrored before doing any
* other processing. MegaGfxProcessor::getWidth, MegaGfxProcessor::getHeight and all
* other coordinates in this interface are expressed over the image after the required
* transformation based on the EXIF data.
*
* Generated images can be in JPG or PNG format.
*
*/
class MegaGfxProcessor
{
public:
enum
{
GFX_HINT_NONE = 0,
GFX_HINT_FORMAT_PNG = 1, // Format can be in PNG
};
/**
* @brief Read the image file and check if it can be processed
*
* This is the first function that will be called to process an image. No other
* functions of this interface will be called before this one.
*
* The recommended implementation is to read the file, check if it's an image and
* get its dimensions. If everything is OK, the function should return true. If the
* file isn't an image or can't be processed, this function should return false.
*
* The SDK will call this function with all files so it's probably a good idea to
* check the extension before trying to open them.
*
* @param path Path of the file that is going to be processed
* @return True if the implementation is able to manage the file, false otherwise.
*/
virtual bool readBitmap(const char* path);
/**
* @brief Returns the width of the image
*
* This function must return the width of the image at the path provided in MegaGfxProcessor::readBitmap
* If a number <= 0 is returned, the image won't be processed.
*
* @return The width of the image
*/
virtual int getWidth();
/**
* @brief Returns the height of the image
*
* This function must return de width of the image at the path provided in MegaGfxProcessor::readBitmap
* If a number <= 0 is returned, the image won't be processed.
*
* @return The height of the image
*/
virtual int getHeight();
/**
* @brief Generates a thumbnail/preview image.
*
* This function provides the parameters of the thumbnail/preview that the SDK wants to
* generate. If the implementation can create it, it has to provide the size of the buffer (in
* bytes) that it needs to store the generated image. Otherwise, it should return a number <= 0.
*
* The implementation of this function has to scale the image to the size (width, height) and
* then extract the rectangle starting at the point (px, py) with size (rw, rh). (px, py, rw and
* rh) are expressed in pixels over the scaled image, being the point (0, 0) the upper-left
* corner of the scaled image, with the X-axis growing to the right and the Y-axis growing to
* the bottom.
*
* @param width Width of the scaled image from which the thumbnail/preview image will be
* extracted
* @param height Height of the scaled image from which the thumbnail/preview image will be
* extracted
* @param px X coordinate of the starting point of the desired image (in pixels over the scaled
* image)
* @param py Y coordinate of the starting point of the desired image (in pixels over the scaled
* image)
* @param rw Width of the desired image (in pixels over the scaled image)
* @param rh Height of the desired image (in pixels over the scaled image)
* @param hint The hint for thumbnail and preview generation:
* - GFX_HINT_NONE
* - GFX_HINT_FORMAT_PNG
*
* @return Size of the buffer required to store the image (in bytes) or a number <= 0 if it's
* not possible to generate it.
*
*/
virtual int getBitmapDataSize(int width, int height, int px, int py, int rw, int rh, int hint);
/**
* @brief Copy the thumbnail/preview data to a buffer provided by the SDK
*
* The SDK uses this function immediately after MegaGfxProcessor::getBitmapDataSize when that
* fuction succeed. The implementation of this function must copy the data of the image in the
* buffer provided by the SDK. The size of this buffer will be the same as the value returned
* in the previous call to MegaGfxProcessor::getBitmapDataSize. That size is provided in the
* second parameter for compatibility with SWIG and to help the implementation to prevent
* buffer overflow errors.
*
* @param bitmapData Preallocated buffer in which the implementation must write the generated image
* @param size Size of the buffer. It will be the same that the previous return value of
* MegaGfxProcessor::getBitmapDataSize
*
* @return True in case of success, false otherwise.
*/
virtual bool getBitmapData(char *bitmapData, size_t size);
/**
* @brief Free resources associated with the processing of the current image
*
* With a call of this function, the processing of the image started with a call to
* MegaGfxProcessor::readBitmap ends. No other functions will be called to continue processing
* the current image, so you can free all related resources.
*
*/
virtual void freeBitmap();
/**
* @brief Indicate which file extensions (file/image types) are supported
*
* Return a string with all the supported extensions concatenated, with . separating
* Make sure to include a trailing . eg. ".jpg.png.bmp.jpeg."
*
* The caller does not take ownership of the string.
*
* If not supplied, all relevant files will be attempted.
*/
virtual const char* supportedImageFormats();
/**
* @brief Indicate which file extensions (file/image types) are supported
*
* Return a string with all the supported extensions concatenated, with . separating
* Make sure to include a trailing . eg. ".mpeg.mp4.avi.mkv."
*
* The caller does not take ownership of the string.
*
* If not supplied, all relevant files will be attempted.
*/
virtual const char* supportedVideoFormats();
virtual ~MegaGfxProcessor();
};
/**
* @brief Represents a GFX provider with a hidden implementation and interfaces for creating different GFX providers.
*
* There are three interfaces available for creating various GFX providers:
* - @see MegaGfxProvider::createIsolatedInstance
* - @see MegaGfxProvider::createExternalInstance
* - @see MegaGfxProvider::createInternalInstance
*
* You can use one of these interfaces to create a GFX provider and provide it to the SDK within the MegaApi::MegaApi
* constructor. Subsequently, the SDK will utilize the GFX provider for generating thumbnails and previews when needed.
* For more details, refer to @see MegaApi::MegaApi.
*/
class MegaGfxProvider
{
public:
virtual ~MegaGfxProvider();
/**
* @brief Create a graphics processor that implemented and run in an isolated process.
*
* Note: Windows, Linux, macOS are supported.
*
* @param endpointName The unique name used for communicating with the isolated process.
* @param executable The path to the executable file.
* @param keepAliveInSeconds The amount of time (in seconds) the isolated process stays active
* without receiving any requests.
* @param extraArgs Additional arguments that will be passed directly to the isolated process.
*
* @note The created instance sends a hello request every keepAliveInSeconds / 3 seconds to
* ensure the isolated process stays running.
*/
static MegaGfxProvider* createIsolatedInstance(const char* endpointName,
const char* executable,
unsigned int keepAliveInSeconds = 60,
const MegaStringList* extraArgs = nullptr);
/**
* @brief Create a graphics processor that use your implementations @see MegaGfxProcessor.
*
* @param processor Your own implementation
*/
static MegaGfxProvider* createExternalInstance(MegaGfxProcessor* processor);
/**
* @brief Create a graphics processor that utilizes the SDK's implementation and runs in the same
* process as the caller.
*/
static MegaGfxProvider* createInternalInstance();
};
/**
* @brief Contains the information related to a proxy server.
*
* Pass an object of this class to MegaApi::setProxySettings to
* start using a proxy server.
*
* Currently, only HTTP proxies are allowed. The proxy server
* should support HTTP request and tunneling for HTTPS.
*
*/
class MegaProxy
{
public:
enum {PROXY_NONE = 0, PROXY_AUTO = 1, PROXY_CUSTOM = 2};
/**
* @brief Creates a MegaProxy object with the default settings (PROXY_AUTO)
*/
MegaProxy();
virtual ~MegaProxy();
/**
* @brief Sets the type of the proxy
*
* The allowed values in the current version are:
* - PROXY_NONE means no proxy
* - PROXY_AUTO means automatic detection (default)
* - PROXY_CUSTOM means a proxy using user-provided data
*
* @param newProxyType Sets the type of the proxy
*/
void setProxyType(int newProxyType);
/**
* @brief Sets the URL of the proxy
*
* That URL must follow this format: "<scheme>://<hostname|ip>:<port>"
*
* This is a valid example: http://127.0.0.1:8080
*
* @param newProxyURL URL of the proxy: "<scheme>://<hostname|ip>:<port>"
*/
void setProxyURL(const char* newProxyURL);
/**
* @brief Set the credentials needed to use the proxy
*
* If you don't need to use any credentials, do not use this function
* or pass NULL in the first parameter.
*
* @param newUsername Username to access the proxy, or NULL if credentials aren't needed
* @param newPassword Password to access the proxy
*/
void setCredentials(const char* newUsername, const char* newPassword);
/**
* @brief Returns the current proxy type of the object
*
* The allowed values in the current version are:
* - PROXY_NONE means no proxy
* - PROXY_AUTO means automatic detection (default)
* - PROXY_CUSTOM means a proxy using user-provided data
*
* @return Current proxy type (PROXY_NONE, PROXY_AUTO or PROXY_CUSTOM)
*/
int getProxyType();
/**
* @brief Returns the URL of the proxy, previously set with MegaProxy::setProxyURL.
*
* The MegaProxy object retains the ownership of the returned value.
* It will be valid until the MegaProxy::setProxyURL is called (that will delete the previous value)
* or until the MegaProxy object is deleted.
*
* @return URL of the proxy
*/
const char *getProxyURL();
/**
* @brief Returns true if credentials are needed to access the proxy, false otherwise.
*
* The default value of this function is false. It will return true after calling
* MegaProxy::setCredentials with a non NULL username.
*
* @return True if credentials are needed to access the proxy, false otherwise.
*/
bool credentialsNeeded();
/**
* @brief Return the username required to access the proxy
*
* The MegaProxy object retains the ownership of the returned value.
* It will be valid until the MegaProxy::setCredentials is called (that will delete the previous value)
* or until the MegaProxy object is deleted.
*
* @return Username required to access the proxy
*/
const char *getUsername();
/**
* @brief Return the username required to access the proxy
*
* The MegaProxy object retains the ownership of the returned value.
* It will be valid until the MegaProxy::setCredentials is called (that will delete the previous value)
* or until the MegaProxy object is deleted.
*
* @return Password required to access the proxy
*/
const char *getPassword();
private:
int proxyType;
const char *proxyURL;
const char *username;
const char *password;
};
/**
* @brief Interface to receive SDK logs
*
* You can implement this class and pass an object of your subclass to MegaApi::setLoggerClass
* to receive SDK logs. You will have to use also MegaApi::setLogLevel to select the level of
* the logs that you want to receive.
*
*/
class MegaLogger
{
public:
/**
* @brief This function will be called with all logs with level <= your selected
* level of logging (by default it is MegaApi::LOG_LEVEL_INFO)
*
* @param time Readable string representing the current time.
*
* The SDK retains the ownership of this string, it won't be valid after this funtion returns.
*
* @param loglevel Log level of this message
*
* Valid values are:
* - MegaApi::LOG_LEVEL_FATAL = 0
* - MegaApi::LOG_LEVEL_ERROR = 1
* - MegaApi::LOG_LEVEL_WARNING = 2
* - MegaApi::LOG_LEVEL_INFO = 3
* - MegaApi::LOG_LEVEL_DEBUG = 4
* - MegaApi::LOG_LEVEL_VERBOSE = 5
* - MegaApi::LOG_LEVEL_MAX = 5
*
* @param source Location where this log was generated
*
* For logs generated inside the SDK, this will contain the source file and the line of code.
* The SDK retains the ownership of this string, it won't be valid after this funtion returns.
*
* @param message Log message
*
* The SDK retains the ownership of this string, it won't be valid after this funtion returns.
*
* @param directMessages: in ENABLE_LOG_PERFORMANCE MODE, this will indicate the logger that an array of const char* should
* be written in the logs immediately without buffering the output. message can be discarded in that case.
*
* @param directMessagesSizes: size of the previous const char *.
*
*/
virtual void log(const char *time, int loglevel, const char *source, const char *message
#ifdef ENABLE_LOG_PERFORMANCE
, const char **directMessages = nullptr, size_t *directMessagesSizes = nullptr, int numberMessages = 0
#endif
);
virtual ~MegaLogger(){}
};
/**
* @brief Represents a node (file/folder) in the MEGA account
*
* It allows to get all data related to a file/folder in MEGA. It can be also used
* to start SDK requests (MegaApi::renameNode, MegaApi::moveNode, etc.)
*
* Objects of this class aren't live, they are snapshots of the state of a node
* in MEGA when the object is created, they are immutable.
*
* Do not inherit from this class. You can inspect the MEGA filesystem and get these objects using
* MegaApi::getChildren, MegaApi::getChildNode and other MegaApi functions.
*
*/
class MegaNode
{
public:
enum {
TYPE_UNKNOWN = -1,
TYPE_FILE = 0,
TYPE_FOLDER = 1,
TYPE_ROOT = 2,
TYPE_VAULT = 3,
TYPE_INCOMING = TYPE_VAULT, // kept for backwards-compatibility (renamed to Vault)
TYPE_RUBBISH = 4
};
enum {
NODE_LBL_UNKNOWN = 0,
NODE_LBL_RED,
NODE_LBL_ORANGE,
NODE_LBL_YELLOW,
NODE_LBL_GREEN,
NODE_LBL_BLUE,
NODE_LBL_PURPLE,
NODE_LBL_GREY,
};
enum
{
CHANGE_TYPE_REMOVED = 0x01,
CHANGE_TYPE_ATTRIBUTES = 0x02,
CHANGE_TYPE_OWNER = 0x04,
CHANGE_TYPE_TIMESTAMP = 0x08,
CHANGE_TYPE_FILE_ATTRIBUTES = 0x10,
CHANGE_TYPE_INSHARE = 0x20,
CHANGE_TYPE_OUTSHARE = 0x40,
CHANGE_TYPE_PARENT = 0x80,
CHANGE_TYPE_PENDINGSHARE = 0x100,
CHANGE_TYPE_PUBLIC_LINK = 0x200,
CHANGE_TYPE_NEW = 0x400,
CHANGE_TYPE_NAME = 0x800,
CHANGE_TYPE_FAVOURITE = 0x1000,
CHANGE_TYPE_COUNTER = 0x2000,
CHANGE_TYPE_SENSITIVE = 0x4000,
CHANGE_TYPE_PWD = 0x8000,
CHANGE_TYPE_DESCRIPTION = 0x10000,
CHANGE_TYPE_TAGS = 0x20000,
};
/**
* @brief Pure Object Data for Credit Card Node attributes. Instances of this class are
* returned by the function getCreditCardData on a Credit Card Node, as well as provided
* as an argument for Credit Card Node updates in updateCreditCardNode function.
*/
class CreditCardNodeData
{
public:
virtual ~CreditCardNodeData() = default;
/**
* @brief Creates a new instance of CreditCardNodeData.
*
* @param cardNumber Number of the card (All characters must be digits). This field
* cannot be null nor empty when creating a new Credit card Node
* @param notes Notes to attach to the Credit card node
* @param cardHolderName Name of holder of Credit Card
* @param cvv card verification Value of the Credit Card (All characters must be digits)
* @param expirationDate expiration date of Credit card (Expected format `MM/YY` with MM
* and YY digits)
*
* @note: nullptr can be used to specify that a field is not to be updated when calling
* MegaApi::updateCreditCardNode.
*
* @note The caller takes the ownership of the returned pointer.
*
* @return A pointer to the newly created object which will be owned by the caller.
*/
static CreditCardNodeData* createInstance(const char* cardNumber,
const char* notes,
const char* cardHolderName,
const char* cvv,
const char* expirationDate);
/**
* @brief Set cardNumber attribute value.
*
* @note All characters must be digits
*
* @param cardNumber Value to set
*/
virtual void setCardNumber(const char* cardNumber) = 0;
/**
* @brief Set notes attribute value.
*
* @param notes Value to set
*/
virtual void setNotes(const char* notes) = 0;
/**
* @brief Set cardHolderName attribute value.
*
* @param cardHolderName Value to set
*/
virtual void setCardHolderName(const char* cardHolderName) = 0;
/**
* @brief Set cvv attribute value.
*
* @note All characters must be digits
*
* @param cvv Value to set
*/
virtual void setCvv(const char* cvv) = 0;
/**
* @brief Set expirationDate attribute value.
*
* @note Expected format `MM/YY` with MM and YY digits
*
* @param expirationDate Value to set
*/
virtual void setExpirationDate(const char* expirationDate) = 0;
/**
* @brief Get cardNumber attribute value.
*
* @return null-terminated string with the cardNumber value or nullptr/NULL if none
*/
virtual const char* cardNumber() const = 0;
/**
* @brief Get notes attribute value.
*
* @return null-terminated string with the notes value or nullptr/NULL if none
*/
virtual const char* notes() const = 0;
/**
* @brief Get cardHolderName attribute value.
*
* @return null-terminated string with the cardHolderName value or nullptr/NULL if none
*/
virtual const char* cardHolderName() const = 0;
/**
* @brief Get cvv attribute value.
*
* @return null-terminated string with the cvv value or nullptr/NULL if none
*/
virtual const char* cvv() const = 0;
/**
* @brief Get expiration date attribute value (in MM/YY format).
*
* @return null-terminated string with the expirationDate value or nullptr/NULL if none
*/
virtual const char* expirationDate() const = 0;
protected:
CreditCardNodeData() = default;
};
/**
* @brief Pure Object Data for Password Node attributes. Instances of this class are
* returned by the function getPasswordData on a Password Node, as well as provided
* as an argument for Password Node updates in updatePasswordNode function.
*/
class PasswordNodeData
{
public:
/**
* @brief Represents data related to TOTP (Time-based One-Time Password) token
* generation.
*
* Example 1: Create a Password node with TOTP data.
* 1) Create an instance of PasswordNodeData::TotpData:
*
* std::unique_ptr<TotpData> totpData{
* TotpData::createInstance("abcd", 20, TotpData::HASH_ALGO_SHA256, 8)};
*
* 2) Create an instance of Password Node Data providing TOTP data created in previous
* step:
*
* std::unique_ptr<PasswordNodeData> pwdData {
* PasswordNodeData::createInstance("12},\" '34",
* "notes",
* "url",
* "userName",
* totpData.get())};
*
* 3) Invoke MegaApi::createPasswordNode as usual providing pwdData created in previous
* step
*
* Example 2: Update a TOTP field from an existing node:
* 1) Get the password data from the node:
*
* std::unique_ptr<PasswordNodeData> pwdData{n->getPasswordData()};
*
* 2) Create a new instance of TotpData as in step 1) in previous example with the new
* information or get a copy of the data stored in the `pwdData` and modify the field
* as follows:
*
* std::unique_ptr<PasswordNodeData::TotpData> tData {pwdData->totpData()->copy()};
* tData->setSharedSecret("HQER2385");
*
* 3) Set this new TotpData to the pwdData:
*
* pwdData->setTotpData(tData.get());
*
* 4) Finally, call updatePasswordNode with this pwdData.
*
* Example 3: Remove TOTP data from a password node:
* 1) Get the password data from the node as step 1) of example 2.
* 2) Create a special instance of TotpData to remove the data:
*
* std::unique_ptr<TotpData> totpData{TotpData::createRemovalInstance()};
*
* 3) Set this totpData to the pwdData as in step 3) in example 2.
* 4) Finally, call updatePasswordNode with this pwdData.
*/
class TotpData
{
public:
/**
* @brief The Validation class represents the current validation status for a
* TotpData instance
*
* Usage:
* - Get a validation instance from your TotpData object using the
* TotpData::getValidation() method
* - If you are planning to use the object to update the existing TotpData of a
* password node, invoke the Validation::isValidForUpdate() to check if the your
* TotpData object contains valid data.
* - If it returns true, you can safely use it to update the node. No errors will
* be triggered due to the format of the totp data.
* - If not (returns false), you can check the outputs from the following methods
* to detect where the problem comes from:
* - sharedSecretValid(): Must be a string only containing characters in
* "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"
* - algorithmValid(): Must be one of the enum entries `HASH_ALGO_*`
* - nDigitsValid(): Between 6 and 10 both included
* - expirationTimeValid(): A positive number greater than 0
* - If the instances is going to be used for creating a new password node with totp
* data or to update a node that has no totp data stored, you should check the
* output from Validation::isValidForCreate().
* - If it returns true, you can use the TotpData instance to create a new node or
* to update an existing one without previous totp data.
* - Else, in addition to the methods that must return true also for the update
* (above), for creation, all the fields must be present. For that you can
* check:
* - sharedSecretExist()
* - algorithmExist()
* - nDigitsExist()
* - expirationTimeExist()
*/
class Validation
{
public:
virtual ~Validation() = default;
/**
* @brief Returns `true` if shared secret has a value, `false` otherwise
*/
virtual bool sharedSecretExist() const = 0;
/**
* @brief Returns `true` if shared secret is valid, `false` otherwise
*/
virtual bool sharedSecretValid() const = 0;
/**
* @brief Returns `true` if algorithm has a value different from TOTPNULLOPT,
* `false` otherwise
*/
virtual bool algorithmExist() const = 0;
/**
* @brief Returns `true` if algorithm is valid, `false` otherwise
*/
virtual bool algorithmValid() const = 0;
/**
* @brief Returns `true` if expiration time has a value different from
* TOTPNULLOPT, `false` otherwise
*/
virtual bool expirationTimeExist() const = 0;
/**
* @brief Returns `true` if expiration time is valid, `false` otherwise
*/
virtual bool expirationTimeValid() const = 0;
/**
* @brief Returns `true` if number of digits has a value different from
* TOTPNULLOPT, `false` otherwise
*/
virtual bool nDigitsExist() const = 0;
/**
* @brief Returns `true` if number of digits is valid, `false` otherwise
*/
virtual bool nDigitsValid() const = 0;
/**
* @brief Returns `true` if TotpData instance is valid for initializing a new
* totp data field in a password node, `false` otherwise
* @note For initializing the totpData field in a password node, all the
* mandatory fields (shared secret, expiration time, algorithm and n digits)
* must be present in the TotpData instance.
*/
virtual bool isValidForCreate() const = 0;
/**
* @brief Returns `true` if TotpData instance is valid just for updating
* existing totp data on a password node, `false` otherwise
*/
virtual bool isValidForUpdate() const = 0;
protected:
Validation() = default;
};
enum
{
HASH_ALGO_SHA1 = 0,
HASH_ALGO_SHA256 = 1,
HASH_ALGO_SHA512 = 2,
};
// Default values when not provided by the authentication provider
static constexpr int DEFAULT_HASH_ALGO = 0;
static constexpr int DEFAULT_EXPIRATION_TIME_SECS = 30;
static constexpr int DEFAULT_NDIGITS = 6;
// Use this constant to leave a field untouched
static constexpr int TOTPNULLOPT = -1;
virtual ~TotpData() = default;
/**
* @brief Creates a special instance of `TotpData` marked for removal.
* This instance could be used to remove TOTP data from PasswordNodeData.
*
* @return A pointer to a `TotpData` instance marked for removal.
* @note The caller takes the ownership of the returned pointer.
*/
static TotpData* createRemovalInstance();
/**
* @brief Creates a new instance of `TotpData` with specified parameters.
*
* In an update operation, to leave values untouched, use nullptr for `sharedSecret`
* and TOTPNULLOPT constant for the rest of the parameters.
*
* For creating a node with Totp data or for setting it in an existing node that has
* no totp data, you are forced to pass all the parameters valid values. You can use
* DEFAULT_EXPIRATION_TIME_SECS, DEFAULT_HASH_ALGO and DEFAULT_NDIGITS to set
* default values.
*
* @param sharedSecret The shared secret key for TOTP.
* @param expirationTimeSecs The expiration time in seconds.
* @param hashAlgorithm The hashing algorithm to use.
* @param ndigits The number of digits in the generated TOTP code.
* @return A pointer to a newly created `TotpData` instance.
* @note The caller takes the ownership of the returned pointer.
*/
static TotpData* createInstance(const char* sharedSecret,
const int expirationTimeSecs,
const int hashAlgorithm,
const int ndigits);
/**
* @brief Returns the shared secret key for TOTP
*
* @return the null-terminated string with shared secret key for TOTP if any,
* nullptr/NULL otherwise
*/
virtual const char* sharedSecret() const = 0;
/**
* @brief Returns the expiration time in seconds.
*
* @return the expiration time in seconds if any, TOTPNULLOPT otherwise.
*/
virtual int expirationTime() const = 0;
/**
* @brief Returns the hashing algorithm to use.
*
* @return the hashing algorithm to use if any, TOTPNULLOPT otherwise.
*/
virtual int hashAlgorithm() const = 0;
/**
* @brief Returns the number of digits in the generated TOTP code.
*
* @return true the number of digits in the generated TOTP code if any, TOTPNULLOPT
* otherwise.
*/
virtual int nDigits() const = 0;
/**
* @brief Check if TOTP data instance is marked to be removed
*
* @return true if TOTP data instance is marked to be removed, otherwise false
*/
virtual bool markedToRemove() const = 0;
/**
* @brief Set shared secret attribute value.
*
* @param sharedSecret Value to set
*/
virtual void setSharedSecret(const char* sharedSecret) = 0;
/**
* @brief Set expiration time attribute value.
*
* @param expirationTimeSecs time Value to set
*/
virtual void setExpirationTime(const int expirationTimeSecs) = 0;
/**
* @brief Set Hash algorithm attribute value.
*
* @param algorithm Value to set
*/
virtual void setHashAlgorithm(const int algorithm) = 0;
/**
* @brief Set Ndigits attribute value.
*
* @param n Value to set
*/
virtual void setNdigits(const int n) = 0;
/**
* @brief Returns a copy of TOTP data.
*
* @return a pointer to the copy of TOTP data.
*/
virtual TotpData* copy() const = 0;
/**
* @brief Returns a Validation instance that can be used to check any error detected
* in the TotpData object
*
* @return A pointer to a newly created `Validation` instance.
* @note The caller takes the ownership of the returned pointer.
* @see Validation class for more details
*/
virtual Validation* getValidation() const = 0;
protected:
TotpData() = default;
};
/**
* @brief Creates a new instance of PasswordNodeData
* @return A pointer to the newly created object which will be owned by the caller
*/
static PasswordNodeData* createInstance(const char* pwd,
const char* notes,
const char* url,
const char* userName,
const TotpData* totpData);
/**
* @brief Set TOTP data attribute value.
*
* @param totpData Value to set
*/
virtual void setTotpData(const TotpData* totpData) = 0;
/**
* @brief Set password attribute value.
*
* @param pwd Value to set
*/
virtual void setPassword(const char* pwd) = 0;
/**
* @brief Set notes attribute value.
*
* @param n Value to set
*/
virtual void setNotes(const char* n) = 0;
/**
* @brief Set URL attribute value.
*
* @param u Value to set
*/
virtual void setUrl(const char* u) = 0;
/**
* @brief Set user name attribute value.
*
* @param un Value to set
*/
virtual void setUserName(const char* un) = 0;
/**
* @brief Get password attribute value.
*
* @return null-terminated string with the password value or nullptr/NULL if none
*/
virtual const char* password() const = 0;
/**
* @brief Get notes attribute value.
*
* @return null-terminated string with the password value or nullptr/NULL if none
*/
virtual const char* notes() const = 0;
/**
* @brief Get URL attribute value.
*
* @return null-terminated string with the password value or nullptr/NULL if none
*/
virtual const char* url() const = 0;
/**
* @brief Get user name attribute value.
*
* @return null-terminated string with the password value or nullptr/NULL if none
*/
virtual const char* userName() const = 0;
/**
* @brief Get TOTP data attribute value.
*
* The PasswordNodeData object retains the ownership of the TotpData.
* You can get a copy of TotpData by calling TotpData::copy
*
* @return TOTP data attribute
*/
virtual const TotpData* totpData() const = 0;
virtual ~PasswordNodeData() = default;
protected:
PasswordNodeData() = default;
};
static const int INVALID_DURATION = -1;
static const double INVALID_COORDINATE;
virtual ~MegaNode();
/**
* @brief Creates a copy of this MegaNode object.
*
* The resulting object is fully independent of the source MegaNode,
* it contains a copy of all internal attributes, so it will be valid after
* the original object is deleted.
*
* You are the owner of the returned object
*
* @return Copy of the MegaNode object
*/
virtual MegaNode *copy();
/**
* @brief Returns the type of the node
*
* Valid values are:
* - TYPE_UNKNOWN = -1,
* Unknown node type
*
* - TYPE_FILE = 0,
* The MegaNode object represents a file in MEGA
*
* - TYPE_FOLDER = 1
* The MegaNode object represents a folder in MEGA
*
* - TYPE_ROOT = 2
* The MegaNode object represents root of the MEGA Cloud Drive
*
* - TYPE_VAULT = 3
* The MegaNode object represents root of the MEGA Vault
*
* - TYPE_RUBBISH = 4
* The MegaNode object represents root of the MEGA Rubbish Bin
*
* @return Type of the node
*/
virtual int getType() const;
/**
* @brief Returns the name of the node
*
* The name is only valid for nodes of type TYPE_FILE or TYPE_FOLDER.
* For other MegaNode types, the name is undefined.
*
* The MegaNode object retains the ownership of the returned string. It will
* be valid until the MegaNode object is deleted.
*
* @return Name of the node
*/
virtual const char* getName();
/**
* @brief Returns the fingerprint (Base64-encoded) of the node
*
* Only files have a fingerprint, and there could be files without it.
* If the node doesn't have a fingerprint, this funtion returns NULL
*
* The MegaNode object retains the ownership of the returned string. It will
* be valid until the MegaNode object is deleted.
*
* @return Base64-encoded fingerprint of the node, or NULL it the node doesn't have a fingerprint.
*/
virtual const char* getFingerprint();
/**
* @brief Returns the original fingerprint (Base64-encoded) of the node
*
* In the case where a file was modified before uploaded (eg. resized photo or gps coords removed),
* it may have an original fingerprint set (by MegaApi::setOriginalFingerprint or
* MegaApi::backgroundMediaUploadComplete), which is the fingerprint of the file before it was modified.
* This can be useful on mobile devices to avoid uploading a file multiple times when only
* the original file is kept on the device.
*
* The MegaNode object retains the ownership of the returned string. It will
* be valid until the MegaNode object is deleted.
*
* @return Base64-encoded original fingerprint of the node, or NULL it the node doesn't have an original fingerprint.
*/
virtual const char* getOriginalFingerprint();
/**
* @brief Returns true if the node has custom attributes
*
* Custom attributes can be set using MegaApi::setCustomNodeAttribute
*
* @return True if the node has custom attributes, otherwise false
* @see MegaApi::setCustomNodeAttribute
*/
virtual bool hasCustomAttrs();
/**
* @brief Returns the list with the names of the custom attributes of the node
*
* Custom attributes can be set using MegaApi::setCustomNodeAttribute
*
* You take the ownership of the returned value
*
* @return Names of the custom attributes of the node
* @see MegaApi::setCustomNodeAttribute
*/
virtual MegaStringList *getCustomAttrNames();
/**
* @brief Get a custom attribute of the node
*
* Custom attributes can be set using MegaApi::setCustomNodeAttribute
*
* The MegaNode object retains the ownership of the returned string. It will
* be valid until the MegaNode object is deleted.
*
* @param attrName Name of the custom attribute
* @return Custom attribute of the node
* @see MegaApi::setCustomNodeAttribute
*/
virtual const char *getCustomAttr(const char* attrName);
/**
* @brief Get the attribute of the node representing its duration.
*
* The purpose of this attribute is to store the duration of audio/video files.
*
* @return The number of seconds, or -1 if this attribute is not set.
*/
virtual int getDuration();
/**
* @brief Get the attribute of the node representing its width.
*
* @return The number of pixels for width, or -1 if this attribute is not set.
*/
virtual int getWidth();
/**
* @brief Get the attribute of the node representing its height.
*
* @return The number of pixels for height, or -1 if this attribute is not set.
*/
virtual int getHeight();
/**
* @brief Get the attribute of the node representing its shortformat.
*
* @return The shortformat, or -1 if this attribute is not set.
*/
virtual int getShortformat();
/**
* @brief Get the attribute of the node representing its videocodecid.
*
* @return The videocodecid, or -1 if this attribute is not set.
*/
virtual int getVideocodecid();
/**
* @brief Return if the node is marked as favourite.
*
* @return True if node is marked as favourite, otherwise return false (attribute is not set).
*/
virtual bool isFavourite();
/**
* @brief Ascertain if the node is marked as sensitive
*
* see MegaApi::isSensitiveInherit to see if the node is marked sensitive
* or as descendent of a node that is marked sensitive
*
* @param node node to inspect
*/
virtual bool isMarkedSensitive();
/**
* @brief Get the attribute of the node representing its label.
*
* @return The label of the node, valid values are:
* - MegaNode::NODE_LBL_UNKNOWN = 0
* - MegaNode::NODE_LBL_RED = 1
* - MegaNode::NODE_LBL_ORANGE = 2
* - MegaNode::NODE_LBL_YELLOW = 3
* - MegaNode::NODE_LBL_GREEN = 4
* - MegaNode::NODE_LBL_BLUE = 5
* - MegaNode::NODE_LBL_PURPLE = 6
* - MegaNode::NODE_LBL_GREY = 7
*/
virtual int getLabel();
/**
* @brief Get the attribute of the node representing the latitude.
*
* The purpose of this attribute is to store the coordinate where a photo was taken.
*
* @return The latitude coordinate in its decimal degree notation, or INVALID_COORDINATE
* if this attribute is not set.
*/
virtual double getLatitude();
/**
* @brief Get the attribute of the node representing the longitude.
*
* The purpose of this attribute is to store the coordinate where a photo was taken.
*
* @return The longitude coordinate in its decimal degree notation, or INVALID_COORDINATE
* if this attribute is not set.
*/
virtual double getLongitude();
/**
* @brief Get the attribute of the node representing the description
*
* The purpose of this attribute is to store the node description.
*
* The MegaNode object retains the ownership of the returned string. It will be valid until
* the MegaNode object is deleted.
*
* @return Node description
*/
virtual const char* getDescription();
/**
* @brief Get a list of tags from a node
*
* These tags are stored as a node attribute
*
* You take the ownership of the returned value.
*
* @return List of tags from the node
*/
virtual MegaStringList* getTags();
/**
* @brief Returns the handle of this MegaNode in a Base64-encoded string
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @return Base64-encoded handle of the node
*/
virtual char* getBase64Handle();
/**
* @brief Returns the size of the node
*
* The returned value is only valid for nodes of type TYPE_FILE.
*
* @return Size of the node
*/
virtual int64_t getSize();
/**
* @brief Returns the creation time of the node in MEGA (in seconds since the epoch)
*
* The returned value is only valid for nodes of type TYPE_FILE or TYPE_FOLDER.
*
* @return Creation time of the node (in seconds since the epoch)
*/
virtual int64_t getCreationTime();
/**
* @brief Returns the modification time of the file that was uploaded to MEGA (in seconds since the epoch)
*
* The returned value is only valid for nodes of type TYPE_FILE.
*
* @return Modification time of the file that was uploaded to MEGA (in seconds since the epoch)
*/
virtual int64_t getModificationTime();
/**
* @brief Returns a handle to identify this MegaNode
*
* You can use MegaApi::getNodeByHandle to recover the node later.
*
* @return Handle that identifies this MegaNode
*/
virtual MegaHandle getHandle() const;
/**
* @brief Returns the handle of the previous parent of this node.
*
* This attribute is set when nodes are moved to the Rubbish Bin to
* ease their restoration. If the attribute is not set for the node,
* this function returns MegaApi::INVALID_HANDLE
*
* @return Handle of the previous parent of this node or MegaApi::INVALID_HANDLE
* if the attribute is not set.
*/
virtual MegaHandle getRestoreHandle();
/**
* @brief Returns the handle of the parent node
*
* You can use MegaApi::getNodeByHandle to recover the node later.
*
* @return Handle of the parent node (or INVALID_HANDLE for root nodes)
*/
virtual MegaHandle getParentHandle();
/**
* @brief Returns the key of the node in a Base64-encoded string
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @return Returns the key of the node.
*/
virtual char* getBase64Key();
/**
* @brief Returns the expiration time of a public link, if any
*
* @return The expiration time as an Epoch timestamp. Returns 0 for non-expire
* links, and -1 if the MegaNode is not exported.
*/
virtual int64_t getExpirationTime();
/**
* @brief Returns the public handle of a node
*
* Only exported nodes have a public handle.
*
* @return The public handle of an exported node. If the MegaNode
* has not been exported, it returns UNDEF.
*/
virtual MegaHandle getPublicHandle();
/**
* @brief Returns a public node corresponding to the exported MegaNode
*
* You take ownership of the returned value.
*
* @return Public node for the exported node. If the MegaNode has not been
* exported or it has expired, then it returns NULL.
*/
virtual MegaNode* getPublicNode();
/**
* @brief Returns the URL for the public link of the exported node.
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @param includeKey False if you want the link without the key.
* @return The URL for the public link of the exported node. If the MegaNode
* has not been exported, it returns NULL.
*/
virtual char * getPublicLink(bool includeKey = true);
/**
* @brief Returns the creation time for the public link of the exported node (in seconds since the epoch).
*
* @return Creation time for the public link of the node. Returns 0 if the creation time is not available
* and -1 if the MegaNode has not been exported.
*/
virtual int64_t getPublicLinkCreationTime();
/**
* @brief Returns authentication key for a writable folder.
*
* The MegaNode object retains the ownership of the returned string. It will
* be valid until the MegaNode object is deleted.
*
* @return authentication key for a writable folder. If there is no authentication key,
* nullptr shall be returned.
*/
virtual const char * getWritableLinkAuthKey();
/**
* @brief Returns true if this node represents a file (type == TYPE_FILE)
* @return true if this node represents a file, otherwise false
*/
virtual bool isFile();
/**
* @brief Returns true this node represents a folder or a root node
*
* @return true this node represents a folder or a root node
*/
virtual bool isFolder();
/**
* @brief Returns true if this node has been removed from the MEGA account
*
* This value is only useful for nodes notified by MegaListener::onNodesUpdate or
* MegaGlobalListener::onNodesUpdate that can notify about deleted nodes.
*
* In other cases, the return value of this function will be always false.
*
* @return true if this node has been removed from the MEGA account
*/
virtual bool isRemoved();
/**
* @brief Returns true if this node has an specific change
*
* This value is only useful for nodes notified by MegaListener::onNodesUpdate or
* MegaGlobalListener::onNodesUpdate that can notify about node modifications.
*
* In other cases, the return value of this function will be always false.
*
* @param changeType The type of change to check. It can be one of the following values:
*
* - MegaNode::CHANGE_TYPE_REMOVED = 0x01
* Check if the node is being removed
*
* - MegaNode::CHANGE_TYPE_ATTRIBUTES = 0x02
* Check if an attribute of the node has changed, usually the namespace name
*
* - MegaNode::CHANGE_TYPE_OWNER = 0x04
* Check if the owner of the node has changed
*
* - MegaNode::CHANGE_TYPE_TIMESTAMP = 0x08
* Check if the modification time of the node has changed
*
* - MegaNode::CHANGE_TYPE_FILE_ATTRIBUTES = 0x10
* Check if file attributes have changed, usually the thumbnail or the preview for images
*
* - MegaNode::CHANGE_TYPE_INSHARE = 0x20
* Check if the node is a new or modified inshare
*
* - MegaNode:: CHANGE_TYPE_OUTSHARE = 0x40
* Check if the node is a new or modified outshare
*
* - MegaNode::CHANGE_TYPE_PARENT = 0x80
* Check if the parent of the node has changed
*
* - MegaNode::CHANGE_TYPE_PENDINGSHARE = 0x100
* Check if the pending share of the node has changed
*
* - MegaNode::CHANGE_TYPE_PUBLIC_LINK = 0x200
* Check if the public link of the node has changed
*
* - MegaNode::CHANGE_TYPE_NEW = 0x400
* Check if the node is new
*
* - MegaNode::CHANGE_TYPE_PWD = 0x8000
* Check if any Password Node Data value for this node changed
*
* - MegaNode::CHANGE_TYPE_DESCRIPTION = 0x10000
* Check if description for this node has changed
*
* - MegaNode::CHANGE_TYPE_TAGS = 0x20000
* Check if tags for this node have changed
*
* @return true if this node has an specific change
*/
virtual bool hasChanged(uint64_t changeType);
/**
* @brief Returns a bit field with the changes of the node
*
* This value is only useful for nodes notified by MegaListener::onNodesUpdate or
* MegaGlobalListener::onNodesUpdate that can notify about node modifications.
*
* @return The returned value is an OR combination of these flags:
*
*- MegaNode::CHANGE_TYPE_REMOVED = 0x01
* The node is being removed
*
* - MegaNode::CHANGE_TYPE_ATTRIBUTES = 0x02
* An attribute of the node has changed, usually the namespace name
*
* - MegaNode::CHANGE_TYPE_OWNER = 0x04
* The owner of the node has changed
*
* - MegaNode::CHANGE_TYPE_TIMESTAMP = 0x08
* The modification time of the node has changed
*
* - MegaNode::CHANGE_TYPE_FILE_ATTRIBUTES = 0x10
* File attributes have changed, usually the thumbnail or the preview for images
*
* - MegaNode::CHANGE_TYPE_INSHARE = 0x20
* The node is a new or modified inshare
*
* - MegaNode::CHANGE_TYPE_OUTSHARE = 0x40
* The node is a new or modified outshare
*
* - MegaNode::CHANGE_TYPE_PARENT = 0x80
* The parent of the node has changed
*
* - MegaNode::CHANGE_TYPE_PENDINGSHARE = 0x100
* Check if the pending share of the node has changed
*
* - MegaNode::CHANGE_TYPE_PUBLIC_LINK = 0x200
* Check if the public link of the node has changed
*
* - MegaNode::CHANGE_TYPE_NEW = 0x400
* Check if the node is new
*
* - MegaNode::CHANGE_TYPE_NAME = 0x800
* Check if the node name has changed
*
* - MegaNode::CHANGE_TYPE_FAVOURITE = 0x1000
* Check if the node was added to or removed from favorites
*
* - MegaNode::CHANGE_TYPE_COUNTER = 0x2000
* Check if counter for this node (its subtree) has changed
*
* - MegaNode::CHANGE_TYPE_PWD = 0x8000
* Check if any Password Node Data value for this node changed
*
* - MegaNode::CHANGE_TYPE_DESCRIPTION = 0x10000
* Check if description for this node has changed
*
* - MegaNode::CHANGE_TYPE_TAGS = 0x20000
* Check if tags for this node have changed
*
*/
virtual uint64_t getChanges();
/**
* @brief Returns true if the node has an associated thumbnail
* @return true if the node has an associated thumbnail
*/
virtual bool hasThumbnail();
/**
* @brief Returns true if the node has an associated preview
* @return true if the node has an associated preview
*/
virtual bool hasPreview();
/**
* @brief Returns true if this is a public node
*
* Only MegaNode objects generated with MegaApi::getPublicMegaNode
* will return true.
*
* @return true if this is a public node
*/
virtual bool isPublic();
/**
* @brief Check if the MegaNode is being shared by/with your own user
*
* For nodes that are being shared, you can get a list of MegaShare
* objects using MegaApi::getOutShares, or a list of MegaNode objects
* using MegaApi::getInShares
*
* @return true is the MegaNode is being shared, otherwise false
* @note Exported nodes (public link) are not considered to be shared nodes.
*/
virtual bool isShared();
/**
* @brief Check if the MegaNode is being shared with other users
*
* For nodes that are being shared, you can get a list of MegaShare
* objects using MegaApi::getOutShares
*
* @return true is the MegaNode is being shared, otherwise false
*/
virtual bool isOutShare();
/**
* @brief Check if a MegaNode belong to another User, but it is shared with you
*
* For nodes that are being shared, you can get a list of MegaNode
* objects using MegaApi::getInShares
*
* @return true is the MegaNode is being shared, otherwise false
*/
virtual bool isInShare();
/**
* @brief Returns true if the node has been exported (has a public link)
*
* Public links are created by calling MegaApi::exportNode.
*
* @return true if this is an exported node
*/
virtual bool isExported();
/**
* @brief Returns true if the node has been exported (has a temporal public link)
* and the related public link has expired.
*
* Public links are created by calling MegaApi::exportNode.
*
* @return true if the public link has expired.
*/
virtual bool isExpired();
/**
* @brief Returns true if this the node has been exported
* and the related public link has been taken down.
*
* Public links are created by calling MegaApi::exportNode.
*
* @return true if the public link has been taken down.
*/
virtual bool isTakenDown();
/**
* @brief Returns true if this MegaNode is a private node from a foreign account
*
* Only MegaNodes created with MegaApi::createForeignFileNode and MegaApi::createForeignFolderNode
* returns true in this function.
*
* @return true if this node is a private node from a foreign account
*/
virtual bool isForeign();
/**
* @brief Returns true if this MegaNode is a Credit Card Node
*
* @note: A Credit Card Node is a Password Manager Node with credit card information.
*
* Only MegaNodes created with MegaApi::createCreditCardNode return true in this function.
*
* @return true if this node is a Credit Card Node
*/
virtual bool isCreditCardNode() const;
/**
* @brief Returns true if this MegaNode is a Password Node
*
* @note: A Password Node is a Password Manager Node with login credential information.
*
* Only MegaNodes created with MegaApi::createPasswordNode return true in this function.
*
* @return true if this node is a Password Node
*/
virtual bool isPasswordNode() const;
/**
* @brief Returns true if this MegaNode is a Password Manager Node
*
* A node is considered a Password Manager Node if Password Manager Base is its
* ancestor and it's not a Password Manager Node Folder.
*
* @return true if this node is a Password Manager Node, false otherwise.
* In case node doesn't exists this method will also returns false.
*/
virtual bool isPasswordManagerNode() const;
/**
* @brief Gets the Credit Card Node value if the node is a Credit Card Node
*
* Non-set MegaNode::CreditCardNodeData members will return nullptr/NULL
*
* @note The caller takes the ownership of the returned pointer.
*
* @return Credit Card Node data. Caller receives ownership.
*/
virtual CreditCardNodeData* getCreditCardData() const;
/**
* @brief Gets the Password Node value if the node is a Password Node
*
* Non-set MegaNode::PasswordNodeData members will return nullptr/NULL
*
* You take ownership of the returned value.
*
* @return Password Node data. Caller receives ownership.
*/
virtual PasswordNodeData* getPasswordData() const;
/**
* @brief Returns a string that contains the decryption key of the file (in binary format)
*
* The MegaNode object retains the ownership of the returned pointer. It will be valid until the deletion
* of the MegaNode object.
*
* @warning This method is not suitable for programming languages that require auto-generated bindings,
* due to the lack of mapping of string pointers to objects in different languages.
*
* @return Decryption key of the file (in binary format)
*/
virtual std::string* getNodeKey();
/**
* @brief Returns true if the node key is decrypted
*
* For nodes in shared folders, there could be missing keys. Also, faulty
* clients might create invalid keys. In those cases, the node's key might
* not be decrypted successfully.
*
* @return True if the node key is decrypted
*/
virtual bool isNodeKeyDecrypted();
/**
* @brief Returns the file attributes related to the node
*
* The return value is only valid for nodes attached in a chatroom. In all other cases this function
* will return NULL.
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @return File attributes related to the node
*/
virtual char *getFileAttrString();
/**
* @brief Set an auth token to access this node
*
* This function is used to authenticate private nodes from a different account.
*
* @param privateAuth token to access the node
*/
virtual void setPrivateAuth(const char *privateAuth);
/**
* @brief Returns the child nodes of an authorized folder node
*
* This function always returns NULL, except for authorized folder nodes.
* Authorized folder nodes are the ones returned by MegaApi::authorizeNode.
*
* The MegaNode object retains the ownership of the returned pointer. It will be valid until the deletion
* of the MegaNode object.
*
* @return Child nodes of an authorized folder node, otherwise NULL
*/
virtual MegaNodeList *getChildren();
virtual MegaHandle getOwner() const;
/**
* @brief Returns the device id stored as a Node attribute.
* It will be an empty string for other nodes than device folders related to backups.
*
* The MegaNode object retains the ownership of the returned string, it will be valid until
* the MegaNode object is deleted.
*
* @return The device id associated with the Node of a Backup folder.
*/
virtual const char* getDeviceId() const;
/**
* @brief Returns the S4 metadata stored as a Node attribute.
*
* The MegaNode object retains the ownership of the returned string, it will be valid until
* the MegaNode object is deleted.
*
* @return The s4 attribute associated with the Node.
*/
virtual const char* getS4() const;
/**
* @brief Provides a serialization of the MegaNode object
*
* @note This function is intended to use ONLY with MegaNode objects obtained from
* attachment messages received in a chatroom (@see MegaChatMessage::getMegaNodeList()).
* Using MegaNode objects returned by MegaNode::unserialize from a serialized
* non-chat MegaNode object may cause undefined behavior.
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @return Serialization of the MegaNode object, in Base64, or NULL if error.
*/
virtual char *serialize();
/**
* @brief Returns a new MegaNode object from its serialization
*
* @note This function is intended to use ONLY with MegaNode objects obtained from
* attachment messages received in a chatroom (@see MegaChatMessage::getMegaNodeList()).
* Using MegaNode objects obtained by MegaNode::unserialize from a serialized
* non-chat MegaNode object may cause undefined behavior.
*
* You take the ownership of the returned value.
*
* @param d Serialization of a MegaNode object obtained from a chat message (in Base64)
* @return A new MegaNode object, or NULL if error.
*/
static MegaNode* unserialize(const char *d);
};
class MegaBackupInfo;
/**
* @brief List of MegaBackupInfo objects
*
* A MegaBackupInfoList has the ownership of the MegaBackupInfo objects that it contains, so they
* will be valid only until the MegaBackupInfoList is deleted. If you want to retain a MegaBackupInfo
* returned by a MegaBackupInfoList, use MegaBackupInfo::copy().
*
* Objects of this class are immutable.
*/
class MegaBackupInfoList
{
public:
/**
* @brief Returns the MegaBackupInfo at the position i in the MegaBackupInfoList
*
* The MegaBackupInfoList retains the ownership of any returned MegaBackupInfo. It will be valid
* only until the MegaBackupInfoList is deleted. If you want to retain a MegaBackupInfo returned
* by this function, use MegaBackupInfo::copy().
*
* If the index is >= the size of the list, this function returns null.
*
* @param i Position of the instance that we want to get from the list
* @return Instance at position i in the list
*/
virtual const MegaBackupInfo* get(unsigned int /*i*/) const
{
return nullptr;
}
/**
* @brief Returns the number of MegaBackupInfo instances in the list
* @return Number of MegaBackupInfo instances in the list
*/
virtual unsigned int size() const { return 0; }
virtual MegaBackupInfoList* copy() const { return nullptr; }
virtual ~MegaBackupInfoList() = default;
};
/**
* @brief Represents a Set in MEGA
*
* It allows to get all data related to a Set in MEGA.
*
* Objects of this class aren't live, they are snapshots of the state of a Set
* in MEGA when the object is created, they are immutable.
*
*/
class MegaSet
{
public:
/**
* @brief Returns id of current Set.
*
* @return Set id.
*/
virtual MegaHandle id() const { return INVALID_HANDLE; }
/**
* @brief Returns public id of current Set if it was exported. INVALID_HANDLE otherwise
*
* @return Public id of Set.
*/
virtual MegaHandle publicId() const { return INVALID_HANDLE; }
/**
* @brief Returns id of user that owns current Set.
*
* @return user id.
*/
virtual MegaHandle user() const { return INVALID_HANDLE; }
/**
* @brief Returns timestamp of latest changes to current Set (but not to its Elements).
*
* @return timestamp value.
*/
virtual int64_t ts() const { return 0; }
/**
* @brief Returns creation timestamp of current Set.
*
* @return timestamp value.
*/
virtual int64_t cts() const { return 0; }
/**
* @brief Returns type of current Set according to defined enum.
*
* @return type value.
*/
virtual int type() const { return SET_TYPE_INVALID; }
/**
* @brief Returns name of current Set.
*
* The MegaSet object retains the ownership of the returned string, it will be valid until
* the MegaSet object is deleted.
*
* @return name of current Set.
*/
virtual const char* name() const { return nullptr; }
/**
* @brief Returns id of Element set as 'cover' for current Set.
*
* It will return INVALID_HANDLE if no cover was set or if the Element became invalid
* (was removed) in the meantime.
*
* @return Element id.
*/
virtual MegaHandle cover() const { return INVALID_HANDLE; }
/**
* @brief Returns true if this Set has a specific change
*
* This value is only useful for Sets notified by MegaListener::onSetsUpdate or
* MegaGlobalListener::onSetsUpdate that can notify about Set modifications.
*
* In other cases, the return value of this function will be always false.
*
* @param changeType The type of change to check. It can be one of the following values:
*
* - MegaSet::CHANGE_TYPE_NEW = 0x01
* Check if the Set was new
*
* - MegaSet::CHANGE_TYPE_NAME = 0x02
* Check if Set name has changed
*
* - MegaSet::CHANGE_TYPE_COVER = 0x04
* Check if Set cover has changed
*
* - MegaSet::CHANGE_TYPE_REMOVED = 0x08
* Check if the Set was removed
*
* - MegaSet::CHANGE_TYPE_EXPORT = 0x10
* Check if the Set was exported or disabled (i.e. exporting ended)
*
* @return true if this Set has a specific change
*/
virtual bool hasChanged(uint64_t /*changeType*/) const
{
return false;
}
/**
* @brief Returns the addition / OR bit-operation of all the MegaSet::CHANGE_TYPE for
* current MegaSet
*
* Note that the position of each bit matches the type of each according to the values
* for MegaSet::CHANGE_TYPE_*
*
* @return value to check bitwise position according to MegaSet::CHANGE_TYPE_* options
*/
virtual uint64_t getChanges() const { return 0; }
/**
* @brief Returns true if this Set is exported (can be accessed via public link)
*
* Public link is retrieved when the Set becomes exported
*
* @return true if this Set is exported
*/
virtual bool isExported() const { return false; }
/**
* @brief Returns deletion reason for the link associated with the set
*
* Valid values are:
* - DELETION_LINK_NO_REMOVED = 0
* - DELETION_LINK_BY_USER = 1
* - DELETION_LINK_DISPUTE = 2
* - DELETION_LINK_ETD = 3
* - DELETION_LINK_ATD = 4
*
* @return reason for link has been removed
*/
virtual int getLinkDeletionReason() const
{
return false;
}
/**
* @brief Returns true if this set has been exported
* and the related public link has been taken down.
*
* Public links are created by calling MegaApi::exportSet.
*
* @return true if the public link has been taken down.
*/
virtual bool isTakenDown() const
{
return false;
}
virtual MegaSet* copy() const { return nullptr; }
virtual ~MegaSet() = default;
enum // 1:1 with Set::CH_XXX values
{
CHANGE_TYPE_NEW = 0x01,
CHANGE_TYPE_NAME = 0x02,
CHANGE_TYPE_COVER = 0x04,
CHANGE_TYPE_REMOVED = 0x08,
CHANGE_TYPE_EXPORT = 0x10,
};
enum : int // 1:1 with existing Set::TYPE_YYY values (<255)
{
SET_TYPE_ALBUM = 0,
SET_TYPE_PLAYLIST = 1,
SET_TYPE_IGNORE = SET_TYPE_ALBUM,
SET_TYPE_INVALID = -1,
};
enum : int // 1:1 with existing Set::LinkDeletionReason::
{
DELETION_LINK_NO_REMOVED = 0,
DELETION_LINK_BY_USER = 1,
DELETION_LINK_DISPUTE = 2,
DELETION_LINK_ETD = 3,
DELETION_LINK_ATD = 4,
};
};
/**
* @brief List of MegaSet objects
*
* A MegaSetList has the ownership of the MegaSet objects that it contains, so they will be
* only valid until the MegaSetList is deleted. If you want to retain a MegaSet returned by
* a MegaSetList, use MegaSet::copy().
*
* Objects of this class are immutable.
*/
class MegaSetList
{
public:
/**
* @brief Returns the MegaSet at the position i in the MegaSetList
*
* The MegaSetList retains the ownership of the returned MegaSet. It will be only valid until
* the MegaSetList is deleted. If you want to retain a MegaSet returned by this function,
* use MegaSet::copy().
*
* If the index is >= the size of the list, this function returns NULL.
*
* @param i Position of the MegaSet that we want to get for the list
* @return MegaSet at the position i in the list
*/
virtual const MegaSet* get(unsigned int /*i*/) const
{
return nullptr;
}
/**
* @brief Returns the number of MegaSets in the list
* @return Number of MegaSets in the list
*/
virtual unsigned int size() const { return 0; }
virtual MegaSetList* copy() const { return nullptr; }
virtual ~MegaSetList() = default;
};
/**
* @brief Represents an Element of a Set in MEGA
*
* It allows to get all data related to an Element of a Set in MEGA.
*
* Objects of this class aren't live, they are snapshots of the state of an Element of a Set
* in MEGA when the object is created, they are immutable.
*
*/
class MegaSetElement
{
public:
/**
* @brief Returns id of current Element.
*
* @return Element id.
*/
virtual MegaHandle id() const { return INVALID_HANDLE; }
/**
* @brief Returns handle of file-node represented by current Element.
*
* @return file-node handle.
*/
virtual MegaHandle node() const { return INVALID_HANDLE; }
/**
* @brief Returns id of MegaSet current MegaSetElement belongs to.
*
* @return MegaSet id.
*/
virtual MegaHandle setId() const { return INVALID_HANDLE; }
/**
* @brief Returns order of current Element.
*
* If not set explicitly, the API will typically set it to multiples of 1000.
*
* @return order of current Element.
*/
virtual int64_t order() const { return 0; }
/**
* @brief Returns timestamp of latest changes to current Element.
*
* @return timestamp value.
*/
virtual int64_t ts() const { return 0; }
/**
* @brief Returns name of current Element.
*
* The MegaSetElement object retains the ownership of the returned string, it will be valid until
* the MegaSetElement object is deleted.
*
* @return name of current Element.
*/
virtual const char* name() const { return nullptr; }
/**
* @brief Returns true if this SetElement has a specific change
*
* This value is only useful for Sets notified by MegaListener::onSetElementsUpdate or
* MegaGlobalListener::onSetElementsUpdate that can notify about SetElements modifications.
*
* In other cases, the return value of this function will be always false.
*
* @param changeType The type of change to check. It can be one of the following values:
*
* - MegaSetElement::CHANGE_TYPE_ELEM_NEW = 0x01
* Check if the SetElement was new
*
* - MegaSetElement::CHANGE_TYPE_ELEM_NAME = 0x02
* Check if SetElement name has changed
*
* - MegaSetElement::CHANGE_TYPE_ELEM_ORDER = 0x04
* Check if SetElement order has changed
*
* - MegaSetElement::CHANGE_TYPE_ELEM_REMOVED = 0x08
* Check if the SetElement was removed
*
* @return true if this Set has a specific change
*/
virtual bool hasChanged(uint64_t /*changeType*/) const
{
return false;
}
/**
* @brief Returns the addition / OR bit-operation of all the MegaSetElement::CHANGE_TYPE for
* current MegaSetElement
*
* Note that the position of each bit matches the type of each according to the values
* for MegaSetElement::CHANGE_TYPE_ELEM_*
*
* @return value to check bitwise position according to MegaSetElement::CHANGE_TYPE_ELEM* options
*/
virtual uint64_t getChanges() const { return 0; }
virtual MegaSetElement* copy() const { return nullptr; }
virtual ~MegaSetElement() = default;
enum // 1:1 with SetElement::CH_EL_XXX values
{
CHANGE_TYPE_ELEM_NEW = 0x01,
CHANGE_TYPE_ELEM_NAME = 0x02,
CHANGE_TYPE_ELEM_ORDER = 0x04,
CHANGE_TYPE_ELEM_REMOVED = 0x08,
};
};
/**
* @brief List of MegaSetElement objects
*
* A MegaSetElementList has the ownership of the MegaSetElement objects that it contains, so they will be
* only valid until the MegaSetElementList is deleted. If you want to retain a MegaSetElement returned by
* a MegaSetElementList, use MegaSetElement::copy().
*
* Objects of this class are immutable.
*/
class MegaSetElementList
{
public:
/**
* @brief Returns the MegaSetElement at the position i in the MegaSetElementList
*
* The MegaSetElementList retains the ownership of the returned MegaSetElement. It will be only
* valid until the MegaSetElementList is deleted. If you want to retain a MegaSetElement
* returned by this function, use MegaSetElement::copy().
*
* If the index is >= the size of the list, this function returns NULL.
*
* @param i Position of the MegaSetElement that we want to get for the list
* @return MegaSetElement at the position i in the list
*/
virtual const MegaSetElement* get(unsigned int /*i*/) const
{
return nullptr;
}
/**
* @brief Returns the number of MegaSetElements in the list
* @return Number of MegaSetElements in the list
*/
virtual unsigned int size() const { return 0; }
virtual MegaSetElementList* copy() const { return nullptr; }
virtual ~MegaSetElementList() = default;
};
/**
* @brief Represents an user in MEGA
*
* It allows to get all data related to an user in MEGA. It can be also used
* to start SDK requests (MegaApi::share MegaApi::removeContact, etc.)
*
* Objects of this class aren't live, they are snapshots of the state of an user
* in MEGA when the object is created, they are immutable.
*
* Do not inherit from this class. You can get the contacts of an account using
* MegaApi::getContacts and MegaApi::getContact.
*
*/
class MegaUser
{
public:
enum
{
VISIBILITY_UNKNOWN = -1, // Unkown visibility
VISIBILITY_HIDDEN = 0, // Passive Contact (ex-contacts, or user who owned files in an
// incoming share from you)
VISIBILITY_VISIBLE = 1, // Active contact which is visible for you
VISIBILITY_INACTIVE = 2, // User account is Ex-users from MEGA (deleted account)
VISIBILITY_BLOCKED = 3 // User account is blocked
};
virtual ~MegaUser();
/**
* @brief Creates a copy of this MegaUser object.
*
* The resulting object is fully independent of the source MegaUser,
* it contains a copy of all internal attributes, so it will be valid after
* the original object is deleted.
*
* You are the owner of the returned object
*
* @return Copy of the MegaUser object
*/
virtual MegaUser *copy();
/**
* @brief Returns the email associated with the contact.
*
* The email can be used to recover the MegaUser object later using MegaApi::getContact
*
* The MegaUser object retains the ownership of the returned string, it will be valid until
* the MegaUser object is deleted.
*
* @return The email associated with the contact.
*/
virtual const char* getEmail();
/**
* @brief Returns the handle associated with the contact.
*
* @return The handle associated with the contact.
*/
virtual MegaHandle getHandle();
/**
* @brief Get the current visibility of the contact
*
* The returned value will be one of these:
*
* - VISIBILITY_UNKNOWN = -1
* The visibility of the contact isn't know
*
* - VISIBILITY_HIDDEN = 0
* The contact is currently hidden
*
* - VISIBILITY_VISIBLE = 1
* The contact is currently visible
*
* - VISIBILITY_INACTIVE = 2
* The contact is currently inactive
*
* - VISIBILITY_BLOCKED = 3
* The contact is currently blocked
*
* @note The visibility of your own user is undefined and shouldn't be used.
* @return Current visibility of the contact
*/
virtual int getVisibility();
/**
* @brief Returns the timestamp when the contact was added to the contact list (in seconds since the epoch)
* @return Timestamp when the contact was added to the contact list (in seconds since the epoch)
*/
virtual int64_t getTimestamp();
enum : uint64_t
{
CHANGE_TYPE_AUTHRING = 0x01,
CHANGE_TYPE_LSTINT = 0x02,
CHANGE_TYPE_AVATAR = 0x04,
CHANGE_TYPE_FIRSTNAME = 0x08,
CHANGE_TYPE_LASTNAME = 0x10,
CHANGE_TYPE_EMAIL = 0x20,
CHANGE_TYPE_KEYRING = 0x40,
CHANGE_TYPE_COUNTRY = 0x80,
CHANGE_TYPE_BIRTHDAY = 0x100,
CHANGE_TYPE_PUBKEY_CU255 = 0x200,
CHANGE_TYPE_PUBKEY_ED255 = 0x400,
CHANGE_TYPE_SIG_PUBKEY_RSA = 0x800,
CHANGE_TYPE_SIG_PUBKEY_CU255 = 0x1000,
CHANGE_TYPE_LANGUAGE = 0x2000,
CHANGE_TYPE_PWD_REMINDER = 0x4000,
CHANGE_TYPE_DISABLE_VERSIONS = 0x8000,
CHANGE_TYPE_CONTACT_LINK_VERIFICATION = 0x10000,
CHANGE_TYPE_RICH_PREVIEWS = 0x20000,
CHANGE_TYPE_RUBBISH_TIME = 0x40000,
CHANGE_TYPE_STORAGE_STATE = 0x80000,
CHANGE_TYPE_GEOLOCATION = 0x100000,
CHANGE_TYPE_CAMERA_UPLOADS_FOLDER = 0x200000,
CHANGE_TYPE_MY_CHAT_FILES_FOLDER = 0x400000,
CHANGE_TYPE_PUSH_SETTINGS = 0x800000,
CHANGE_TYPE_ALIAS = 0x1000000,
CHANGE_TYPE_UNSHAREABLE_KEY = 0x2000000,
CHANGE_TYPE_DEVICE_NAMES = 0x4000000,
CHANGE_TYPE_MY_BACKUPS_FOLDER = 0x8000000,
CHANGE_TYPE_COOKIE_SETTINGS = 0x10000000,
CHANGE_TYPE_NO_CALLKIT = 0x20000000,
CHANGE_APPS_PREFS = 0x40000000,
CHANGE_CC_PREFS = 0x80000000,
CHANGE_TYPE_RECENT_CLEAR_TIMESTAMP = 0x100000000ULL,
};
/**
* @brief Returns true if this user has an specific change
*
* This value is only useful for users notified by MegaListener::onUsersUpdate or
* MegaGlobalListener::onUsersUpdate that can notify about user modifications.
*
* In other cases, the return value of this function will be always false.
*
* @param changeType The type of change to check. It can be one of the following values:
*
* - MegaUser::CHANGE_TYPE_AUTH = 0x01
* Check if the user has new or modified authentication information
*
* - MegaUser::CHANGE_TYPE_LSTINT = 0x02
* Check if the last interaction timestamp is modified
*
* - MegaUser::CHANGE_TYPE_AVATAR = 0x04
* Check if the user has a new or modified avatar image, or if the avatar was removed
*
* - MegaUser::CHANGE_TYPE_FIRSTNAME = 0x08
* Check if the user has new or modified firstname
*
* - MegaUser::CHANGE_TYPE_LASTNAME = 0x10
* Check if the user has new or modified lastname
*
* - MegaUser::CHANGE_TYPE_EMAIL = 0x20
* Check if the user has modified email
*
* - MegaUser::CHANGE_TYPE_KEYRING = 0x40
* Check if the user has new or modified keyring
*
* - MegaUser::CHANGE_TYPE_COUNTRY = 0x80
* Check if the user has new or modified country
*
* - MegaUser::CHANGE_TYPE_BIRTHDAY = 0x100
* Check if the user has new or modified birthday, birthmonth or birthyear
*
* - MegaUser::CHANGE_TYPE_PUBKEY_CU255 = 0x200
* Check if the user has new or modified public key for chat
*
* - MegaUser::CHANGE_TYPE_PUBKEY_ED255 = 0x400
* Check if the user has new or modified public key for signing
*
* - MegaUser::CHANGE_TYPE_SIG_PUBKEY_RSA = 0x800
* Check if the user has new or modified signature for RSA public key
*
* - MegaUser::CHANGE_TYPE_SIG_PUBKEY_CU255 = 0x1000
* Check if the user has new or modified signature for Cu25519 public key
*
* - MegaUser::CHANGE_TYPE_LANGUAGE = 0x2000
* Check if the user has modified the preferred language
*
* - MegaUser::CHANGE_TYPE_PWD_REMINDER = 0x4000
* Check if the data related to the password reminder dialog has changed
*
* - MegaUser::CHANGE_TYPE_DISABLE_VERSIONS = 0x8000
* Check if option for file versioning has changed
*
* - MegaUser::CHANGE_TYPE_CONTACT_LINK_VERIFICATION = 0x10000
* Check if option for automatic contact-link verification has changed
*
* - MegaUser::CHANGE_TYPE_RICH_PREVIEWS = 0x20000
* Check if option for rich links has changed
*
* - MegaUser::CHANGE_TYPE_RUBBISH_TIME = 0x40000
* Check if rubbish time for autopurge has changed
*
* - MegaUser::CHANGE_TYPE_STORAGE_STATE = 0x80000
* Check if the state of the storage has changed
*
* - MegaUser::CHANGE_TYPE_GEOLOCATION = 0x100000
* Check if option for geolocation messages has changed
*
* - MegaUser::CHANGE_TYPE_CAMERA_UPLOADS_FOLDER = 0x200000
* Check if "Camera uploads" folder has changed
*
* - MegaUser::CHANGE_TYPE_MY_CHAT_FILES_FOLDER = 0x400000
* Check if "My chat files" folder changed
*
* - MegaUser::CHANGE_TYPE_PUSH_SETTINGS = 0x800000
* Check if settings for push notifications have changed
*
* - MegaUser::CHANGE_TYPE_ALIAS = 0x1000000
* Check if aliases have changed
*
* - MegaUser::CHANGE_TYPE_UNSHAREABLE_KEY = 0x2000000
* (internal) The unshareable key has been created
*
* - MegaUser::CHANGE_TYPE_DEVICE_NAMES = 0x4000000
* Check if device names have changed
*
* - MegaUser::CHANGE_TYPE_MY_BACKUPS_FOLDER = 0x8000000
* Check if "My Backups" folder has changed
*
* - MegaUser::CHANGE_TYPE_COOKIE_SETTINGS = 0x10000000
* Check if option for cookie settings has changed
*
* - MegaUser::CHANGE_TYPE_NO_CALLKIT = 0x20000000
* Check if option for iOS CallKit has changed
*
* - MegaUser::CHANGE_APPS_PREFS = 0x40000000
* Check if apps prefs have changed
*
* - MegaUser::CHANGE_CC_PREFS = 0x80000000
* Check if content consumption prefs have changed
*
* - MegaUser::CHANGE_TYPE_RECENT_CLEAR_TIMESTAMP = 0x100000000
* Check if the timestamp for clearing recent actions history has changed
*
* @return true if this user has an specific change
*/
virtual bool hasChanged(uint64_t changeType);
/**
* @brief Returns a bit field with the changes of the user
*
* This value is only useful for users notified by MegaListener::onUsersUpdate or
* MegaGlobalListener::onUsersUpdate that can notify about user modifications.
*
* @return The returned value is an OR combination of these flags:
*
* - MegaUser::CHANGE_TYPE_AUTH = 0x01
* Check if the user has new or modified authentication information
*
* - MegaUser::CHANGE_TYPE_LSTINT = 0x02
* Check if the last interaction timestamp is modified
*
* - MegaUser::CHANGE_TYPE_AVATAR = 0x04
* Check if the user has a new or modified avatar image
*
* - MegaUser::CHANGE_TYPE_FIRSTNAME = 0x08
* Check if the user has new or modified firstname
*
* - MegaUser::CHANGE_TYPE_LASTNAME = 0x10
* Check if the user has new or modified lastname
*
* - MegaUser::CHANGE_TYPE_EMAIL = 0x20
* Check if the user has modified email
*
* - MegaUser::CHANGE_TYPE_KEYRING = 0x40
* Check if the user has new or modified keyring
*
* - MegaUser::CHANGE_TYPE_COUNTRY = 0x80
* Check if the user has new or modified country
*
* - MegaUser::CHANGE_TYPE_BIRTHDAY = 0x100
* Check if the user has new or modified birthday, birthmonth or birthyear
*
* - MegaUser::CHANGE_TYPE_PUBKEY_CU255 = 0x200
* Check if the user has new or modified public key for chat
*
* - MegaUser::CHANGE_TYPE_PUBKEY_ED255 = 0x400
* Check if the user has new or modified public key for signing
*
* - MegaUser::CHANGE_TYPE_SIG_PUBKEY_RSA = 0x800
* Check if the user has new or modified signature for RSA public key
*
* - MegaUser::CHANGE_TYPE_SIG_PUBKEY_CU255 = 0x1000
* Check if the user has new or modified signature for Cu25519 public key
*
* - MegaUser::CHANGE_TYPE_LANGUAGE = 0x2000
* Check if the user has modified the preferred language
*
* - MegaUser::CHANGE_TYPE_PWD_REMINDER = 0x4000
* Check if the data related to the password reminder dialog has changed
*
* - MegaUser::CHANGE_TYPE_DISABLE_VERSIONS = 0x8000
* Check if option for file versioning has changed
*
* - MegaUser::CHANGE_TYPE_CONTACT_LINK_VERIFICATION = 0x10000
* Check if option for automatic contact-link verification has changed
*
* - MegaUser::CHANGE_TYPE_RICH_PREVIEWS = 0x20000
* Check if option for rich links has changed
*
* - MegaUser::CHANGE_TYPE_RUBBISH_TIME = 0x40000
* Check if rubbish time for autopurge has changed
*
* - MegaUser::CHANGE_TYPE_STORAGE_STATE = 0x80000
* Check if the state of the storage has changed
*
* - MegaUser::CHANGE_TYPE_GEOLOCATION = 0x100000
* Check if option for geolocation messages has changed
*
* - MegaUser::CHANGE_TYPE_PUSH_SETTINGS = 0x800000
* Check if settings for push notifications have changed
*
* - MegaUser::CHANGE_TYPE_ALIAS = 0x1000000
* Check if aliases have changed
*
* - MegaUser::CHANGE_TYPE_UNSHAREABLE_KEY = 0x2000000
* (internal) The unshareable key has been created
*
* - MegaUser::CHANGE_TYPE_DEVICE_NAMES = 0x4000000
* Check if device names have changed
*
* - MegaUser::CHANGE_TYPE_BACKUP_NAMES = 0x8000000
*
* - MegaUser::CHANGE_TYPE_COOKIE_SETTINGS = 0x10000000
* Check if option for cookie settings has changed
*
* - MegaUser::CHANGE_TYPE_NO_CALLKIT = 0x20000000
* Check if option for iOS CallKit has changed
*
* - MegaUser::CHANGE_APPS_PREFS = 0x40000000
* Check if apps prefs have changed
*
* - MegaUser::CHANGE_CC_PREFS = 0x80000000
* Check if content consumption prefs have changed
*
* Check if backup names have changed */
virtual uint64_t getChanges();
/**
* @brief Indicates if the user is changed by yourself or by another client.
*
* This value is only useful for users notified by MegaListener::onUsersUpdate or
* MegaGlobalListener::onUsersUpdate that can notify about user modifications.
*
* @return 0 if the change is external. >0 if the change is the result of an
* explicit request, -1 if the change is the result of an implicit request
* made by the SDK internally.
*/
virtual int isOwnChange();
};
/**
* @brief Represents a user alert in MEGA.
* Alerts are the notifictions appearing under the bell in the webclient
*
* Objects of this class aren't live, they are snapshots of the state
* in MEGA when the object is created, they are immutable.
*
* MegaUserAlerts can be retrieved with MegaApi::getUserAlerts
*
*/
class MegaUserAlert
{
public:
enum {
TYPE_INCOMINGPENDINGCONTACT_REQUEST,
TYPE_INCOMINGPENDINGCONTACT_CANCELLED,
TYPE_INCOMINGPENDINGCONTACT_REMINDER,
TYPE_CONTACTCHANGE_DELETEDYOU,
TYPE_CONTACTCHANGE_CONTACTESTABLISHED,
TYPE_CONTACTCHANGE_ACCOUNTDELETED,
TYPE_CONTACTCHANGE_BLOCKEDYOU,
TYPE_UPDATEDPENDINGCONTACTINCOMING_IGNORED,
TYPE_UPDATEDPENDINGCONTACTINCOMING_ACCEPTED,
TYPE_UPDATEDPENDINGCONTACTINCOMING_DENIED,
TYPE_UPDATEDPENDINGCONTACTOUTGOING_ACCEPTED,
TYPE_UPDATEDPENDINGCONTACTOUTGOING_DENIED,
TYPE_NEWSHARE,
TYPE_DELETEDSHARE,
TYPE_NEWSHAREDNODES,
TYPE_REMOVEDSHAREDNODES,
TYPE_UPDATEDSHAREDNODES,
TYPE_PAYMENT_SUCCEEDED,
TYPE_PAYMENT_FAILED,
TYPE_PAYMENTREMINDER,
TYPE_TAKEDOWN,
TYPE_TAKEDOWN_REINSTATED,
TYPE_SCHEDULEDMEETING_NEW,
TYPE_SCHEDULEDMEETING_DELETED,
TYPE_SCHEDULEDMEETING_UPDATED,
TYPE_SET_TAKEDOWN,
TYPE_SET_TAKEDOWN_REINSTATED,
TOTAL_OF_ALERT_TYPES
};
#ifdef ENABLE_CHAT
enum
{
SM_CHANGE_TYPE_TITLE = 0x01,
SM_CHANGE_TYPE_DESCRIPTION = 0x02,
SM_CHANGE_TYPE_CANCELLED = 0x04,
SM_CHANGE_TYPE_TIMEZONE = 0x08,
SM_CHANGE_TYPE_STARTDATE = 0x10,
SM_CHANGE_TYPE_ENDDATE = 0x20,
SM_CHANGE_TYPE_RULES = 0x40,
};
#endif
virtual ~MegaUserAlert();
/**
* @brief Creates a copy of this MegaUserAlert object.
*
* The resulting object is fully independent of the source MegaUserAlert,
* it contains a copy of all internal attributes, so it will be valid after
* the original object is deleted.
*
* You are the owner of the returned object
*
* @return Copy of the MegaUserAlert object
*/
virtual MegaUserAlert *copy() const;
/**
* @brief Returns the id of the alert
*
* The ids are assigned to alerts sequentially from program start,
* however there may be gaps. The id can be used to create an
* association with a UI element in order to process updates in callbacks.
*
* @return Type of alert associated with the object
*/
virtual unsigned getId() const;
/**
* @brief Returns whether the alert has been acknowledged by this client or another
*
* @return Flag indicating whether the alert has been seen
*/
virtual bool getSeen() const;
/**
* @brief Returns whether the alert is still relevant to the logged in user.
*
* An alert may be relevant initially but become non-relevant, eg. payment reminder.
* Alerts which are no longer relevant are usually removed from the visible list.
*
* @return Flag indicting whether the alert is still relevant
*/
virtual bool getRelevant() const;
/**
* @brief Returns the type of alert associated with the object
* @return Type of alert associated with the object
*/
virtual int getType() const;
/**
* @brief Returns a readable string that shows the type of alert
*
* This function returns a pointer to a statically allocated buffer.
* You don't have to free the returned pointer
*
* @return Readable string showing the type of alert
*/
virtual const char *getTypeString() const;
/**
* @brief Returns the handle of a user related to the alert
*
* This value is valid for user related alerts:
* TYPE_UPDATEDPENDINGCONTACTINCOMING_IGNORED, TYPE_UPDATEDPENDINGCONTACTOUTGOING_ACCEPTED,
* TYPE_UPDATEDPENDINGCONTACTOUTGOING_DENIED,
* TYPE_CONTACTCHANGE_CONTACTESTABLISHED, TYPE_CONTACTCHANGE_ACCOUNTDELETED,
* TYPE_CONTACTCHANGE_BLOCKEDYOU, TYPE_CONTACTCHANGE_DELETEDYOU,
* TYPE_NEWSHARE, TYPE_DELETEDSHARE, TYPE_NEWSHAREDNODES, TYPE_REMOVEDSHAREDNODES,
* TYPE_SCHEDULEDMEETING_NEW, TYPE_SCHEDULEDMEETING_UPDATED, TYPE_SCHEDULEDMEETING_DELETED
*
* @warning This value is still valid for user related alerts:
* TYPE_INCOMINGPENDINGCONTACT_CANCELLED, TYPE_INCOMINGPENDINGCONTACT_REMINDER,
* TYPE_INCOMINGPENDINGCONTACT_REQUEST
* However, the returned value is the handle of the Pending Contact Request. There is no
* user's handle associated to these type of alerts. Use MegaUserAlert::getPcrHandle.
*
* @return the associated user's handle, otherwise UNDEF
*/
virtual MegaHandle getUserHandle() const;
/**
* @brief Returns the handle of a node related to the alert
*
* This value is valid for alerts that relate to a single node.
* TYPE_NEWSHARE (folder handle), TYPE_DELETEDSHARE (folder handle), TYPE_NEWSHAREDNODES
* (parent handle), TYPE_TAKEDOWN (node handle), TYPE_TAKEDOWN_REINSTATED (node handle)
*
* This value is also valid for the following alerts:
* TYPE_SCHEDULEDMEETING_NEW (chatid), TYPE_SCHEDULEDMEETING_DELETED (chatid),
* TYPE_SCHEDULEDMEETING_UPDATED (chatid), TYPE_SET_TAKEDOWN (set id),
* TYPE_SET_TAKEDOWN_REINSTATED (set id)
*
* @return the relevant node handle, or UNDEF if this alert does not have one.
*/
virtual MegaHandle getNodeHandle() const;
/**
* @brief Returns the handle of a Pending Contact Request related to the alert
*
* This value is valid for user related alerts:
* TYPE_INCOMINGPENDINGCONTACT_CANCELLED, TYPE_INCOMINGPENDINGCONTACT_REMINDER,
* TYPE_INCOMINGPENDINGCONTACT_REQUEST (PCR handle for all of these user alert types)
*
* This value is also valid for the following alerts:
* TYPE_SCHEDULEDMEETING_NEW (parent scheduledMeetingId),
* TYPE_SCHEDULEDMEETING_UPDATED (parent scheduledMeetingId)
*
* @return the relevant handle, or UNDEF if this alert does not have one.
*/
virtual MegaHandle getPcrHandle() const;
/**
* @brief Returns an email related to the alert
*
* This value is valid for alerts that relate to another user, provided the
* user could be looked up at the time the alert arrived. If it was not available,
* this function will return false and the client can request it via the userHandle.
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaUserAlert object is deleted.
* TYPE_CONTACTCHANGE_ACCOUNTDELETED,TYPE_CONTACTCHANGE_BLOCKEDYOU,
* TYPE_CONTACTCHANGE_CONTACTESTABLISHED, TYPE_CONTACTCHANGE_DELETEDYOU,
* TYPE_DELETEDSHARE,
* TYPE_INCOMINGPENDINGCONTACT_CANCELLED, TYPE_INCOMINGPENDINGCONTACT_REMINDER,
* TYPE_INCOMINGPENDINGCONTACT_REQUEST,
* TYPE_NEWSHARE, TYPE_NEWSHAREDNODES, TYPE_REMOVEDSHAREDNODES
* TYPE_UPDATEDPENDINGCONTACTINCOMING_IGNORED, TYPE_UPDATEDPENDINGCONTACTOUTGOING_ACCEPTED,
* TYPE_UPDATEDPENDINGCONTACTOUTGOING_DENIED,
* TYPE_SCHEDULEDMEETING_NEW, TYPE_SCHEDULEDMEETING_UPDATED, TYPE_SCHEDULEDMEETING_DELETED
*
* @return email string of the relevant user, or NULL if not available
*/
virtual const char* getEmail() const;
/**
* @brief Returns the path of a file, folder, or node related to the alert
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaUserAlert object is deleted.
*
* This value is valid for those alerts that relate to a single path, provided
* it could be looked up from the cached nodes at the time the alert arrived.
* Otherwise, it may be obtainable via the nodeHandle.
* TYPE_DELETEDSHARE, TYPE_NEWSHARE?, TYPE_TAKEDOWN?, TYPE_TAKEDOWN_REINSTATED?
*
* @return the path string if relevant and available, otherwise NULL
*/
virtual const char* getPath() const;
/**
* @brief Returns the name of a file, folder, or node related to the alert
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaUserAlert object is deleted.
*
* This value is valid for those alerts that relate to a single name, provided
* it could be looked up from the cached nodes at the time the alert arrived.
* Otherwise, it may be obtainable via the nodeHandle.
* TYPE_DELETEDSHARE, TYPE_NEWSHARE?, TYPE_TAKEDOWN?, TYPE_TAKEDOWN_REINSTATED?,
* TYPE_SET_TAKEDOWN?, TYPE_SET_TAKEDOWN_REINSTATED?
*
* @return the name string if relevant and available, otherwise NULL
*/
virtual const char* getName() const;
/**
* @brief Returns the heading related to this alert
*
* The SDK retains the ownership of the returned value. They will be valid until
* the MegaUserAlert object is deleted.
*
* This value is valid for all alerts, and similar to the strings displayed in the
* webclient alerts.
*
* @return heading related to this alert.
*/
virtual const char* getHeading() const;
/**
* @brief Returns the title related to this alert
*
* The SDK retains the ownership of the returned value. They will be valid until
* the MegaUserAlert object is deleted.
*
* This value is valid for all alerts, and similar to the strings displayed in the
* webclient alerts.
*
* @return title related to this alert.
*/
virtual const char* getTitle() const;
/**
* @brief Returns a number related to this alert
*
* This value is valid for these alerts:
* TYPE_DELETEDSHARE (index 0: value 1 if access for this user was removed by the share owner, otherwise
* value 0 if someone left the folder)
* TYPE_NEWSHAREDNODES (index 0: folder count 1: file count)
* TYPE_REMOVEDSHAREDNODES (index 0: item count)
* TYPE_UPDATEDSHAREDNODES (index 0: item count)
*
* This value is also valid for the following alerts:
* TYPE_SCHEDULEDMEETING_NEW (index 0: value MEGA_INVALID_TIMESTAMP if there's no original startDateTime available for this user alert, otherwise
* returns a value greater than MEGA_INVALID_TIMESTAMP)
*
* TYPE_SCHEDULEDMEETING_UPDATED (index 0: value MEGA_INVALID_TIMESTAMP if there's no original startDateTime available for this user alert, otherwise
* returns a value greater than MEGA_INVALID_TIMESTAMP)
*
* @return Number related to this user alert, or -1 if the index is invalid
*/
virtual int64_t getNumber(unsigned index) const;
/**
* @brief Returns a timestamp related to this alert
*
* This value is valid for index 0 for all requests, indicating when the alert occurred.
* Additionally TYPE_PAYMENTREMINDER index 1 is the timestamp of the expiry of the period.
*
* @return Timestamp related to this request, or -1 if the index is invalid
*/
virtual int64_t getTimestamp(unsigned index) const;
/**
* @brief Returns a handle related to this alert
*
* TYPE_NEWSHAREDNODES (folder and files)
*
* @return MegaHandle related to this request, or INVALID_HANDLE if the index is invalid
*/
virtual MegaHandle getHandle(unsigned index) const;
/**
* @brief Returns an additional string, related to the alert
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaUserAlert object is deleted.
*
* This value is currently only valid for
* TYPE_PAYMENT_FAILED index 0: the plan name
* TYPE_PAYMENT_SUCCEEDED index 0: the plan name
*
* @return a pointer to the string if index is valid; otherwise NULL
*/
virtual const char* getString(unsigned index) const;
#ifdef ENABLE_CHAT
/**
* @brief Returns the MegaHandle that identifies the scheduled meeting id related to this alert
*
* This value is currently only valid for:
* TYPE_SCHEDULEDMEETING_NEW
* TYPE_SCHEDULEDMEETING_DELETED
* TYPE_SCHEDULEDMEETING_UPDATED
*
* @return MegaHandle that identifies the scheduled meeting id related to this alert
*/
virtual MegaHandle getSchedId() const;
/**
* @brief Returns true if the scheduled meeting associated to this alert has an specific change
*
* This value is currently only valid for:
* TYPE_SCHEDULEDMEETING_UPDATED
*
* @param changeType The type of change to check. It can be one of the following values:
* - MegaUserAlert::SM_CHANGE_TYPE_TITLE 0x01 - Title has changed
* - MegaUserAlert::SM_CHANGE_TYPE_DESCRIPTION 0x02 - Description has changed
* - MegaUserAlert::SM_CHANGE_TYPE_CANCELLED 0x04 - Cancelled flag has changed
* - MegaUserAlert::SM_CHANGE_TYPE_TIMEZONE 0x08 - Timezone has changed
* - MegaUserAlert::SM_CHANGE_TYPE_STARTDATE 0x10 - Start date time has changed
* - MegaUserAlert::SM_CHANGE_TYPE_ENDDATE 0x20 - End date time has changed
* - MegaUserAlert::SM_CHANGE_TYPE_RULES 0x40 - Repetition rules have changed
*
* @return true if this scheduled meeting associated to this alert has an specific change
*/
virtual bool hasSchedMeetingChanged(uint64_t /*changeType*/) const;
/**
* @brief Returns a MegaStringList that contains old and new title for the scheduled meeting
*
* Note: This value is only valid if the following conditions are met:
* - MegaUserAlert::getType == TYPE_SCHEDULEDMEETING_UPDATED
* - MegaUserAlert::hasChanged(MegaUserAlert::SM_CHANGE_TYPE_TITLE)
*
* To retrieve old title you need to call: MegaStringList::get(0)
* To retrieve new title you need to call: MegaStringList::get(1)
*
* @return MegaStringList that contains old and new title for the scheduled meeting
*/
virtual MegaStringList* getUpdatedTitle() const;
/**
* @brief Returns a MegaStringList that contains old and new TimeZone for the scheduled meeting
*
* Note: This value is only valid if the following conditions are met:
* - MegaUserAlert::getType == TYPE_SCHEDULEDMEETING_UPDATED
* - MegaUserAlert::hasChanged(MegaUserAlert::SM_CHANGE_TYPE_TIMEZONE)
*
* To retrieve old TimeZone you need to call: MegaStringList::get(0)
* To retrieve new TimeZone you need to call: MegaStringList::get(1)
*
* @return MegaStringList that contains old and new TimeZone for the scheduled meeting
*/
virtual MegaStringList* getUpdatedTimeZone() const;
/**
* @brief Returns a MegaIntegerList that contains old and new StartDateTime for the scheduled meeting
*
* Note: This value is only valid if the following conditions are met:
* - MegaUserAlert::getType == TYPE_SCHEDULEDMEETING_UPDATED
* - MegaUserAlert::hasChanged(MegaUserAlert::SM_CHANGE_TYPE_STARTDATE)
*
* To retrieve old StartDateTime you need to call: MegaIntegerList::get(0)
* To retrieve new StartDateTime you need to call: MegaIntegerList::get(1)
*
* @return MegaIntegerList that contains old and new StartDateTime for the scheduled meeting
*/
virtual MegaIntegerList* getUpdatedStartDate() const;
/**
* @brief Returns a MegaIntegerList that contains old and new EndDateTime for the scheduled meeting
*
* Note: This value is only valid if the following conditions are met:
* - MegaUserAlert::getType == TYPE_SCHEDULEDMEETING_UPDATED
* - MegaUserAlert::hasChanged(MegaUserAlert::SM_CHANGE_TYPE_ENDDATE)
*
* To retrieve old EndDateTime you need to call: MegaIntegerList::get(0)
* To retrieve new EndDateTime you need to call: MegaIntegerList::get(1)
*
* @return MegaIntegerList that contains old and new EndDateTime for the scheduled meeting
*/
virtual MegaIntegerList* getUpdatedEndDate() const;
#endif
/**
* @brief Indicates if the user alert is changed by yourself or by another client.
*
* This value is only useful for user alerts notified by MegaListener::onUserAlertsUpdate or
* MegaGlobalListener::onUserAlertsUpdate that can notify about user alerts modifications.
*
* @return false if the change is external. true if the change is the result of a
* request sent by this instance of the SDK.
*/
virtual bool isOwnChange() const;
/**
* @brief Indicates that the alert is about to be removed
*
* This value is useful to clean existing alerts that are not valid anymore.
* In example, a TYPE_REMOVEDSHAREDNODES may become TYPE_UPDATEDSHAREDNODES. In
* that case, the former will be notified as removed, and a new alert is added for
* the latter.
*
* The SDK purge old alerts in order to keep the list limited to maximum amount
* (currently up to 200). In result, the SDK may notify alerts as removed.
*
* @return True if the alert is about to be removed
*/
virtual bool isRemoved() const;
};
/**
* @brief List of MegaHandle objects
*
*/
class MegaHandleList
{
protected:
MegaHandleList();
public:
/**
* @brief Creates a new instance of MegaHandleList
* @return A pointer the new object
*/
static MegaHandleList *createInstance();
virtual ~MegaHandleList();
/**
* @brief Creates a copy of this MegaHandleList object
*
* The resulting object is fully independent of the source MegaHandleList,
* it contains a copy of all internal attributes, so it will be valid after
* the original object is deleted.
*
* You are the owner of the returned object
*
* @return Copy of the MegaHandleList object
*/
virtual MegaHandleList *copy() const;
/**
* @brief Returns the MegaHandle at the position i in the MegaHandleList
*
*
* If the index is >= the size of the list, this function returns MEGACHAT_INVALID_HANDLE.
*
* @param i Position of the MegaHandle that we want to get for the list
* @return MegaHandle at the position i in the list
*/
virtual MegaHandle get(unsigned int i) const;
/**
* @brief Returns the number of MegaHandles in the list
* @return Number of MegaHandles in the list
*/
virtual unsigned int size() const;
/**
* @brief Add new MegaHandle to list
* @param megaHandle to be added
*/
virtual void addMegaHandle(MegaHandle megaHandle);
};
class MegaIntegerList
{
public:
virtual ~MegaIntegerList();
static MegaIntegerList* createInstance();
virtual MegaIntegerList *copy() const;
/**
* @brief Returns the integer at the position i in the MegaIntegerList
*
* If the index is >= the size of the list, this function returns -1.
*
* @param i Position of the integer that we want to get for the list
* @return Integer at the position i in the list
*/
virtual int64_t get(int i) const;
/**
* @brief Add element to the MegaIntegerList
*
* @param value to add to list
*/
virtual void add(long long);
/**
* @brief Returns the number of integer values in the list
* @return Number of integer values in the list
*/
virtual int size() const;
};
/**
* @brief Represents the outbound sharing of a folder with a user in MEGA
*
* It allows to get all data related to the sharing. You can start sharing a folder with
* a contact or cancel an existing sharing using MegaApi::share. A public link of a folder
* is also considered a sharing and can be cancelled.
*
* Objects of this class aren't live, they are snapshots of the state of the sharing
* in MEGA when the object is created, they are immutable.
*
* Do not inherit from this class. You can get current active sharings using MegaApi::getOutShares
*
*/
class MegaShare
{
public:
enum {
ACCESS_UNKNOWN = -1,
ACCESS_READ = 0,
ACCESS_READWRITE,
ACCESS_FULL,
ACCESS_OWNER
};
virtual ~MegaShare();
/**
* @brief Creates a copy of this MegaShare object
*
* The resulting object is fully independent of the source MegaShare,
* it contains a copy of all internal attributes, so it will be valid after
* the original object is deleted.
*
* You are the owner of the returned object
*
* @return Copy of the MegaShare object
*/
virtual MegaShare *copy();
/**
* @brief Returns the email of the user with whom we are sharing the folder
*
* For public shared folders, this function returns NULL
*
* The MegaShare object retains the ownership of the returned string, it will be valid until
* the MegaShare object is deleted.
*
* @return The email of the user with whom we share the folder, or NULL if it's a public folder
*/
virtual const char *getUser();
/**
* @brief Returns the handle of the folder that is being shared
* @return The handle of the folder that is being shared
*/
virtual MegaHandle getNodeHandle();
/**
* @brief Returns the access level of the sharing
*
* Possible return values are:
* - ACCESS_UNKNOWN = -1
* It means that the access level is unknown
*
* - ACCESS_READ = 0
* The user can read the folder only
*
* - ACCESS_READWRITE = 1
* The user can read and write the folder
*
* - ACCESS_FULL = 2
* The user has full permissions over the folder
*
* - ACCESS_OWNER = 3
* The user is the owner of the folder
*
* @return The access level of the sharing
*/
virtual int getAccess();
/**
* @brief Returns the timestamp when the sharing was created (in seconds since the epoch)
* @return The timestamp when the sharing was created (in seconds since the epoch)
*/
virtual int64_t getTimestamp();
/**
* @brief Returns true if the sharing is pending
*
* A sharing is pending when the folder has been shared with a user (or email) that
* is not still a contact of this account.
*
* @return True if the sharing is pending, otherwise false.
*/
virtual bool isPending();
/**
* @brief Returns true if the sharing is verified
*
* A sharing is verified when the keys have been shared with the other user after
* verifying his credentials (see MegaApi::verifyCredentials).
*
* @return True if the sharing is pending, otherwise false.
*/
virtual bool isVerified();
};
#ifdef ENABLE_CHAT
class MegaTextChatPeerList
{
protected:
MegaTextChatPeerList();
public:
enum {
PRIV_UNKNOWN = -2,
PRIV_RM = -1,
PRIV_RO = 0,
PRIV_STANDARD = 2,
PRIV_MODERATOR = 3
};
/**
* @brief Creates a new instance of MegaTextChatPeerList
* @return A pointer to the superclass of the private object
*/
static MegaTextChatPeerList * createInstance();
virtual ~MegaTextChatPeerList();
/**
* @brief Creates a copy of this MegaTextChatPeerList object
*
* The resulting object is fully independent of the source MegaTextChatPeerList,
* it contains a copy of all internal attributes, so it will be valid after
* the original object is deleted.
*
* You are the owner of the returned object
*
* @return Copy of the MegaTextChatPeerList object
*/
virtual MegaTextChatPeerList *copy() const;
/**
* @brief addPeer Adds a new chat peer to the list
*
* @param h MegaHandle of the user to be added
* @param priv Privilege level of the user to be added
* Valid values are:
* - MegaTextChatPeerList::PRIV_UNKNOWN = -2
* - MegaTextChatPeerList::PRIV_RM = -1
* - MegaTextChatPeerList::PRIV_RO = 0
* - MegaTextChatPeerList::PRIV_STANDARD = 2
* - MegaTextChatPeerList::PRIV_MODERATOR = 3
*/
virtual void addPeer(MegaHandle h, int priv);
/**
* @brief Returns the MegaHandle of the chat peer at the position i in the list
*
* If the index is >= the size of the list, this function returns INVALID_HANDLE.
*
* @param i Position of the chat peer that we want to get from the list
* @return MegaHandle of the chat peer at the position i in the list
*/
virtual MegaHandle getPeerHandle(int i) const;
/**
* @brief Returns the privilege of the chat peer at the position i in the list
*
* If the index is >= the size of the list, this function returns PRIV_UNKNOWN.
*
* @param i Position of the chat peer that we want to get from the list
* @return Privilege level of the chat peer at the position i in the list.
* Valid values are:
* - MegaTextChatPeerList::PRIV_UNKNOWN = -2
* - MegaTextChatPeerList::PRIV_RM = -1
* - MegaTextChatPeerList::PRIV_RO = 0
* - MegaTextChatPeerList::PRIV_STANDARD = 2
* - MegaTextChatPeerList::PRIV_MODERATOR = 3
*/
virtual int getPeerPrivilege(int i) const;
/**
* @brief Returns the number of chat peer in the list
* @return Number of chat peers in the list
*/
virtual int size() const;
};
class MegaTextChat
{
public:
enum
{
CHANGE_TYPE_ATTACHMENT = 0x01,
CHANGE_TYPE_FLAGS = 0x02,
CHANGE_TYPE_MODE = 0x04,
CHANGE_TYPE_CHAT_OPTIONS = 0x08,
CHANGE_TYPE_SCHED_MEETING = 0x10,
CHANGE_TYPE_SCHED_REPLACE_OCURR = 0x20,
CHANGE_TYPE_SCHED_APPEND_OCURR = 0x40,
};
virtual ~MegaTextChat();
/**
* @brief Creates a copy of this MegaTextChat object
*
* The resulting object is fully independent of the source MegaTextChat,
* it contains a copy of all internal attributes, so it will be valid after
* the original object is deleted.
*
* You are the owner of the returned object
*
* @return Copy of the MegaTextChat object
*/
virtual MegaTextChat *copy() const;
/**
* @brief getHandle Returns the MegaHandle of the chat.
* @return MegaHandle of the chat.
*/
virtual MegaHandle getHandle() const;
/**
* @brief getOwnPrivilege Returns your privilege level in this chat
* @return
*/
virtual int getOwnPrivilege() const;
/**
* @brief Returns the chat shard
* @return The chat shard
*/
virtual int getShard() const;
/**
* @brief getPeerList Returns the full user list and privileges (excluding yourself).
*
* The MegaTextChat retains the ownership of the returned MetaTextChatPeerList. It will
* be only valid until the MegaTextChat is deleted.
*
* @return The list of peers in the chat.
*/
virtual const MegaTextChatPeerList *getPeerList() const;
/**
* @brief Establish the list of peers participating on this chatroom
*
* If a peers list already exist, this function will delete it.
*
* The MegaTextChat does not take ownership of the list passed as parameter, it makes
* a local copy.
*
* @param peers List of peers
*/
virtual void setPeerList(const MegaTextChatPeerList *peers);
/**
* @brief isGroup Returns whether this chat is a group chat or not
* @return True if this chat is a group chat. Only chats with more than 2 peers are groupal chats.
*/
virtual bool isGroup() const;
/**
* @brief getOriginatingUser Returns the user that originated the chat notification
*
* @note This value is only relevant for new or updated chats notified by MegaGlobalListener::onChatsUpdate or
* MegaListener::onChatsUpdate.
*
* @return The handle of the user who originated the chat notification.
*/
virtual MegaHandle getOriginatingUser() const;
/**
* @brief Returns the title of the chat, if any.
*
* The MegaTextChat retains the ownership of the returned string. It will
* be only valid until the MegaTextChat is deleted.
*
* @return The title of the chat as a byte array encoded in Base64URL, or NULL if not available.
*/
virtual const char *getTitle() const;
/**
* @brief Returns the Unified key of the chat, if it's a public chat.
*
* The MegaTextChat retains the ownership of the returned string. It will
* be only valid until the MegaTextChat is deleted.
*
* @return The Unified key [<senderid><uk>] of the chat as a byte array encoded in Base64URL, or NULL if not available.
*/
virtual const char *getUnifiedKey() const;
/**
* @brief Returns the chat options.
*
* The returned value contains the chat options represented in 1 Byte, where each individual option is stored in 1 bit.
* Check ChatOptions struct at types.h
*
* @return The chat options in a numeric format
*/
virtual unsigned char getChatOptions() const;
/**
* @brief Returns true if this chat has an specific change
*
* This value is only useful for chats notified by MegaListener::onChatsUpdate or
* MegaGlobalListener::onChatsUpdate that can notify about chat modifications.
*
* In other cases, the return value of this function will be always false.
*
* @param changeType The type of change to check. It can be one of the following values:
*
* - MegaTextChat::CHANGE_TYPE_ATTACHMENT = 0x01
* Check if the access to nodes have been granted/revoked
*
* - MegaTextChat::CHANGE_TYPE_FLAGS = 0x02
* Check if flags have changed (like archive flag)
*
* - MegaTextChat::CHANGE_TYPE_MODE = 0x04
* Check if operation mode has changed to private mode (from public mode)
*
* - MegaTextChat::CHANGE_TYPE_CHAT_OPTIONS = 0x08
* Check if chat options have changed
*
* - MegaTextChat::CHANGE_TYPE_SCHED_MEETING = 0x10
* Check if scheduled meetings have changed
*
* - MegaTextChat::CHANGE_TYPE_SCHED_OCURR = 0x20
* Check if scheduled meetings occurrences have changed
* (current ones are automatically discarded)
*
* CHANGE_TYPE_SCHED_APPEND_OCURR
* Check if we have received more scheduled meetings occurrences
*
* @return true if this chat has an specific change
*/
virtual bool hasChanged(uint64_t changeType) const;
/**
* @brief Returns a bit field with the changes of the chatroom
*
* This value is only useful for chats notified by MegaListener::onChatsUpdate or
* MegaGlobalListener::onChatsUpdate that can notify about chat modifications.
*
* - MegaTextChat::CHANGE_TYPE_ATTACHMENT = 0x01
* Check if the access to nodes have been granted/revoked
*
* - MegaTextChat::CHANGE_TYPE_FLAGS = 0x02
* Check if flags have changed (like archive flag)
*
* - MegaTextChat::CHANGE_TYPE_MODE = 0x04
* Check if operation mode has changed to private mode (from public mode)
*
* - MegaTextChat::CHANGE_TYPE_CHAT_OPTIONS = 0x08
* Check if chat options have changed
*
* - MegaTextChat::CHANGE_TYPE_SCHED_MEETING = 0x10
* Check if scheduled meetings have changed
*
* - MegaTextChat::CHANGE_TYPE_SCHED_OCURR = 0x20
* Check if scheduled meetings occurrences have changed
* (current ones are automatically discarded)
*
* CHANGE_TYPE_SCHED_APPEND_OCURR
* Check if we have received more scheduled meetings occurrences
*
* @return The returned value is an OR combination of these flags
*/
virtual uint64_t getChanges() const;
/**
* @brief Indicates if the chat is changed by yourself or by another client.
*
* This value is only useful for chats notified by MegaListener::onChatsUpdate or
* MegaGlobalListener::onChatsUpdate that can notify about chat modifications.
*
* @return 0 if the change is external. >0 if the change is the result of an
* explicit request, -1 if the change is the result of an implicit request
* made by the SDK internally.
*/
virtual int isOwnChange() const;
/**
* @brief Returns the scheduled meetings list.
*
* The MegaTextChat retains the ownership of the returned MegaScheduledMeetingList. It will
* be only valid until the MegaTextChat is deleted.
*
* @return The list of the scheduled meetings.
*/
virtual const MegaScheduledMeetingList* getScheduledMeetingList() const;
/**
* @brief Returns a list with updated the scheduled meetings occurrences.
*
* The MegaTextChat retains the ownership of the returned MegaScheduledMeetingList. It will
* be only valid until the MegaTextChat is deleted.
*
* The value returned by this method will only be valid when
* MegaTextChat::hasChange(CHANGE_TYPE_SCHED_APPEND_OCURR) returns true
*
* @return The list of the updated scheduled meetings occurrences.
*/
virtual const MegaScheduledMeetingList* getUpdatedOccurrencesList() const;
/**
* @brief Returns a MegaHandleList with the handles of the scheduled meetings that have changed
*
* This method only returns a valid value when MegaTextChat::hasChange(CHANGE_TYPE_SCHED_MEETING) returns true
*
* The MegaTextChat retains the ownership of the returned MegaHandleList. It will
* be only valid until the MegaTextChat is deleted.
*
* @return MegaHandleList with the handles of the scheduled meetings that have changed.
*/
virtual const MegaHandleList* getSchedMeetingsChanged() const;
/**
* @brief Returns the creation timestamp of the chat
*
* In seconds since the Epoch
*
* @return Creation date of the chat
*/
virtual int64_t getCreationTime() const;
/**
* @brief Returns whether this chat has been archived by the user or not
* @return True if this chat is archived.
*/
virtual bool isArchived() const;
/**
* @brief Returns whether this chat is public or private
* @return True if this chat is public
*/
virtual bool isPublicChat() const;
/**
* @brief Returns whether this chat is a meeting room
* @return True if this chat is a meeting room
*/
virtual bool isMeeting() const;
};
/**
* @brief List of MegaTextChat objects
*
* A MegaTextChatList has the ownership of the MegaTextChat objects that it contains, so they will be
* only valid until the MegaTextChatList is deleted. If you want to retain a MegaTextChat returned by
* a MegaTextChatList, use MegaTextChat::copy.
*
* Objects of this class are immutable.
*/
class MegaTextChatList
{
public:
virtual ~MegaTextChatList();
virtual MegaTextChatList *copy() const;
/**
* @brief Returns the MegaTextChat at the position i in the MegaTextChatList
*
* The MegaTextChatList retains the ownership of the returned MegaTextChat. It will be only valid until
* the MegaTextChatList is deleted. If you want to retain a MegaTextChat returned by this function,
* use MegaTextChat::copy.
*
* If the index is >= the size of the list, this function returns NULL.
*
* @param i Position of the MegaTextChat that we want to get for the list
* @return MegaTextChat at the position i in the list
*/
virtual const MegaTextChat *get(unsigned int i) const;
/**
* @brief Returns the number of MegaTextChats in the list
* @return Number of MegaTextChats in the list
*/
virtual int size() const;
};
/**
* @brief This class represents a scheduled meeting. Scheduled Meetings allows the user to specify an event that will occur in the future.
* The user can also specify a set of rules for repetition, these rules enable an event to reoccur periodically.
*
* Important consideration:
* A Chatroom only should have one root scheduled meeting associated, it means that just one scheduled meeting for a chatroom,
* should have an invalid parent sched Id (MegaScheduledMeeting::parentSchedId)
*
*/
class MegaScheduledMeeting
{
public:
virtual ~MegaScheduledMeeting();
/**
* @brief Creates a new instance of MegaScheduledMeeting
*
* @param chatid : chat handle
* @param schedId : scheduled meeting handle
* @param parentSchedId : parent scheduled meeting handle
* @param cancelled : cancelled flag
* @param timezone : timeZone
* @param startDateTime : start dateTime (unix timestamp)
* @param endDateTime : end dateTime (unix timestamp)
* @param title : meeting title
* @param description : meeting description
* @param attributes : attributes to store any additional data
* @param overrides : start dateTime of the original meeting series event to be replaced (unix timestamp)
* @param flags : flags bitmask (used to store additional boolean settings as a bitmask)
* @param rules : scheduled meetings rules
*
* @return A pointer to the superclass of the private object
*/
static MegaScheduledMeeting* createInstance(MegaHandle chatid, MegaHandle schedId, MegaHandle parentSchedId, MegaHandle organizerUserId,
int cancelled, const char* timezone, MegaTimeStamp startDateTime,
MegaTimeStamp endDateTime, const char* title, const char* description, const char* attributes,
MegaTimeStamp overrides, MegaScheduledFlags* flags, MegaScheduledRules* rules);
/**
* @brief Creates a copy of this MegaScheduledMeeting object
*
* The resulting object is fully independent of the source MegaScheduledMeeting,
* it contains a copy of all internal attributes, so it will be valid after
* the original object is deleted.
*
* You take the ownership of the returned object
*
* @return Copy of the MegaScheduledMeeting object
*/
virtual MegaScheduledMeeting* copy() const;
/**
* @brief Returns if scheduled meeting is cancelled or not
*
* @return True if scheduled meeting is cancelled, otherwise returns false
*/
virtual int cancelled() const;
/**
* @brief Returns the MegaHandle of the chat
*
* @return MegaHandle of the chat
*/
virtual MegaHandle chatid() const;
/**
* @brief Returns the MegaHandle that identifies the scheduled meeting
*
* @return MegaHandle that identifies the scheduled meeting
*/
virtual MegaHandle schedId() const;
/**
* @brief Returns the MegaHandle of the organizer user of the scheduled meeting
*
* @return MegaHandle of the organizer user of the scheduled meeting
*/
virtual MegaHandle organizerUserid() const;
/**
* @brief Returns the MegaHandle that identifies the parent scheduled meeting
*
* @return MegaHandle that identifies the parent scheduled meeting
*/
virtual MegaHandle parentSchedId() const;
/**
* @brief Returns the time zone
*
* @return time zone
*/
virtual const char* timezone() const;
/**
* @brief Returns the start dateTime of the scheduled Meeting (unix timestamp)
*
* @return the start dateTime of the scheduled Meeting
*/
virtual MegaTimeStamp startDateTime() const;
/**
* @brief Returns the end dateTime of the scheduled Meeting (unix timestamp)
*
* @return the end dateTime of the scheduled Meeting
*/
virtual MegaTimeStamp endDateTime() const;
/**
* @brief Returns the scheduled meeting title
*
* @return The title of the scheduled meeting
*/
virtual const char* title() const;
/**
* @brief Returns the scheduled meeting description
*
* @return The description of the scheduled meeting
*/
virtual const char* description() const;
/**
* @brief Returns additional scheduled meetings attributes
*
* @return Additional scheduled meetings attributes
*/
virtual const char* attributes() const;
/**
* @brief Returns the start dateTime of the original meeting series event to be replaced (unix timestamp)
*
* @return the start dateTime of the original meeting series event to be replaced
*/
virtual MegaTimeStamp overrides() const;
/**
* @brief Returns a pointer to MegaScheduledFlags that contains the scheduled meetings flags
*
* You take ownership of the returned MegaScheduledFlags
*
* @return A pointer to MegaScheduledFlags that contains the scheduled meetings flags
*/
virtual MegaScheduledFlags* flags() const;
/**
* @brief Returns a pointer to MegaScheduledRules that contains the scheduled meetings rules
*
* You take ownership of the returned MegaScheduledRules
*
* @return A pointer to MegaScheduledRules that contains the scheduled meetings rules
*/
virtual MegaScheduledRules* rules() const;
};
/**
* @brief This class represents a set of meetings flags in a bit mask format, where every flag is represented by 1 bit
*/
class MegaScheduledFlags
{
public:
enum
{
FLAGS_SEND_EMAILS = 0, // API will send out calendar emails for this meeting if it's enabled
FLAGS_SIZE = 1, // size in bits of flags bitmask
};
virtual ~MegaScheduledFlags();
/**
* @brief Creates a new instance of MegaScheduledFlags
*
* @return A pointer to the superclass of the private object
*/
static MegaScheduledFlags* createInstance();
/**
* @brief Imports scheduled meetings flags from numeric value
*/
virtual void importFlagsValue(unsigned long);
/**
* @brief Creates a copy of this virtual MegaScheduledFlags object
*
* The resulting object is fully independent of the source MegaScheduledFlags,
* it contains a copy of all internal attributes, so it will be valid after
* the original object is deleted.
*
* You take the ownership of the returned object
*
* @return Copy of the MegaScheduledFlags object
*/
virtual MegaScheduledFlags* copy() const;
/**
* @brief Reset the value of all options (to disabled)
*/
virtual void reset();
/**
* @brief Returns the bistmask in a numeric value format
*
* @return The bistmask in a numeric value format
*/
virtual unsigned long getNumericValue() const;
/**
* @brief Returns true if all flags are disabled
*
* @return True if all flags are disabled, otherwise returns false.
*/
virtual bool isEmpty() const;
};
/**
* @brief This class represents a set of set of rules that can be defined for a Scheduled meeting.
*/
class MegaScheduledRules
{
public:
enum {
FREQ_INVALID = -1,
FREQ_DAILY = 0,
FREQ_WEEKLY = 1,
FREQ_MONTHLY = 2,
};
constexpr static int INTERVAL_INVALID = 0;
virtual ~MegaScheduledRules();
/**
* @brief Creates a new instance of MegaScheduledRules
*
* @param freq : scheduled meeting frequency (DAILY | WEEKLY | MONTHLY), this is used in conjunction with interval
* @param interval : repetition interval in relation to the frequency
* @param until : specifies when the repetitions should end
* @param byWeekDay : allows us to specify that an event will only occur on given week day/s
* @param byMonthDay : allows us to specify that an event will only occur on a given day/s of the month
* @param byMonthWeekDay : allows us to specify that an event will only occurs on a specific weekday offset of the month. (i.e every 2nd Sunday of each month)
*
* @return A pointer to the superclass of the private object
*/
static MegaScheduledRules* createInstance(int freq,
int interval = INTERVAL_INVALID,
MegaTimeStamp until = MEGA_INVALID_TIMESTAMP,
const ::mega::MegaIntegerList* byWeekDay = nullptr,
const ::mega::MegaIntegerList* byMonthDay = nullptr,
const ::mega::MegaIntegerMap* byMonthWeekDay = nullptr);
/**
* @brief Creates a copy of this MegaScheduledRules object
*
* The resulting object is fully independent of the source MegaScheduledRules,
* it contains a copy of all internal attributes, so it will be valid after
* the original object is deleted.
*
* You take the ownership of the returned object
*
* @return Copy of the MegaScheduledRules object
*/
virtual MegaScheduledRules* copy() const;
/**
* @brief Returns the frequency of the scheduled meeting: (DAILY | WEEKLY | MONTHLY)
* @return The frequence of the scheduled meeting
*/
virtual int freq() const;
/**
* @brief Returns repetition interval in relation to the frequency
*
* @return The inverval in relation to the frequency of the scheduled meeting
*/
virtual int interval() const;
/**
* @brief Returns when the repetitions should end (unix timestamp)
*
* @return When the repetitions should end
*/
virtual MegaTimeStamp until() const;
/**
* @brief Returns a MegaIntegerList with the week days when the event will occur
*
* @return A MegaIntegerList with the week days when the event will occur
*/
virtual const mega::MegaIntegerList* byWeekDay() const;
/**
* @brief Returns a MegaIntegerList with the days of the month when the event will occur
*
* @return A MegaIntegerList with the days of the month when the event will occur
*/
virtual const mega::MegaIntegerList* byMonthDay() const;
/**
* @brief Returns a MegaIntegerMap <offset, weekday> that allows to specify one or multiple weekday offset
* + Positive offset: (ie: [5,4] event will occur every 5th Thursday of each month)
* + Negative offset: (ie: [-1,1] event will occur every last Monday of each month)
*
* @return A MegaIntegerMap <offset, weekday> that allows to specify one or multiple weekday offset
*/
virtual const mega::MegaIntegerMap* byMonthWeekDay() const;
/**
* @brief Returns if a given frequency is valid or not
*
* @return True if freq is valid, otherwise false
*/
static bool isValidFreq(int freq);
/**
* @brief Returns if a given interval is valid or not
*
* @return True if interval is valid, otherwise false
*/
static bool isValidInterval(int interval);
};
/**
* @brief List of MegaScheduledMeeting objects
*/
class MegaScheduledMeetingList
{
public:
virtual ~MegaScheduledMeetingList();
/**
* @brief Creates a new instance of MegaScheduledMeetingList
*
* You take the ownership of the returned object
*
* @return A pointer to the superclass of the private object
*/
static MegaScheduledMeetingList* createInstance();
/**
* @brief Creates a copy of this MegaScheduledMeetingList object
*
* The resulting object is fully independent of the source MegaScheduledMeetingList,
* it contains a copy of all internal attributes, so it will be valid after
* the original object is deleted.
*
* You take the ownership of the returned object
*
* @return Copy of the MegaScheduledMeetingList object
*/
virtual MegaScheduledMeetingList *copy() const;
/**
* @brief Returns the number of elements in the list
* @return Number of elements in the list
*/
virtual unsigned long size() const;
/**
* @brief Returns the MegaScheduledMeeting at the position i in the MegaScheduledMeetingList
*
* If the index is >= the size of the list, this function returns NULL.
*
* @param i Position of the element that we want to get for the list
* @return MegaScheduledMeeting at the position i in the MegaScheduledMeetingList
*/
virtual MegaScheduledMeeting* at(unsigned long i) const;
/**
* @brief Get a MegaScheduledMeeting object in the list, that has a specific scheduled meeting id
* If no scheduled meeting is found with the provided id, this method will returns NULL
*
* You take the ownership of the returned value
*
* @param h Scheduled meeting id
* @return MegaScheduledMeeting with scheduled meeting id equal to h, or NULL
*/
virtual MegaScheduledMeeting* getBySchedId(MegaHandle h) const;
/**
* @brief Add element to the MegaScheduledMeetingList
*
* The SDK adquires the ownership of provided MegaScheduledMeeting
*
* @param sm MegaScheduledMeeting to add to list
*/
virtual void insert(MegaScheduledMeeting* sm);
/**
* @brief Clears the MegaScheduledMeetingList
*/
virtual void clear();
};
#endif
/**
* @brief Map of string values with string keys (map<string,string>)
*
* A MegaStringMap has the ownership of the strings that it contains, so they will be
* only valid until the MegaStringMap is deleted. If you want to retain a string returned by
* a MegaStringMap, copy it.
*
* Objects of this class are immutable.
*/
class MegaStringMap
{
protected:
MegaStringMap();
public:
virtual ~MegaStringMap();
/**
* @brief Creates a new instance of MegaStringMap
* @return A pointer to the superclass of the private object
*/
static MegaStringMap *createInstance();
/**
* @brief Creates a copy of this MegaStringMap object
*
* The resulting object is fully independent of the source MegaStringMap,
* it contains a copy of all internal attributes, so it will be valid after
* the original object is deleted.
*
* You take the ownership of the returned object
*
* @return Copy of the MegaStringMap object
*/
virtual MegaStringMap *copy() const;
/**
* @brief Returns the string at the position key in the MegaStringMap
*
* The returned value is a null-terminated char array. If the value in the map is an array of
* bytes, then it will be a Base64-encoded string.
*
* The MegaStringMap retains the ownership of the returned string. It will be only valid until
* the MegaStringMap is deleted.
*
* If the key is not found in the map, this function returns NULL.
*
* @param key Key of the string that you want to get from the map
* @return String at the position key in the map
*/
virtual const char* get(const char* key) const;
/**
* @brief Returns the list of keys in the MegaStringMap
*
* You take the ownership of the returned value
*
* @return A MegaStringList containing the keys present in the MegaStringMap
*/
virtual MegaStringList *getKeys() const;
/**
* @brief Sets a value in the MegaStringMap for the given key.
*
* If the key already exists in the MegaStringMap, the value will be overwritten by the
* new value.
*
* The MegaStringMap does not take ownership of the strings passed as parameter, it makes
* a local copy.
*
* @param key Key for the new value in the map. It must be a NULL-terminated string.
* @param value The new value for the key in the map. It must be a NULL-terminated string.
*/
virtual void set(const char* key, const char *value);
/**
* @brief Returns the number of strings in the map
* @return Number of strings in the map
*/
virtual int size() const;
};
/**
* @brief Map (multimap) of integer values with integer keys (map<long long, long long>)
*/
class MegaIntegerMap
{
public:
/**
* @brief Creates a new instance of MegaIntegerMap
* @return A pointer to the superclass of the private object
*/
static MegaIntegerMap* createInstance();
virtual ~MegaIntegerMap();
virtual MegaIntegerMap* copy() const;
/**
* @brief Returns the list of keys in the MegaIntegerMap
*
* You take the ownership of the returned value
*
* @return A MegaIntegerList containing the keys present in the MegaIntegerMap
*/
virtual MegaIntegerList* getKeys() const;
/**
* @brief Returns a list of values for the provided key
*
* You take the ownership of the returned value
*
* @param key Key of the element that you want to get from the map
* @return A MegaIntegerList containing the list of values for the provided key
*/
virtual MegaIntegerList* get(int64_t key) const;
/**
* @brief Sets a value in the map for the given key.
*
* If the key already exists, the value will be overwritten by the
* new value.
*
* @param key The key in the map.
* @param value The new value for the key in the map.
*/
virtual void set(int64_t key, int64_t value);
/**
* @brief Returns the number of (long long, long long) pairs in the map
* @return Number of pairs in the map
*/
virtual int64_t size() const;
};
/**
* @brief Map of integer values with string keys (map<string, int64_t>)
*/
class MegaStringIntegerMap
{
public:
virtual ~MegaStringIntegerMap() = default;
virtual MegaStringIntegerMap* copy() const = 0;
/**
* @brief Returns the list of keys in the MegaStringIntegerMap
*
* You take the ownership of the returned value
*
* @return A MegaStringList containing the keys present in the MegaStringIntegerMap
*/
virtual MegaStringList* getKeys() const = 0;
/**
* @brief Returns a list with the value of the provided key
*
* You take the ownership of the returned value
*
* @param key Key of the element that you want to get from the map
* @return A MegaIntegerList containing the list with the value for the provided key
*/
virtual MegaIntegerList* get(const char* key) const = 0;
/**
* @brief Sets a value in the map for the given key.
*
* If the key already exists, the value will be overwritten by the
* new value.
*
* @param key The key in the map.
* @param value The new value for the key in the map.
*/
virtual void set(const char* key, int64_t value) = 0;
/**
* @brief Returns the number of (string, int64_t) pairs in the map
* @return Number of pairs in the map
*/
virtual int64_t size() const = 0;
};
/**
* @brief List of strings
*
* A MegaStringList has the ownership of the strings that it contains, so they will be
* only valid until the MegaStringList is deleted. If you want to retain a string returned by
* a MegaStringList, copy it.
*
* Objects of this class are immutable.
*/
class MegaStringList
{
public:
/**
* @brief Creates a new instance of MegaStringList
*
* @return A pointer to the superclass of the private object
*/
static MegaStringList *createInstance();
virtual ~MegaStringList();
virtual MegaStringList *copy() const;
/**
* @brief Returns the string at the position i in the MegaStringList
*
* The MegaStringList retains the ownership of the returned string. It will be only valid until
* the MegaStringList is deleted.
*
* If the index is >= the size of the list, this function returns NULL.
*
* @param i Position of the string that we want to get for the list
* @return string at the position i in the list
*/
virtual const char* get(int i) const;
/**
* @brief Returns the number of strings in the list
* @return Number of strings in the list
*/
virtual int size() const;
/**
* @brief Add element to the list
*
* @param value String to add to list
*/
virtual void add(const char* value);
};
/**
* @brief A map of strings to string lists
*
* A MegaStringListMap takes owership of the MegaStringList objects passed to it. It does
* NOT take ownership of the keys passed to it but makes a local copy.
*/
class MegaStringListMap
{
protected:
MegaStringListMap();
public:
virtual ~MegaStringListMap();
static MegaStringListMap* createInstance();
virtual MegaStringListMap* copy() const;
/**
* @brief Returns the string list at the given key in the map
*
* The MegaStringMap retains the ownership of the returned string list. It will be only
* valid until the MegaStringMap is deleted.
*
* If the key is not found in the map, this function returns NULL.
*
* @param key Key to lookup in the map. Must be null-terminated
* @return String list at the given key in the map
*/
virtual const MegaStringList* get(const char* key) const;
/**
* @brief Returns the list of keys in the MegaStringListMap
*
* You take the ownership of the returned value
*
* @return A MegaStringList containing the keys present in the MegaStringListMap
*/
virtual MegaStringList *getKeys() const;
/**
* @brief Sets a value in the map for the given key.
*
* If the key already exists, the value will be overwritten by the
* new value.
*
* The map does not take ownership of the passed key, it makes
* a local copy. However, it does take ownership of the passed value.
*
* @param key The key in the map. It must be a null-terminated string.
* @param value The new value for the key in the map.
*/
virtual void set(const char* key, const MegaStringList* value);
/**
* @brief Returns the number of (string, string list) pairs in the map
* @return Number of pairs in the map
*/
virtual int size() const;
};
/**
* @brief A list of string lists forming a table of strings.
*
* Each row can have a different number of columns.
* However, ideally this class should be used as a table only.
*
* A MegaStringTable takes owership of the MegaStringList objects passed to it.
*/
class MegaStringTable
{
protected:
MegaStringTable();
public:
virtual ~MegaStringTable();
static MegaStringTable *createInstance();
virtual MegaStringTable* copy() const;
/**
* @brief Appends a new string list to the end of the table
*
* The table takes ownership of the passed value.
*
* @param value The string list to append
*/
virtual void append(const MegaStringList* value);
/**
* @brief Returns the string list at position i
*
* The table retains the ownership of the returned string list. It will be only valid until
* the table is deleted.
*
* The returned pointer is null if i is out of range.
*
* @return The string list at position i
*/
virtual const MegaStringList* get(int i) const;
/**
* @brief Returns the number of string lists in the table
* @return Number of string lists in the table
*/
virtual int size() const;
};
/**
* @brief List of MegaNode objects
*
* A MegaNodeList has the ownership of the MegaNode objects that it contains, so they will be
* only valid until the NodeList is deleted. If you want to retain a MegaMode returned by
* a MegaNodeList, use MegaNode::copy.
*
* Objects of this class are immutable.
*
* @see MegaApi::getChildren, MegaApi::search, MegaApi::getInShares
*/
class MegaNodeList
{
protected:
MegaNodeList();
public:
/**
* @brief Creates a new instance of MegaNodeList
* @return A pointer to the superclass of the private object
*/
static MegaNodeList * createInstance();
virtual ~MegaNodeList();
virtual MegaNodeList *copy() const;
/**
* @brief Returns the MegaNode at the position i in the MegaNodeList
*
* The MegaNodeList retains the ownership of the returned MegaNode. It will be only valid until
* the MegaNodeList is deleted.
*
* If the index is >= the size of the list, this function returns NULL.
*
* @param i Position of the MegaNode that we want to get for the list
* @return MegaNode at the position i in the list
*/
virtual MegaNode* get(int i) const;
/**
* @brief Returns the number of MegaNode objects in the list
* @return Number of MegaNode objects in the list
*/
virtual int size() const;
/**
* @brief Add new node to list
* @param node MegaNode to be added. The node inserted is a copy from 'node'
*/
virtual void addNode(MegaNode* node);
};
/**
* @brief Lists of file and folder children MegaNode objects
*
* @obsolete This method is unused by app
*
* A MegaChildrenLists object has the ownership of the MegaNodeList objects that it contains,
* so they will be only valid until the MegaChildrenLists is deleted. If you want to retain
* a MegaNodeList returned by a MegaChildrenLists, use MegaNodeList::copy.
*
* Objects of this class are immutable.
*/
class MegaChildrenLists
{
public:
virtual ~MegaChildrenLists();
virtual MegaChildrenLists *copy();
/**
* @brief Get the list of folder MegaNode objects
* @return List of MegaNode folders
*/
virtual MegaNodeList* getFolderList();
/**
* @brief Get the list of file MegaNode objects
* @return List of MegaNode files
*/
virtual MegaNodeList* getFileList();
};
/**
* @brief List of MegaUser objects
*
* A MegaUserList has the ownership of the MegaUser objects that it contains, so they will be
* only valid until the MegaUserList is deleted. If you want to retain a MegaUser returned by
* a MegaUserList, use MegaUser::copy.
*
* Objects of this class are immutable.
*
* @see MegaApi::getContacts
*
*/
class MegaUserList
{
public:
virtual ~MegaUserList();
virtual MegaUserList *copy();
/**
* @brief Returns the MegaUser at the position i in the MegaUserList
*
* The MegaUserList retains the ownership of the returned MegaUser. It will be only valid until
* the MegaUserList is deleted.
*
* If the index is >= the size of the list, this function returns NULL.
*
* @param i Position of the MegaUser that we want to get for the list
* @return MegaUser at the position i in the list
*/
virtual MegaUser* get(int i);
/**
* @brief Returns the number of MegaUser objects in the list
* @return Number of MegaUser objects in the list
*/
virtual int size();
};
/**
* @brief List of MegaShare objects
*
* A MegaShareList has the ownership of the MegaShare objects that it contains, so they will be
* only valid until the MegaShareList is deleted. If you want to retain a MegaShare returned by
* a MegaShareList, use MegaShare::copy.
*
* Objects of this class are immutable.
*
* @see MegaApi::getOutShares
*/
class MegaShareList
{
public:
virtual ~MegaShareList();
/**
* @brief Returns the MegaShare at the position i in the MegaShareList
*
* The MegaShareList retains the ownership of the returned MegaShare. It will be only valid until
* the MegaShareList is deleted.
*
* If the index is >= the size of the list, this function returns NULL.
*
* @param i Position of the MegaShare that we want to get for the list
* @return MegaShare at the position i in the list
*/
virtual MegaShare* get(int i);
/**
* @brief Returns the number of MegaShare objects in the list
* @return Number of MegaShare objects in the list
*/
virtual int size();
};
/**
* @brief List of MegaTransfer objects
*
* A MegaTransferList has the ownership of the MegaTransfer objects that it contains, so they will be
* only valid until the MegaTransferList is deleted. If you want to retain a MegaTransfer returned by
* a MegaTransferList, use MegaTransfer::copy.
*
* Objects of this class are immutable.
*
* @see MegaApi::getTransfers
*/
class MegaTransferList
{
public:
virtual ~MegaTransferList();
/**
* @brief Returns the MegaTransfer at the position i in the MegaTransferList
*
* The MegaTransferList retains the ownership of the returned MegaTransfer. It will be only valid until
* the MegaTransferList is deleted.
*
* If the index is >= the size of the list, this function returns NULL.
*
* @param i Position of the MegaTransfer that we want to get for the list
* @return MegaTransfer at the position i in the list
*/
virtual MegaTransfer* get(int i);
/**
* @brief Returns the number of MegaTransfer objects in the list
* @return Number of MegaTransfer objects in the list
*/
virtual int size();
};
/**
* @brief List of MegaContactRequest objects
*
* A MegaContactRequestList has the ownership of the MegaContactRequest objects that it contains, so they will be
* only valid until the MegaContactRequestList is deleted. If you want to retain a MegaContactRequest returned by
* a MegaContactRequestList, use MegaContactRequest::copy.
*
* Objects of this class are immutable.
*
* @see MegaApi::getContactRequests
*/
class MegaContactRequestList
{
public:
virtual ~MegaContactRequestList();
virtual MegaContactRequestList* copy() const;
/**
* @brief Returns the MegaContactRequest at the position i in the MegaContactRequestList
*
* The MegaContactRequestList retains the ownership of the returned MegaContactRequest. It
* will be only valid until the MegaContactRequestList is deleted.
*
* If the index is >= the size of the list, this function returns NULL.
*
* @param i Position of the MegaContactRequest that we want to get for the list
* @return MegaContactRequest at the position i in the list
*/
MegaContactRequest* get(int i);
/**
* @brief Returns the MegaContactRequest at the position i in the MegaContactRequestList
*
* The MegaContactRequestList retains the ownership of the returned MegaContactRequest. It will be only valid until
* the MegaContactRequestList is deleted.
*
* If the index is >= the size of the list, this function returns NULL.
*
* @param i Position of the MegaContactRequest that we want to get for the list
* @return MegaContactRequest at the position i in the list
*/
virtual const MegaContactRequest* get(int i) const;
/**
* @brief Returns the number of MegaContactRequest objects in the list
* @return Number of MegaContactRequest objects in the list
*/
virtual int size() const;
};
/**
* @brief List of MegaUserAlert objects
*
* A MegaUserAlertList has the ownership of the MegaUserAlert objects that it contains, so they will be
* only valid until the MegaUserAlertList is deleted. If you want to retain a MegaUserAlert returned by
* a MegaUserAlertList, use MegaUserAlert::copy.
*
* Objects of this class are immutable.
*
* @see MegaApi::getUserAlerts
*
*/
class MegaUserAlertList
{
public:
virtual ~MegaUserAlertList();
virtual MegaUserAlertList *copy() const;
/**
* @brief Returns the MegaUserAlert at the position i in the MegaUserAlertList
*
* The MegaUserAlertList retains the ownership of the returned MegaUserAlert. It will be only valid until
* the MegaUserAlertList is deleted.
*
* If the index is >= the size of the list, this function returns NULL.
*
* @param i Position of the MegaUserAlert that we want to get for the list
* @return MegaUserAlert at the position i in the list
*/
virtual MegaUserAlert* get(int i) const;
/**
* @brief Returns the number of MegaUserAlert objects in the list
* @return Number of MegaUserAlert objects in the list
*/
virtual int size() const;
/**
* @brief Removes all MegaUserAlert objects from the list (does not delete them)
*/
virtual void clear();
};
/**
* @brief Represents a set of files uploaded or updated in MEGA.
* These are used to display the recent changes to an account.
*
* Objects of this class aren't live, they are snapshots of the state
* in MEGA when the object is created, they are immutable.
*
* MegaRecentActionBuckets can be retrieved with MegaApi::getRecentActions
* and MegaApi::getRecentActionsAsync.
*
*/
class MegaRecentActionBucket
{
public:
virtual ~MegaRecentActionBucket();
/**
* @brief Creates a copy of this MegaRecentActionBucket object.
*
* The resulting object is fully independent of the source MegaRecentActionBucket,
* it contains a copy of all internal attributes, so it will be valid after
* the original object is deleted.
*
* You are the owner of the returned object
*
* @return Copy of the MegaRecentActionBucket object
*/
virtual MegaRecentActionBucket *copy() const;
/**
* @brief Returns a timestamp reflecting when these changes occurred
*
* @return Timestamp indicating when the changes occurred (in seconds since the Epoch)
*/
virtual int64_t getTimestamp() const;
/**
* @brief Returns the email of the user who made the changes
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaRecentActionBucket object is deleted.
*
* @return The associated user's email
*/
virtual const char* getUserEmail() const;
/**
* @brief Returns the handle of the parent folder these changes occurred in
*
* @return The handle of the parent folder for these changes.
*/
virtual MegaHandle getParentHandle() const;
/**
* @brief Returns whether the changes are updated files, or new files
*
* @return True if the changes are updates rather than newly uploaded files.
*/
virtual bool isUpdate() const;
/**
* @brief Returns whether the files are photos or videos
*
* @return True if the files in this change are media files.
*/
virtual bool isMedia() const;
/**
* @brief Returns nodes representing the files changed in this bucket
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaRecentActionBucket object is deleted.
*
* @return A MegaNodeList containing the files in the bucket
*/
virtual const MegaNodeList* getNodes() const;
};
/**
* @brief List of MegaRecentActionBucket objects
*
* A MegaRecentActionBucketList has the ownership of the MegaRecentActionBucket objects that it
* contains, so they will be only valid until the MegaRecentActionBucketList is deleted. If you want
* to retain a MegaRecentActionBucket returned by a MegaRecentActionBucketList, use
* MegaRecentActionBucket::copy.
*
* Objects of this class are immutable.
*
* @see MegaApi::getRecentActions
* @see MegaApi::getRecentActionsAsync
*
*/
class MegaRecentActionBucketList
{
public:
virtual ~MegaRecentActionBucketList();
/**
* @brief Creates a copy of this MegaRecentActionBucketList object.
*
* The resulting object is fully independent of the source MegaRecentActionBucketList,
* it contains a copy of all internal attributes, so it will be valid after
* the original object is deleted.
*
* You are the owner of the returned object
*
* @return Copy of the MegaRecentActionBucketList object
*/
virtual MegaRecentActionBucketList *copy() const;
/**
* @brief Returns the MegaRecentActionBucket at the position i in the MegaRecentActionBucketList
*
* The MegaRecentActionBucketList retains the ownership of the returned MegaRecentActionBucket. It will be only valid until
* the MegaRecentActionBucketList is deleted.
*
* If the index is >= the size of the list, this function returns NULL.
*
* @param i Position of the MegaRecentActionBucket that we want to get for the list
* @return MegaRecentActionBucket at the position i in the list
*/
virtual MegaRecentActionBucket* get(int i) const;
/**
* @brief Returns the number of MegaRecentActionBucket objects in the list
* @return Number of MegaRecentActionBucket objects in the list
*/
virtual int size() const;
};
/**
* @brief Represents a set of properties that define a SmartBanner.
* These are used to display a banner in mobile apps.
*
* MegaBanner-s can be retrieved from MegaBannerList
*
*/
class MegaBanner
{
public:
virtual ~MegaBanner();
/**
* @brief Creates a copy of this MegaBanner object.
*
* The resulting object is fully independent of the source MegaBanner,
* it contains a copy of all internal attributes, so it will be valid after
* the original object is deleted.
*
* You are the owner of the returned object
*
* @return Copy of the MegaBanner object
*/
virtual MegaBanner* copy() const;
/**
* @brief Returns the id of the MegaBanner
*
* @return Id of this banner
*/
virtual int getId() const;
/**
* @brief Returns the title associated with the MegaBanner object
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaBanner object is deleted.
*
* @return Title associated with the MegaBanner object
*/
virtual const char* getTitle() const;
/**
* @brief Returns the description associated with the MegaBanner object
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaBanner object is deleted.
*
* @return Description associated with the MegaBanner object
*/
virtual const char* getDescription() const;
/**
* @brief Returns the filename of the image used by the MegaBanner object
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaBanner object is deleted.
*
* @return Filename of the image used by the MegaBanner object
*/
virtual const char* getImage() const;
/**
* @brief Returns the URL associated with the MegaBanner object
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaBanner object is deleted.
*
* @return URL associated with the MegaBanner object
*/
virtual const char* getUrl() const;
/**
* @brief Returns the filename of the background image used by the MegaBanner object
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaBanner object is deleted.
*
* @return Filename of the background image used by the MegaBanner object
*/
virtual const char* getBackgroundImage() const;
/**
* @brief Returns the URL where images are located
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaBanner object is deleted.
*
* @return URL where images are located
*/
virtual const char* getImageLocation() const;
/**
* @brief Returns the variant of the banner
*
* @return Variant of the banner
*/
virtual int getVariant() const;
/**
* @brief Returns the button of the banner
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaBanner object is deleted.
*
* @return Button of the banner
*/
virtual const char* getButton() const;
protected:
MegaBanner();
};
/**
* @brief List of MegaBanner objects
*
* A MegaBannerList has the ownership of the MegaBanner objects that it contains, so they will be
* only valid until the MegaBannerList is deleted.
*
*/
class MegaBannerList
{
public:
virtual ~MegaBannerList();
/**
* @brief Creates a copy of this MegaBannerList object.
*
* The resulting object is fully independent of the source MegaBannerList,
* it contains a copy of all internal objects, so it will be valid after
* the original object is deleted.
*
* You are the owner of the returned object
*
* @return Copy of the MegaBannerList object
*/
virtual MegaBannerList* copy() const;
/**
* @brief Returns the MegaBanner at position i in the MegaBannerList
*
* The MegaBannerList retains the ownership of the returned MegaBanner. It will be only valid until
* the MegaBannerList is deleted.
*
* If the index is >= the size of the list, this function returns NULL.
*
* @param i Position of the MegaBanner that we want to get for the list
* @return MegaBanner at position i in the list
*/
virtual const MegaBanner* get(int i) const;
/**
* @brief Returns the number of MegaBanner objects in the list
* @return Number of MegaBanner objects in the list
*/
virtual int size() const;
protected:
MegaBannerList();
};
/**
* @brief Represents a set of properties that define discount code
*/
class MegaDiscountCode
{
public:
virtual ~MegaDiscountCode();
/**
* @brief Creates a copy of this MegaDiscountCode object.
*
* The resulting object is fully independent of the source MegaDiscountCode,
* it contains a copy of all internal attributes, so it will be valid after
* the original object is deleted.
*
* You are the owner of the returned object
*
* @return Copy of the MegaDiscountCode object
*/
virtual MegaDiscountCode* copy() const;
/**
* @brief Returns the discount code string
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaDiscountCode object is deleted.
*/
virtual const char* getCode() const;
/**
* @brief Returns the item associated with the discount code
*/
virtual int getItem() const;
/**
* @brief Returns the account level associated with the discount code
*/
virtual int getAccountLevel() const;
/**
* @brief Returns number of months (1 or 12), or 0 if code applies to any number of months
*/
virtual int getMonths() const;
/**
* @brief Returns the percentage discount associated with the discount code
*/
virtual int getPercentageDiscount() const;
/**
* @brief Returns the behavior type associated with the discount code
*/
virtual int getBehaviorType() const;
protected:
MegaDiscountCode();
};
/**
* @brief List of MegaDiscountCode objects
*
* A MegaDiscountCodeList has the ownership of the MegaDiscountCode objects that it contains, so
* they will be only valid until the MegaDiscountCodeList is deleted. If you want to retain a
* MegaDiscountCode returned by a MegaDiscountCodeList, use MegaDiscountCode::copy.
*/
class MegaDiscountCodeList
{
public:
virtual ~MegaDiscountCodeList();
/**
* @brief Creates a copy of this MegaDiscountCodeList object.
*
* The resulting object is fully independent of the source MegaDiscountCodeList,
* it contains a copy of all internal attributes, so it will be valid after
* the original object is deleted.
*
* You are the owner of the returned object
*
* @return Copy of the MegaDiscountCodeList object
*/
virtual MegaDiscountCodeList* copy() const;
/**
* @brief Returns the MegaDiscountCode at position i in the MegaDiscountCodeList
*
* The MegaDiscountCodeList retains the ownership of the returned MegaDiscountCode. It will be
* only valid until the MegaDiscountCodeList is deleted.
*
* If the index is >= the size of the list, this function returns nullptr.
*
* @param i Position of the MegaDiscountCode that we want to get for the list
* @return MegaDiscountCode at position i in the list
*/
virtual const MegaDiscountCode* get(int i) const;
/**
* @brief Returns the number of MegaDiscountCode objects in the list
* @return Number of MegaDiscountCode objects in the list
*/
virtual int size() const;
protected:
MegaDiscountCodeList();
};
/**
* @brief Represents a set of properties that define discount code information
* These are used to display discount code details to the user.
*/
class MegaDiscountCodeInfo: public MegaDiscountCode
{
public:
virtual ~MegaDiscountCodeInfo();
/**
* @brief Creates a copy of this MegaDiscountCodeInfo object.
*
* The resulting object is fully independent of the source MegaDiscountCodeInfo,
* it contains a copy of all internal attributes, so it will be valid after
* the original object is deleted.
*
* You take the ownership of returned value
*
* @return Copy of the MegaDiscountCodeInfo object
*/
virtual MegaDiscountCodeInfo* copy() const;
/*
* @brief Returns the expiry time associated with the discount code info (seconds since epoch)
*/
virtual int getExpiry() const;
/*
* @brief Returns the compulsory subscription associated with the discount code info
* Subscription will continue after discount period
*/
virtual int getCompulsorySubscription() const;
/*
* @brief Returns the multi discount associated with the discount code info
* Turn flag on for using new Multi Discount system (alters UI appearance & behaviour)
*/
virtual int getMultiDiscount() const;
/*
* @brief Returns a MegaStringIntegerMap with all feature names and it's code: {{"vpn", 1},
* {"pwm", 2} ...}
* You take the ownership of returned value
*/
virtual MegaStringIntegerMap* getFeatures() const;
/*
* @brief Returns the tax value associated with the discount code info
*/
virtual int getTaxValue() const;
/*
* @brief Returns if the user is tax exempt (0% tax)
*/
virtual bool isTaxExempt() const;
/*
* @brief Returns if the tax is applied on top of the base price (PPT)
*/
virtual bool isTaxAppliedOnTop() const;
/*
* @brief Returns the tax rate associated with the discount code info
*/
virtual int getTaxRate() const;
/*
* @brief Returns the tax name associated with the discount code info
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaDiscountCodeInfo object is deleted.
*/
virtual const char* getTaxName() const;
/*
* @brief Returns the tax country associated with the discount code info
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaDiscountCodeInfo object is deleted.
*/
virtual const char* getTaxCountry() const;
/*
* @brief Returns the euro total price associated with the discount code info
*/
virtual double getEuroTotalPrice() const;
/*
* @brief Returns the euro discount amount associated with the discount code info
*/
virtual double getEuroDiscountAmount() const;
/*
* @brief Returns the euro discounted total price associated with the discount code info
*/
virtual double getEuroDiscountedTotalPrice() const;
/*
* @brief Returns the euro discounted monthly price associated with the discount code info
*/
virtual double getEuroDiscountedMonthlyPrice() const;
/*
* @brief Returns the euro total price net associated with the discount code info
*/
virtual double getEuroTotalPriceNet() const;
/*
* @brief Returns the euro discount amount net associated with the discount code info
*/
virtual double getEuroDiscountAmountNet() const;
/*
* @brief Returns the euro discounted total price net associated with the discount code info
*/
virtual double getEuroDiscountedTotalPriceNet() const;
/*
* @brief Returns the euro discounted monthly price net associated with the discount code info
*/
virtual double getEuroDiscountedMonthlyPriceNet() const;
/*
* @brief Returns the local currency code associated with the discount code info
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaDiscountCodeInfo object is deleted.
*/
virtual const char* getLocalCurrencyCode() const;
/*
* @brief Returns the local currency symbol associated with the discount code info
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaDiscountCodeInfo object is deleted.
*/
virtual const char* getLocalCurrencySymbol() const;
/*
* @brief Returns the local total price associated with the discount code info
*/
virtual double getLocalTotalPrice() const;
/*
* @brief Returns the local discount amount associated with the discount code info
*/
virtual double getLocalDiscountAmount() const;
/*
* @brief Returns the local discounted total price associated with the discount code info
*/
virtual double getLocalDiscountedTotalPrice() const;
/*
* @brief Returns the local discounted monthly price associated with the discount code info
*/
virtual double getLocalDiscountedMonthlyPrice() const;
/*
* @brief Returns the local total price net associated with the discount code info
*/
virtual double getLocalTotalPriceNet() const;
/*
* @brief Returns the local discount amount net associated with the discount code info
*/
virtual double getLocalDiscountAmountNet() const;
/*
* @brief Returns the local discounted total price net associated with the discount code info
*/
virtual double getLocalDiscountedTotalPriceNet() const;
/*
* @brief Returns the local discounted monthly price net associated with the discount code info
*/
virtual double getLocalDiscountedMonthlyPriceNet() const;
protected:
MegaDiscountCodeInfo();
};
/**
* @brief Provides information about an asynchronous request
*
* Most functions in this API are asynchronous, except the ones that never require to
* contact MEGA servers. Developers can use listeners (MegaListener, MegaRequestListener)
* to track the progress of each request. MegaRequest objects are provided in callbacks sent
* to these listeners and allow developers to know the state of the request, their parameters
* and their results.
*
* Objects of this class aren't live, they are snapshots of the state of the request
* when the object is created, they are immutable.
*
* These objects have a high number of 'getters', but only some of them return valid values
* for each type of request. Documentation of each request specify which fields are valid.
*
*/
class MegaRequest
{
public:
enum {
TYPE_LOGIN = 0,
TYPE_CREATE_FOLDER = 1,
TYPE_MOVE = 2,
TYPE_COPY = 3,
TYPE_RENAME = 4,
TYPE_REMOVE = 5,
TYPE_SHARE = 6,
TYPE_IMPORT_LINK = 7,
TYPE_EXPORT = 8,
TYPE_FETCH_NODES = 9,
TYPE_ACCOUNT_DETAILS = 10,
TYPE_CHANGE_PW = 11,
TYPE_UPLOAD = 12,
TYPE_LOGOUT = 13,
TYPE_GET_PUBLIC_NODE = 14,
TYPE_GET_ATTR_FILE = 15,
TYPE_SET_ATTR_FILE = 16,
TYPE_GET_ATTR_USER = 17,
TYPE_SET_ATTR_USER = 18,
TYPE_RETRY_PENDING_CONNECTIONS = 19,
TYPE_REMOVE_CONTACT = 20,
TYPE_CREATE_ACCOUNT = 21,
TYPE_CONFIRM_ACCOUNT = 22,
TYPE_QUERY_SIGNUP_LINK = 23,
TYPE_ADD_SYNC = 24,
TYPE_REMOVE_SYNC = 25,
//TYPE_DISABLE_SYNC = 26,
//TYPE_ENABLE_SYNC = 27,
TYPE_COPY_SYNC_CONFIG = 28,
TYPE_COPY_CACHED_STATUS = 29,
TYPE_IMPORT_SYNC_CONFIGS = 30,
TYPE_REMOVE_SYNCS = 31,
TYPE_PAUSE_TRANSFERS = 32,
TYPE_CANCEL_TRANSFER = 33,
TYPE_CANCEL_TRANSFERS = 34,
TYPE_DELETE = 35,
TYPE_REPORT_EVENT = 36,
TYPE_CANCEL_ATTR_FILE = 37,
TYPE_GET_PRICING = 38,
TYPE_GET_PAYMENT_ID = 39,
TYPE_GET_USER_DATA = 40,
TYPE_LOAD_BALANCING = 41,
TYPE_KILL_SESSION = 42,
TYPE_SUBMIT_PURCHASE_RECEIPT = 43,
TYPE_CREDIT_CARD_STORE = 44,
TYPE_UPGRADE_ACCOUNT = 45,
TYPE_CREDIT_CARD_QUERY_SUBSCRIPTIONS = 46,
TYPE_CREDIT_CARD_CANCEL_SUBSCRIPTIONS = 47,
TYPE_GET_SESSION_TRANSFER_URL = 48,
TYPE_GET_PAYMENT_METHODS = 49,
TYPE_INVITE_CONTACT = 50,
TYPE_REPLY_CONTACT_REQUEST = 51,
TYPE_SUBMIT_FEEDBACK = 52,
TYPE_SEND_EVENT = 53,
TYPE_CLEAN_RUBBISH_BIN = 54,
TYPE_SET_ATTR_NODE = 55,
TYPE_CHAT_CREATE = 56,
TYPE_CHAT_FETCH = 57,
TYPE_CHAT_INVITE = 58,
TYPE_CHAT_REMOVE = 59,
TYPE_CHAT_URL = 60,
TYPE_CHAT_GRANT_ACCESS = 61,
TYPE_CHAT_REMOVE_ACCESS = 62,
TYPE_USE_HTTPS_ONLY = 63,
TYPE_SET_PROXY = 64,
TYPE_GET_RECOVERY_LINK = 65,
TYPE_QUERY_RECOVERY_LINK = 66,
TYPE_CONFIRM_RECOVERY_LINK = 67,
TYPE_GET_CANCEL_LINK = 68,
TYPE_CONFIRM_CANCEL_LINK = 69,
TYPE_GET_CHANGE_EMAIL_LINK = 70,
TYPE_CONFIRM_CHANGE_EMAIL_LINK = 71,
TYPE_CHAT_UPDATE_PERMISSIONS = 72,
TYPE_CHAT_TRUNCATE = 73,
TYPE_CHAT_SET_TITLE = 74,
TYPE_SET_MAX_CONNECTIONS = 75,
TYPE_PAUSE_TRANSFER = 76,
TYPE_MOVE_TRANSFER = 77,
TYPE_CHAT_PRESENCE_URL = 78,
TYPE_REGISTER_PUSH_NOTIFICATION = 79,
TYPE_GET_USER_EMAIL = 80,
TYPE_APP_VERSION = 81,
TYPE_GET_LOCAL_SSL_CERT = 82,
TYPE_SEND_SIGNUP_LINK = 83,
TYPE_QUERY_DNS = 84,
TYPE_QUERY_GELB = 85, // (obsolete)
TYPE_CHAT_STATS = 86,
TYPE_DOWNLOAD_FILE = 87,
TYPE_QUERY_TRANSFER_QUOTA = 88,
TYPE_PASSWORD_LINK = 89,
TYPE_GET_ACHIEVEMENTS = 90,
TYPE_RESTORE = 91,
TYPE_REMOVE_VERSIONS = 92,
TYPE_CHAT_ARCHIVE = 93,
TYPE_WHY_AM_I_BLOCKED = 94,
TYPE_CONTACT_LINK_CREATE = 95,
TYPE_CONTACT_LINK_QUERY = 96,
TYPE_CONTACT_LINK_DELETE = 97,
TYPE_FOLDER_INFO = 98,
TYPE_RICH_LINK = 99,
TYPE_KEEP_ME_ALIVE = 100,
TYPE_MULTI_FACTOR_AUTH_CHECK = 101,
TYPE_MULTI_FACTOR_AUTH_GET = 102,
TYPE_MULTI_FACTOR_AUTH_SET = 103,
TYPE_ADD_SCHEDULED_COPY = 104,
TYPE_REMOVE_SCHEDULED_COPY = 105,
TYPE_TIMER = 106,
TYPE_ABORT_CURRENT_SCHEDULED_COPY = 107,
TYPE_GET_PSA = 108,
TYPE_FETCH_TIMEZONE = 109,
TYPE_USERALERT_ACKNOWLEDGE = 110,
TYPE_CHAT_LINK_HANDLE = 111,
TYPE_CHAT_LINK_URL = 112,
TYPE_SET_PRIVATE_MODE = 113,
TYPE_AUTOJOIN_PUBLIC_CHAT = 114,
TYPE_CATCHUP = 115,
TYPE_PUBLIC_LINK_INFORMATION = 116,
TYPE_GET_BACKGROUND_UPLOAD_URL = 117,
TYPE_COMPLETE_BACKGROUND_UPLOAD = 118,
TYPE_GET_CLOUD_STORAGE_USED = 119,
TYPE_SEND_SMS_VERIFICATIONCODE = 120, // (deprecated / obsolete)
TYPE_CHECK_SMS_VERIFICATIONCODE = 121, // (deprecated / obsolete)
// TYPE_GET_REGISTERED_CONTACTS = 122, (obsolete)
TYPE_GET_COUNTRY_CALLING_CODES = 123, // (deprecated / obsolete)
TYPE_VERIFY_CREDENTIALS = 124,
TYPE_GET_MISC_FLAGS = 125,
TYPE_RESEND_VERIFICATION_EMAIL = 126,
TYPE_SUPPORT_TICKET = 127,
TYPE_SET_RETENTION_TIME = 128,
TYPE_RESET_SMS_VERIFIED_NUMBER = 129, // (deprecated / obsolete)
TYPE_SEND_DEV_COMMAND = 130,
TYPE_GET_BANNERS = 131,
TYPE_DISMISS_BANNER = 132,
TYPE_BACKUP_PUT = 133,
TYPE_BACKUP_REMOVE = 134,
TYPE_BACKUP_PUT_HEART_BEAT = 135,
TYPE_FETCH_ADS = 136,
TYPE_QUERY_ADS = 137,
TYPE_GET_ATTR_NODE = 138,
TYPE_LOAD_EXTERNAL_DRIVE_BACKUPS = 139,
TYPE_CLOSE_EXTERNAL_DRIVE_BACKUPS = 140,
TYPE_GET_DOWNLOAD_URLS = 141,
TYPE_START_CHAT_CALL = 142,
TYPE_JOIN_CHAT_CALL = 143,
TYPE_END_CHAT_CALL = 144,
TYPE_GET_FA_UPLOAD_URL = 145,
TYPE_EXECUTE_ON_THREAD = 146,
TYPE_SET_CHAT_OPTIONS = 147,
TYPE_GET_RECENT_ACTIONS = 148,
TYPE_CHECK_RECOVERY_KEY = 149,
TYPE_SET_MY_BACKUPS = 150,
TYPE_PUT_SET = 151,
TYPE_REMOVE_SET = 152,
TYPE_FETCH_SET = 153,
TYPE_PUT_SET_ELEMENT = 154,
TYPE_REMOVE_SET_ELEMENT = 155,
TYPE_REMOVE_OLD_BACKUP_NODES = 156,
TYPE_SET_SYNC_RUNSTATE = 157,
TYPE_ADD_UPDATE_SCHEDULED_MEETING = 158,
TYPE_DEL_SCHEDULED_MEETING = 159,
TYPE_FETCH_SCHEDULED_MEETING = 160,
TYPE_FETCH_SCHEDULED_MEETING_OCCURRENCES = 161,
TYPE_OPEN_SHARE_DIALOG = 162,
TYPE_UPGRADE_SECURITY = 163,
TYPE_PUT_SET_ELEMENTS = 164,
TYPE_REMOVE_SET_ELEMENTS = 165,
TYPE_EXPORT_SET = 166,
TYPE_GET_EXPORTED_SET_ELEMENT = 167,
TYPE_GET_RECOMMENDED_PRO_PLAN = 168,
TYPE_BACKUP_INFO = 169,
TYPE_BACKUP_REMOVE_MD = 170,
TYPE_AB_TEST_ACTIVE = 171,
TYPE_GET_VPN_REGIONS = 172,
TYPE_GET_VPN_CREDENTIALS = 173,
TYPE_PUT_VPN_CREDENTIAL = 174,
TYPE_DEL_VPN_CREDENTIAL = 175,
TYPE_CHECK_VPN_CREDENTIAL = 176,
TYPE_GET_SYNC_STALL_LIST = 177,
TYPE_FETCH_CREDIT_CARD_INFO = 178,
TYPE_MOVE_TO_DEBRIS = 179,
TYPE_RING_INDIVIDUAL_IN_CALL = 180,
TYPE_CREATE_NODE_TREE = 181,
TYPE_CREATE_PASSWORD_MANAGER_BASE = 182,
TYPE_CREATE_PASSWORD_NODE = 183,
TYPE_UPDATE_PASSWORD_NODE = 184,
TYPE_GET_NOTIFICATIONS = 185,
TYPE_TAG_NODE = 186,
TYPE_ADD_MOUNT = 187,
TYPE_DISABLE_MOUNT = 188,
TYPE_ENABLE_MOUNT = 189,
TYPE_REMOVE_MOUNT = 190,
TYPE_SET_MOUNT_FLAGS = 191,
TYPE_DEL_ATTR_USER = 192,
TYPE_BACKUP_PAUSE_MD = 194,
TYPE_BACKUP_RESUME_MD = 195,
TYPE_IMPORT_PASSWORDS_FROM_FILE = 196,
TYPE_GET_ACTIVE_SURVEY_TRIGGER_ACTIONS = 197,
TYPE_GET_SURVEY = 198,
TYPE_ANSWER_SURVEY = 199,
TYPE_CHANGE_SYNC_ROOT = 200,
TYPE_GET_MY_IP = 201,
TYPE_SET_SYNC_UPLOAD_THROTTLE_VALUES = 202,
TYPE_GET_SYNC_UPLOAD_THROTTLE_VALUES = 203,
TYPE_GET_SYNC_UPLOAD_THROTTLE_LIMITS = 204,
TYPE_CHECK_SYNC_UPLOAD_THROTTLED_ELEMENTS = 205,
TYPE_RUN_NETWORK_CONNECTIVITY_TEST = 206,
TYPE_ADD_SYNC_PREVALIDATION = 207,
TYPE_GET_MAX_CONNECTIONS = 208,
TYPE_GET_SUBSCRIPTION_CANCELLATION_DETAILS = 209,
TYPE_GET_DISCOUNT_CODE_INFORMATION = 210,
TOTAL_OF_REQUEST_TYPES = 211,
};
virtual ~MegaRequest();
/**
* @brief Creates a copy of this MegaRequest object
*
* The resulting object is fully independent of the source MegaRequest,
* it contains a copy of all internal attributes, so it will be valid after
* the original object is deleted.
*
* You are the owner of the returned object
*
* @return Copy of the MegaRequest object
*/
virtual MegaRequest *copy();
/**
* @brief Returns the type of request associated with the object
* @return Type of request associated with the object
*/
virtual int getType() const;
/**
* @brief Returns a readable string that shows the type of request
*
* This function returns a pointer to a statically allocated buffer.
* You don't have to free the returned pointer
*
* @return Readable string showing the type of request
*/
virtual const char *getRequestString() const;
/**
* @brief Returns a readable string that shows the type of request
*
* This function provides exactly the same result as MegaRequest::getRequestString.
* It's provided for a better Java compatibility
*
* @return Readable string showing the type of request
*/
virtual const char* toString() const;
/**
* @brief Returns the handle of a node related to the request
*
* This value is valid for these requests:
* - MegaApi::moveNode - Returns the handle of the node to move
* - MegaApi::copyNode - Returns the handle of the node to copy
* - MegaApi::renameNode - Returns the handle of the node to rename
* - MegaApi::remove - Returns the handle of the node to remove
* - MegaApi::sendFileToUser - Returns the handle of the node to send
* - MegaApi::share - Returns the handle of the folder to share
* - MegaApi::getThumbnail - Returns the handle of the node to get the thumbnail
* - MegaApi::getPreview - Return the handle of the node to get the preview
* - MegaApi::cancelGetThumbnail - Return the handle of the node
* - MegaApi::cancelGetPreview - Returns the handle of the node
* - MegaApi::setThumbnail - Returns the handle of the node
* - MegaApi::setPreview - Returns the handle of the node
* - MegaApi::exportNode - Returns the handle of the node
* - MegaApi::disableExport - Returns the handle of the node
* - MegaApi::getPaymentId - Returns the handle of the product
* - MegaApi::syncFolder - Returns the handle of the folder in MEGA
* - MegaApi::removeSync - Returns the handle of the folder in MEGA
* - MegaApi::upgradeAccount - Returns that handle of the product
* - MegaApi::replyContactRequest - Returns the handle of the contact request
* - MegaApi::inviteToChat - Returns the handle of the chat
* - MegaApi::removeFromChat - Returns the handle of the chat
* - MegaApi::getUrlChat - Returns the handle of the chat
* - MegaApi::grantAccessInChat - Returns the handle of the node
* - MegaApi::removeAccessInChat - Returns the handle of the node
* - MegaApi::setScheduledCopy - Returns the target node of the backup
* - MegaApi::updateBackup - Returns the target node of the backup
* - MegaApi::sendBackupHeartbeat - Returns the last node backed up
* - MegaApi::getChatLinkURL - Returns the public handle
* - MegaApi::sendChatLogs - Returns the user handle
* - MegaApi::fetchAds - Returns public handle that the user is visiting (optionally)
* - MegaApi::queryAds - Returns public handle that the user is visiting (optionally)
*
* This value is valid for these requests in onRequestFinish when the
* error code is MegaError::API_OK:
* - MegaApi::createFolder - Returns the handle of the new folder
* - MegaApi::copyNode - Returns the handle of the new node
* - MegaApi::importFileLink - Returns the handle of the new node
* - MegaApi::getPasswordManagerBase - Returns the handle of the base folder node
*
* @return Handle of a node related to the request
*/
virtual MegaHandle getNodeHandle() const;
/**
* @brief Returns a link related to the request
*
* This value is valid for these requests:
* - MegaApi::querySignupLink - Returns the confirmation link
* - MegaApi::confirmAccount - Returns the confirmation link
* - MegaApi::loginToFolder - Returns the link to the folder
* - MegaApi::importFileLink - Returns the link to the file to import
* - MegaApi::getPublicNode - Returns the link to the file
* - MegaApi::copySyncDataToCache - Returns the path of the remote folder
*
* This value is valid for these requests in onRequestFinish when the
* error code is MegaError::API_OK:
* - MegaApi::exportNode - Returns the public link
* - MegaApi::getPaymentId - Returns the payment identifier
* - MegaApi::getUrlChat - Returns the user-specific URL for the chat
* - MegaApi::getChatPresenceURL - Returns the user-specific URL for the chat presence server
* - MegaApi::getUploadURL - Returns the upload IPv4
* - MegaApi::getThumbnailUploadURL - Returns the upload IPv4
* - MegaApi::getPreviewUploadURL - Returns the upload IPv4
* - MegaApi::getDownloadUrl - Returns semicolon-separated IPv4 of the server in the URL(s)
* - MegaApi::exportSet - Returns the public link
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaRequest object is deleted.
*
* @return Link related to the request
*/
virtual const char* getLink() const;
/**
* @brief Returns the handle of a parent node related to the request
*
* This value is valid for these requests:
* - MegaApi::createFolder - Returns the handle of the parent folder
* - MegaApi::moveNode - Returns the handle of the new parent for the node
* - MegaApi::copyNode - Returns the handle of the parent for the new node
* - MegaApi::importFileLink - Returns the handle of the node that receives the imported
* file
* - MegaApi::inviteToChat - Returns the handle of the user to be invited
* - MegaApi::removeFromChat - Returns the handle of the user to be removed
* - MegaApi::grantAccessInchat - Returns the chat identifier
* - MegaApi::removeAccessInchat - Returns the chat identifier
* - MegaApi::removeBackup - Returns the backupId
* - MegaApi::updateBackup - Returns the backupId
* - MegaApi::sendBackupHeartbeat - Returns the backupId
* - MegaApi::syncFolder - Returns the backupId asociated with the sync
* - MegaApi::copySyncDataToCache - Returns the backupId asociated with the sync
* - MegaApi::getChatLinkURL - Returns the chatid
* - MegaApi::sendChatLogs - Returns the callid (if exits)
* - MegaApi::createPasswordNode - Returns parent folder for the new Password Node
* - MegaApi::importPasswordsFromFile - Returns parent folder for the imported Password Node
*
* This value is valid for these requests in onRequestFinish when the
* error code is MegaError::API_OK:
* - MegaApi::syncFolder - Returns a fingerprint of the local folder
*
* @return Handle of a parent node related to the request
*/
virtual MegaHandle getParentHandle() const;
/**
* @brief Returns a session key related to the request
*
* This value is valid for these requests:
* - MegaApi::fastLogin - Returns session key used to access the account
* - MegaApi::sendEvent - Returns the ViewID key used to track the view
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaRequest object is deleted.
*
* @return Session key related to the request
*/
virtual const char* getSessionKey() const;
/**
* @brief Returns a name related to the request
*
* This value is valid for these requests:
* - MegaApi::createAccount - Returns the name or the firstname of the user
* - MegaApi::createFolder - Returns the name of the new folder
* - MegaApi::renameNode - Returns the new name for the node
* - MegaApi::syncFolder - Returns the name for the sync
* - MegaApi::copySyncDataToCache - Returns the name for the sync
* - MegaApi::setScheduledCopy - Returns the device id hash of the backup source device
* - MegaApi::updateBackup - Returns the device id hash of the backup source device
* - MegaApi::getUploadURL - Returns the upload URL
* - MegaApi::getThumbnailUploadURL - Returns the upload URL
* - MegaApi::getPreviewUploadURL - Returns the upload URL
*
* This value is valid for these request in onRequestFinish when the
* error code is MegaError::API_OK:
* - MegaApi::querySignupLink - Returns the name of the user
* - MegaApi::confirmAccount - Returns the name of the user
* - MegaApi::getUserData - Returns the name of the user
* - MegaApi::getDownloadUrl - Returns semicolon-separated download URL(s) to the file
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaRequest object is deleted.
*
* @return Name related to the request
*/
virtual const char* getName() const;
/**
* @brief Returns an email related to the request
*
* This value is valid for these requests:
* - MegaApi::login - Returns the email of the account
* - MegaApi::fastLogin - Returns the email of the account
* - MegaApi::loginToFolder - Returns the string "FOLDER"
* - MegaApi::createAccount - Returns the email for the account
* - MegaApi::sendFileToUser - Returns the email of the user that receives the node
* - MegaApi::share - Returns the email that receives the shared folder
* - MegaApi::getUserAvatar - Returns the email of the user to get the avatar
* - MegaApi::removeContact - Returns the email of the contact
* - MegaApi::getUserData - Returns the email of the contact
* - MegaApi::inviteContact - Returns the email of the contact
* - MegaApi::grantAccessInChat -Returns the MegaHandle of the user in Base64 enconding
* - MegaApi::removeAccessInChat -Returns the MegaHandle of the user in Base64 enconding
*
* This value is valid for these request in onRequestFinish when the
* error code is MegaError::API_OK:
* - MegaApi::querySignupLink - Returns the email of the account
* - MegaApi::confirmAccount - Returns the email of the account
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaRequest object is deleted.
*
* @return Email related to the request
*/
virtual const char* getEmail() const;
/**
* @brief Returns a password related to the request
*
* This value is valid for these requests:
* - MegaApi::login - Returns the password of the account
* - MegaApi::loginToFolder - Returns the authentication key to write in public folder
* - MegaApi::changePassword - Returns the old password of the account (first parameter)
*
* This value is valid for these request in onRequestFinish when the
* error code is MegaError::API_OK:
* - MegaApi::getUserData - Returns the public RSA key of the contact, Base64-encoded
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaRequest object is deleted.
*
* @return Password related to the request
*/
virtual const char* getPassword() const;
/**
* @brief Returns a new password related to the request
*
* This value is valid for these requests:
* - MegaApi::changePassword - Returns the new password for the account
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaRequest object is deleted.
*
* @return New password related to the request
*/
virtual const char* getNewPassword() const;
/**
* @brief Returns a private key related to the request
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaRequest object is deleted.
*
* This value is valid for these request in onRequestFinish when the
* error code is MegaError::API_OK:
* - MegaApi::getUserData - Returns the private RSA key of the account, Base64-encoded
* @return Private key related to the request
*/
virtual const char* getPrivateKey() const;
/**
* @brief Returns an access level related to the request
*
* This value is valid for these requests:
* - MegaApi::share - Returns the access level for the shared folder
* - MegaApi::exportNode - Returns true
* - MegaApi::disableExport - Returns false
* - MegaApi::inviteToChat - Returns the privilege level wanted for the user
* - MegaApi::setScheduledCopy - Returns the backup state
* - MegaApi::updateBackup - Returns the backup state
* - MegaApi::sendBackupHeartbeat - Returns the backup state
*
* @return Access level related to the request
*/
virtual int getAccess() const;
/**
* @brief Returns the path of a file related to the request
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaRequest object is deleted.
*
* This value is valid for these requests:
* - MegaApi::getThumbnail - Returns the destination path for the thumbnail
* - MegaApi::getPreview - Returns the destination path for the preview
* - MegaApi::getUserAvatar - Returns the destination path for the avatar
* - MegaApi::setThumbnail - Returns the source path for the thumbnail
* - MegaApi::setPreview - Returns the source path for the preview
* - MegaApi::setAvatar - Returns the source path for the avatar
* - MegaApi::syncFolder - Returns the path of the local folder
* - MegaApi::setScheduledCopy - Returns the path of the local folder
* - MegaApi::updateBackup - Returns the path of the local folder
*
* @return Path of a file related to the request
*/
virtual const char* getFile() const;
/**
* @brief Return the number of times that a request has temporarily failed
* @return Number of times that a request has temporarily failed
* This value is valid for these requests:
* - MegaApi::setScheduledCopy - Returns the maximun number of backups to keep
*/
virtual int getNumRetry() const;
/**
* @brief Returns a public node related to the request
*
* This value is valid for these requests:
* - MegaApi::copyNode - Returns the node to copy (if it is a public node)
* - MegaApi::getPreviewElementNode
*
* This value is valid for these request in onRequestFinish when the
* error code is MegaError::API_OK:
* - MegaApi::getPublicNode - Returns the public node
*
* You take ownership of the returned value.
*
* @return Public node related to the request
*/
virtual MegaNode *getPublicMegaNode() const;
/**
* @brief Returns the type of parameter related to the request
*
* This value is valid for these requests:
* - MegaApi::getThumbnail - Returns MegaApi::ATTR_TYPE_THUMBNAIL
* - MegaApi::getPreview - Returns MegaApi::ATTR_TYPE_PREVIEW
* - MegaApi::cancelGetThumbnail - Returns MegaApi::ATTR_TYPE_THUMBNAIL
* - MegaApi::cancelGetPreview - Returns MegaApi::ATTR_TYPE_PREVIEW
* - MegaApi::setThumbnail - Returns MegaApi::ATTR_TYPE_THUMBNAIL
* - MegaApi::setPreview - Returns MegaApi::ATTR_TYPE_PREVIEW
* - MegaApi::reportDebugEvent - Returns MegaApi::EVENT_DEBUG
* - MegaApi::cancelTransfers - Returns MegaTransfer::TYPE_DOWNLOAD if downloads are
* cancelled or MegaTransfer::TYPE_UPLOAD if uploads are cancelled
* - MegaApi::setUserAttribute - Returns the attribute type
* - MegaApi::getUserAttribute - Returns the attribute type
* - MegaApi::setMaxConnections - Returns the direction of transfers
* - MegaApi::dismissBanner - Returns the id of the banner
* - MegaApi::sendBackupHeartbeat - Returns the number of backup files uploaded
* - MegaApi::getRecentActions - Returns the maximum number of nodes
* - MegaApi::getRecentActionsAsync - Returns the maximum number of nodes
* - MegaApi::importPasswordsFromFile - Returns source of the file provided as an argument
*
* @return Type of parameter related to the request
*/
virtual int getParamType() const;
/**
* @brief Returns a text relative to this request
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaRequest object is deleted.
*
* This value is valid for these requests:
* - MegaApi::submitFeedback - Returns the comment about the app
* - MegaApi::reportDebugEvent - Returns the debug message
* - MegaApi::setUserAttribute - Returns the new value for the attribute
* - MegaApi::inviteContact - Returns the message appended to the contact invitation
* - MegaApi::sendEvent - Returns the event message
* - MegaApi::createAccount - Returns the lastname for the new account
* - MegaApi::setScheduledCopy - Returns the cron like time string to define period
* - MegaApi::getUploadURL - Returns the upload IPv6
* - MegaApi::getThumbnailUploadURL - Returns the upload IPv6
* - MegaApi::getPreviewUploadURL - Returns the upload IPv6
* - MegaApi::getDownloadUrl - Returns semicolon-separated IPv6 of the server in the URL(s)
* - MegaApi::startChatCall - Returns the url sfu
* - MegaApi::joinChatCall - Returns the url sfu
*
* This value is valid for these request in onRequestFinish when the
* error code is MegaError::API_OK:
* - MegaApi::getUserAttribute - Returns the value of the attribute
*
* @return Text relative to this request
*/
virtual const char *getText() const;
/**
* @brief Returns a number related to this request
*
* This value is valid for these requests:
* - MegaApi::retryPendingConnections - Returns if transfers are retried
* - MegaApi::submitFeedback - Returns the rating for the app
* - MegaApi::pauseTransfers - Returns the direction of the transfers to pause/resume
* - MegaApi::upgradeAccount - Returns the payment method
* - MegaApi::replyContactRequest - Returns the action to do with the contact request
* - MegaApi::inviteContact - Returns the action to do with the contact request
* - MegaApi::sendEvent - Returns the event type
* - MegaApi::moveTransferUp - Returns MegaTransfer::MOVE_TYPE_UP
* - MegaApi::moveTransferUpByTag - Returns MegaTransfer::MOVE_TYPE_UP
* - MegaApi::moveTransferDown - Returns MegaTransfer::MOVE_TYPE_DOWN
* - MegaApi::moveTransferDownByTag - Returns MegaTransfer::MOVE_TYPE_DOWN
* - MegaApi::moveTransferToFirst - Returns MegaTransfer::MOVE_TYPE_TOP
* - MegaApi::moveTransferToFirstByTag - Returns MegaTransfer::MOVE_TYPE_TOP
* - MegaApi::moveTransferToLast - Returns MegaTransfer::MOVE_TYPE_BOTTOM
* - MegaApi::moveTransferToLastByTag - Returns MegaTransfer::MOVE_TYPE_BOTTOM
* - MegaApi::moveTransferBefore - Returns the tag of the transfer with the target position
* - MegaApi::moveTransferBeforeByTag - Returns the tag of the transfer with the target
* position
* - MegaApi::setScheduledCopy - Returns the period between backups in deciseconds (-1 if
* cron time used)
* - MegaApi::abortCurrentScheduledCopy - Returns the tag of the aborted backup
* - MegaApi::removeScheduledCopy - Returns the tag of the deleted backup
* - MegaApi::startTimer - Returns the selected period
* - MegaApi::sendChatStats - Returns the connection port
* - MegaApi::dismissBanner - Returns the timestamp of the request
* - MegaApi::sendBackupHeartbeat - Returns the time associated with the request
* - MegaApi::createPublicChat - Returns if chat room is a meeting room
* - MegaApi::fetchAds - Returns a bitmap flag used to communicate with the API
* - MegaApi::queryAds - Returns a bitmap flag used to communicate with the API
* - MegaApi::clearRecentActionHistory - Returns the epoch time in seconds to set as the
* recent action history clear timestamp
*
* This value is valid for these request in onRequestFinish when the
* error code is MegaError::API_OK:
* - MegaApi::creditCardQuerySubscriptions - Returns the number of credit card subscriptions
* - MegaApi::getPaymentMethods - Returns a bitfield with the available payment methods
* - MegaApi::getCloudStorageUsed - Returns the sum of the sizes of file cloud nodes.
* - MegaApi::getRecentActions - Returns the number of days since nodes will be considerated
* - MegaApi::getRecentActionsAsync - Returns the number of days since nodes will be
* considered
*
* @return Number related to this request
*/
virtual long long getNumber() const;
/**
* @brief Returns a flag related to the request
*
* This value is valid for these requests:
* - MegaApi::retryPendingConnections - Returns if request are disconnected
* - MegaApi::pauseTransfers - Returns true if transfers were paused, false if they were
* resumed
* - MegaApi::createChat - Creates a chat for one or more participants
* - MegaApi::exportNode - Makes the folder writable
* - MegaApi::fetchnodes - Return true if logged in into a folder and the provided key is
* invalid.
* - MegaApi::getPublicNode - Return true if the provided key along the link is invalid.
* - MegaApi::pauseTransfer - Returns true if the transfer has to be pause or false if it
* has to be resumed
* - MegaApi::pauseTransferByTag - Returns true if the transfer has to be pause or false if
* it has to be resumed
* - MegaApi::moveTransferUp - Returns true (it means that it's an automatic move)
* - MegaApi::moveTransferUpByTag - Returns true (it means that it's an automatic move)
* - MegaApi::moveTransferDown - Returns true (it means that it's an automatic move)
* - MegaApi::moveTransferDownByTag - Returns true (it means that it's an automatic move)
* - MegaApi::moveTransferToFirst - Returns true (it means that it's an automatic move)
* - MegaApi::moveTransferToFirstByTag - Returns true (it means that it's an automatic move)
* - MegaApi::moveTransferToLast - Returns true (it means that it's an automatic move)
* - MegaApi::moveTransferToLastByTag - Returns true (it means that it's an automatic move)
* - MegaApi::moveTransferBefore - Returns false (it means that it's a manual move)
* - MegaApi::moveTransferBeforeByTag - Returns false (it means that it's a manual move)
* - MegaApi::setBackup - Returns if backups that should have happen in the past should be
* taken care of
* - MegaApi::getChatLinkURL - Returns a vector with one element (callid), if call doesn't
* exit it will be NULL
* - MegaApi::setScheduledCopy - Returns if backups that should have happen in the past
* should be taken care of
* - MegaApi::sendEvent - Returns true if the JourneyID should be tracked
* - MegaApi::getVisibleWelcomeDialog - Returns true if the Welcome dialog is visible
* - MegaApi::getVisibleTermsOfService - Returns true if the Terms of Service need to be
* displayed
* - MegaApi::getRecentActionsAsync - Returns true if exclude sensitives
*
* This value is valid for these request in onRequestFinish when the
* error code is MegaError::API_OK:
* - MegaApi::queryTransferQuota - True if it is expected to get an overquota error,
* otherwise false
*
* @return Flag related to the request
*/
virtual bool getFlag() const;
/**
* @brief Returns the number of transferred bytes during the request
* @return Number of transferred bytes during the request
*/
virtual long long getTransferredBytes() const;
/**
* @brief Returns the number of bytes that the SDK will have to transfer to finish the request
*
* In addition, this value is also valid for these requests:
* - MegaApi::setScheduledCopy - Returns the backup type
* - MegaApi::updateBackup - Returns the backup type
*
* @return Number of bytes that the SDK will have to transfer to finish the request
*/
virtual long long getTotalBytes() const;
/**
* @brief Return the MegaRequestListener associated with this request
*
* This function will return NULL if there isn't an associated request listener.
*
* @return MegaRequestListener associated with this request
*/
virtual MegaRequestListener *getListener() const;
/**
* @brief Returns details related to the MEGA account
*
* This value is valid for these request in onRequestFinish when the
* error code is MegaError::API_OK:
* - MegaApi::getAccountDetails - Details of the MEGA account
*
* You take the ownership of the returned value.
*
* @return Details related to the MEGA account
*/
virtual MegaAccountDetails *getMegaAccountDetails() const;
/**
* @brief Returns available pricing plans to upgrade a MEGA account
*
* This value is valid for these request in onRequestFinish when the
* error code is MegaError::API_OK:
* - MegaApi::getPricing - Returns the available pricing plans
*
* You take the ownership of the returned value.
*
* @return Available pricing plans to upgrade a MEGA account
*/
virtual MegaPricing *getPricing() const;
/**
* @brief Returns currency data related to prices
*
* This value is valid for these request in onRequestFinish when the
* error code is MegaError::API_OK:
* - MegaApi::getPricing - Returns available pricing plans to upgrade a MEGA account
*
* You take the ownership of the returned value.
*
* @return Currency data related to prices
*/
virtual MegaCurrency *getCurrency() const;
/**
* @brief Returns details related to the MEGA Achievements of this account
*
* This value is valid for these request in onRequestFinish when the
* error code is MegaError::API_OK:
* - MegaApi::getMegaAchievements - Details of the MEGA Achievements of this account
*
* You take the ownership of the returned value.
*
* @return Details related to the MEGA Achievements of this account
*/
virtual MegaAchievementsDetails *getMegaAchievementsDetails() const;
/**
* @brief Get details about timezones and the current default
*
* This value is valid for these request in onRequestFinish when the
* error code is MegaError::API_OK:
* - MegaApi::fetchTimeZone - Details about timezones and the current default
*
* In any other case, this function returns NULL.
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaRequest object is deleted.
*
* @return Details about timezones and the current default
*/
virtual MegaTimeZoneDetails *getMegaTimeZoneDetails() const;
/**
* @brief Returns the tag of a transfer related to the request
*
* This value is valid for these requests:
* - MegaApi::cancelTransfer - Returns the tag of the cancelled transfer (MegaTransfer::getTag)
* - MegaApi::pauseTransfer - Returns the tag of the request to pause or resume
* - MegaApi::pauseTransferByTag - Returns the tag of the request to pause or resume
* - MegaApi::moveTransferUp - Returns the tag of the transfer to move
* - MegaApi::moveTransferUpByTag - Returns the tag of the transfer to move
* - MegaApi::moveTransferDown - Returns the tag of the transfer to move
* - MegaApi::moveTransferDownByTag - Returns the tag of the transfer to move
* - MegaApi::moveTransferToFirst - Returns the tag of the transfer to move
* - MegaApi::moveTransferToFirstByTag - Returns the tag of the transfer to move
* - MegaApi::moveTransferToLast - Returns the tag of the transfer to move
* - MegaApi::moveTransferToLastByTag - Returns the tag of the transfer to move
* - MegaApi::moveTransferBefore - Returns the tag of the transfer to move
* - MegaApi::moveTransferBeforeByTag - Returns the tag of the transfer to move
* - MegaApi::setScheduledCopy - Returns the tag asociated with the backup
* - MegaApi::sendBackupHeartbeat - Returns the number of backup files downloaded
*
* @return Tag of a transfer related to the request
*/
virtual int getTransferTag() const;
/**
* @brief Returns the number of details related to this request
*
* This value is valid for these requests:
* - MegaApi::getAccountDetails
* - MegaApi::getSpecificAccountDetails
* - MegaApi::getExtendedAccountDetails
* - MegaApi::disableSync
* - MegaApi::removeSync
* - MegaApi::enableSync
* - MegaApi::syncFolder
* - MegaApi::setScheduledCopy
* - MegaApi::updateBackup
* - MegaApi::sendBackupHeartbeat
*
* @return Number of details related to this request
*/
virtual int getNumDetails() const;
/**
* @brief Returns the tag that identifies this request
*
* The tag is unique for the MegaApi object that has generated it only
*
* @return Unique tag that identifies this request
*/
virtual int getTag() const;
#ifdef ENABLE_CHAT
/**
* @brief Returns the list of peers in a chat.
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaRequest object is deleted.
*
* This value is valid for these requests:
* - MegaApi::createChat - Returns the list of peers and their privilege level
*
* @return List of peers of a chat. Can be \c nullptr
*/
virtual MegaTextChatPeerList *getMegaTextChatPeerList() const;
/**
* @brief Returns the list of chats.
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaRequest object is deleted.
*
* This value is valid for these requests in onRequestFinish when the
* error code is MegaError::API_OK:
* - MegaApi::createChat - Returns the new chat's information
*
* @return List of chats
*/
virtual MegaTextChatList *getMegaTextChatList() const;
#endif
/**
* @brief Returns the string map
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaRequest object is deleted.
*
* This value is valid for these requests in onRequestFinish when the
* error code is MegaError::API_OK:
* - MegaApi::getUserAttribute - Returns the attribute value
* - MegaApi::fetchAds - Returns ads
*
* @return String map including the key-value pairs of the attribute
*/
virtual MegaStringMap* getMegaStringMap() const;
/**
* @brief Returns the string list map
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaRequest object is deleted.
*
* @return String list map
*/
virtual MegaStringListMap* getMegaStringListMap() const;
/**
* @brief Returns the string table
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaRequest object is deleted.
*
* @return String table
*/
virtual MegaStringTable* getMegaStringTable() const;
/**
* @brief Returns information about the contents of a folder
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaRequest object is deleted.
*
* This value is valid for these requests in onRequestFinish when the
* error code is MegaError::API_OK:
* - MegaApi::getFolderInfo - Returns the information related to the folder
*
* @return Object with information about the contents of a folder
*/
virtual MegaFolderInfo *getMegaFolderInfo() const;
/**
* @brief Returns settings for push notifications
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaRequest object is deleted.
*
* This value is valid for these requests in onRequestFinish when the
* error code is MegaError::API_OK:
* - MegaApi::getPushNotificationSettings - Returns settings for push notifications
*
* @return Object with settings for push notifications
*/
virtual const MegaPushNotificationSettings *getMegaPushNotificationSettings() const;
/**
* @brief Returns information about background uploads (used in iOS)
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaRequest object is deleted.
*
* This value is valid for requests relating to background uploads. The returned
* pointer is to the relevant background upload object.
*
* @return Object with information about the contents of a folder
*/
virtual MegaBackgroundMediaUpload* getMegaBackgroundMediaUploadPtr() const;
/**
* @brief Returns the list of all Smart Banners available for current user
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaRequest object is deleted.
*
* This value is valid for these requests in onRequestFinish when the
* error code is MegaError::API_OK:
* - MegaApi::getBanners - Requests all Smart Banners available for current user
*
* @return List of all Smart Banners available for current user
*/
virtual MegaBannerList* getMegaBannerList() const;
/**
* @brief Returns the string list
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaRequest object is deleted.
*
* This value is valid for these requests:
* - MegaApi::fetchAds - A list of the adslot ids to fetch
*
* @return String list
*/
virtual MegaStringList* getMegaStringList() const;
/**
* @brief Returns a map with string as key and integer as value
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaRequest object is deleted.
*
* This value is valid for these requests:
* - MegaApi::importPasswordsFromFile - A map with problematic content as key and error code
* as value
*
* @return Map with string as key and integer as value
*/
virtual MegaStringIntegerMap* getMegaStringIntegerMap() const;
#ifdef ENABLE_CHAT
/**
* @brief Returns the scheduled meeting list
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaRequest object is deleted.
*
* @return scheduled meeting list
*/
virtual MegaScheduledMeetingList* getMegaScheduledMeetingList() const;
#endif
/**
* @brief Returns the MegaHandle list
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaRequest object is deleted.
*
* This value is valid for these requests:
* - MegaApi::getFavourites - A list of MegaHandle objects
* - MegaApi::getChatLinkURL - Returns a vector with the callid (if call exits in other case it will be NULL)
*
* @return MegaHandle list
*/
virtual MegaHandleList* getMegaHandleList() const;
/**
* @brief Returns the recent actions bucket list
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaRequest object is deleted.
*
* This value is valid for these requests:
* - MegaApi::getRecentActionsAsync
*
* @return MegaRecentActionBucketList list
*/
virtual MegaRecentActionBucketList *getRecentActions() const;
/**
* @brief Returns a list of integers associated with this request
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaRequest object is deleted.
*
* This value is valid for these requests:
* - MegaApi::createSetElements -> error codes for all requested Elements
*
* @return list of integers associated with this request (can be null)
*/
virtual const MegaIntegerList* getMegaIntegerList() const;
/**
* @brief Returns a MegaSet explicitly fetched from online API (typically using 'aft' command)
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaRequest object is deleted.
* This value is valid for these requests:
* - MegaApi::fetchSet
*
* @return requested MegaSet or null if not found
*/
virtual MegaSet* getMegaSet() const;
/**
* @brief Returns the list of elements, part of the MegaSet explicitly fetched from online API (typically using 'aft' command)
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaRequest object is deleted.
*
* This value is valid for these requests:
* - MegaApi::fetchSet
*
* @return list of elements in the requested MegaSet, or null if Set not found
*/
virtual MegaSetElementList* getMegaSetElementList() const;
/**
* @brief Returns the list of all backups
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaRequest object is deleted.
*
* This value is valid for these requests:
* - MegaApi::getBackupInfo
*
* @return list of all backups
*/
virtual MegaBackupInfoList* getMegaBackupInfoList() const;
#ifdef ENABLE_SYNC
/**
* @brief
* Returns a reference to this request's MegaSyncStallList instance.
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaRequest object is deleted.
*
* This value is valid only for the following requests:
* - MegaApi::getMegaSyncStallList
*
* @return
* A reference to this request's MegaSyncStallList instance.
*/
virtual MegaSyncStallList* getMegaSyncStallList() const;
/**
* @brief
* Returns a reference to this request's MegaSyncStallMap instance.
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaRequest object is deleted.
*
* This value is valid only for the following requests:
* - MegaApi::getMegaSyncStallMap
*
* @return
* A reference to this request's getMegaSyncStallMap instance.
*/
virtual MegaSyncStallMap* getMegaSyncStallMap() const;
#endif // ENABLE_SYNC
/**
* @brief Provide all available VPN Regions, including their details.
*
* The data included for each Region is the following:
* - Name (example: hMLKTUojS6o, 1MvzBCx1Uf4)
* - Country Code (example: ES, LU)
* - Country Name (example: Spain, Luxembourg)
* - Region Name (optional) (example: Esch-sur-Alzette)
* - Town Name (Optional) (example: Bettembourg)
* - Map of {ClusterID, Cluster}.
* - For each Cluster:
* · Host.
* · DNS IP list (as a MegaStringList).
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaRequest object is deleted.
*
* @return not-null instance with available VPN Regions, if the relevant request was sent;
* nullptr otherwise.
*/
virtual MegaVpnRegionList* getMegaVpnRegionsDetailed() const;
/**
* @brief Returns the VPN credentials registered by the user.
*
* Important consideration (as indicated on MegaApi::getVpnCredentials):
* These credentials do NOT contain the User Private Key.
* The credentials that include the User Private Key are generated by
* MegaApi::putVpnCredential and cannot be retrieved afterwards.
*
* The data stored in MegaVpnCredentials is the following:
* - List of occupied SlotIDs.
* - For each SlotID:
* · ClusterID.
* · IPv4.
* · IPv6.
* . DeviceID. This value can be empty if there is no associated device ID.
* The current device ID can be retrieved via MegaApi::getDeviceId
* - For each ClusterID:
* · Cluster Public Key.
* - List of VPN regions (as a MegaStringList).
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaRequest object is deleted.
*
* @return MegaVpnCredentials* if there are any VPN credentials for the user, nullptr otherwise.
*/
virtual MegaVpnCredentials* getMegaVpnCredentials() const;
/**
* @brief Returns the results of a network connectivity test.
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaRequest object is deleted.
*
* @return Valid pointer if this request was used for running a nework connectivity test,
* nullptr otherwise.
*/
virtual MegaNetworkConnectivityTestResults* getMegaNetworkConnectivityTestResults() const;
/**
* @brief Get list of available notifications for Notification Center
*
* This value is valid only for the following requests:
* - MegaApi::getNotifications
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaRequest object is deleted.
*
* @return non-null pointer if a valid MegaApi functionality has been called, nullptr otherwise.
*/
virtual const MegaNotificationList* getMegaNotifications() const;
/**
* @brief Get node tree after its creation
*
* This value is valid only for the following requests:
* - MegaApi::createNodeTree
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaRequest object is deleted.
*
* @return non-null pointer if a valid MegaApi functionality has been called, null otherwise.
*/
virtual const MegaNodeTree* getMegaNodeTree() const;
virtual const MegaCancelSubscriptionReasonList* getMegaCancelSubscriptionReasons() const;
/**
* @brief Get list of discount codes available for current user
*
* This value is valid only for the following requests:
* - MegaApi::getDiscountCodes
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaRequest object is deleted.
*
* @return non-null pointer if a valid MegaApi functionality has been called, null
* otherwise.
*/
virtual MegaDiscountCodeList* getMegaDiscountCodeList() const;
/**
* @brief Get information about a discount code
*
* This value is valid only for the following requests:
* - MegaApi::getDiscountCodeInformation
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaRequest object is deleted.
*
* @return non-null pointer if a valid MegaApi functionality has been called, null
* otherwise.
*/
virtual const MegaDiscountCodeInfo* getMegaDiscountCodeInfo() const;
};
/**
* @brief Provides information about an event
*
* Objects of this class aren't live, they are snapshots of the state of the event
* when the object is created, they are immutable.
*/
class MegaEvent
{
public:
enum {
EVENT_COMMIT_DB = 0,
EVENT_ACCOUNT_CONFIRMATION = 1,
EVENT_CHANGE_TO_HTTPS = 2,
EVENT_DISCONNECT = 3,
EVENT_ACCOUNT_BLOCKED = 4,
EVENT_STORAGE = 5,
EVENT_NODES_CURRENT = 6,
EVENT_MEDIA_INFO_READY = 7,
EVENT_STORAGE_SUM_CHANGED = 8,
EVENT_BUSINESS_STATUS = 9,
EVENT_KEY_MODIFIED = 10,
EVENT_MISC_FLAGS_READY = 11,
#ifdef ENABLE_SYNC
// EVENT_FIRST_SYNC_RESUMING = 12, // (obsolete)
EVENT_SYNCS_DISABLED = 13,
EVENT_SYNCS_RESTORED = 14,
#endif
EVENT_REQSTAT_PROGRESS = 15,
EVENT_RELOADING = 16,
EVENT_FATAL_ERROR = 17,
EVENT_UPGRADE_SECURITY = 18,
EVENT_DOWNGRADE_ATTACK = 19,
EVENT_CONFIRM_USER_EMAIL = 20,
EVENT_CREDIT_CARD_EXPIRY = 21,
EVENT_NETWORK_ACTIVITY = 22,
};
enum
{
REASON_ERROR_UNKNOWN = -1, // Unknown reason
REASON_ERROR_NO_ERROR = 0, // No error
REASON_ERROR_FAILURE_UNSERIALIZE_NODE = 1, // Failure when node is unserialized from DB
REASON_ERROR_DB_IO_FAILURE = 2, // Input/output error at DB layer
REASON_ERROR_DB_FULL = 3, // Failure at DB layer because disk is full
REASON_ERROR_DB_INDEX_OVERFLOW = 4, // Index used to primary key at db overflow
REASON_ERROR_NO_JSCD = 5, // No JSON Sync Config Data
REASON_ERROR_REGENERATE_JSCD = 6, // JSON Sync Config Data has been regenerated
REASON_ERROR_DB_CORRUPT = 7, // DB file is corrupted
};
/**
* @brief Direction of a network activity for EVENT_NETWORK_ACTIVITY.
*
* Maps 1:1 with the internal enum of the same name in types.h
*/
enum NetworkActivityChannel
{
SC = 0, // Server to client channel
CS = 1, // Client to server channel
};
/**
* @brief Type of network activity for EVENT_NETWORK_ACTIVITY.
*
* Maps 1:1 with the internal enum of the same name in types.h
*/
enum NetworkActivityType
{
REQUEST_SENT = 0,
REQUEST_RECEIVED = 1,
REQUEST_ERROR = 2,
};
virtual ~MegaEvent();
/**
* @brief Creates a copy of this MegaEvent object
*
* The resulting object is fully independent of the source MegaEvent,
* it contains a copy of all internal attributes, so it will be valid after
* the original object is deleted.
*
* You are the owner of the returned object
*
* @return Copy of the MegaEvent object
*/
virtual MegaEvent *copy();
/**
* @brief Returns the type of event
*
* This method identifies the nature of the event being notified. Based on the event type,
* other methods like getText(), getNumber(), or getHandle() may return meaningful values.
*
* To understand what data each method provides for a specific event type,
* refer to the documentation of MegaEvent::getText(), MegaEvent::getNumber(),
* MegaEvent::getHandle() and MegaEvent::getNumber(const std::string& key).
*
* Possible values:
*
* - EVENT_COMMIT_DB (0):
* SDK has committed the ongoing DB transaction. Use getText() for the sequence number.
*
* - EVENT_ACCOUNT_CONFIRMATION (1):
* A new account was confirmed. Use getText() for the email address.
*
* - EVENT_CHANGE_TO_HTTPS (2):
* SDK switched to HTTPS due to HTTP connection issues or tampering.
*
* - EVENT_DISCONNECT (3):
* SDK disconnected due to network change or invalid IPs. App should reset its connections.
*
* - EVENT_ACCOUNT_BLOCKED (4):
* Account has been blocked. Use getText() for a user message and getNumber() for a reason
* code.
*
* - EVENT_STORAGE (5):
* Storage state has changed. Use getNumber() for the new storage state.
*
* - EVENT_NODES_CURRENT (6):
* All external changes to nodes have been received.
*
* - EVENT_MEDIA_INFO_READY (7):
* Codec-mapping information has been received and is ready.
*
* - EVENT_STORAGE_SUM_CHANGED (8):
* Total storage usage has changed. Use getNumber() for the updated storage sum.
*
* - EVENT_BUSINESS_STATUS (9):
* Business account status changed. Use getNumber() for the new status code.
*
* - EVENT_KEY_MODIFIED (10):
* A user's key has changed. Use getHandle() for the user and getNumber() for the key type.
*
* - EVENT_MISC_FLAGS_READY (11):
* Miscellaneous flags are now available or have been updated.
*
* - EVENT_FIRST_SYNC_RESUMING(12):
* This event is obsolete.
*
* - MegaEvent::EVENT_SYNCS_DISABLED (13):
* Syncs were bulk-disabled due to a situation like storage overquota. Use getNumber() to
* retrieve the sync error code.
*
* - MegaEvent::EVENT_SYNCS_RESTORED (14):
* Syncs have been restored after login and fetchnodes. Use getNumber() to retrieve the sync
* error code.
*
* - EVENT_REQSTAT_PROGRESS (15):
* Ongoing API request progress. Use getNumber() for progress (in per mil), or -1 if none.
*
* - EVENT_RELOADING (16):
* Server forced a full reload. App should reinitialize data and UI accordingly.
*
* - EVENT_FATAL_ERROR (17):
* A fatal error was encountered. Use getNumber() to retrieve the error code.
*
* - EVENT_UPGRADE_SECURITY (18):
* Account was upgraded to use key attributes for improved security.
*
* - EVENT_DOWNGRADE_ATTACK (19):
* Downgrade attack was detected. Removed shares might have reappeared.
*
* - EVENT_CONFIRM_USER_EMAIL (20):
* User confirmed their email. Use getHandle() for user and getText() for email address.
*
* - EVENT_CREDIT_CARD_EXPIRY (21):
* Credit card is expiring soon or a new one was added.
* App should call `MegaApi::fetchCreditCardInfo()` to get updated details.
*
* - EVENT_NETWORK_ACTIVITY (22):
* Network activity occurred on the SC or CS channel.
* Use `getNumber("channel")`, `getNumber("activity_type")`, and `getNumber("error_code")`
* to get more detail about the event.
*
*
* @return Event type, from the MegaEvent::EventType enum.
*/
virtual int getType() const;
/**
* @brief Returns a text string relative to this event
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaEvent object is deleted.
*
* The meaning of the returned text depends on the event type (see MegaEvent::getType()).
*
* - EVENT_COMMIT_DB:
* Returns the sequence number recorded by the SDK when the event happened.
*
* - EVENT_ACCOUNT_CONFIRMATION:
* Returns the email address used to confirm the account.
*
* - EVENT_CONFIRM_USER_EMAIL:
* Returns the email address used to confirm the account.
*
* - EVENT_ACCOUNT_BLOCKED:
* Returns the message to show to the user explaining the reason for the block.
*
* @return Text relative to this event.
*/
virtual const char* getText() const;
/**
* @brief Returns a number relative to this event
*
* The meaning of the returned number depends on the event type (see MegaEvent::getType()).
*
* - EVENT_STORAGE:
* Provides the current storage state of the account:
* - MegaApi::STORAGE_STATE_GREEN = 0: No storage problems.
* - MegaApi::STORAGE_STATE_ORANGE = 1: Account is almost full.
* - MegaApi::STORAGE_STATE_RED = 2: Account is full; uploads are stopped.
* - MegaApi::STORAGE_STATE_CHANGE = 3: Deprecated; current state is notified directly.
* - MegaApi::STORAGE_STATE_PAYWALL = 4: Account full for a long time; most actions
* disallowed.
*
* - EVENT_STORAGE_SUM_CHANGED:
* Contains the new total storage sum used by the account.
*
* - EVENT_REQSTAT_PROGRESS:
* Returns the progress of a long-running API operation in per mil (0–1000),
* or -1 if no operation is in progress.
*
* - EVENT_FATAL_ERROR:
* Provides the reason for a fatal error:
* - REASON_ERROR_UNKNOWN = -1
* - REASON_ERROR_NO_ERROR = 0
* - REASON_ERROR_FAILURE_UNSERIALIZE_NODE = 1
* - REASON_ERROR_DB_IO_FAILURE = 2
* - REASON_ERROR_DB_FULL = 3
* - REASON_ERROR_DB_INDEX_OVERFLOW = 4
* - REASON_ERROR_NO_JSCD = 5
* - REASON_ERROR_REGENERATE_JSCD = 6
* - REASON_ERROR_DB_CORRUPT = 7
*
* - EVENT_ACCOUNT_BLOCKED:
* Indicates the reason for account blockage:
* - MegaApi::ACCOUNT_BLOCKED_TOS_COPYRIGHT = 200
* - MegaApi::ACCOUNT_BLOCKED_TOS_NON_COPYRIGHT = 300
* - MegaApi::ACCOUNT_BLOCKED_SUBUSER_DISABLED = 400
* - MegaApi::ACCOUNT_BLOCKED_SUBUSER_REMOVED = 401
* - MegaApi::ACCOUNT_BLOCKED_VERIFICATION_EMAIL = 700
*
* - EVENT_BUSINESS_STATUS:
* Indicates the business account status:
* - BUSINESS_STATUS_EXPIRED = -1
* - BUSINESS_STATUS_INACTIVE = 0
* - BUSINESS_STATUS_ACTIVE = 1
* - BUSINESS_STATUS_GRACE_PERIOD = 2
*
* - EVENT_KEY_MODIFIED:
* Provides the type of key that was modified for a user (see getHandle() for the user
* handle):
* - 0: Public chat key (Cu25519)
* - 1: Public signing key (Ed25519)
* - 2: Public RSA key
* - 3: Signature of chat key
* - 4: Signature of RSA key
*
* @return Number relative to this event.
*/
virtual int64_t getNumber() const;
/**
* @brief Returns a handle relative to this event
*
* The meaning of the returned handle depends on the event type (see MegaEvent::getType()).
*
* - EVENT_CONFIRM_USER_EMAIL:
* Returns the user handle for the confirmed account.
*
* - EVENT_KEY_MODIFIED:
* Returns the handle of the user whose key has been modified.
*
* @return Handle relative to this event, or INVALID_HANDLE if not applicable.
*/
virtual MegaHandle getHandle() const;
/**
* @brief Returns a readable description of the event
*
* This function returns a pointer to a statically allocated buffer.
* You don't have to free the returned pointer
*
* @return Readable description of the event
*/
virtual const char* getEventString() const;
/**
* @brief Returns a numeric value associated with the specified key for this event.
*
* This method allows accessing multiple named numeric values that may be associated
* with the event.
*
* The meaning of the returned number depends on the event type (see MegaEvent::getType()).
*
* - EVENT_NETWORK_ACTIVITY:
* This event uses multiple getNumber keys:
* - getNumber("channel") returns the channel where the activity happened (See
* MegaEvent::NetworkActivityChannel).
* - getNumber("activity_type") returns the type of network activity (See
* MegaEvent::NetworkActivityType).
* - getNumber("error_code") returns the error code (See MegaError enum) or status (HTTP
* status code) of the activity.
*
* @param key The key identifying the numeric data.
*
* @return An optional containing the numeric value corresponding to the provided key,
* or an empty optional if not available.
*/
virtual std::optional<int64_t> getNumber(const std::string& key) const;
};
/**
* @brief Provides information about a transfer
*
* Developers can use listeners (MegaListener, MegaTransferListener)
* to track the progress of each transfer. MegaTransfer objects are provided in callbacks sent
* to these listeners and allow developers to know the state of the transfers, their parameters
* and their results.
*
* Objects of this class aren't live, they are snapshots of the state of the transfer
* when the object is created, they are immutable.
*
*/
class MegaTransfer
{
public:
enum {
TYPE_DOWNLOAD = 0,
TYPE_UPLOAD = 1,
TYPE_LOCAL_TCP_DOWNLOAD = 2,
TYPE_LOCAL_HTTP_DOWNLOAD = 2 //kept for backwards compatibility
};
enum {
STATE_NONE = 0,
STATE_QUEUED,
STATE_ACTIVE,
STATE_PAUSED,
STATE_RETRYING,
STATE_COMPLETING,
STATE_COMPLETED,
STATE_CANCELLED,
STATE_FAILED
};
enum {
MOVE_TYPE_UP = 1,
MOVE_TYPE_DOWN,
MOVE_TYPE_TOP,
MOVE_TYPE_BOTTOM
};
enum {
STAGE_NONE = 0,
STAGE_SCAN,
STAGE_CREATE_TREE,
STAGE_TRANSFERRING_FILES,
STAGE_MAX = STAGE_TRANSFERRING_FILES,
};
enum
{ // Collision Check for same file
COLLISION_CHECK_ASSUMESAME = 1, // assume files are the same
COLLISION_CHECK_ALWAYSERROR = 2, // treat as an error
COLLISION_CHECK_FINGERPRINT = 3, // Check fingerprint. Assume files are same if their fingerprint are same (quick)
COLLISION_CHECK_METAMAC = 4, // Check MetaMac. Assume files are same if their meta mac are same (slow, a lot of disk + CPU)
COLLISION_CHECK_ASSUMEDIFFERENT = 5, // assume files are different
};
enum
{
// Defines how to handle name collisions when saving files.
// For folders, the default behavior is to merge (i.e., do nothing)
// unless the filesystem is case-insensitive and the collision is caused
// by the same name with different capitalization.
// In that case, we apply the selected collision resolution strategy.
// Note: Overwrite always applies merge behavior for folders.
COLLISION_RESOLUTION_OVERWRITE = 1, // Overwrite the existing one for files
COLLISION_RESOLUTION_NEW_WITH_N =
2, // Rename the new one with suffix (1), (2), and etc.
COLLISION_RESOLUTION_EXISTING_TO_OLDN =
3, // Rename the existing one with suffix .old1, old2, and etc.
};
virtual ~MegaTransfer();
/**
* @brief Creates a copy of this MegaTransfer object
*
* The resulting object is fully independent of the source MegaTransfer,
* it contains a copy of all internal attributes, so it will be valid after
* the original object is deleted.
*
* You are the owner of the returned object
*
* @return Copy of the MegaTransfer object
*/
virtual MegaTransfer *copy();
/**
* @brief Returns the type of the transfer (TYPE_DOWNLOAD, TYPE_UPLOAD)
* @return The type of the transfer (TYPE_DOWNLOAD, TYPE_UPLOAD)
*/
virtual int getType() const;
/**
* @brief Returns a readable string showing the type of transfer (UPLOAD, DOWNLOAD)
*
* This function returns a pointer to a statically allocated buffer.
* You don't have to free the returned pointer
*
* @return Readable string showing the type of transfer (UPLOAD, DOWNLOAD)
*/
virtual const char *getTransferString() const;
/**
* @brief Returns a readable string that shows the type of the transfer
*
* This function provides exactly the same result as MegaTransfer::getTransferString (UPLOAD, DOWNLOAD)
* It's provided for a better Java compatibility
*
* @return Readable string showing the type of transfer (UPLOAD, DOWNLOAD)
*/
virtual const char* toString() const;
/**
* @brief Returns the starting time of the request (in deciseconds)
*
* The returned value is a monotonic time since some unspecified starting point expressed in
* deciseconds.
*
* @return Starting time of the transfer (in deciseconds)
*/
virtual int64_t getStartTime() const;
/**
* @brief Returns the number of transferred bytes during this request
* @return Transferred bytes during this transfer
*/
virtual long long getTransferredBytes() const;
/**
* @brief Returns the total bytes to be transferred to complete the transfer
* @return Total bytes to be transferred to complete the transfer
*/
virtual long long getTotalBytes() const;
/**
* @brief Returns the local path related to this request
*
* For uploads, this function returns the path to the source file. For downloads, it
* returns the path of the destination file.
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaTransfer object is deleted.
*
* @return Local path related to this transfer
*/
virtual const char* getPath() const;
/**
* @brief Returns the parent path related to this request
*
* For uploads, this function returns the path to the folder containing the source file.
* except when uploading files for support: it will return the support account then.
* For downloads, it returns that path to the folder containing the destination file.
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaTransfer object is deleted.
*
* @return Parent path related to this transfer
*/
virtual const char* getParentPath() const;
/**
* @brief Returns the handle related to this transfer
*
* For downloads, this function returns the handle of the source node.
*
* For uploads, it returns the handle of the new node in MegaTransferListener::onTransferFinish
* and MegaListener::onTransferFinish when the error code is API_OK. Otherwise, it returns
* mega::INVALID_HANDLE.
*
* @return The handle related to the transfer.
*/
virtual MegaHandle getNodeHandle() const;
/**
* @brief Returns the handle of the parent node related to this transfer
*
* For downloads, this function returns always mega::INVALID_HANDLE. For uploads,
* it returns the handle of the destination node (folder) for the uploaded file.
*
* @return The handle of the destination folder for uploads, or mega::INVALID_HANDLE for downloads.
*/
virtual MegaHandle getParentHandle() const;
/**
* @brief Returns the starting position of the transfer for streaming downloads
*
* The return value of this fuction will be 0 if the transfer isn't a streaming
* download (MegaApi::startStreaming)
*
* @return Starting position of the transfer for streaming downloads, otherwise 0
*/
virtual long long getStartPos() const;
/**
* @brief Returns the end position of the transfer for streaming downloads
*
* The return value of this fuction will be 0 if the transfer isn't a streaming
* download (MegaApi::startStreaming)
*
* @return End position of the transfer for streaming downloads, otherwise 0
*/
virtual long long getEndPos() const;
/**
* @brief Returns the name of the file that is being transferred
*
* It's possible to upload a file with a different name (MegaApi::startUpload). In that case,
* this function returns the destination name.
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaTransfer object is deleted.
*
* @return Name of the file that is being transferred
*/
virtual const char* getFileName() const;
/**
* @brief Returns the MegaTransferListener object associated with this transfer
*
* MegaTransferListener objects can be associated with transfers at startup, if a listener
* isn't associated, this function will return NULL
*
* @return Listener associated with this transfer
*/
virtual MegaTransferListener* getListener() const;
/**
* @brief Return the number of times that a transfer has temporarily failed
* @return Number of times that a transfer has temporarily failed
*/
virtual int getNumRetry() const;
/**
* @brief Returns the maximum number of times that the transfer will be retried
* @return Mmximum number of times that the transfer will be retried
*/
virtual int getMaxRetries() const;
/**
* @brief Returns a numeric value that can be used for different purposes:
*
* 1) In case MegaTransfer::isRecursive is true, it returns the current stage in case this
* transfer represents a folder upload/download operation. Valid values are:
* - MegaTransfer::STAGE_SCAN = 1
* - MegaTransfer::STAGE_CREATE_TREE = 2
* - MegaTransfer::STAGE_TRANSFERRING_FILES = 3
* Any other returned value in this scenario, must be ignored.
*
* In this scenario the value returned by this method, can only be considered as valid, when
* we receive MegaTransferListener::onTransferUpdate or MegaListener::onTransferUpdate, and
* the returned value is in between the range specified above.
*
* Note: any specific stage can only be notified once at most.
* @deprecated use the stage in the onFolderTransferUpdate callback instead
*
* 2) In case of file transfer, MegaTransfer::getType is MegaTransfer::TYPE_UPLOAD and
* MegaTransfer::isSourceFileTemporary is true, This method method returns a number greater
* than 0 if temporary file could be removed from local filesystem, otherwise returns 0
*
* In this scenario the value returned by this method, can only be considered as valid, when
* we receive MegaTransferListener::onTransferFinish or MegaListener::onTransferFinish.
*
* @return A numeric value that can be used for different purposes
*/
virtual unsigned getStage() const;
/**
* @brief Returns an identifier of this transfer as long as it is in-flight (i.e. not
* completed or cancelled).
*
* @note The identifiers may not be consecutive and can be reused once the transfer is
* completed or cancelled.
*
* @note The identifiers are reset a after fresh login (without session)
*
* @return 32-bits unsigned integer that identifies this transfer
*/
virtual uint32_t getUniqueId() const;
/**
* @brief Returns an integer that identifies this transfer
* @return Integer that identifies this transfer
*/
virtual int getTag() const;
/**
* @brief Returns the current speed of this transfer
* @return Current speed of this transfer
*/
virtual long long getSpeed() const;
/**
* @brief Returns the average speed of this transfer
* @return Average speed of this transfer
*/
virtual long long getMeanSpeed() const;
/**
* @brief Returns the number of bytes transferred since the previous callback
* @return Number of bytes transferred since the previous callback
* @see MegaListener::onTransferUpdate, MegaTransferListener::onTransferUpdate
*/
virtual long long getDeltaSize() const;
/**
* @brief Returns the timestamp when the last data was received (in deciseconds)
*
* This timestamp doesn't have a defined starting point. Use the difference between
* the return value of this function and MegaTransfer::getStartTime to know how
* much time the transfer has been running.
*
* @return Timestamp when the last data was received (in deciseconds)
*/
virtual int64_t getUpdateTime() const;
/**
* @brief Returns a public node related to the transfer
*
* The return value is only valid for downloads of public nodes.
*
* You take the ownership of the returned value.
*
* @return Public node related to the transfer
*/
virtual MegaNode *getPublicMegaNode() const;
/**
* @brief Returns true if this transfer belongs to the synchronization engine
*
* A single transfer can upload/download several files with exactly the same contents. If
* some of these files are being transferred by the synchonization engine, but there is at
* least one file started by the application, this function returns false.
*
* This data is important to know if the transfer is cancellable. Regular transfers are cancellable
* but synchronization transfers aren't.
*
* @return true if this transfer belongs to the synchronization engine, otherwise false
*/
virtual bool isSyncTransfer() const;
/**
* @brief Returns true if this transfer belongs to the backups engine
*
* This data is important to know if the transfer will resume when enableTransferResumption is called.
* Regular transfers are resumed, but backup transfers aren't.
*
* @return true if this transfer belongs to the backups engine, otherwise false
*/
virtual bool isBackupTransfer() const;
/**
* @brief Returns true if the transfer has failed with API_EOVERQUOTA
* and the target is foreign.
*
* @return true if the transfer has failed with API_EOVERQUOTA and the target is foreign.
*/
virtual bool isForeignOverquota() const;
/**
* @brief Returns true if the transfer may force a new upload.
*
* @return true if the transfer can force a new upload.
*/
virtual bool isForceNewUpload() const;
/**
* @brief Returns true is this is a streaming transfer
* @return true if this is a streaming transfer, false otherwise
* @see MegaApi::startStreaming
*/
virtual bool isStreamingTransfer() const;
/**
* @brief Returns true is the transfer is at finished state (COMPLETED, CANCELLED OR FAILED)
* @return true if this transfer is finished, false otherwise
*/
virtual bool isFinished() const;
/**
* @brief Returns the received bytes since the last callback
*
* The returned value is only valid for streaming transfers (MegaApi::startStreaming).
*
* @return Received bytes since the last callback
*/
virtual char *getLastBytes() const;
/**
* @brief Returns the last error related to the transfer with extra info
*
* The MegaTransfer object retains the ownership of the returned pointer. It will
* be valid until the deletion of the MegaTransfer object.
*
* @return Last error related to the transfer, with extended info
*/
virtual const MegaError* getLastErrorExtended() const;
/**
* @brief Returns true if the transfer is a folder transfer
* @return true if it's a folder transfer, otherwise (file transfer) it returns false
*/
virtual bool isFolderTransfer() const;
/**
* @brief Returns the identifier of the folder transfer associated to this transfer
*
* This function is only useful for transfers automatically started in the context of a folder transfer.
* For folder transfers (the ones directly started with startUpload), it returns -1
* Otherwise, it returns 0
*
* @return Tag of the associated folder transfer.
*/
virtual int getFolderTransferTag() const;
/**
* @brief Returns the application data associated with this transfer
*
* You can set the data returned by this function in MegaApi::startDownload
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaTransfer object is deleted.
*
* @return Application data associated with this transfer
*/
virtual const char* getAppData() const;
/**
* @brief Returns the state of the transfer
*
* It can be one of these values:
* - STATE_NONE = 0
* Unknown state. This state should be never returned.
*
* - STATE_QUEUED = 1
* The transfer is queued. No data related to it is being transferred.
*
* - STATE_ACTIVE = 2
* The transfer is active. Its data is being transferred.
*
* - STATE_PAUSED = 3
* The transfer is paused. It won't be activated until it's resumed.
*
* - STATE_RETRYING = 4
* The transfer is waiting to be retried due to a temporary error.
*
* - STATE_COMPLETING = 5
* The transfer is being completed. All data has been transferred
* but it's still needed to attach the resulting node to the
* account (uploads), to attach thumbnails/previews to the
* node (uploads of images) or to create the resulting local
* file (downloads). The transfer should be completed in a short time.
*
* - STATE_COMPLETED = 6
* The transfer has beeing finished.
*
* - STATE_CANCELLED = 7
* The transfer was cancelled by the user.
*
* - STATE_FAILED = 8
* The transfer was cancelled by the SDK due to a fatal error or
* after a high number of retries.
*
* @return State of the transfer
*/
virtual int getState() const;
/**
* @brief Returns the priority of the transfer
*
* This value is intended to keep the order of the transfer queue on apps.
*
* @return Priority of the transfer
*/
virtual unsigned long long getPriority() const;
/**
* @brief Returns the notification number of the SDK when this MegaTransfer was generated
*
* The notification number of the SDK is increased every time the SDK sends a callback
* to the app.
*
* @return Notification number
*/
virtual long long getNotificationNumber() const;
/**
* @brief Returns whether the target folder of the transfer was overriden by the API server
*
* It may happen that the target folder fo a transfer is deleted by the time the node
* is going to be added. Hence, the API will create the node in the rubbish bin.
*
* @return True if target folder was overriden (apps can check the final parent)
*/
virtual bool getTargetOverride() const;
/**
* @brief Returns a pointer to the cancel token associated to a MegaTransfer in case it exists.
*
* CancelToken can be used to cancel a batch of transfers (upload or download) that contains at least one folder.
*
* When user wants to upload/download a batch of items that at least contains one folder, SDK mutex will be partially
* locked until:
* - we have received onTransferStart for every file in the batch
* - we have received onTransferUpdate with MegaTransfer::getStage == MegaTransfer::STAGE_TRANSFERRING_FILES
* for every folder in the batch
*
* During this period, the only safe method (to avoid deadlocks) to cancel transfers is by calling CancelToken::cancel(true).
* This method will cancel all transfers(not finished yet).
*
* Important considerations:
* - A cancel token instance can be shared by multiple transfers, and calling CancelToken::cancel(true) will affect all
* of those transfers.
*
* @return A pointer to a cancelToken instance associated to the transfer in case it exists
*/
virtual MegaCancelToken* getCancelToken();
/**
* @brief Returns a string that identify the recursive operation stage
*
* @return A string that identify the recursive operation stage
*/
static const char* stageToString(unsigned stage);
};
/**
* @brief Provides information about the contents of a folder
*
* This object is related to provide the results of the function MegaApi::getFolderInfo
*
* Objects of this class aren't live, they are snapshots of the state of the contents of the
* folder when the object is created, they are immutable.
*
*/
class MegaFolderInfo
{
public:
virtual ~MegaFolderInfo();
/**
* @brief Creates a copy of this MegaFolderInfo object
*
* The resulting object is fully independent of the source MegaFolderInfo,
* it contains a copy of all internal attributes, so it will be valid after
* the original object is deleted.
*
* You are the owner of the returned object
*
* @return Copy of the MegaFolderInfo object
*/
virtual MegaFolderInfo *copy() const;
/**
* @brief Return the number of file versions inside the folder
*
* The current version of files is not taken into account for the return value of this function
*
* @return Number of file versions inside the folder
*/
virtual int getNumVersions() const;
/**
* @brief Returns the number of files inside the folder
*
* File versions are not counted for the return value of this function
*
* @return Number of files inside the folder
*/
virtual int getNumFiles() const;
/**
* @brief Returns the number of folders inside the folder
* @return Number of folders inside the folder
*/
virtual int getNumFolders() const;
/**
* @brief Returns the total size of files inside the folder
*
* File versions are not taken into account for the return value of this function
*
* @return Total size of files inside the folder
*/
virtual long long getCurrentSize() const;
/**
* @brief Returns the total size of file versions inside the folder
*
* The current version of files is not taken into account for the return value of this function
*
* @return Total size of file versions inside the folder
*/
virtual long long getVersionsSize() const;
};
/**
* @brief Provides information about timezones and the current default
*
* This object is related to results of the function MegaApi::fetchTimeZone
*
* Objects of this class aren't live, they contain details about timezones and the
* default when the object is created, they are immutable.
*
*/
class MegaTimeZoneDetails
{
public:
virtual ~MegaTimeZoneDetails();
/**
* @brief Creates a copy of this MegaTimeZoneDetails object
*
* The resulting object is fully independent of the source MegaTimeZoneDetails,
* it contains a copy of all internal attributes, so it will be valid after
* the original object is deleted.
*
* You are the owner of the returned object
*
* @return Copy of the MegaTimeZoneDetails object
*/
virtual MegaTimeZoneDetails *copy() const;
/**
* @brief Returns the number of timezones in this object
*
* @return Number of timezones in this object
*/
virtual int getNumTimeZones() const;
/**
* @brief Returns the timezone at an index
*
* The MegaTimeZoneDetails object retains the ownership of the returned string.
* It will be only valid until the MegaTimeZoneDetails object is deleted.
*
* @param index Index in the list (it must be lower than MegaTimeZoneDetails::getNumTimeZones)
* @return Timezone at an index
*/
virtual const char *getTimeZone(int index) const;
/**
* @brief Returns the current time offset of the time zone at an index, respect to UTC (in seconds, it can be negative)
*
* @param index Index in the list (it must be lower than MegaTimeZoneDetails::getNumTimeZones)
* @return Current time offset of the time zone at an index, respect to UTC (in seconds, it can be negative)
* @see MegaTimeZoneDetails::getTimeZone
*/
virtual int getTimeOffset(int index) const;
/**
* @brief Get the default time zone index
*
* If there isn't any good default known, this function will return -1
*
* @return Default time zone index, or -1 if there isn't a good default known
*/
virtual int getDefault() const;
};
/**
* @brief Provides information about the notification settings
*
* The notifications can be configured:
*
* 1. Globally
* 1.1. Mute all notifications
* 1.2. Notify only during a schedule: from one time to another time of the day, specifying the timezone of reference
* 1.3. Do Not Disturb for a period of time: it overrides the schedule, if any (no notification will be generated)
*
* 2. Chats: Mute for all chats notifications
*
* 3. Per chat:
* 2.1. Mute all notifications from the specified chat
* 2.2. Always notify for the specified chat
* 2.3. Do Not Disturb for a period of time for the specified chat
*
* @note Notification settings per chat override any global notification setting.
* @note The DND mode per chat is not compatible with the option to always notify and viceversa.
*
* 4. Contacts: new incoming contact request, outgoing contact request accepted...
* 5. Shared folders: new shared folder, access removed...
*
*/
class MegaPushNotificationSettings
{
protected:
MegaPushNotificationSettings();
public:
/**
* @brief Creates a new instance of MegaPushNotificationSettings
* @return A pointer to the superclass of the private object
*/
static MegaPushNotificationSettings *createInstance();
virtual ~MegaPushNotificationSettings();
/**
* @brief Creates a copy of this MegaPushNotificationSettings object
*
* The resulting object is fully independent of the source MegaPushNotificationSettings,
* it contains a copy of all internal attributes, so it will be valid after
* the original object is deleted.
*
* You are the owner of the returned object
*
* @return Copy of the MegaPushNotificationSettings object
*/
virtual MegaPushNotificationSettings *copy() const;
/**
* @brief Returns whether Do-Not-Disturb mode is enabled or not
* @return True if enabled, false otherwise
*/
virtual bool isGlobalDndEnabled() const;
/**
* @brief Returns whether Do-Not-Disturb mode for chats is enabled or not
* @return True if enabled, false otherwise
*/
virtual bool isGlobalChatsDndEnabled() const;
/**
* @brief Returns the timestamp until the DND mode is enabled
*
* This method returns a valid value only if MegaPushNotificationSettings::isGlobalDndEnabled
* returns true.
*
* If there's no DND mode established, this function returns -1.
* @note a DND value of 0 means the DND does not expire.
*
* @return Timestamp until DND mode is enabled (in seconds since the Epoch)
*/
virtual int64_t getGlobalDnd() const;
/**
* @brief Returns whether there is a schedule for notifications or not
* @return True if enabled, false otherwise
*/
virtual bool isGlobalScheduleEnabled() const;
/**
* @brief Returns the time of the day when notifications start
*
* This method returns a valid value only if MegaPushNotificationSettings::isGlobalScheduleEnabled
* returns true.
*
* @return Minutes counting from 00:00 (based on the configured timezone)
*/
virtual int getGlobalScheduleStart() const;
/**
* @brief Returns the time of the day when notifications stop
*
* This method returns a valid value only if MegaPushNotificationSettings::isGlobalScheduleEnabled
* returns true.
*
* @return Minutes counting from 00:00 (based on the configured timezone)
*/
virtual int getGlobalScheduleEnd() const;
/**
* @brief Returns the timezone of reference for the notification schedule
*
* This method returns a valid value only if MegaPushNotificationSettings::isGlobalScheduleEnabled
* returns true.
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @return Minutes counting from 00:00 (based on the configured timezone)
*/
virtual const char *getGlobalScheduleTimezone() const;
/**
* @brief Returns whether Do-Not-Disturb mode for a chat is enabled or not
*
* @param chatid MegaHandle that identifies the chat room
* @return True if enabled, false otherwise
*/
virtual bool isChatDndEnabled(MegaHandle chatid) const;
/**
* @brief Returns the timestamp until the Do-Not-Disturb mode for a chat
*
* This method returns a valid value only if MegaPushNotificationSettings::isChatDndEnabled
* returns true.
*
* If there's no DND mode established for the specified chat, this function returns -1.
* @note a DND value of 0 means the DND does not expire.
*
* @param chatid MegaHandle that identifies the chat room
* @return Timestamp until DND mode is enabled (in seconds since the Epoch)
*/
virtual int64_t getChatDnd(MegaHandle chatid) const;
/**
* @brief Returns whether always notify for a chat or not
*
* This option overrides the global notification settings.
*
* @param chatid MegaHandle that identifies the chat room
* @return True if enabled, false otherwise
*/
virtual bool isChatAlwaysNotifyEnabled(MegaHandle chatid) const;
/**
* @brief Returns whether notifications about Contacts are enabled or not
* @return True if enabled, false otherwise
*/
virtual bool isContactsEnabled() const;
/**
* @brief Returns whether notifications about shared-folders are enabled or not
* @return True if enabled, false otherwise
*/
virtual bool isSharesEnabled() const;
/**
* @brief Returns the timestamp until the chats DND mode is enabled
*
* This method returns a valid value only if MegaPushNotificationSettings::isGlobalChatsDndEnabled
* returns true.
*
* If there's no DND mode established, this function returns -1.
* @note a DND value of 0 means the DND does not expire.
*
* @return Timestamp until chats DND mode is enabled (in seconds since the Epoch)
*/
virtual int64_t getGlobalChatsDnd() const;
/**
* @brief Enable or disable notifications globally
*
* If notifications are globally disabled, the DND global setting will be
* cleared and the specified schedule, if any, will have no effect.
*
* @note When notifications are globally disabled, settings per chat still apply.
*
* @param enable True to enable, false to disable
*/
virtual void enableGlobal(bool enable);
/**
* @brief Set the global DND mode for a period of time
*
* No notifications will be generated until the specified timestamp.
*
* If notifications were globally disabled, this function will enable them
* back (but will not generate notification until the specified timestamp).
*
* @param timestamp Timestamp until DND mode is enabled (in seconds since the Epoch)
*/
virtual void setGlobalDnd(int64_t timestamp);
/**
* @brief Disable the globally specified DND mode
*/
virtual void disableGlobalDnd();
/**
* @brief Set the schedule for notifications globally
*
* Notifications, if globally enabled, will be generated only from \c start
* to \c end time, using the \c timezone as reference.
*
* The timezone should be one of the values returned by MegaTimeZoneDetails::getTimeZone.
* @see MegaApi::fetchTimeZone for more details.
*
* @param start Minutes counting from 00:00 (based on the configured timezone)
* @param end Minutes counting from 00:00 (based on the configured timezone)
* @param timezone C-String representing the timezone
*/
virtual void setGlobalSchedule(int start, int end, const char *timezone);
/**
* @brief Disable the schedule for notifications globally
*/
virtual void disableGlobalSchedule();
/**
* @brief Enable or disable notifications for a chat
*
* If notifications for this chat are disabled, the DND settings for this chat,
* if any, will be cleared.
*
* @note Settings per chat override any global notification setting.
*
* @param chatid MegaHandle that identifies the chat room
* @param enable True to enable, false to disable
*/
virtual void enableChat(MegaHandle chatid, bool enable);
/**
* @brief Set the DND mode for a chat for a period of time
*
* No notifications will be generated until the specified timestamp.
*
* This setting is not compatible with the "Always notify". If DND mode is
* configured, the "Always notify" will be disabled.
*
* If chat notifications were totally disabled for the specified chat, this
* function will enable them back (but will not generate notification until
* the specified timestamp).
*
* @param timestamp Timestamp until DND mode is enabled (in seconds since the Epoch)
*/
virtual void setChatDnd(MegaHandle chatid, int64_t timestamp);
/**
* @brief Set the Global DND for chats for a period of time
*
* No chat notifications will be generated until the specified timestamp.
*
* @param timestamp Timestamp until DND mode is enabled (in seconds since the Epoch)
*/
virtual void setGlobalChatsDnd(int64_t timestamp);
/**
* @brief Enable or disable "Always notify" setting
*
* Notifications for this chat will always be generated, even if they are globally
* disabled, out of the global schedule or a global DND mode is set.
*
* This setting is not compatible with the DND mode for the specified chat. In consequence,
* if "Always notify" is enabled and the DND mode was configured, it will be disabled.
* Also, if notifications were disabled for the specified chat, they will be enabled.
*
* @note Settings per chat override any global notification setting.
*
* @param chatid MegaHandle that identifies the chat room
* @param enable True to enable, false to disable
*/
virtual void enableChatAlwaysNotify(MegaHandle chatid, bool enable);
/**
* @brief Enable or disable notifications related to contacts
* @param enable True to enable, false to disable
*/
virtual void enableContacts(bool enable);
/**
* @brief Enable or disable notifications related to shared-folders
* @param enable True to enable, false to disable
*/
virtual void enableShares(bool enable);
/**
* @brief Enable or disable notifications related to all chats
* @param enable True to enable, false to disable
*/
virtual void enableChats(bool enable);
};
/**
* @brief Provides information about transfer queues
*
* This object is used as the return value of the function MegaApi::getTransferData
*
* Objects of this class aren't live, they are snapshots of the state of the transfer
* queues when the object is created, they are immutable.
*
*/
class MegaTransferData
{
public:
virtual ~MegaTransferData();
/**
* @brief Creates a copy of this MegaTransferData object
*
* The resulting object is fully independent of the source MegaTransferData,
* it contains a copy of all internal attributes, so it will be valid after
* the original object is deleted.
*
* You are the owner of the returned object
*
* @return Copy of the MegaTransferData object
*/
virtual MegaTransferData *copy() const;
/**
* @brief Returns the number of downloads in the transfer queue
* @return Number of downloads in the transfer queue
*/
virtual int getNumDownloads() const;
/**
* @brief Returns the number of uploads in the transfer queue
* @return Number of uploads in the transfer queue
*/
virtual int getNumUploads() const;
/**
* @brief Returns the tag of the download at index i
* @param i index of the selected download. It must be between 0 and MegaTransferData::getNumDownloads (not included)
* @return Tag of the download at index i
*/
virtual int getDownloadTag(int i) const;
/**
* @brief Returns the tag of the upload at index i
* @param i index of the selected upload. It must be between 0 and MegaTransferData::getNumUploads (not included)
* @return Tag of the upload at index i
*/
virtual int getUploadTag(int i) const;
/**
* @brief Returns the priority of the download at index i
* @param i index of the selected download. It must be between 0 and MegaTransferData::getNumDownloads (not included)
* @return Priority of the download at index i
*/
virtual unsigned long long getDownloadPriority(int i) const;
/**
* @brief Returns the priority of the upload at index i
* @param i index of the selected upload. It must be between 0 and MegaTransferData::getNumUploads (not included)
* @return Priority of the upload at index i
*/
virtual unsigned long long getUploadPriority(int i) const;
/**
* @brief Returns the notification number of the SDK when this MegaTransferData was generated
*
* The notification number of the SDK is increased every time the SDK sends a callback
* to the app.
*
* @return Notification number
*/
virtual long long getNotificationNumber() const;
};
/**
* @brief Provides information about a contact request
*
* Developers can use listeners (MegaListener, MegaGlobalListener)
* to track the progress of each contact. MegaContactRequest objects are provided in callbacks sent
* to these listeners and allow developers to know the state of the contact requests, their parameters
* and their results.
*
* Objects of this class aren't live, they are snapshots of the state of the contact request
* when the object is created, they are immutable.
*
*/
class MegaContactRequest
{
public:
enum {
STATUS_UNRESOLVED = 0,
STATUS_ACCEPTED,
STATUS_DENIED,
STATUS_IGNORED,
STATUS_DELETED,
STATUS_REMINDED
};
enum {
REPLY_ACTION_ACCEPT = 0,
REPLY_ACTION_DENY,
REPLY_ACTION_IGNORE
};
enum {
INVITE_ACTION_ADD = 0,
INVITE_ACTION_DELETE,
INVITE_ACTION_REMIND
};
virtual ~MegaContactRequest();
/**
* @brief Creates a copy of this MegaContactRequest object
*
* The resulting object is fully independent of the source MegaContactRequest,
* it contains a copy of all internal attributes, so it will be valid after
* the original object is deleted.
*
* You are the owner of the returned object
*
* @return Copy of the MegaContactRequest object
*/
virtual MegaContactRequest *copy() const;
/**
* @brief Returns the handle of this MegaContactRequest object
* @return Handle of the object
*/
virtual MegaHandle getHandle() const;
/**
* @brief Returns the email of the request creator
* @return Email of the request creator
*/
virtual char* getSourceEmail() const;
/**
* @brief Return the message that the creator of the contact request has added
* @return Message sent by the request creator
*/
virtual char* getSourceMessage() const;
/**
* @brief Returns the email of the recipient or NULL if the current account is the recipient
* @return Email of the recipient or NULL if the request is for us
*/
virtual char* getTargetEmail() const;
/**
* @brief Returns the creation time of the contact request
* @return Creation time of the contact request (in seconds since the Epoch)
*/
virtual int64_t getCreationTime() const;
/**
* @brief Returns the last update time of the contact request
* @return Last update time of the contact request (in seconds since the Epoch)
*/
virtual int64_t getModificationTime() const;
/**
* @brief Returns the status of the contact request
*
* It can be one of the following values:
* - STATUS_UNRESOLVED = 0
* The request is pending
*
* - STATUS_ACCEPTED = 1
* The request has been accepted
*
* - STATUS_DENIED = 2
* The request has been denied
*
* - STATUS_IGNORED = 3
* The request has been ignored
*
* - STATUS_DELETED = 4
* The request has been deleted
*
* - STATUS_REMINDED = 5
* The request has been reminded
*
* @return Status of the contact request
*/
virtual int getStatus() const;
/**
* @brief Direction of the request
* @return True if the request is outgoing and false if it's incoming
*/
virtual bool isOutgoing() const;
/**
* @brief Returns true is the incoming contact request is being automatically accepted
* @return True if the incoming contact request is being automatically accepted
*/
virtual bool isAutoAccepted() const;
};
#ifdef ENABLE_SYNC
/**
* @brief Provides information about a synchronization
*/
class MegaSync
{
public:
enum Error
{
NO_SYNC_ERROR = 0,
UNKNOWN_ERROR = 1,
UNSUPPORTED_FILE_SYSTEM = 2, //File system type is not supported
INVALID_REMOTE_TYPE = 3, //Remote type is not a folder that can be synced
INVALID_LOCAL_TYPE = 4, //Local path does not refer to a folder
INITIAL_SCAN_FAILED = 5, //The initial scan failed
LOCAL_PATH_TEMPORARY_UNAVAILABLE = 6, //Local path is temporarily unavailable: this is fatal when adding a sync
LOCAL_PATH_UNAVAILABLE = 7, //Local path is not available (can't be open)
REMOTE_NODE_NOT_FOUND = 8, //Remote node does no longer exists
STORAGE_OVERQUOTA = 9, //Account reached storage overquota
ACCOUNT_EXPIRED = 10, //Account expired (business or pro flexi)
FOREIGN_TARGET_OVERSTORAGE = 11, //Sync transfer fails (upload into an inshare whose account is overquota)
REMOTE_PATH_HAS_CHANGED = 12, // (obsolete -> changing remote path is not an error)
// REMOTE_PATH_DELETED = 13, // (obsolete -> unified with REMOTE_NODE_NOT_FOUND)
SHARE_NON_FULL_ACCESS = 14, //Existing inbound share sync or part thereof lost full access
LOCAL_FILESYSTEM_MISMATCH = 15, //Filesystem fingerprint does not match the one stored for the synchronization
PUT_NODES_ERROR = 16, // Error processing put nodes result
ACTIVE_SYNC_BELOW_PATH = 17, // There's a synced node below the path to be synced
ACTIVE_SYNC_ABOVE_PATH = 18, // There's a synced node above the path to be synced
REMOTE_NODE_MOVED_TO_RUBBISH = 19, // Moved to rubbish
REMOTE_NODE_INSIDE_RUBBISH = 20, // Attempted to be added in rubbish
VBOXSHAREDFOLDER_UNSUPPORTED = 21, // Found unsupported VBoxSharedFolderFS
LOCAL_PATH_SYNC_COLLISION = 22, //Local path includes a synced path or is included within one
ACCOUNT_BLOCKED= 23, // Account blocked
UNKNOWN_TEMPORARY_ERROR = 24, // unknown temporary error
TOO_MANY_ACTION_PACKETS = 25, // Too many changes in account, local state discarded
LOGGED_OUT = 26, // Logged out
//WHOLE_ACCOUNT_REFETCHED = 27, // obsolete. was: The whole account was reloaded, missed actionpacket changes could not have been applied
//MISSING_PARENT_NODE = 28, // obsolete. was: Setting a new parent to a parent whose LocalNode is missing its corresponding Node crossref
BACKUP_MODIFIED = 29, // Backup has been externally modified.
BACKUP_SOURCE_NOT_BELOW_DRIVE = 30, // Backup source path not below drive path.
SYNC_CONFIG_WRITE_FAILURE = 31, // Unable to write sync config to disk.
ACTIVE_SYNC_SAME_PATH = 32, // There's a synced node at the path to be synced
COULD_NOT_MOVE_CLOUD_NODES = 33, // rename() failed
COULD_NOT_CREATE_IGNORE_FILE = 34, // Couldn't create a sync's initial ignore file.
SYNC_CONFIG_READ_FAILURE = 35, // Couldn't read sync configs from disk.
UNKNOWN_DRIVE_PATH = 36, // Sync's drive path isn't known.
INVALID_SCAN_INTERVAL = 37, // The user's specified an invalid scan interval.
NOTIFICATION_SYSTEM_UNAVAILABLE = 38, // Filesystem notification subsystem has encountered an unrecoverable error.
UNABLE_TO_ADD_WATCH = 39, // Unable to add a filesystem watch.
UNABLE_TO_RETRIEVE_ROOT_FSID = 40, // Unable to retrieve a sync root's FSID.
UNABLE_TO_OPEN_DATABASE = 41, // Unable to open state cache database.
INSUFFICIENT_DISK_SPACE = 42, // Insufficient space for download.
FAILURE_ACCESSING_PERSISTENT_STORAGE = 43, // Failure accessing to persistent storage
MISMATCH_OF_ROOT_FSID = 44, // The sync root's FSID changed. So this is a different folder. And, we can't identify the old sync db as the name depends on this
FILESYSTEM_FILE_IDS_ARE_UNSTABLE = 45, // On MAC in particular, the FSID of a file in an exFAT drive can and does change spontaneously and frequently
FILESYSTEM_ID_UNAVAILABLE = 46, // Could not get the filesystem's id
UNABLE_TO_RETRIEVE_DEVICE_ID = 47, // Unable to retrieve the ID of current device
LOCAL_PATH_MOUNTED = 48, // The local path is a FUSE mount.
};
enum Warning
{
NO_SYNC_WARNING = 0,
LOCAL_IS_FAT = 1, // Found FAT (not a failure per se)
LOCAL_IS_HGFS= 2, // Found HGFS (not a failure per se)
};
enum SyncType
{
TYPE_UNKNOWN = 0,
TYPE_TWOWAY = 3, // Two-way sync
TYPE_BACKUP, // special sync up from local to remote, automatically disabled when remote changed
};
enum SyncRunningState
{
RUNSTATE_PENDING = 0, // Sync config has loaded but we have not attempted to start it yet
RUNSTATE_LOADING = 1, // Sync DB is in the process of loading from disk
RUNSTATE_RUNNING = 2, // Sync DB is loaded and active
// RUNSTATE_PAUSED = 3, (obsolete) Use RUNSTATE_SUSPENDED for paused syncs / backups
RUNSTATE_SUSPENDED =
4, // Sync DB is not loaded, but it is on disk with the last known sync state.
RUNSTATE_DISABLED = 5, // Sync DB does not exist. Starting it is like configuring a brand
// new sync with those settings.
};
virtual ~MegaSync();
/**
* @brief Creates a copy of this MegaSync object
*
* The resulting object is fully independent of the source MegaSync,
* it contains a copy of all internal attributes, so it will be valid after
* the original object is deleted.
*
* You are the owner of the returned object
*
* @return Copy of the MegaError object
*/
virtual MegaSync *copy();
/**
* @brief Get the handle of the folder that is being synced
* @return Handle of the folder that is being synced in MEGA
*/
virtual MegaHandle getMegaHandle() const;
/**
* @brief Get the path of the local folder that is being synced
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaSync object is deleted.
*
* @return Local folder that is being synced
*/
virtual const char* getLocalFolder() const;
/**
* @brief Get the name of the sync
*
* When the app did not provide an specific name, it will return the leaf
* name of the local folder.
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaSync object is deleted.
*
* @return Name given to the sync
*/
virtual const char* getName() const;
/**
* @brief Get the last known path of the remote folder that is being synced
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaSync object is deleted.
*
* @return The path of the Remote folder from when it was last being synced
*/
virtual const char* getLastKnownMegaFolder() const;
/**
* @brief Returns the identifier of this synchronization
*
* Identifiers of synchronizations are always negative numbers.
*
* @return Identifier of the synchronization
*/
virtual MegaHandle getBackupId() const;
/**
* @brief Get the error of a synchronization
*
* Possible values are those in MegaSync::Error. Eg.
* - NO_SYNC_ERROR = 0: No error
* @return Error of a synchronization
*/
virtual int getError() const;
/**
* @brief Get the warning of a synchronization
*
* Possible values are:
* - NO_SYNC_WARNING = 0: No warning
* - LOCAL_IS_FAT = 1: Found FAT (not a failure per se)
* - LOCAL_IS_HGFS = 2: Found HGFS (not a failure per se)
*
* @return Warning of a synchronization
*/
virtual int getWarning() const;
/**
* @brief Get the type of sync
*
* See possible values in MegaSync::SyncType.
*
* @return Type of sync
*/
virtual int getType() const;
/**
* @brief Returns the current run-state of the sync
*
* Returns one of the enum values from SyncRunningState
*
* @return one of the enum values from SyncRunningState.
*/
virtual int getRunState() const;
/**
* @brief Returns a readable description of the sync error
*
* Returns a text equivalent (in english) to getError()
*
* This gives the reason that the sync is in RUNSTATE_SUSPENDED
* or RUNSTATE_DISABLED state.
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @return Readable description of the error
*/
const char * getMegaSyncErrorCode();
/**
* @brief Provides the error description associated with a sync error code
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @param errorCode Error code for which the description will be returned
* @return Description associated with the error code
*/
static const char* getMegaSyncErrorCode(int errorCode);
/**
* @brief Returns a readable description of the sync warning
*
* This function returns a pointer to a statically allocated buffer.
* You don't have to free the returned pointer
*
* @return Readable description of the warning
*/
const char * getMegaSyncWarningCode();
/**
* @brief Provides the warning description associated with a sync warning code
*
* This function returns a pointer to a statically allocated buffer.
* You don't have to free the returned pointer
*
* @param warningCode Warning code for which the description will be returned
* @return Description associated with the warning code
*/
static const char *getMegaSyncWarningCode(int warningCode);
};
/**
* @brief Counts of files/folders/uploads/downloads per Sync
*
* The sync is the one identified by the backupId.
* The other fields are self-explanatory
*
* Objects of this class are immutable.
*/
class MegaSyncStats
{
public:
/** @brief Get the backupId that identifies the Sync
* @return The sync's BackupID
*/
virtual MegaHandle getBackupId() const = 0;
/** @brief Indicates whether the sync is scanning currently
* Scanning means reading the folder entries on local disks
*/
virtual bool isScanning() const = 0;
/** @brief Indicates whether the sync is syncing currently
* Syncing means comparing the two sides and bringing them in line
*/
virtual bool isSyncing() const = 0;
/** @brief Indicates how many folders the sync contains
*/
virtual int getFolderCount() const = 0;
/** @brief Indicates how many files the sync contains
*/
virtual int getFileCount() const = 0;
/** @brief Indicates how many files are being uploaded
*/
virtual int getUploadCount() const = 0;
/** @brief Indicates how many files are being downloaded
*/
virtual int getDownloadCount() const = 0;
/** @brief Make a copy of this object
* You take ownership of the result.
*/
virtual MegaSyncStats *copy() const = 0;
virtual ~MegaSyncStats() = default;
};
/**
* @brief List of MegaSync objects
*
* A MegaSyncList has the ownership of the MegaSync objects that it contains, so they will be
* only valid until the SyncList is deleted. If you want to retain a MegaMode returned by
* a MegaSyncList, use MegaSync::copy.
*
* Objects of this class are immutable.
*
* @see MegaApi::getChildren, MegaApi::search, MegaApi::getInShares
*/
class MegaSyncList
{
protected:
MegaSyncList();
public:
/**
* @brief Creates a new instance of MegaSyncList
* @return A pointer to the superclass of the private object
*/
static MegaSyncList * createInstance();
virtual ~MegaSyncList();
virtual MegaSyncList *copy() const;
/**
* @brief Returns the MegaSync at the position i in the MegaSyncList
*
* The MegaSyncList retains the ownership of the returned MegaSync. It will be only valid until
* the MegaSyncList is deleted.
*
* If the index is >= the size of the list, this function returns NULL.
*
* @param i Position of the MegaSync that we want to get for the list
* @return MegaSync at the position i in the list
*/
virtual MegaSync* get(int i) const;
/**
* @brief Returns the number of MegaSync objects in the list
* @return Number of MegaSync objects in the list
*/
virtual int size() const;
/**
* @brief Add new sync to list
* @param sync MegaSync to be added. The sync inserted is a copy from 'sync'
*/
virtual void addSync(MegaSync* sync);
};
/**
* @brief A synchronization conflict that requires user intervention to be solved
*/
class MegaSyncStall
{
public:
MegaSyncStall() = default;
virtual ~MegaSyncStall() = default;
enum SyncStallReason {
NoReason = 0,
FileIssue,
MoveOrRenameCannotOccur,
DeleteOrMoveWaitingOnScanning,
DeleteWaitingOnMoves,
UploadIssue,
DownloadIssue,
CannotCreateFolder,
CannotPerformDeletion,
SyncItemExceedsSupportedTreeDepth,
FolderMatchedAgainstFile,
LocalAndRemoteChangedSinceLastSyncedState_userMustChoose,
LocalAndRemotePreviouslyUnsyncedDiffer_userMustChoose,
NamesWouldClashWhenSynced,
SyncStallReason_LastPlusOne
};
enum SyncPathProblem {
NoProblem = 0,
FileChangingFrequently = 1,
IgnoreRulesUnknown = 2,
DetectedHardLink = 3,
DetectedSymlink = 4,
DetectedSpecialFile = 5,
DifferentFileOrFolderIsAlreadyPresent = 6,
ParentFolderDoesNotExist = 7,
FilesystemErrorDuringOperation = 8,
NameTooLongForFilesystem = 9,
CannotFingerprintFile = 10,
DestinationPathInUnresolvedArea = 11,
MACVerificationFailure = 12,
UnknownDownloadIssue = 13,
DeletedOrMovedByUser = 14,
FileFolderDeletedByUser = 15,
MoveToDebrisFolderFailed = 16,
IgnoreFileMalformed = 17,
FilesystemErrorListingFolder = 18,
// FilesystemErrorIdentifyingFolderContent = 19, -> obsolete
WaitingForScanningToComplete = 20,
WaitingForAnotherMoveToComplete = 21,
SourceWasMovedElsewhere = 22,
FilesystemCannotStoreThisName = 23,
CloudNodeInvalidFingerprint = 24,
CloudNodeIsBlocked = 25,
PutnodeDeferredByController = 26,
PutnodeCompletionDeferredByController = 27,
PutnodeCompletionPending = 28,
UploadDeferredByController = 29,
DetectedNestedMount = 30,
SyncPathProblem_LastPlusOne
};
/**
* @brief Creates a copy of this MegaSyncStall object
*
* You are the owner of the returned object
*
* @return Copy of the MegaSyncStall object
*/
virtual MegaSyncStall* copy() const = 0;
/**
* @return reason for the sync stall
*/
virtual SyncStallReason reason() const = 0;
/**
* @return a human readable (english only) representation of the sync stall reason. @see SyncStallReason
*/
virtual const char* reasonDebugString() const = 0;
/**
* Retrieves a specific path involved in a sync stall.
*
* This method returns a string representing a path associated with the sync stall, aiding
* in explaining the stall to the user.
*
* Notes:
* - To retrieve all paths involved in the stall, iterate over `index` values starting from
* `0` for both `cloudSide` values (`true` and `false`) until the function returns `NULL`.
* - Empty paths (when the method returns `NULL`) should be ignored unless there is a
* corresponding `pathProblem` for that path.
* - The maximum number of paths is usually two.
*
* @param cloudSide true to retrieve the information for the cloud path, `false` for the
* local.
* @param index The index of the path; valid values are typically `0` or `1`.
* @return A pointer to a character string containing the path, or `NULL` if no path is
* associated with the specified `cloudSide` and `index`.
*/
virtual const char* path(bool cloudSide, int index) const = 0;
/**
* For cloud-side paths, call this function to get the
* corresponding node handle (if any)
*/
virtual MegaHandle cloudNodeHandle(int index) const = 0;
/**
* To get the count of paths
*
* @return path count involved in the sync stall
*/
virtual unsigned int pathCount(bool cloudSide) const = 0;
/**
* Retrieves a code representing a problem associated with a specific path involved in a
* sync stall.
*
* This method returns an integer corresponding to a `SyncPathProblem` enum value that
* describes a condition of the specified path, helping to explain the stall to the user.
*
* Notes:
* - The `-1` value acts as a sentinel indicating "no problem" or "not applicable."
* - Some stall types may always return `-1` if path problems are not relevant for them.
*
* @param cloudSide true to retrieve the information for the cloud path, `false` for the
* local.
* @param index The index of the path; valid values are `0` or `1`.
* @return An integer corresponding to a `SyncPathProblem` enum value, or `-1` if there is
* no problem or the path is does not apply for this stall.
*/
virtual int pathProblem(bool cloudSide, int index) const = 0;
/**
* For some casess, it's likely that a sutiable course of action
* for the user is to add the problematic path to .megaignore
* This function advises if the GUI could/should offer a
* shortcut button to do that.
* The path in question would be the one from pathProblem with
* the same arguments (but expressed as a cloud path from only the
* sync root)
*
* @return local path involved in the sync stall
*/
virtual bool couldSuggestIgnoreThisPath(bool cloudSide, int index) const = 0;
/**
* Use this method for move problems to indicate which side
* the move was detected on, and therefore the other side
* is where the move could not be repliated.
*/
virtual bool detectedCloudSide() const = 0;
/**
* @brief Get an unique identifier for the MegaSyncStall object that takes into account all
* the information it stores.
*/
virtual size_t getHash() const = 0;
};
/**
* @brief A list of synchronization stall conflicts @see MegaSyncStall
*/
class MegaSyncStallList
{
public:
MegaSyncStallList() = default;
virtual ~MegaSyncStallList() = default;
virtual MegaSyncStallList* copy() const;
/**
* @param index of the request element in the list.
* @return constant pointer to a MegaSyncStall stored in the container.
*/
virtual const MegaSyncStall* get(size_t index) const;
/**
* @return number of elements in the list.
*/
virtual size_t size() const;
/**
* @brief Get an unique identifier that is calculated combining the hashes of all the
* elements in the container. The order of the elements also affects the final hash.
*/
virtual size_t getHash() const;
};
/**
* @brief A Map of BackupId to list of synchronization stall conflicts @see MegaSyncStall
*/
class MegaSyncStallMap
{
public:
MegaSyncStallMap() = default;
virtual ~MegaSyncStallMap() = default;
virtual MegaSyncStallMap* copy() const;
/**
* @brief Returns the number of elements in the MegaSyncStallMap.
*
* @return The number of elements in the MegaSyncStallMap.
*/
virtual size_t size() const;
/**
* @brief Get an unique identifier that is calculated combining the hashes of all the
* elements in the container. The order of the elements also affects the final hash.
*
* @return A combined hash value of all MegaSyncStall elements in the map.
*/
virtual size_t getHash() const;
/**
* @brief Retrieves a MegaSyncStallList object associated with the given key.
*
* The SDK retains the ownership of the MegaSyncStall object.
*
* @param key MegaHandle to look for in the stalls map.
* @return A pointer to the MegaSyncStallList object associated with the key, or nullptr if not
* found.
*/
virtual const MegaSyncStallList* get(const MegaHandle key) const;
/**
* @brief Retrieves a list of all keys present in the MegaSyncStallMap.
*
* This method creates and returns a MegaHandleList containing all the keys
* currently present in the internal map of stalls.
*
* @return A MegaHandleList containing all keys(BackupId's) from the stalls map.
*/
virtual MegaHandleList* getKeys() const;
};
#endif // ENABLE_SYNC
/**
* @brief Provides information about a backup
*
* Developers can use listeners (MegaListener, MegaScheduledCopyListener)
* to track the progress of each backup. MegaScheduledCopy objects are provided in callbacks sent
* to these listeners and allow developers to know the state of the backups and their parameters
* and their results.
*
* The implementation will receive callbacks from an internal worker thread.
*
**/
class MegaScheduledCopyListener
{
public:
virtual ~MegaScheduledCopyListener();
/**
* @brief This function is called when the state of the backup changes
*
* The SDK calls this function when the state of the backup changes, for example
* from 'active' to 'ongoing' or 'removing exceeding'.
*
* You can use MegaScheduledCopy::getState to get the new state.
*
* @param api MegaApi object that is backing up files
* @param backup MegaScheduledCopy object that has changed the state
*/
virtual void onBackupStateChanged(MegaApi *api, MegaScheduledCopy *backup);
/**
* @brief This function is called when a backup is about to start being processed
*
* The SDK retains the ownership of the backup parameter.
* Don't use it after this functions returns.
*
* The api object is the one created by the application, it will be valid until
* the application deletes it.
*
* @param api MegaApi object that started the backup
* @param backup Information about the backup
*/
virtual void onBackupStart(MegaApi *api, MegaScheduledCopy *backup);
/**
* @brief This function is called when a backup has finished
*
* The SDK retains the ownership of the backup and error parameters.
* Don't use them after this functions returns.
*
* The api object is the one created by the application, it will be valid until
* the application deletes it.
*
* There won't be more callbacks about this backup.
* The last parameter provides the result of the backup:
* If the backup finished without problems,
* the error code will be API_OK.
* If some transfer failed, the error code will be API_EINCOMPLETE.
* If the backup has been skipped the error code will be API_EEXPIRED.
* If the backup folder cannot be found, the error will be API_ENOENT.
*
*
* @param api MegaApi object that started the backup
* @param backup Information about the backup
* @param error Error information
*/
virtual void onBackupFinish(MegaApi* api, MegaScheduledCopy *backup, MegaError* error);
/**
* @brief This function is called to inform about the progress of a backup
*
* The SDK retains the ownership of the backup parameter.
* Don't use it after this functions returns.
*
* The api object is the one created by the application, it will be valid until
* the application deletes it.
*
* @param api MegaApi object that started the backup
* @param backup Information about the backup
*
* @see MegaScheduledCopy::getTransferredBytes, MegaScheduledCopy::getSpeed
*/
virtual void onBackupUpdate(MegaApi *api, MegaScheduledCopy *backup);
/**
* @brief This function is called when there is a temporary error processing a backup
*
* The backup continues after this callback, so expect more MegaScheduledCopyListener::onBackupTemporaryError or
* a MegaScheduledCopyListener::onBackupFinish callback
*
* The SDK retains the ownership of the backup and error parameters.
* Don't use them after this functions returns.
*
* @param api MegaApi object that started the backup
* @param backup Information about the backup
* @param error Error information
*/
virtual void onBackupTemporaryError(MegaApi *api, MegaScheduledCopy *backup, MegaError* error);
};
/**
* @brief Provides information about a backup
*/
class MegaScheduledCopy
{
public:
enum
{
SCHEDULED_COPY_FAILED = -2,
SCHEDULED_COPY_CANCELED = -1,
SCHEDULED_COPY_INITIALSCAN = 0,
SCHEDULED_COPY_ACTIVE,
SCHEDULED_COPY_ONGOING,
SCHEDULED_COPY_SKIPPING,
SCHEDULED_COPY_REMOVING_EXCEEDING
};
virtual ~MegaScheduledCopy();
/**
* @brief Creates a copy of this MegaScheduledCopy object
*
* The resulting object is fully independent of the source MegaScheduledCopy,
* it contains a copy of all internal attributes, so it will be valid after
* the original object is deleted.
*
* You are the owner of the returned object
*
* @return Copy of the MegaScheduledCopy object
*/
virtual MegaScheduledCopy *copy();
/**
* @brief Get the handle of the folder that is being backed up
* @return Handle of the folder that is being backed up in MEGA
*/
virtual MegaHandle getMegaHandle() const;
/**
* @brief Get the path of the local folder that is being backed up
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaScheduledCopy object is deleted.
*
* @return Local folder that is being backed up
*/
virtual const char* getLocalFolder() const;
/**
* @brief Returns the identifier of this backup
*
* @return Identifier of the backup
*/
virtual int getTag() const;
/**
* @brief Returns if backups that should have happen in the past should be taken care of
*
* @return Whether past backups should be taken care of
*/
virtual bool getAttendPastBackups() const;
/**
* @brief Returns the period of the backup
*
* @return The period of the backup in deciseconds
*/
virtual int64_t getPeriod() const;
/**
* @brief Returns the period string of the backup
* Any of these 6 fields may be an asterisk (*). This would mean the entire range of possible values, i.e. each minute, each hour, etc.
*
* Period is formatted as follows
* - - - - - -
* | | | | | |
* | | | | | |
* | | | | | +---- Day of the Week (range: 1-7, 1 standing for Monday)
* | | | | +------ Month of the Year (range: 1-12)
* | | | +-------- Day of the Month (range: 1-31)
* | | +---------- Hour (range: 0-23)
* | +------------ Minute (range: 0-59)
* +-------------- Second (range: 0-59)
*
* E.g:
* - daily at 04:00:00 (UTC): "0 0 4 * * *"
* - every 15th day at 00:00:00 (UTC) "0 0 0 15 * *"
* - mondays at 04.30.00 (UTC): "0 30 4 * * 1"
*
* @return The period string of the backup
*/
virtual const char *getPeriodString() const;
/**
* @brief Returns the next absolute timestamp of the next backup.
* @param oldStartTimeAbsolute Reference timestamp of the previous backup. If none provided it'll use current one.
*
* Successive nested calls to this functions will give you a full schedule of the next backups.
*
* Timestamp measures are given in number of seconds that elapsed since January 1, 1970 (midnight UTC/GMT),
* not counting leap seconds (in ISO 8601: 1970-01-01T00:00:00Z).
*
* @return timestamp of the next backup.
*/
virtual long long getNextStartTime(long long oldStartTimeAbsolute = -1) const;
/**
* @brief Returns the number of backups to keep
*
* @return Maximun number of Backups to store
*/
virtual int getMaxBackups() const;
/**
* @brief Get the state of the backup
*
* Possible values are:
* - SCHEDULED_COPY_FAILED = -2
* The backup has failed and has been disabled
*
* - SCHEDULED_COPY_CANCELED = -1,
* The backup has failed and has been disabled
*
* - SCHEDULED_COPY_INITIALSCAN = 0,
* The backup is doing the initial scan
*
* - SCHEDULED_COPY_ACTIVE
* The backup is active
*
* - SCHEDULED_COPY_ONGOING
* A backup is being performed
*
* - SCHEDULED_COPY_SKIPPING
* A backup is being skipped
*
* - SCHEDULED_COPY_REMOVING_EXCEEDING
* The backup is active and an exceeding backup is being removed
* @return State of the backup
*/
virtual int getState() const;
// Current backup data:
/**
* @brief Returns the number of folders created in the backup
* @return number of folders created in the backup
*/
virtual long long getNumberFolders() const;
/**
* @brief Returns the number of files created in the backup
* @return number of files created in the backup
*/
virtual long long getNumberFiles() const;
/**
* @brief Returns the number of files to be created in the backup
* @return number of files to be created in the backup
*/
virtual long long getTotalFiles() const;
/**
* @brief Returns the starting time of the current backup being processed (in deciseconds)
*
* The returned value is a monotonic time since some unspecified starting point expressed in
* deciseconds.
*
* @return Starting time of the backup (in deciseconds)
*/
virtual int64_t getCurrentBKStartTime() const;
/**
* @brief Returns the number of transferred bytes during last backup
* @return Transferred bytes during this backup
*/
virtual long long getTransferredBytes() const;
/**
* @brief Returns the total bytes to be transferred to complete last backup
* @return Total bytes to be transferred to complete the backup
*/
virtual long long getTotalBytes() const;
/**
* @brief Returns the current speed of last backup
* @return Current speed of this backup
*/
virtual long long getSpeed() const;
/**
* @brief Returns the average speed of last backup
* @return Average speed of this backup
*/
virtual long long getMeanSpeed() const;
/**
* @brief Returns the timestamp when the last data was received (in deciseconds)
*
* This timestamp doesn't have a defined starting point. Use the difference between
* the return value of this function and MegaScheduledCopy::getCurrentBKStartTime to know how
* much time the backup has been running.
*
* @return Timestamp when the last data was received (in deciseconds)
*/
virtual int64_t getUpdateTime() const;
/**
* @brief Returns the list with the transfers that have failed for during last backup
*
* You take the ownership of the returned value
*
* @return Names of the custom attributes of the node
* @see MegaApi::setCustomNodeAttribute
*/
virtual MegaTransferList *getFailedTransfers();
};
/**
* @brief Provides information about an error
*/
class MegaError
{
public:
/**
* @brief Declaration of API error codes.
*/
enum
{
API_OK = 0, ///< Everything OK
API_EINTERNAL = -1, ///< Internal error.
API_EARGS = -2, ///< Bad arguments.
API_EAGAIN = -3, ///< Request failed, retry with exponential back-off.
API_ERATELIMIT = -4, ///< Too many requests, slow down.
API_EFAILED = -5, ///< Request failed permanently.
API_ETOOMANY = -6, ///< Too many requests for this resource.
API_ERANGE = -7, ///< Resource access out of range.
API_EEXPIRED = -8, ///< Resource expired.
API_ENOENT = -9, ///< Resource does not exist.
API_ECIRCULAR = -10, ///< Circular linkage.
API_EACCESS = -11, ///< Access denied.
API_EEXIST = -12, ///< Resource already exists.
API_EINCOMPLETE = -13, ///< Request incomplete.
API_EKEY = -14, ///< Cryptographic error.
API_ESID = -15, ///< Bad session ID.
API_EBLOCKED = -16, ///< Resource administratively blocked.
API_EOVERQUOTA = -17, ///< Quota exceeded.
API_ETEMPUNAVAIL = -18, ///< Resource temporarily not available.
API_ETOOMANYCONNECTIONS = -19, ///< Too many connections on this resource.
API_EWRITE = -20, ///< File could not be written to (or failed post-write integrity check).
API_EREAD = -21, ///< File could not be read from (or changed unexpectedly during reading).
API_EAPPKEY = -22, ///< Invalid or missing application key.
API_ESSL = -23, ///< SSL verification failed
API_EGOINGOVERQUOTA = -24, ///< Not enough quota
API_EROLLEDBACK = -25, ///< A strongly-grouped request was rolled back.
API_EMFAREQUIRED = -26, ///< Multi-factor authentication required
API_EMASTERONLY = -27, ///< Access denied for sub-users (only for business accounts)
API_EBUSINESSPASTDUE = -28, ///< Business account expired
API_EPAYWALL = -29, ///< Over Disk Quota Paywall
API_ESUBUSERKEYMISSING = -30, ///< A business error where a subuser has not yet encrypted
/// their master key for the admin user and tries to perform
/// a disallowed command (currently u and p)
PAYMENT_ECARD = -101,
PAYMENT_EBILLING = -102,
PAYMENT_EFRAUD = -103,
PAYMENT_ETOOMANY = -104,
PAYMENT_EBALANCE = -105,
PAYMENT_EGENERIC = -106,
LOCAL_ENOSPC = -1000, ///< Insufficient space.
LOCAL_ETIMEOUT = -1001, ///< A request timed out.
LOCAL_ENETWORK = -1003, ///< Local network error
};
/**
* @brief Api error code context.
*/
enum ErrorContexts
{
API_EC_DEFAULT = 0, ///< Default error code context
API_EC_DOWNLOAD = 1, ///< Download transfer context.
API_EC_IMPORT = 2, ///< Import context.
API_EC_UPLOAD = 3, ///< Upload transfer context.
};
/**
* @brief User custom error details
*/
enum UserErrorCode
{
USER_ETD_UNKNOWN = -1,
USER_ENABLED = 0,
USER_PENDINGCONFIRMATION = 1,
USER_SUSPENDED_GENERIC = 2,
USER_SUSPENDED_PAYMENT = 3,
USER_COPYRIGHT_SUSPENSION = 4,
USER_SUSPENDED_ADMIN_FULLDISABLE = 5,
USER_SUSPENDED_ADMIN_PARTIALDISABLE = 6,
USER_ETD_SUSPENSION = 7,
USER_SUSPENDED_SMSVERIFICATIONREQUIRED = 8,
USER_SUSPENDED_EMAILVERIFICATIONREQUIRED = 9,
USER_SUBACCOUNT_PENDINGCONFIRMATION = 10,
USER_SUBACCOUNT_DISABLED = 11,
USER_SUBACCOUNT_DELETED = 12,
USER_BUSINESSACCOUNT = 20,
USER_SUSPENDED_PASSWORD_CHANGE_REQUIRED = 21,
USER_EPHEMERAL_RESELLER_USER = 22,
USER_SUSPENDED_NOUSER = 99,
};
/**
* @brief Link custom error details
*/
enum LinkErrorCode
{
LINK_UNKNOWN = -1, ///< Unknown state
LINK_UNDELETED = 0, ///< Link is undeleted
LINK_DELETED_DOWN = 1, ///< Link is deleted or down
LINK_DOWN_ETD = 2, ///< Link is down due to an ETD specifically
};
virtual ~MegaError();
/**
* @brief Creates a copy of this MegaError object
*
* The resulting object is fully independent of the source MegaError,
* it contains a copy of all internal attributes, so it will be valid after
* the original object is deleted.
*
* You are the owner of the returned object
*
* @return Copy of the MegaError object
*/
virtual MegaError* copy() const;
/**
* @brief Returns the error code associated with this MegaError
*
* @return Error code, an Errors enum, associated with this MegaError
*/
virtual int getErrorCode() const;
/**
* @brief
* Retrieve the result of the last mount operation.
*
* @return
* An element of the MegaMount::Result enumeration.
*
* @note
* This member is only relevant for the following request types:
* - TYPE_ADD_MOUNT
* - TYPE_DISABLE_MOUNT
* - TYPE_ENABLE_MOUNT
* - TYPE_REMOVE_MOUNT
* - TYPE_SET_MOUNT_FLAGS
*/
virtual int getMountResult() const;
/**
* @brief Returns the sync error associated with this MegaError
*
* @return MegaSync::Error associated with this MegaError
*/
virtual int getSyncError() const;
/**
* @brief Returns a value associated with the error
*
* Currently, this value is only useful when it is related to an API_EOVERQUOTA
* error related to a transfer. In that case, it's the number of seconds until
* the more bandwidth will be available for the account.
*
* In any other case, this value will be 0
*
* @return Value associated with the error
*/
virtual long long getValue() const;
/**
* @brief Returns true if error has extra info
*
* @note This method can return true for:
* - MegaRequest::TYPE_FETCH_NODES with error ENOENT
* - MegaRequest::TYPE_GET_PUBLIC_NODE with error ETOOMANY
* - MegaRequest::TYPE_IMPORT_LINK with error ETOOMANY
* - MegaTransferListener::onTransferFinish with error ETOOMANY
*
* @return True if error has extra info
*/
virtual bool hasExtraInfo() const;
/**
* @brief Returns the user status
*
* This method only returns a valid value when hasExtraInfo is true
* Possible values are defined in MegaError::UserErrorCode
*
* Otherwise, it returns MegaError::UserErrorCode::USER_ETD_UNKNOWN
*
* @return user status
*/
virtual long long getUserStatus() const;
/**
* @brief Returns the link status
*
* This method only returns a valid value when hasExtraInfo is true
* Possible values:
* MegaError::LinkErrorCode::LINK_UNDELETED
* MegaError::LinkErrorCode::LINK_DELETED_DOWN
* MegaError::LinkErrorCode::LINK_DOWN_ETD
*
* Otherwise, it returns MegaError::LinkErrorCode::LINK_UNKNOWN
*
* @return link status
*/
virtual long long getLinkStatus() const;
/**
* @brief Returns a readable description of the error
*
* This function returns a pointer to a statically allocated buffer.
* You don't have to free the returned pointer
*
* @return Readable description of the error
*/
virtual const char* getErrorString() const;
/**
* @brief Returns a readable description of the error
*
* This function returns a pointer to a statically allocated buffer.
* You don't have to free the returned pointer
*
* This function provides exactly the same result as MegaError::getErrorString.
* It's provided for a better Java compatibility
*
* @return Readable description of the error
*/
virtual const char* toString() const;
/**
* @brief Provides the error description associated with an error code
*
* This function returns a pointer to a statically allocated buffer.
* You don't have to free the returned pointer
*
* @param errorCode Error code for which the description will be returned
* @return Description associated with the error code
*/
static const char *getErrorString(int errorCode);
/**
* @brief Provides the error description associated with an error code
* given a certain context.
*
* This function returns a pointer to a statically allocated buffer.
* You don't have to free the returned pointer
*
* @param errorCode Error code for which the description will be returned
* @param context Context to provide a more accurate description (MegaError::ErrorContexts)
* @return Description associated with the error code
*/
static const char *getErrorString(int errorCode, ErrorContexts context);
protected:
MegaError(int e);
MegaError(int e, int se);
//< 0 = API error code, > 0 = http error, 0 = No error
// MegaError::Errors enum/ErrorCodes
int errorCode;
// SyncError/MegaSync::Error
int syncError;
friend class MegaTransfer;
friend class MegaApiImpl;
};
/**
* @brief Interface to process node trees
*
* An implementation of this class can be used to process a node tree passing a pointer to
* MegaApi::processMegaTree
*
* The implementation will receive callbacks from an internal worker thread.
*
*/
class MegaTreeProcessor
{
public:
/**
* @brief Function that will be called for all nodes in a node tree
* @param node Node to be processed
* @return true to continue processing nodes, false to stop
*/
virtual bool processMegaNode(MegaNode* node);
virtual ~MegaTreeProcessor();
};
/**
* @brief Interface to receive information about requests
*
* All requests allows to pass a pointer to an implementation of this interface in the last parameter.
* You can also get information about all requests using MegaApi::addRequestListener
*
* MegaListener objects can also receive information about requests
*
* This interface uses MegaRequest objects to provide information of requests. Take into account that not all
* fields of MegaRequest objects are valid for all requests. See the documentation about each request to know
* which fields contain useful information for each one.
*
* The implementation will receive callbacks from an internal worker thread.
*
*/
class MegaRequestListener
{
public:
/**
* @brief This function is called when a request is about to start being processed
*
* The SDK retains the ownership of the request parameter.
* Don't use it after this functions returns.
*
* The api object is the one created by the application, it will be valid until
* the application deletes it.
*
* @param api MegaApi object that started the request
* @param request Information about the request
*/
virtual void onRequestStart(MegaApi* api, MegaRequest *request);
/**
* @brief This function is called when a request has finished
*
* There won't be more callbacks about this request.
* The last parameter provides the result of the request. If the request finished without problems,
* the error code will be API_OK
*
* The SDK retains the ownership of the request and error parameters.
* Don't use them after this functions returns.
*
* The api object is the one created by the application, it will be valid until
* the application deletes it.
*
* @param api MegaApi object that started the request
* @param request Information about the request
* @param e Error information
*/
virtual void onRequestFinish(MegaApi* api, MegaRequest *request, MegaError* e);
/**
* @brief This function is called to inform about the progres of a request
*
* Currently, this callback is only used for fetchNodes (MegaRequest::TYPE_FETCH_NODES) requests
*
* The SDK retains the ownership of the request parameter.
* Don't use it after this functions returns.
*
* The api object is the one created by the application, it will be valid until
* the application deletes it.
*
*
* @param api MegaApi object that started the request
* @param request Information about the request
* @see MegaRequest::getTotalBytes MegaRequest::getTransferredBytes
*/
virtual void onRequestUpdate(MegaApi*api, MegaRequest *request);
/**
* @brief This function is called when there is a temporary error processing a request
*
* The request continues after this callback, so expect more MegaRequestListener::onRequestTemporaryError or
* a MegaRequestListener::onRequestFinish callback
*
* The SDK retains the ownership of the request and error parameters.
* Don't use them after this functions returns.
*
* The api object is the one created by the application, it will be valid until
* the application deletes it.
*
* @param api MegaApi object that started the request
* @param request Information about the request
* @param error Error information
*/
virtual void onRequestTemporaryError(MegaApi *api, MegaRequest *request, MegaError* error);
virtual ~MegaRequestListener();
};
/**
* @brief This class extendes the functionality of MegaRequestListener
* allowing a synchronous behaviour
* It can be used the same way as a MegaRequestListener by overriding doOnRequestFinish
* instead of onRequestFinish. This function will be called
* when onRequestFinish is called by the SDK.
*
* For a synchronous usage, a client for this listener may wait() until the request is finished and doOnRequestFinish is completed.
* Alternatively a trywait function is included which waits for an amount of time or until the request is finished.
* Then it can gather the MegaError and MegaRequest objects to process the outcome of the request.
*
* @see MegaRequestListener
*/
class SynchronousRequestListener : public MegaRequestListener
{
private:
MegaSemaphore* semaphore;
void onRequestFinish(MegaApi *api, MegaRequest *request, MegaError *error);
protected:
MegaRequestListener *listener;
MegaApi *megaApi;
MegaRequest *megaRequest;
MegaError *megaError;
public:
SynchronousRequestListener();
/**
* @brief This function is called when a request has finished
*
* There won't be more callbacks about this request.
* The last parameter provides the result of the request. If the request finished without problems,
* the error code will be API_OK
*
* The SDK retains the ownership of the request and error parameters.
* Don't use them after this functions returns.
*
* The api object is the one created by the application, it will be valid until
* the application deletes it.
*
* @param api MegaApi object that started the request
* @param request Information about the request
* @param error Error information
*/
virtual void doOnRequestFinish(MegaApi *api, MegaRequest *request, MegaError *error);
/**
* @brief Wait untill the request is finished. This means that the request has been processed and
* doOnRequestFinish is completed.
* After successfully waiting for the request to be finished, the caller can use getError() and getRequest()
* to gather the output and errors produced by the request. Thus, implementing the callback doOnRequestFinish
* is not required and the processing can be coded more linearly.
*
*/
void wait();
/**
* @brief Waits untill either the request is finished or the provided time is passed.
*
* After successfully waiting for the request to be finished, the caller can use getError() and getRequest()
* to gather the output and errors produced by the request. Thus, implementing the callback doOnRequestFinish
* is not required and the processing can be coded more linearly.
* @param milliseconds Max number of milliseconds to wait.
* @return returns 0 if the request had finished and a value different to 0 if timeout passed.
*/
int trywait(int milliseconds);
/**
* @brief Get the MegaError object produced by the request.
* The RequestListener retains the ownership of the object and will delete upon its destruction
* @return the error
*/
MegaError *getError() const;
/**
* @brief Get the MegaRequest object produced by the request.
* The RequestListener retains the ownership of the object and will delete upon its destruction
* @return the request
*/
MegaRequest *getRequest() const;
/**
* @brief Getter for the MegaApi object that started the request.
* @return the MegaApi object that started the request.
*/
MegaApi *getApi() const;
virtual ~SynchronousRequestListener();
};
/**
* @brief Interface to receive information about transfers
*
* All transfers allows to pass a pointer to an implementation of this interface in the last parameter.
* You can also get information about all transfers using MegaApi::addTransferListener
*
* MegaListener objects can also receive information about transfers
*
* The implementation will receive callbacks from an internal worker thread.
*
*/
class MegaTransferListener
{
public:
/**
* @brief This function is called when a transfer is about to start being processed
*
* The SDK retains the ownership of the transfer parameter.
* Don't use it after this functions returns.
*
* The api object is the one created by the application, it will be valid until
* the application deletes it.
*
* @param api MegaApi object that started the transfer
* @param transfer Information about the transfer
*/
virtual void onTransferStart(MegaApi *api, MegaTransfer *transfer);
/**
* @brief This function is called when a transfer has finished
*
* The SDK retains the ownership of the transfer and error parameters.
* Don't use them after this functions returns.
*
* The api object is the one created by the application, it will be valid until
* the application deletes it.
*
* There won't be more callbacks about this transfer.
* The last parameter provides the result of the transfer. If the transfer finished without problems,
* the error code will be API_OK
*
* @param api MegaApi object that started the transfer
* @param transfer Information about the transfer
* @param error Error information
*/
virtual void onTransferFinish(MegaApi* api, MegaTransfer *transfer, MegaError* error);
/**
* @brief This function is called to inform about the progress of a transfer
*
* The SDK retains the ownership of the transfer parameter.
* Don't use it after this functions returns.
*
* The api object is the one created by the application, it will be valid until
* the application deletes it.
*
* In case this transfer represents a recursive operation (folder upload/download) SDK will
* notify apps about the stages transition.
*
* Current recursive operation stage can be retrieved with method MegaTransfer::getStage.
* This method returns the following values:
* - MegaTransfer::STAGE_SCAN = 1
* - MegaTransfer::STAGE_CREATE_TREE = 2
* - MegaTransfer::STAGE_TRANSFERRING_FILES = 3
* For more information about stages refer to MegaTransfer::getStage
*
* @param api MegaApi object that started the transfer
* @param transfer Information about the transfer
*
* @see MegaTransfer::getTransferredBytes, MegaTransfer::getSpeed, MegaTransfer::getStage
*/
virtual void onTransferUpdate(MegaApi *api, MegaTransfer *transfer);
/**
* @brief This function is called to inform about the progress of a folder transfer
*
* The SDK retains the ownership of all parameters.
* Don't use any after this functions returns.
*
* The api object is the one created by the application, it will be valid until
* the application deletes it.
*
* This callback is only made for folder transfers, and only to the listener for that
* transfer, not for any globally registered listeners. The callback is only made
* during the scanning phase.
*
* This function can be used to give feedback to the user as to how scanning is progressing,
* since scanning may take a while and the application may be showing a modal dialog during
* this time.
*
* Note that this function could be called from a variety of threads during the
* overall operation, so proper thread safety should be observed.
*
* @param api MegaApi object that started the transfer
* @param transfer Information about the transfer
* @stage MegaTransfer::STAGE_SCAN or a later value in that enum
* @param foldercount The count of folders scanned so far
* @param foldercount The count of folders created so far (only relevant in MegaTransfer::STAGE_CREATE_TREE)
* @param filecount The count of files scanned (and fingerprinted) so far. 0 if not in scanning stage
* @param currentFolder The path of the folder currently being scanned (NULL except in the scan stage)
* @param currentFileLeafname The leaft name of the file currently being fingerprinted (can be NULL for the first call in a new folder, and when not scanning anymore)
*/
virtual void onFolderTransferUpdate(MegaApi *api, MegaTransfer *transfer, int stage, uint32_t foldercount, uint32_t createdfoldercount, uint32_t filecount, const char* currentFolder, const char* currentFileLeafname);
/**
* @brief This function is called when there is a temporary error processing a transfer
*
* The transfer continues after this callback, so expect more MegaTransferListener::onTransferTemporaryError or
* a MegaTransferListener::onTransferFinish callback
*
* The SDK retains the ownership of the transfer and error parameters.
* Don't use them after this functions returns.
*
* If the error code is API_EOVERQUOTA we need to call to MegaTransfer::isForeignOverquota to determine if
* our own storage, or a foreign storage is in overquota. If MegaTransfer::isForeignOverquota returns true
* a foreign storage is in overquota, otherwise our own storage is in overquota.
*
* @param api MegaApi object that started the transfer
* @param transfer Information about the transfer
* @param error Error information
*/
virtual void onTransferTemporaryError(MegaApi *api, MegaTransfer *transfer, MegaError* error);
virtual ~MegaTransferListener();
/**
* @brief This function is called to provide the last read bytes of streaming downloads
*
* This function won't be called for non streaming downloads. You can get the same buffer
* provided by this function in MegaTransferListener::onTransferUpdate, using
* MegaTransfer::getLastBytes MegaTransfer::getDeltaSize.
*
* The SDK retains the ownership of the transfer and buffer parameters.
* Don't use them after this functions returns.
*
* This callback is mainly provided for compatibility with other programming languages.
*
* @param api MegaApi object that started the transfer
* @param transfer Information about the transfer
* @param buffer Buffer with the last read bytes
* @param size Size of the buffer
* @return true to continue the transfer, false to cancel it
*
* @see MegaApi::startStreaming
*/
virtual bool onTransferData(MegaApi *api, MegaTransfer *transfer, char *buffer, size_t size);
};
/**
* @brief This class extendes the functionality of MegaTransferListener
* allowing a synchronous behaviour
* It can be used the same way as a MegaTransferListener by overriding doOnTransferFinish
* instead of onTransferFinish. This function will be called
* when onTransferFinish is called by the SDK.
*
* For a synchronous usage, a client for this listener may wait() until the transfer is finished and doOnTransferFinish is completed.
* Alternatively a trywait function is included which waits for an amount of time or until the transfer is finished.
* Then it can gather the MegaError and MegaTransfer objects to process the outcome of the transfer.
*
* @see MegaTransferListener
*/
class SynchronousTransferListener : public MegaTransferListener
{
private:
MegaSemaphore* semaphore;
void onTransferFinish(MegaApi *api, MegaTransfer *transfer, MegaError *error);
protected:
MegaTransferListener *listener;
MegaApi *megaApi;
MegaTransfer *megaTransfer;
MegaError *megaError;
public:
SynchronousTransferListener();
/**
* @brief This function is called when a transfer has finished
*
* There won't be more callbacks about this transfer.
* The last parameter provides the result of the transfer. If the transfer finished without problems,
* the error code will be API_OK
*
* The SDK retains the ownership of the transfer and error parameters.
* Don't use them after this functions returns.
*
* The api object is the one created by the application, it will be valid until
* the application deletes it.
*
* @param api MegaApi object that started the transfer
* @param transfer Information about the transfer
* @param error Error information
*/
virtual void doOnTransferFinish(MegaApi *api, MegaTransfer *transfer, MegaError *error);
/**
* @brief Wait untill the transfer is finished. This means that the transfer has been processed and
* doOnTransferFinish is completed.
* After successfully waiting for the transfer to be finished, the caller can use getError() and getTransfer()
* to gather the output and errors produced by the transfer. Thus, implementing the callback doOnTransferFinish
* is not required and the processing can be coded more linearly.
*
*/
void wait();
/**
* @brief Waits untill either the transfer is finished or the provided time is passed.
*
* After successfully waiting for the transfer to be finished, the caller can use getError() and getTransfer()
* to gather the output and errors produced by the transfer. Thus, implementing the callback doOnTransferFinish
* is not required and the processing can be coded more linearly.
* @param milliseconds Max number of milliseconds to wait.
* @return returns 0 if the transfer had finished and a value different to 0 if timeout passed.
*/
int trywait(int milliseconds);
/**
* @brief Get the MegaError object produced by the transfer.
* The TransferListener retains the ownership of the object and will delete upon its destruction
* @return the error
*/
MegaError *getError() const;
/**
* @brief Get the MegaTransfer object produced by the transfer.
* The TransferListener retains the ownership of the object and will delete upon its destruction
* @return the transfer
*/
MegaTransfer *getTransfer() const;
/**
* @brief Getter for the MegaApi object that started the transfer.
* @return the MegaApi object that started the transfer.
*/
MegaApi *getApi() const;
virtual ~SynchronousTransferListener();
};
/**
* @brief Interface to get information about global events
*
* You can implement this interface and start receiving events calling MegaApi::addGlobalListener
*
* MegaListener objects can also receive global events
*
* The implementation will receive callbacks from an internal worker thread.
*/
class MegaGlobalListener
{
public:
/**
* @brief This function is called when there are new or updated contacts in the account
*
* When the full account is reloaded or a large number of server notifications arrives at
* once, the second parameter will be NULL.
*
* The SDK retains the ownership of the MegaUserList in the second parameter. The list and
* all the MegaUser objects that it contains will be valid until this function returns. If
* you want to save the list, use MegaUserList::copy. If you want to save only some of the
* MegaUser objects, use MegaUser::copy for those objects.
*
* @param api MegaApi object connected to the account
* @param users List that contains the new or updated contacts
*/
virtual void onUsersUpdate(MegaApi* api, MegaUserList *users);
/**
* @brief This function is called when there are new or updated user alerts in the account
*
* When there is a problem parsing the incoming information from the server or the full
* account is reloaded or a large number of server notifications arrives at once, the second
* parameter will be NULL.
*
* The SDK retains the ownership of the MegaUserAlertList in the second parameter. The list
* and all the MegaUserAlert objects that it contains will be valid until this function
* returns. If you want to save the list, use MegaUserAlertList::copy. If you want to save
* only some of the MegaUserAlert objects, use MegaUserAlert::copy for those objects.
*
* @param api MegaApi object connected to the account
* @param alerts List that contains the new or updated alerts
*/
virtual void onUserAlertsUpdate(MegaApi* api, MegaUserAlertList *alerts);
/**
* @brief This function is called when there are new or updated nodes in the account
*
* When the full account is reloaded or a large number of server notifications arrives at once, the
* second parameter will be NULL.
*
* The SDK retains the ownership of the MegaNodeList in the second parameter. The list and all the
* MegaNode objects that it contains will be valid until this function returns. If you want to save the
* list, use MegaNodeList::copy. If you want to save only some of the MegaNode objects, use MegaNode::copy
* for those nodes.
*
* @param api MegaApi object connected to the account
* @param nodes List that contains the new or updated nodes
*/
virtual void onNodesUpdate(MegaApi* api, MegaNodeList *nodes);
/**
* @brief This function is called when the account has been updated (upgraded/downgraded)
*
* @param api MegaApi object connected to the account
*/
virtual void onAccountUpdate(MegaApi *api);
/**
* @brief This function is called when a Set has been updated (created / updated / removed)
*
* When the full account is reloaded or a large number of server notifications arrives at
* once, the second parameter will be NULL.
*
* The SDK retains the ownership of the MegaSetList in the second parameter. The list and
* all the MegaSet objects that it contains will be valid until this function returns. If
* you want to save the list, use MegaSetList::copy. If you want to save only some of the
* MegaSet objects, use MegaSet::copy for them.
*
* @param api MegaApi object connected to the account
* @param sets List that contains the new or updated Sets
*/
virtual void onSetsUpdate(MegaApi* api, MegaSetList* sets);
/**
* @brief This function is called when a Set-Element has been updated (created / updated /
* removed)
*
* When the full account is reloaded or a large number of server notifications arrives at
* once, the second parameter will be NULL.
*
* The SDK retains the ownership of the MegaSetElementList in the second parameter. The list
* and all the MegaSetElement objects that it contains will be valid until this function
* returns. If you want to save the list, use MegaSetElementList::copy. If you want to save
* only some of the MegaSetElement objects, use MegaSetElement::copy for them.
*
* @param api MegaApi object connected to the account
* @param elements List that contains the new or updated Set-Elements
*/
virtual void onSetElementsUpdate(MegaApi* api, MegaSetElementList* elements);
/**
* @brief This function is called when there are new or updated contact requests in the account
*
* When the full account is reloaded or a large number of server notifications arrives at once, the
* second parameter will be NULL.
*
* The SDK retains the ownership of the MegaContactRequestList in the second parameter. The list and all the
* MegaContactRequest objects that it contains will be valid until this function returns. If you want to save the
* list, use MegaContactRequestList::copy. If you want to save only some of the MegaContactRequest objects, use MegaContactRequest::copy
* for them.
*
* @param api MegaApi object connected to the account
* @param requests List that contains the new or updated contact requests
*/
virtual void onContactRequestsUpdate(MegaApi* api, MegaContactRequestList* requests);
/**
* @brief This function is called when seqTag updates.
*
* Used for synchronization of state between webclient and app on the same device
* Subject to significatnt alterations in future as this is based on internal implementation details.
*
* @param api MegaApi object connected to the account
* @param seqTag The string representing the sequence tag. (ownership stays with the SDK)
*/
virtual void onSeqTagUpdate(MegaApi* api, const std::string* seqTag);
#ifdef ENABLE_SYNC
/**
* @brief This function is called with the state of the synchronization engine has changed
*
* You can call MegaApi::isScanning and MegaApi::isWaiting to know the global state
* of the synchronization engine.
*
* @param api MegaApi object related to the event
*/
virtual void onGlobalSyncStateChanged(MegaApi* api);
#endif
#ifdef ENABLE_CHAT
/**
* @brief This function is called when there are new or updated chats
*
* When the full account is reloaded or a large number of server notifications arrives at
* once, the second parameter will be NULL.
*
* This callback is also used to initialize the list of chats available during the
* fetchnodes request.
*
* The SDK retains the ownership of the MegaTextChatList in the second parameter. The list
* and all the MegaTextChat objects that it contains will be valid until this function
* returns. If you want to save the list, use MegaTextChatList::copy. If you want to save
* only some of the MegaTextChat objects, use MegaTextChat::copy for those objects.
*
* @param api MegaApi object connected to the account
* @param chats List that contains the new or updated chats
*/
virtual void onChatsUpdate(MegaApi* api, MegaTextChatList *chats);
#endif
/**
* The details about the event, including the event type and any additional information,
* are received in the \c params parameter.
*
* You can check the type of event by calling MegaEvent::getType. Refer to the method
* documentation for details on the parameters that can be notified and how to access them.
*
* The SDK retains ownership of the event details (\c event).
* Do not use them after this function returns.
*
* @param api MegaApi object connected to the account
* @param event Details about the event
*/
virtual void onEvent(MegaApi* api, MegaEvent *event);
/**
* @brief This function is called when external drives are connected or disconnected
*
* The SDK retains the ownership of the char* in the third parameter, which will be valid until this function returns.
*
* @param api MegaApi object connected to the account
* @param present Indicator of the drive status after this change (true: drive was connected; false: drive was disconnected)
* @param rootPathInUtf8 Root path of the drive that determined this change (i.e. "D:", "/mnt/usbdrive")
*/
virtual void onDrivePresenceChanged(MegaApi* api, bool present, const char* rootPathInUtf8);
virtual ~MegaGlobalListener();
};
/**
* @brief Interface to get all information related to a MEGA account
*
* Implementations of this interface can receive all events (request, transfer, global) and two
* additional events related to the synchronization engine. The SDK will provide a new interface
* to get synchronization events separately in future updates-
*
* Multiple inheritance isn't used for compatibility with other programming languages
*
* The implementation will receive callbacks from an internal worker thread.
*
*/
class MegaListener
{
public:
/**
* @brief This function is called when a request is about to start being processed
*
* The SDK retains the ownership of the request parameter.
* Don't use it after this functions returns.
*
* The api object is the one created by the application, it will be valid until
* the application deletes it.
*
* @param api MegaApi object that started the request
* @param request Information about the request
*/
virtual void onRequestStart(MegaApi* api, MegaRequest *request);
/**
* @brief This function is called when a request has finished
*
* There won't be more callbacks about this request.
* The last parameter provides the result of the request. If the request finished without problems,
* the error code will be API_OK
*
* The SDK retains the ownership of the request and error parameters.
* Don't use them after this functions returns.
*
* The api object is the one created by the application, it will be valid until
* the application deletes it.
*
* @param api MegaApi object that started the request
* @param request Information about the request
* @param e Error information
*/
virtual void onRequestFinish(MegaApi* api, MegaRequest *request, MegaError* e);
/**
* @brief This function is called to inform about the progres of a request
*
* Currently, this callback is only used for fetchNodes (MegaRequest::TYPE_FETCH_NODES) requests
*
* The SDK retains the ownership of the request parameter.
* Don't use it after this functions returns.
*
* The api object is the one created by the application, it will be valid until
* the application deletes it.
*
*
* @param api MegaApi object that started the request
* @param request Information about the request
* @see MegaRequest::getTotalBytes MegaRequest::getTransferredBytes
*/
virtual void onRequestUpdate(MegaApi*api, MegaRequest *request);
/**
* @brief This function is called when there is a temporary error processing a request
*
* The request continues after this callback, so expect more MegaRequestListener::onRequestTemporaryError or
* a MegaRequestListener::onRequestFinish callback
*
* The SDK retains the ownership of the request and error parameters.
* Don't use them after this functions returns.
*
* The api object is the one created by the application, it will be valid until
* the application deletes it.
*
* @param api MegaApi object that started the request
* @param request Information about the request
* @param error Error information
*/
virtual void onRequestTemporaryError(MegaApi *api, MegaRequest *request, MegaError* error);
/**
* @brief This function is called when a transfer is about to start being processed
*
* The SDK retains the ownership of the transfer parameter.
* Don't use it after this functions returns.
*
* The api object is the one created by the application, it will be valid until
* the application deletes it.
*
* @param api MegaApi object that started the request
* @param transfer Information about the transfer
*/
virtual void onTransferStart(MegaApi *api, MegaTransfer *transfer);
/**
* @brief This function is called when a transfer has finished
*
* The SDK retains the ownership of the transfer and error parameters.
* Don't use them after this functions returns.
*
* The api object is the one created by the application, it will be valid until
* the application deletes it.
*
* There won't be more callbacks about this transfer.
* The last parameter provides the result of the transfer. If the transfer finished without problems,
* the error code will be API_OK
*
* In case that we are uploading a file into an incoming share, and our write permissions over the share
* are revoked before the transfer has finished, API will put the node into our rubbish-bin.
*
* @param api MegaApi object that started the transfer
* @param transfer Information about the transfer
* @param error Error information
*/
virtual void onTransferFinish(MegaApi* api, MegaTransfer *transfer, MegaError* error);
/**
* @brief This function is called to inform about the progress of a transfer
*
* The SDK retains the ownership of the transfer parameter.
* Don't use it after this functions returns.
*
* The api object is the one created by the application, it will be valid until
* the application deletes it.
*
* @param api MegaApi object that started the transfer
* @param transfer Information about the transfer
*
* In case this transfer represents a recursive operation (folder upload/download) SDK will
* notify apps about the stages transition.
*
* Current recursive operation stage can be retrieved with method MegaTransfer::getStage.
* This method returns the following values:
* - MegaTransfer::STAGE_SCAN = 1
* - MegaTransfer::STAGE_CREATE_TREE = 2
* - MegaTransfer::STAGE_TRANSFERRING_FILES = 3
* For more information about stages refer to MegaTransfer::getStage
*
* @see MegaTransfer::getTransferredBytes, MegaTransfer::getSpeed, MegaTransfer::getStage
*/
virtual void onTransferUpdate(MegaApi *api, MegaTransfer *transfer);
/**
* @brief This function is called when there is a temporary error processing a transfer
*
* The transfer continues after this callback, so expect more MegaTransferListener::onTransferTemporaryError or
* a MegaTransferListener::onTransferFinish callback
*
* The SDK retains the ownership of the transfer and error parameters.
* Don't use them after this functions returns.
*
* If the error code is API_EOVERQUOTA we need to call to MegaTransfer::isForeignOverquota to determine if
* our own storage, or a foreign storage is in overquota. If MegaTransfer::isForeignOverquota returns true
* a foreign storage is in overquota, otherwise our own storage is in overquota.
*
* @param api MegaApi object that started the transfer
* @param transfer Information about the transfer
* @param error Error information
*/
virtual void onTransferTemporaryError(MegaApi *api, MegaTransfer *transfer, MegaError* error);
/**
* @brief This function is called when there are new or updated contacts in the account
*
* When the full account is reloaded or a large number of server notifications arrives at
* once, the second parameter will be NULL.
*
* The SDK retains the ownership of the MegaUserList in the second parameter. The list and
* all the MegaUser objects that it contains will be valid until this function returns. If
* you want to save the list, use MegaUserList::copy. If you want to save only some of the
* MegaUser objects, use MegaUser::copy for those objects.
*
* @param api MegaApi object connected to the account
* @param users List that contains the new or updated contacts
*/
virtual void onUsersUpdate(MegaApi* api, MegaUserList *users);
/**
* @brief This function is called when there are new or updated user alerts in the account
*
* When there is a problem parsing the incoming information from the server or the full
* account is reloaded or a large number of server notifications arrives at once, the second
* parameter will be NULL.
*
* The SDK retains the ownership of the MegaUserAlertList in the second parameter. The list
* and all the MegaUserAlert objects that it contains will be valid until this function
* returns. If you want to save the list, use MegaUserAlertList::copy. If you want to save
* only some of the MegaUserAlert objects, use MegaUserAlert::copy for those objects.
*
* @param api MegaApi object connected to the account
* @param alerts List that contains the new or updated alerts
*/
virtual void onUserAlertsUpdate(MegaApi* api, MegaUserAlertList *alerts);
/**
* @brief This function is called when there are new or updated nodes in the account
*
* When the full account is reloaded or a large number of server notifications arrives at once, the
* second parameter will be NULL.
*
* The SDK retains the ownership of the MegaNodeList in the second parameter. The list and all the
* MegaNode objects that it contains will be valid until this function returns. If you want to save the
* list, use MegaNodeList::copy. If you want to save only some of the MegaNode objects, use MegaNode::copy
* for those nodes.
*
* @param api MegaApi object connected to the account
* @param nodes List that contains the new or updated nodes
*/
virtual void onNodesUpdate(MegaApi* api, MegaNodeList *nodes);
/**
* @brief This function is called when the account has been updated (upgraded/downgraded)
*
* @param api MegaApi object connected to the account
*/
virtual void onAccountUpdate(MegaApi *api);
/**
* @brief This function is called when a Set has been updated (created / updated / removed)
*
* When the full account is reloaded or a large number of server notifications arrives at
* once, the second parameter will be NULL.
*
* The SDK retains the ownership of the MegaSetList in the second parameter. The list and
* all the MegaSet objects that it contains will be valid until this function returns. If
* you want to save the list, use MegaSetList::copy. If you want to save only some of the
* MegaSet objects, use MegaSet::copy for them.
*
* @param api MegaApi object connected to the account
* @param sets List that contains the new or updated Sets
*/
virtual void onSetsUpdate(MegaApi* api, MegaSetList* sets);
/**
* @brief This function is called when a Set-Element has been updated (created / updated /
* removed)
*
* When the full account is reloaded or a large number of server notifications arrives at
* once, the second parameter will be NULL.
*
* The SDK retains the ownership of the MegaSetElementList in the second parameter. The list
* and all the MegaSetElement objects that it contains will be valid until this function
* returns. If you want to save the list, use MegaSetElementList::copy. If you want to save
* only some of the MegaSetElement objects, use MegaSetElement::copy for them.
*
* @param api MegaApi object connected to the account
* @param elements List that contains the new or updated Set-Elements
*/
virtual void onSetElementsUpdate(MegaApi* api, MegaSetElementList* elements);
/**
* @brief This function is called when there are new or updated contact requests in the account
*
* When the full account is reloaded or a large number of server notifications arrives at once, the
* second parameter will be NULL.
*
* The SDK retains the ownership of the MegaContactRequestList in the second parameter. The list and all the
* MegaContactRequest objects that it contains will be valid until this function returns. If you want to save the
* list, use MegaContactRequestList::copy. If you want to save only some of the MegaContactRequest objects, use MegaContactRequest::copy
* for them.
*
* @param api MegaApi object connected to the account
* @param requests List that contains the new or updated contact requests
*/
virtual void onContactRequestsUpdate(MegaApi* api, MegaContactRequestList* requests);
#ifdef ENABLE_SYNC
/**
* @brief This function is called when the state of a synced file or folder changes
*
* Possible values for the state are:
* - MegaApi::STATE_SYNCED = 1
* The file is synced with the MEGA account
*
* - MegaApi::STATE_PENDING = 2
* The file isn't synced with the MEGA account. It's waiting to be synced.
*
* - MegaApi::STATE_SYNCING = 3
* The file is being synced with the MEGA account
*
* The SDK retains the ownership of the sync and localPath parameters.
* Don't use them after this functions returns.
*
* @param api MegaApi object that is synchronizing files
* @param sync MegaSync object manages the file
* @param localPath Local path of the file or folder
* @param newState New state of the file
*/
virtual void onSyncFileStateChanged(MegaApi *api, MegaSync *sync, std::string *localPath, int newState);
/**
* @brief This callback will be called when a sync is added
*
* The SDK will call this after loading (and attempt to resume) syncs from cache or whenever a new
* Synchronization is configured.
*
* Notice that adding a sync will not cause onSyncStateChanged to be called.
*
* The SDK retains the ownership of the sync parameter.
* Don't use it after this functions returns.
*
* @param sync MegaSync object representing a sync
* @param api MegaApi object that is synchronizing files
* @param additionState conditions in which the sync is added
*/
virtual void onSyncAdded(MegaApi *api, MegaSync *sync);
/**
* @brief This callback will be called when a sync is removed.
*
* This entail that the sync is completely removed from cache
*
* The SDK retains the ownership of the sync parameter.
* Don't use it after this functions returns.
*
* @param api MegaApi object that is synchronizing files
* @param sync MegaSync object representing a sync
*/
virtual void onSyncDeleted(MegaApi *api, MegaSync *sync);
/**
* @brief This function is called when the state of the synchronization changes
*
* The SDK calls this function when the state of the synchronization changes. you can use
* MegaSync::getRunState to get the new state of the synchronization
* and MegaSync::getError to get the error if any.
*
* The SDK retains the ownership of the sync parameter.
* Don't use it after this functions returns.
*
* @param api MegaApi object that is synchronizing files
* @param sync MegaSync object that has changed its state
*/
virtual void onSyncStateChanged(MegaApi *api, MegaSync *sync);
/**
* @brief This function is called when there is an update on
* the number of nodes or transfers in the sync
*
* The SDK retains the ownership of the MegaSyncStats.
* Don't use it after this functions returns. But you can copy it
*
* @param api MegaApi object that is synchronizing files
* @param syncStats Identifies the sync and provides the counts
*/
virtual void onSyncStatsUpdated(MegaApi *api, MegaSyncStats* syncStats);
/**
* @brief This function is called with the state of the synchronization engine has changed
*
* You can call MegaApi::isScanning and MegaApi::isWaiting to know the global state
* of the synchronization engine.
*
* @param api MegaApi object related to the event
*/
virtual void onGlobalSyncStateChanged(MegaApi* api);
/**
* @brief This function is called when the root in the cloud of the sync has changed.
*
* You can use MegaSync::getLastKnownMegaFolder to get the new root in the cloud.
*
* @note This method will be called if the change doesn't imply a change in the state of the
* sync or any additional errors.
*
* The SDK retains the ownership of the sync parameter.
* Don't use it after this functions returns.
*
* @param api MegaApi object that is synchronizing files
* @param sync MegaSync object that has changed its remote root node
*/
virtual void onSyncRemoteRootChanged(MegaApi* api, MegaSync* sync);
#endif
/**
* @brief This function is called when the state of the backup changes
*
* The SDK calls this function when the state of the backup changes, for example
* from 'active' to 'ongoing' or 'removing exceeding'.
*
* You can use MegaScheduledCopy::getState to get the new state.
*
* @param api MegaApi object that is backing up files
* @param backup MegaScheduledCopy object that has changed the state
*/
virtual void onBackupStateChanged(MegaApi *api, MegaScheduledCopy *backup);
/**
* @brief This function is called when a backup is about to start being processed
*
* The SDK retains the ownership of the backup parameter.
* Don't use it after this functions returns.
*
* The api object is the one created by the application, it will be valid until
* the application deletes it.
*
* @param api MegaApi object that started the backup
* @param backup Information about the backup
*/
virtual void onBackupStart(MegaApi *api, MegaScheduledCopy *backup);
/**
* @brief This function is called when a backup has finished
*
* The SDK retains the ownership of the backup and error parameters.
* Don't use them after this functions returns.
*
* The api object is the one created by the application, it will be valid until
* the application deletes it.
*
* There won't be more callbacks about this backup.
* The last parameter provides the result of the backup. If the backup finished without problems,
* the error code will be API_OK
*
* @param api MegaApi object that started the backup
* @param backup Information about the backup
* @param error Error information
*/
virtual void onBackupFinish(MegaApi* api, MegaScheduledCopy *backup, MegaError* error);
/**
* @brief This function is called to inform about the progress of a backup
*
* The SDK retains the ownership of the backup parameter.
* Don't use it after this functions returns.
*
* The api object is the one created by the application, it will be valid until
* the application deletes it.
*
* @param api MegaApi object that started the backup
* @param backup Information about the backup
*
* @see MegaScheduledCopy::getTransferredBytes, MegaScheduledCopy::getSpeed
*/
virtual void onBackupUpdate(MegaApi *api, MegaScheduledCopy *backup);
/**
* @brief This function is called when there is a temporary error processing a backup
*
* The backup continues after this callback, so expect more MegaScheduledCopyListener::onBackupTemporaryError or
* a MegaScheduledCopyListener::onBackupFinish callback
*
* The SDK retains the ownership of the backup and error parameters.
* Don't use them after this functions returns.
*
* @param api MegaApi object that started the backup
* @param backup Information about the backup
* @param error Error information
*/
virtual void onBackupTemporaryError(MegaApi *api, MegaScheduledCopy *backup, MegaError* error);
#ifdef ENABLE_CHAT
/**
* @brief This function is called when there are new or updated chats
*
* When the full account is reloaded or a large number of server notifications arrives at once,
* the second parameter will be NULL.
*
* The SDK retains the ownership of the MegaTextChatList in the second parameter. The list and
* all the MegaTextChat objects that it contains will be valid until this function returns. If
* you want to save the list, use MegaTextChatList::copy. If you want to save only some of the
* MegaTextChat objects, use MegaTextChat::copy for those objects.
*
* @param api MegaApi object connected to the account
* @param chats List that contains the new or updated chats
*/
virtual void onChatsUpdate(MegaApi* api, MegaTextChatList* chats);
#endif
/**
* The details about the event, including the event type and any additional information,
* are received in the \c params parameter.
*
* You can check the type of event by calling MegaEvent::getType. Refer to the method
* documentation for details on the parameters that can be notified and how to access them.
*
* The SDK retains ownership of the event details (\c event).
* Do not use them after this function returns.
*
* @param api MegaApi object connected to the account
* @param event Details about the event
*/
virtual void onEvent(MegaApi* api, MegaEvent* event);
virtual ~MegaListener();
/**
* @brief
* Called when a mount is being added to the database.
*
* @param api
* The API instance where the mount is being added.
*
* @param path
* A path identifying the mount that was added.
*
* @param megaMountResult
* An element of the MegaMount::Result enumeration.
*/
virtual void onMountAdded(MegaApi* api, const char* path, int megaMountResult);
/**
* @brief
* Called when a mount's flags are being changed.
*
* @param api
* The API instance where the mount is being added.
*
* @param path
* A path identifying the mount that has changed.
*
* @param megaMountResult
* An element of the MegaMount::Result enumeration.
*/
virtual void onMountChanged(MegaApi* api, const char* path, int megaMountResult);
/**
* @brief
* Called when a mount is being disabled.
*
* @param api
* The API instance where the mount is being added.
*
* @param path
* A path identifying the mount that has been disabled.
*
* @param megaMountResult
* An element of the MegaMount::Result enumeration.
*/
virtual void onMountDisabled(MegaApi* api, const char* path, int megaMountResult);
/**
* @brief
* Called when a mount is being enabled.
*
* @param api
* The API instance where the mount is being enabled.
*
* @param path
* A path identifying the mount that has been enabled.
*
* @param megaMountResult
* An element of the MegaMount::Result enumeration.
*/
virtual void onMountEnabled(MegaApi* api, const char* path, int megaMountResult);
/**
* @brief
* Called when a mount is being removed from the database.
*
* @param api
* The API instance where the mount is being removed.
*
* @param path
* A path identifying the mount that has been removed.
*
* @param megaMountResult
* An element of the MegaMount::Result enumeration.
*/
virtual void onMountRemoved(MegaApi* api, const char* path, int megaMountResult);
};
/**
* @brief Stores information about a background photo/video upload, used in iOS to take advantage of power saving features
*
* This object can be serialised so it can be stored in case your app is unloaded by its OS, and the background operation
* completed afterward.
*
*/
class MegaBackgroundMediaUpload
{
protected:
MegaBackgroundMediaUpload();
public:
/**
* @brief Initial step to upload a photo/video via iOS low-power background upload feature
*
* Creates an object which can be used to encrypt a media file, and upload it outside of the SDK,
* eg. in order to take advantage of a particular platform's low power background upload functionality.
*
* You take ownership of the returned value.
*
* @param api The MegaApi the new object will be used with. It must live longer than the new object.
* @return A pointer to an object that keeps some needed state through the process of
* uploading a media file via iOS low power background uploads (or similar).
*/
static MegaBackgroundMediaUpload* createInstance(MegaApi *api);
/**
* @brief Extract mediainfo information about the photo or video.
*
* Call this function once with the file to be uploaded. It uses mediainfo to extract information that will
* help other clients to show or to play the files. The information is stored in this object until the whole
* operation completes.
*
* Call MegaApi::ensureMediaInfo first in order prepare the library to attach file attributes
* that enable videos to be identified and played in the web browser.
*
* @param inputFilepath The file to analyse with MediaInfo.
* @return true if analysis was performed (and any relevant attributes stored ready for upload), false if mediainfo was not ready yet.
*/
virtual bool analyseMediaInfo(const char* inputFilepath);
/**
* @brief Encrypt the file or a portion of it
*
* Call this function once with the file to be uploaded. It uses mediainfo to extract information that will
* help the webclient show or play the file in various browsers. The information is stored in this object
* until the whole operation completes. The encrypted data is stored in a new file.
*
* In order to save space on mobile devices, this function can be called in such a way that the last portion
* of the file is encrypted (to a new file), and then that last portion of the file is removed by file truncation.
* That operation can be repeated until the file is completely encrypted, and only the encrypted version remains,
* and takes up the same amount of space on the device. The size of the portions must first be calculated by using
* the 'adjustsizeonly' parameter, and iterating from the start of the file, specifying the approximate sizes of the portions.
*
* Encryption is done by reading small pieces of the file, encrypting them, and outputting to the new file,
* so that RAM usage is not excessive.
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @param inputFilepath The file to encrypt a portion of (and the one that is ultimately being uploaded).
* @param startPos The index of the first byte of the file to encrypt
* @param length The number of bytes of the file to encrypt. The function will round this value up by up to 1MB to fit the
* MEGA internal chunking algorithm. The number of bytes actually encrypted and stored in the new file is the updated number.
* You can supply -1 as input to request the remainder file (from startPos) be encrypted.
* @param outputFilepath The name of the new file to create, and store the encrypted data in.
* @param adjustsizeonly If this is set true, then encryption is not performed, and only the length parameter is adjusted.
* This feature is to enable precalculating the exact sizes of the file portions for upload.
* @return If the function tries to encrypt and succeeds, the return value is the suffix to append to the URL when uploading this enrypted chunk.
* If adjustsizeonly was set, and the function succeeds, the return value will be non-NULL (and will need deallocation as usual).
* If the function fails, the return value is NULL, and an error will have been logged.
*/
virtual char *encryptFile(const char* inputFilepath, int64_t startPos, int64_t* length, const char* outputFilepath, bool adjustsizeonly);
/**
* @brief Retrieves the value of the uploadURL once it has been successfully requested via MegaApi::backgroundMediaUploadRequestUploadURL
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @return The URL to upload to (after appending the suffix), if one has been received. Otherwise NULL.
*/
virtual char *getUploadURL();
/**
* @brief Attach a thumbnail by its file attribute handle.
*
* The thumbnail will implictly be attached to the node created as part of MegaApi::backgroundMediaUploadComplete.
* The thumbnail file attibrute must have been obtained by MegaApi::putThumbnail.
* If the result of MegaApi::putThumbnail is not available by the time MegaApi::backgroundMediaUploadComplete
* is called, it can be attached to the node later using MegaApi::setThumbnailByHandle.
*
* @param h The handle obtained via MegaApi::putThumbnail
*/
virtual void setThumbnail(MegaHandle h);
/**
* @brief Attach a preview by its file attribute handle.
*
* The preview will implictly be attached to the node created as part of MegaApi::backgroundMediaUploadComplete.
* The preview file attibrute must have been obtained by MegaApi::putPreview.
* If the result of MegaApi::putPreview is not available by the time MegaApi::backgroundMediaUploadComplete
* is called, it can be attached to the node later using MegaApi::setPreviewByHandle.
*
* @param h The handle obtained via MegaApi::putPreview
*/
virtual void setPreview(MegaHandle h);
/**
* @brief Sets the GPS coordinates for the node
*
* The node created via MegaApi::backgroundMediaUploadComplete will gain these coordinates as part of the
* node creation. If the unshareable flag is set, the coodinates are encrypted in a way that even if the
* node is later shared, the GPS coordinates cannot be decrypted by a different account.
*
* @param latitude The GPS latitude
* @param longitude The GPS longitude
* @param unshareable Set this true to prevent the coordinates being readable by other accounts.
*/
virtual void setCoordinates(double latitude, double longitude, bool unshareable);
/**
* @brief Turns the data stored in this object into a base 64 encoded string.
*
* The object can then be recreated via MegaBackgroundMediaUpload::unserialize and supplying the returned string.
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @return serialized version of this object (including URL, mediainfo attributes, and internal data suitable to resume uploading with in future)
*/
virtual char *serialize();
/**
* @brief Get back the needed MegaBackgroundMediaUpload after the iOS app exited and restarted
*
* In case the iOS app exits while a background upload is going on, and the app is started again
* to complete the operation, call this function to recreate the MegaBackgroundMediaUpload object
* needed for a call to MegaApi::backgroundMediaUploadComplete. The object must have been serialised
* before the app was unloaded by using MegaBackgroundMediaUpload::serialize.
*
* You take ownership of the returned value.
*
* @param data The string the object was serialized to previously.
* @param api The MegaApi this object will be used with. It must live longer than this object.
* @return A pointer to a new MegaBackgroundMediaUpload with all fields set to the data that was
* stored in the serialized string.
*/
static MegaBackgroundMediaUpload* unserialize(const char* data, MegaApi* api);
/**
* @brief Destructor
*/
virtual ~MegaBackgroundMediaUpload();
};
class MegaInputStream
{
public:
virtual int64_t getSize();
virtual bool read(char *buffer, size_t size);
virtual ~MegaInputStream();
};
/**
* @brief Store filtering options used in searches @see MegaApi::search, MegaApi::getChildren.
*
*/
class MegaSearchFilter
{
protected:
MegaSearchFilter();
public:
// A helper enum for filtering boolean fields
enum
{
BOOL_FILTER_DISABLED = 0,
BOOL_FILTER_ONLY_TRUE,
BOOL_FILTER_ONLY_FALSE,
};
/**
* @brief Creates a new instance of MegaSearchFilter
* @return A pointer of current type, a superclass of the private object
*/
static MegaSearchFilter* createInstance();
/**
* @brief Create a copy of this instance.
*
* The resulted instance is fully independent of the source instance,
* it contains a copy of all internal attributes, so it will be valid after
* the original instance was deleted.
*
* You are the owner of the returned instance
*
* @return Copy of the current instance
*/
virtual MegaSearchFilter* copy() const;
virtual ~MegaSearchFilter();
/**
* @brief Set option for filtering by name.
*
* @param searchString Contains a name or an expression using wildcards.
*/
virtual void byName(const char* searchString);
/**
* @brief Set option for filtering by predefined node types.
* If not set, it will behave as MegaNode::TYPE_UNKNOWN was used.
*
* @param nodeType Type of nodes requested in the search
* Valid values for this parameter are (invalid values will be ignored):
* - MegaNode::TYPE_UNKNOWN = -1 --> all types
* - MegaNode::TYPE_FILE = 0
* - MegaNode::TYPE_FOLDER = 1
*/
virtual void byNodeType(int nodeType);
/**
* @brief Set option for filtering by predefined file categories.
* If not set, it will behave as FILE_TYPE_DEFAULT was used.
* When set to a valus different than FILE_TYPE_DEFAULT it will search only for files.
*
* @param mimeType Category of files requested in the search
* Valid values for this parameter are (invalid values will be ignored):
* - MegaApi::FILE_TYPE_DEFAULT = 0 --> no particular category, include folders too
* - MegaApi::FILE_TYPE_PHOTO = 1
* - MegaApi::FILE_TYPE_AUDIO = 2
* - MegaApi::FILE_TYPE_VIDEO = 3
* - MegaApi::FILE_TYPE_DOCUMENT = 4
* - MegaApi::FILE_TYPE_PDF = 5
* - MegaApi::FILE_TYPE_PRESENTATION = 6
* - MegaApi::FILE_TYPE_ARCHIVE = 7
* - MegaApi::FILE_TYPE_PROGRAM = 8
* - MegaApi::FILE_TYPE_MISC = 9
* - MegaApi::FILE_TYPE_SPREADSHEET = 10
* - MegaApi::FILE_TYPE_ALL_DOCS = 11 --> any of {DOCUMENT, PDF, PRESENTATION, SPREADSHEET}
* - MegaApi::FILE_TYPE_OTHERS = 12
* - MegaApi::FILE_TYPE_ALL_VISUAL_MEDIA = 13--> any of {PHOTO, VIDEO}
*/
virtual void byCategory(int mimeType);
/**
* @brief Set option for filtering out non favourite nodes.
* If not set, it will behave as if BOOL_FILTER_DISABLED was used.
*
* @param boolFilterOption Kind of boolean filter to apply.
* Valid values for this parameter are (invalid values will be ignored):
* - MegaSearchFilter::BOOL_FILTER_DISABLED = 0 --> Both favourites and non favourites are considered
* - MegaSearchFilter::BOOL_FILTER_ONLY_TRUE = 1 --> Only favourites
* - MegaSearchFilter::BOOL_FILTER_ONLY_FALSE = 2 --> Only non favourites
*/
virtual void byFavourite(int boolFilterOption);
/**
* @brief Sets the filter option for excluding sensitive nodes.
* If not set, it defaults to BOOL_FILTER_DISABLED.
*
* @note Due to compatibility reasons and the nature of the sensitive attribute, the behavior of
* this filter may appear counter-intuitive, especially compared to byFavourite. Summary:
* - Use BOOL_FILTER_ONLY_FALSE to get only nodes marked as sensitive.
* - The union of results using BOOL_FILTER_ONLY_TRUE and BOOL_FILTER_ONLY_FALSE
* differs from the results using BOOL_FILTER_DISABLED.
*
* @param boolFilterOption A tri-state variable determining the filter to apply.
* Valid values are (invalid values will be ignored):
* - MegaSearchFilter::BOOL_FILTER_DISABLED = 0 --> Considers all nodes.
* - MegaSearchFilter::BOOL_FILTER_ONLY_TRUE = 1 --> Returns only nodes not marked as sensitive
* and without any parent directory marked as sensitive.
* - MegaSearchFilter::BOOL_FILTER_ONLY_FALSE = 2 --> Returns only nodes marked as sensitive,
* i.e. node->isMarkedSensitive() == true.
*/
virtual void bySensitivity(int boolFilterOption);
/**
* @brief Set option for retrieving nodes below a particular ancestor.
* If not set, nodes will not be restricted to a particular ancestor.
*
* @note When called, it will cancel any previous setting done by calling byLocation().
*
* @param ancestorHandle Handle of an acestor to which the search will be restricted to
*/
virtual void byLocationHandle(MegaHandle ancestorHandle);
/**
* @brief Set option for searching nodes below predefined locations.
* If not set, it will behave like using SEARCH_TARGET_ALL.
*
* @note When called, it will cancel any previous setting done by calling byLocationHandle().
*
* @param locationType Location to which the search will be restricted to
* Valid values for this parameter are (invalid values will be ignored):
* - SEARCH_TARGET_INSHARE = 0
* - SEARCH_TARGET_OUTSHARE = 1
* - SEARCH_TARGET_PUBLICLINK = 2
* - SEARCH_TARGET_ROOTNODE = 3 --> search under Cloud and Vault rootnodes
* - SEARCH_TARGET_ALL = 4 --> by default search under Cloud, Vault, Rubbish and among INSHARE-s;
* if an ancestor was explicitly set via byLocationHandle(), search under that particular ancestor
*/
virtual void byLocation(int locationType);
/**
* @brief Set option for filtering out nodes created outside a defined time interval.
* If any of the passed values is 0 it will be ignored, and no filtering will be
* performed based on it.
*
* @param lowerLimit timestamp lower than any of the considered nodes.
* @param upperLimit timestamp greater than any of the considered nodes.
*/
virtual void byCreationTime(int64_t lowerLimit, int64_t upperLimit);
/**
* @brief Set option for filtering out nodes modified outside a defined time interval.
* If any of the passed values is 0 it will be ignored, and no filtering will be
* performed based on it.
* If any of the passed values is non-0, only nodes with valid modification time will
* be included in the results. For now only File nodes have modification time so only
* they will be included in the results.
*
* @param lowerLimit timestamp lower than any of the considered nodes.
* @param upperLimit timestamp greater than any of the considered nodes.
*/
virtual void byModificationTime(int64_t lowerLimit, int64_t upperLimit);
/**
* @brief Set option for filtering by contains in description.
*
* @param searchString Contains string to be searched at nodes description
*/
virtual void byDescription(const char* searchString);
/**
* @brief Set option for filtering by tag
*
* @note ',' is an invalid character, it shouldn't be used as part of searchString. If used,
* empty list will be returned
*
* @param searchString Contains string to be searched at nodes tags
*/
virtual void byTag(const char* searchString);
/**
* @brief Set the logical operator for filtering text related conditions
*
* @note This method sets the logical operator to be used between multiple search criteria
* (name, tags and description). The operator can either be `AND` or `OR` based on the
* input parameter.
*
* If not invoked, `AND` will be used as the default behavior.
*
* @param useAnd If true, the `AND` operator will be used between search criteria.
* If false, the `OR` operator will be used.
*/
virtual void useAndForTextQuery(bool useAnd);
/**
* @brief Return the string used for filtering by name.
*
* @return string set for filtering by name, or empty string ("") if not set
*/
virtual const char* byName() const;
/**
* @brief Return predefined node type used for filtering.
*
* @return predefined node type set for filtering, or MegaNode::TYPE_UNKNOWN if not set
*/
virtual int byNodeType() const;
/**
* @brief Return predefined category used for filtering.
*
* @return predefined category set for filtering, or FILE_TYPE_DEFAULT if not set
*/
virtual int byCategory() const;
/**
* @brief Return the option for filtering out non favourite nodes.
*
* @return option set for filtering out favourite nodes, or BOOL_FILTER_DISABLED if not set
*/
virtual int byFavourite() const;
/**
* @brief Return the option for filtering out sensitive nodes.
*
* @return option set for filtering out sensitive nodes, or BOOL_FILTER_DISABLED if not set
*/
virtual int bySensitivity() const;
/**
* @brief Return ancestor handle set for restricting node search to.
*
* @return ancestor handle set for restricting node search to, or INVALID_HANDLE if not set
*/
virtual MegaHandle byLocationHandle() const;
/**
* @brief Return predefined location set for restricting node search to.
*
* @return predefined location set for restricting node search to, or SEARCH_TARGET_ALL if not set
*/
virtual int byLocation() const;
/**
* @brief Return lower limit creation timestamp set for restricting node search to.
*
* @return lower limit creation timestamp set for restricting node search to, or 0 if not set
*/
virtual int64_t byCreationTimeLowerLimit() const;
/**
* @brief Return upper limit creation timestamp set for restricting node search to.
*
* @return upper limit creation timestamp set for restricting node search to, or 0 if not set
*/
virtual int64_t byCreationTimeUpperLimit() const;
/**
* @brief Return lower limit modification timestamp set for restricting node search to.
*
* @return lower limit modification timestamp set for restricting node search to, or 0 if not set
*/
virtual int64_t byModificationTimeLowerLimit() const;
/**
* @brief Return upper limit modification timestamp set for restricting node search to.
*
* @return upper limit modification timestamp set for restricting node search to, or 0 if not set
*/
virtual int64_t byModificationTimeUpperLimit() const;
/**
* @brief Return the string used for filtering by description.
*
* @return string set for filtering by description, or empty string ("") if not set
*/
virtual const char* byDescription() const;
/**
* @brief Return the string used for filtering by tag.
*
* @return string set for filtering by tag, or empty string ("") if not set
*/
virtual const char* byTag() const;
/**
* @brief Get the current logical operator used for filtering text related conditions
*
* @return True if the `AND` operator is being used between search criteria,
* false if the `OR` operator is being used.
*/
virtual bool useAndForTextQuery() const;
};
/**
* @brief Store pagination options used in searches @see MegaApi::search, MegaApi::getChildren.
*
*/
class MegaSearchPage
{
protected:
MegaSearchPage();
public:
/**
* @brief Creates a new instance of MegaSearchPage
*
* @param startingOffset The first position in the list of results to be included in the returned page (starts from 0).
* @param size The maximum number of results included in the page, or 0 to return all (remaining) results
*
* @return A pointer of current type, a superclass of the private object
*/
static MegaSearchPage* createInstance(size_t startingOffset, size_t size);
/**
* @brief Create a copy of this instance.
*
* The resulted instance is fully independent of the source instance,
* it contains a copy of all internal attributes, so it will be valid after
* the original instance was deleted.
*
* You are the owner of the returned instance
*
* @return Copy of the current instance
*/
virtual MegaSearchPage* copy() const;
virtual ~MegaSearchPage();
/**
* @brief Return the first position in the list of results to be included in the returned page (starts from 0)
*
* @return first position in the list of results to be included in the returned page (starts from 0)
*/
virtual size_t startingOffset() const;
/**
* @brief Return the maximum number of results included in the page, or 0 to return all (remaining) results
*
* @return maximum number of results included in the page, or 0 to return all (remaining) results
*/
virtual size_t size() const;
};
class MegaNodeTree
{
protected:
MegaNodeTree() = default;
public:
virtual ~MegaNodeTree() = default;
static MegaNodeTree* createInstance(const MegaNodeTree* nodeTreeChild,
const char* name,
const char* s4AttributeValue,
const MegaCompleteUploadData* completeUploadData,
MegaHandle sourceHandle = INVALID_HANDLE);
virtual MegaNodeTree* getNodeTreeChild() const = 0;
virtual MegaHandle getNodeHandle() const = 0;
virtual MegaNodeTree* copy() const = 0;
};
class MegaCompleteUploadData
{
protected:
MegaCompleteUploadData() = default;
public:
virtual ~MegaCompleteUploadData() = default;
static MegaCompleteUploadData* createInstance(const char* fingerprint,
const char* string64UploadToken,
const char* string64FileKey);
virtual MegaCompleteUploadData* copy() const = 0;
};
/**
* @brief Store information of an A/B Test or a Feature flag
*
* @see MegaApi::getFlag.
*/
class MegaFlag
{
public:
virtual ~MegaFlag() = default;
/**
* @brief Possible flag types.
*/
enum // 1:1 with enum values from internal implementation
{
FLAG_TYPE_INVALID = 0,
FLAG_TYPE_AB_TEST = 1,
FLAG_TYPE_FEATURE = 2,
};
/**
* @brief Get the type of the flag
*
* @return The type of the flag. Possible values are any of the FLAG_TYPE_x values.
*/
virtual uint32_t getType() const = 0;
/**
* @brief Get the group of the flag
*
* @return The group of the flag. Any value greater than 0 means the flag is active.
*/
virtual uint32_t getGroup() const = 0;
};
class MegaApiImpl;
/**
* @brief Allows calling many synchronous operations on MegaApi without being blocked by SDK activity.
*
* Call MegaApi::getMegaApiLock() to get an instance of this class to use.
*/
class MegaApiLock
{
public:
/**
* @brief Lock the MegaApi if this instance does not currently have a lock on it yet.
*
* There is no harm in calling this more than once, the MegaApi will only be locked
* once, and the first unlock() call will release it. Sometimes it is useful eg.
* in a loop which may or may not need to use a locking function, or may need to use
* many, to call lockOnce() before any such usage, and know that the MegaApi will
* be locked once from that point, until the end of the loop (when unlockOnce() can
* be called, or the MegaApiLock destroyed.
*/
void lockOnce();
/**
* @brief Tries to lock the MegaApi if this instance does not currently have a lock on it yet.
*
* If the lock is succeeded in the expected time, the behaviour is the same as lockOnce().
*
* @param time Milliseconds to wait for locking
*
* @return if the locking succeded
*/
bool tryLockFor(long long time);
/**
* @brief Release the lock on the MegaApi if one is still held by this instance
*
* The MegaApi will be unable to continue work until all MegaApiLock objects release
* their locks. Only use multiple of these if you need nested locking. The destructor
* of the object will release the lock, so it is sufficient to delete it when finished.
* However, when using it from a garbage collected language it may be prudent to call unlock() directly.
*
* This function must be called from the same thread that called MegaApiLock::lockOnce().
*/
void unlockOnce();
/**
* @brief Destructor. This will call unlock() if the MegaApi is still locked by this instance.
*/
~MegaApiLock();
private:
MegaApiImpl* api;
bool locked = false;
MegaApiLock(MegaApiImpl*, bool lock);
MegaApiLock(const MegaApiLock&) = delete;
void operator=(const MegaApiLock&) = delete;
friend class MegaApi;
};
/**
* @brief Optional parameters to customize an upload.
*/
class MegaUploadOptions
{
public:
MegaUploadOptions() = default;
static constexpr int64_t INVALID_CUSTOM_MOD_TIME = -1;
static constexpr char PITAG_TRIGGER_NOT_APPLICABLE = '.';
static constexpr char PITAG_TARGET_NOT_APPLICABLE = '.';
/**
* @brief Creates a new instance of MegaUploadOptions.
*
* The caller takes ownership of the returned pointer.
*/
static MegaUploadOptions* createInstance();
/**
* Custom file or folder name in MEGA.
* If empty, the name is taken from the local path.
*/
std::string fileName;
/**
* Custom modification time for files (seconds since epoch).
* Use MegaUploadOptions::INVALID_CUSTOM_MOD_TIME to keep the local mtime.
*/
int64_t mtime = INVALID_CUSTOM_MOD_TIME;
/**
* Custom app data associated with the transfer.
* Accessible via MegaTransfer::getAppData().
*/
const char* appData = nullptr;
/**
* If true, the SDK deletes the local file when the upload finishes.
* Intended for temporary files only.
*/
bool isSourceTemporary = false;
/**
* If true, the upload is put on top of the upload queue.
*/
bool startFirst = false;
/**
* One-byte upload trigger tag (see PITAG_TRIGGER_*).
*/
char pitagTrigger = PITAG_TRIGGER_NOT_APPLICABLE;
/**
* Indicate if the upload is done to a chat
*/
bool isChatUpload = false;
/**
* One-byte upload target tag (see PITAG_TARGET_*).
* Allows specifying destinations such as chat uploads.
* Apps uploading to chats should set the appropriate chat target (c, C, or s);
* for other uploads keep the default value to avoid interfering with internal logic.
*/
char pitagTarget = PITAG_TARGET_NOT_APPLICABLE;
};
/**
* @brief Allows to control a MEGA account or a shared folder
*
* You can enable local node caching by passing a local path in the constructor of this class. That saves many data usage
* and many time starting your app because the entire filesystem won't have to be downloaded each time. The persistent
* node cache will only be loaded by logging in with a session key. To take advantage of this feature, apart of passing the
* local path to the constructor, your application have to save the session key after login (MegaApi::dumpSession) and use
* it to log in the next time. This is highly recommended also to enhance the security, because in this was the access password
* doesn't have to be stored by the application.
*
* To access MEGA using this SDK, you have to create an object of this class and use one of the MegaApi::login options (to log in
* to a MEGA account or a public folder). If the login request succeed, you must call MegaApi::fetchNodes to get the filesystem in MEGA.
* After successfully completing that request, you can use all other functions, manage the files and start transfers.
*
* After using MegaApi::logout you can reuse the same MegaApi object to log in to another MEGA account or a public folder.
*
* Some functions in this class return a pointer and give you the ownership. In all of them, memory allocations
* are made using new (for single objects) and new[] (for arrays) so you should use delete and delete[] to free them.
*/
class MegaApi
{
public:
enum
{
CLIENT_TYPE_DEFAULT = 0,
CLIENT_TYPE_VPN,
CLIENT_TYPE_PASSWORD_MANAGER,
};
enum
{
STATE_NONE = 0,
STATE_SYNCED,
STATE_PENDING,
STATE_SYNCING,
STATE_IGNORED
};
enum {
LOG_LEVEL_FATAL = 0, // Very severe error event that will presumably lead the application to abort.
LOG_LEVEL_ERROR, // Error information but will continue application to keep running.
LOG_LEVEL_WARNING, // Information representing errors in application but application will keep running
LOG_LEVEL_INFO, // Mainly useful to represent current progress of application.
LOG_LEVEL_DEBUG, // Informational logs, that are useful for developers. Only applicable if DEBUG is defined.
LOG_LEVEL_VERBOSE,
LOG_LEVEL_MAX = LOG_LEVEL_VERBOSE
};
enum {
ATTR_TYPE_THUMBNAIL = 0,
ATTR_TYPE_PREVIEW = 1
};
enum {
USER_ATTR_UNKNOWN = -1,
USER_ATTR_AVATAR = 0, // public - char array
USER_ATTR_FIRSTNAME = 1, // public - char array
USER_ATTR_LASTNAME = 2, // public - char array
USER_ATTR_AUTHRING = 3, // private - byte array
USER_ATTR_LAST_INTERACTION = 4, // private - byte array
USER_ATTR_ED25519_PUBLIC_KEY = 5, // public - byte array
USER_ATTR_CU25519_PUBLIC_KEY = 6, // public - byte array
USER_ATTR_KEYRING = 7, // private - byte array
USER_ATTR_SIG_RSA_PUBLIC_KEY = 8, // public - byte array
USER_ATTR_SIG_CU255_PUBLIC_KEY = 9, // public - byte array
USER_ATTR_LANGUAGE = 14, // private - char array
USER_ATTR_PWD_REMINDER = 15, // private - char array
USER_ATTR_DISABLE_VERSIONS = 16, // private - byte array
USER_ATTR_CONTACT_LINK_VERIFICATION = 17, // private - byte array
USER_ATTR_RICH_PREVIEWS = 18, // private - byte array
USER_ATTR_RUBBISH_TIME = 19, // private - byte array
USER_ATTR_LAST_PSA = 20, // private - char array
USER_ATTR_STORAGE_STATE = 21, // private - char array
USER_ATTR_GEOLOCATION = 22, // private - byte array
USER_ATTR_CAMERA_UPLOADS_FOLDER = 23,// private - byte array
USER_ATTR_MY_CHAT_FILES_FOLDER = 24, // private - byte array
USER_ATTR_PUSH_SETTINGS = 25, // private - char array
// ATTR_UNSHAREABLE_KEY = 26 // it's internal for SDK, not exposed to apps
USER_ATTR_ALIAS = 27, // private - byte array
USER_ATTR_DEVICE_NAMES = 30, // private - byte array
USER_ATTR_MY_BACKUPS_FOLDER = 31, // protected - char array in B64 - non-versioned
// USER_ATTR_BACKUP_NAMES = 32, // (obsolete) private - byte array
USER_ATTR_COOKIE_SETTINGS = 33, // private - byte array - non-versioned
USER_ATTR_JSON_SYNC_CONFIG_DATA = 34,// private - byte array
// USER_ATTR_DRIVE_NAMES = 35, // (obsolete, merged with USER_ATTR_DEVICE_NAMES)
// private - byte array
USER_ATTR_NO_CALLKIT = 36, // private - byte array
USER_ATTR_APPS_PREFS = 38, // private - byte array - versioned
USER_ATTR_CC_PREFS = 39, // private - byte array - versioned
USER_ATTR_VISIBLE_WELCOME_DIALOG = 40, // private - non-encrypted - byte array - non-versioned
USER_ATTR_VISIBLE_TERMS_OF_SERVICE = 41, // private - non-encrypted - byte array - non-versioned
USER_ATTR_PWM_BASE = 42, // private non-encrypted (fully controlled by API) - char array in B64
USER_ATTR_ENABLE_TEST_NOTIFICATIONS = 43, // private - non-encrypted - char array - non-versioned
USER_ATTR_LAST_READ_NOTIFICATION = 44, // private - non-encrypted - char array - non-versioned
USER_ATTR_LAST_ACTIONED_BANNER = 45, // private - non-encrypted - char array - non-versioned
USER_ATTR_ENABLE_TEST_SURVEYS =
46, // private - non-encrypted - char array in B64 - non-versioned
// USER_ATTR_WELCOME_PDF_COPIED = 47, // (obsolete) private - non-encrypted - char array
ATTR_SYNC_DESIRED_STATE = 48, // private - byte array - versioned
USER_ATTR_S4 = 49, // private - non-encrypted - char array
USER_ATTR_S4_CONTAINER = 50, // private - non-encrypted - char array
USER_ATTR_DEV_OPT = 51, // private - encrypted - byte array
USER_ATTR_RECENT_CLEAR_TIMESTAMP =
52, // private - encrypted - byte array - non-versioned
};
enum {
NODE_ATTR_DURATION = 0,
NODE_ATTR_COORDINATES = 1,
NODE_ATTR_ORIGINALFINGERPRINT = 2,
NODE_ATTR_LABEL = 3,
NODE_ATTR_FAV = 4, // "fav"
NODE_ATTR_S4 = 5,
NODE_ATTR_SEN = 6, // "sen"
NODE_ATTR_DESCRIPTION = 7,
};
enum {
PAYMENT_METHOD_BALANCE = 0,
PAYMENT_METHOD_PAYPAL = 1,
PAYMENT_METHOD_ITUNES = 2,
PAYMENT_METHOD_GOOGLE_WALLET = 3,
PAYMENT_METHOD_BITCOIN = 4,
PAYMENT_METHOD_UNIONPAY = 5,
PAYMENT_METHOD_FORTUMO = 6,
PAYMENT_METHOD_STRIPE = 7, // credit-card (stripe)
PAYMENT_METHOD_CREDIT_CARD = 8,
PAYMENT_METHOD_CENTILI = 9,
PAYMENT_METHOD_PAYSAFE_CARD = 10,
PAYMENT_METHOD_ASTROPAY = 11,
PAYMENT_METHOD_RESERVED = 12, // TBD
PAYMENT_METHOD_WINDOWS_STORE = 13,
PAYMENT_METHOD_TPAY = 14,
PAYMENT_METHOD_DIRECT_RESELLER = 15,
PAYMENT_METHOD_ECP = 16,
PAYMENT_METHOD_SABADELL = 17,
PAYMENT_METHOD_HUAWEI_WALLET = 18,
PAYMENT_METHOD_STRIPE2 = 19, // credit-card (stripe)
PAYMENT_METHOD_WIRE_TRANSFER = 999
};
enum {
TRANSFER_METHOD_NORMAL = 0,
TRANSFER_METHOD_ALTERNATIVE_PORT = 1,
TRANSFER_METHOD_AUTO = 2,
TRANSFER_METHOD_AUTO_NORMAL = 3,
TRANSFER_METHOD_AUTO_ALTERNATIVE = 4
};
enum {
PUSH_NOTIFICATION_ANDROID = 1,
PUSH_NOTIFICATION_IOS_VOIP = 2,
PUSH_NOTIFICATION_IOS_STD = 3,
PUSH_NOTIFICATION_ANDROID_HUAWEI = 4
};
enum {
PASSWORD_STRENGTH_VERYWEAK = 0,
PASSWORD_STRENGTH_WEAK = 1,
PASSWORD_STRENGTH_MEDIUM = 2,
PASSWORD_STRENGTH_GOOD = 3,
PASSWORD_STRENGTH_STRONG = 4
};
enum {
RETRY_NONE = 0,
RETRY_CONNECTIVITY = 1,
RETRY_SERVERS_BUSY = 2,
RETRY_API_LOCK = 3,
RETRY_RATE_LIMIT = 4,
// RETRY_LOCAL_LOCK = 5, // obsolete
RETRY_UNKNOWN = 6
};
enum {
KEEP_ALIVE_CAMERA_UPLOADS = 0
};
enum {
STORAGE_STATE_UNKNOWN = -9,
STORAGE_STATE_GREEN = 0,
STORAGE_STATE_ORANGE = 1,
STORAGE_STATE_RED = 2,
STORAGE_STATE_CHANGE = 3, /** @deprecated not notified any more */
STORAGE_STATE_PAYWALL = 4,
};
enum {
BUSINESS_STATUS_EXPIRED = -1,
BUSINESS_STATUS_INACTIVE = 0, // no business subscription
BUSINESS_STATUS_ACTIVE = 1,
BUSINESS_STATUS_GRACE_PERIOD = 2
};
enum {
AFFILIATE_TYPE_INVALID = 0, // legacy mode
AFFILIATE_TYPE_ID = 1,
AFFILIATE_TYPE_FILE_FOLDER = 2,
AFFILIATE_TYPE_CHAT = 3,
AFFILIATE_TYPE_CONTACT = 4,
};
enum {
ACCOUNT_NOT_BLOCKED = 0,
// ACCOUNT_BLOCKED_EXCESS_DATA_USAGE = 100, (obsolete)
ACCOUNT_BLOCKED_TOS_COPYRIGHT = 200, // suspended due to copyright violations
ACCOUNT_BLOCKED_TOS_NON_COPYRIGHT = 300, // suspended due to multiple breaches of MEGA ToS
ACCOUNT_BLOCKED_SUBUSER_DISABLED = 400, // subuser disabled by business administrator
ACCOUNT_BLOCKED_SUBUSER_REMOVED = 401, // subuser removed by business administrator
/* SMS verification was deprecated. This symbol is deprecated. Please don't use it in
* new code. */
ACCOUNT_BLOCKED_VERIFICATION_SMS = 500, // (deprecated)
ACCOUNT_BLOCKED_VERIFICATION_EMAIL = 700, // temporary blocked, require email verification
};
enum {
BACKUP_TYPE_INVALID = -1,
BACKUP_TYPE_TWO_WAY_SYNC = 0,
BACKUP_TYPE_UP_SYNC = 1,
BACKUP_TYPE_DOWN_SYNC = 2,
BACKUP_TYPE_CAMERA_UPLOADS = 3,
BACKUP_TYPE_MEDIA_UPLOADS = 4, // Android has a secondary CU
BACKUP_TYPE_BACKUP_UPLOAD = 5,
};
enum {
ADS_DEFAULT = 0x0, // If you don't want to set any overrides/flags, then please provide 0
ADS_FORCE_ADS = 0x200, // Force enable ads regardless of any other factors.
ADS_IGNORE_MEGA = 0x400, // Show ads even if the current user or file owner is a MEGA employee.
ADS_IGNORE_COUNTRY = 0x800, // Show ads even if the user is not within an enabled country.
ADS_IGNORE_IP = 0x1000, // Show ads even if the user is on a blacklisted IP (MEGA ips).
ADS_IGNORE_PRO = 0x2000, // Show ads even if the current user or file owner is a PRO user.
ADS_FLAG_IGNORE_ROLLOUT = 0x4000, // Ignore the rollout logic which only servers ads to 10% of users based on their IP.
};
enum
{
CREATE_ACCOUNT = 0,
RESUME_ACCOUNT = 1,
CANCEL_ACCOUNT = 2,
CREATE_EPLUSPLUS_ACCOUNT = 3,
RESUME_EPLUSPLUS_ACCOUNT = 4,
};
enum
{
CREATE_SET = (1 << 0),
OPTION_SET_NAME = (1 << 1),
OPTION_SET_COVER = (1 << 2),
};
enum
{
CREATE_ELEMENT = (1 << 0),
OPTION_ELEMENT_NAME = (1 << 1),
OPTION_ELEMENT_ORDER = (1 << 2),
};
enum
{
TAG_NODE_SET = 0,
TAG_NODE_REMOVE = 1,
TAG_NODE_UPDATE = 2,
};
enum
{
CREDIT_CARD_CANCEL_SUBSCRIPTIONS_CAN_CONTACT_NO = 0,
CREDIT_CARD_CANCEL_SUBSCRIPTIONS_CAN_CONTACT_YES = 1,
};
enum
{
IMPORT_PASSWORD_SOURCE_GOOGLE = 0,
};
enum
{
IMPORTED_PASSWORD_ERROR_PARSER = 1,
IMPORTED_PASSWORD_ERROR_MISSINGPASSWORD = 2,
IMPORTED_PASSWORD_ERROR_MISSINGNAME = 3,
IMPORTED_PASSWORD_ERROR_MISSING_TOTP_SHSE = 4,
IMPORTED_PASSWORD_ERROR_INVALID_TOTP_SHSE = 5,
IMPORTED_PASSWORD_ERROR_MISSING_TOTP_NDIGITS = 6,
IMPORTED_PASSWORD_ERROR_INVALID_TOTP_NDIGITS = 7,
IMPORTED_PASSWORD_ERROR_MISSING_TOTP_EXPTIME = 8,
IMPORTED_PASSWORD_ERROR_INVALID_TOTP_EXPTIME = 9,
IMPORTED_PASSWORD_ERROR_MISSING_TOTP_HASH_ALG = 10,
IMPORTED_PASSWORD_ERROR_INVALID_TOTP_HASH_ALG = 11,
IMPORTED_PASSWORD_ERROR_MISSING_CREDIT_CARD_NUMBER = 12,
IMPORTED_PASSWORD_ERROR_INVALID_CREDIT_CARD_NUMBER = 13,
IMPORTED_PASSWORD_ERROR_INVALID_CREDIT_CARD_CVV = 14,
IMPORTED_PASSWORD_ERROR_INVALID_CREDIT_CARD_EXPIRATION_DATE = 15,
};
enum
{
TRANSFER_STATS_DOWNLOAD = 0,
TRANSFER_STATS_UPLOAD = 1,
TRANSFER_STATS_BOTH = 2,
TRANSFER_STATS_MAX = TRANSFER_STATS_BOTH,
};
/**
* @enum ActionType
* @brief Enumeration representing different types of trigger actions for surveys.
*
* This enum is used to define actions that will trigger specific surveys.
* Each action is associated with a particular user activity.
*/
enum SurveyTriggerActionId
{
ACT_END_UPLOAD = 1,
ACT_END_MEETING = 2,
ACT_CLOSING_DOC = 3,
ACT_END_VIDEO = 4,
ACT_END_AUDIO = 5,
ACT_INIT_BACKUP = 6,
ACT_END_PHOTO_UPLOAD = 7,
ACT_END_ALBUM_UPLOAD = 8,
ACT_SHARE_FOLDER_FILE = 9,
};
enum
{
PWM_NODE_TYPE_PASSWORD = 1,
PWM_NODE_TYPE_CREDIT_CARD = 2,
};
enum
{
JSON_LOG_NONE = 0,
JSON_LOG_CHUNK_RECEIVED = 1,
JSON_LOG_CHUNK_PROCESSING = 1 << 1,
JSON_LOG_CHUNK_CONSUMED = 1 << 2,
JSON_LOG_SENDING = 1 << 3,
JSON_LOG_NONCHUNK_RECEIVED = 1 << 4,
};
/**
* @brief PITAG trigger codes exposed at API level.
*
* Maps 1:1 with PitagTrigger in types.h.
*/
static constexpr char PITAG_TRIGGER_NOT_APPLICABLE = '.';
static constexpr char PITAG_TRIGGER_PICKER = 'p';
static constexpr char PITAG_TRIGGER_DRAG_AND_DROP = 'd';
static constexpr char PITAG_TRIGGER_CAMERA = 'c';
static constexpr char PITAG_TRIGGER_SCANNER = 's';
static constexpr char PITAG_TRIGGER_SYNC_ALGORITHM = 'a';
static constexpr char PITAG_TRIGGER_SHARE_FROM_APP = 'S';
static constexpr char PITAG_TRIGGER_CAMERA_CAPTURE = 'C';
static constexpr char PITAG_TRIGGER_EXPLORER_EXTENSION = 'e';
/**
* @brief PITAG target codes exposed at API level.
*
* Maps 1:1 with PitagTarget in types.h.
* Apps uploading to chats should set the appropriate chat target (c, C, or s);
* for other uploads keep the default value to avoid interfering with internal logic.
*/
static constexpr char PITAG_TARGET_NOT_APPLICABLE = '.';
static constexpr char PITAG_TARGET_CLOUD_DRIVE = 'D';
static constexpr char PITAG_TARGET_CHAT_1TO1 = 'c';
static constexpr char PITAG_TARGET_CHAT_GROUP = 'C';
static constexpr char PITAG_TARGET_NOTE_TO_SELF = 's';
static constexpr char PITAG_TARGET_INCOMING_SHARE = 'i';
static constexpr char PITAG_TARGET_MULTIPLE_CHATS = 'M';
/**
* @brief Optional parameters to customize an upload.
*/
static constexpr int64_t INVALID_CUSTOM_MOD_TIME = -1;
static constexpr int CHAT_OPTIONS_EMPTY = 0;
static constexpr int MAX_NODE_DESCRIPTION_SIZE = 3000;
/**
* @brief Constructor suitable for most applications
*
* @param basePath Base path to store the local cache
* If you pass NULL to this parameter, the SDK will use the current working directory.
*
* @param userAgent User agent to use in network requests
* If you pass NULL to this parameter, a default user agent will be used
*
* @param workerThreadCount The number of worker threads for encryption or other operations
* Using worker threads means that synchronous function calls on MegaApi will be blocked
* less, and uploads and downloads can proceed more quickly on very fast connections.
*
* @param clientType Client type (default, VPN or Password Manager) enables SDK to function
* differently
*
*/
MegaApi(const char* appKey,
const char* basePath = NULL,
const char* userAgent = NULL,
unsigned workerThreadCount = 1,
int clientType = CLIENT_TYPE_DEFAULT);
/**
* @brief MegaApi Constructor that uses a given GFX provider
*
* The SDK attach thumbnails and previews to all uploaded images. To generate them, it needs
* a graphics provider.
* @see MegaGfxProvider
*
* @param provider Graphics processing provider. The SDK will use it to generate previews
* and thumbnails. Once MegaApi returns, the provider couldn't be reused and the caller
* should release it.
*
* @param basePath Base path to store the local cache
* If you pass NULL to this parameter, the SDK will use the current working directory.
*
* @param userAgent User agent to use in network requests
* If you pass NULL to this parameter, a default user agent will be used
*
* @param workerThreadCount The number of worker threads for encryption or other operations
* Using worker threads means that synchronous function calls on MegaApi will be blocked
* less, and uploads and downloads can proceed more quickly on very fast connections.
*
* @param clientType Client type (default, VPN or Password Manager) enables SDK to function
* differently
*
*/
MegaApi(const char* appKey,
MegaGfxProvider* provider,
const char* basePath = NULL,
const char* userAgent = NULL,
unsigned workerThreadCount = 1,
int clientType = CLIENT_TYPE_DEFAULT);
#ifdef HAVE_MEGAAPI_RPC
MegaApi();
#endif
virtual ~MegaApi();
/**
* @brief Register a listener to receive all events (requests, transfers, global, synchronization)
*
* You can use MegaApi::removeListener to stop receiving events.
*
* @param listener Listener that will receive all events (requests, transfers, global, synchronization)
*/
void addListener(MegaListener* listener);
/**
* @brief Register a listener to receive all events about requests
*
* You can use MegaApi::removeRequestListener to stop receiving events.
*
* @param listener Listener that will receive all events about requests
*/
virtual void addRequestListener(MegaRequestListener* listener);
/**
* @brief Register a listener to receive all events about transfers
*
* You can use MegaApi::removeTransferListener to stop receiving events.
*
* @param listener Listener that will receive all events about transfers
*/
void addTransferListener(MegaTransferListener* listener);
/**
* @brief Register a listener to receive global events
*
* You can use MegaApi::removeGlobalListener to stop receiving events.
*
* @param listener Listener that will receive global events
*/
void addGlobalListener(MegaGlobalListener* listener);
/**
* @brief Add a listener for all events related to backups
* @param listener Listener that will receive backup events
*/
void addScheduledCopyListener(MegaScheduledCopyListener *listener);
/**
* @brief
* Unregister a backup listener
*
* @paramlistener
* Object that will be unregistered
*
* @return
* True if listener was found and unregistered.
*/
bool removeScheduledCopyListener(MegaScheduledCopyListener *listener);
/**
* @brief
* Unregister a listener
*
* This listener won't receive more events.
*
* @param listener
* Object that is unregistered
*
* @return
* True if listener was found and unregistered.
*/
bool removeListener(MegaListener* listener);
/**
* @brief
* Unregister a MegaRequestListener
*
* This listener won't receive more events.
*
* @param listener
* Object that is unregistered
*
* @return
* True if listener was found and unregistered.
*/
bool removeRequestListener(MegaRequestListener* listener);
/**
* @brief
* Unregister a MegaTransferListener
*
* This listener won't receive more events.
*
* @param listener
* Object that is unregistered
*
* @return
* True if listener was found and unregistered.
*/
bool removeTransferListener(MegaTransferListener* listener);
/**
* @brief
* Unregister a MegaGlobalListener
*
* This listener won't receive more events.
*
* @param listener
* Object that is unregistered
*
* @return
* True if listener was found and unregistered.
*/
bool removeGlobalListener(MegaGlobalListener* listener);
/**
* @brief Get internal timestamp used by the SDK
*
* This is a time used in certain internal operations.
*
* @return actual SDK time in deciseconds
*/
long long getSDKtime();
/**
* @brief Get an URL to transfer the current session to the webclient
*
* This function creates a new session for the link so logging out in the web client won't
* log out the current session.
*
* The associated request type is MegaRequest::TYPE_GET_SESSION_TRANSFER_URL
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getLink - URL to open the desired page with the same account
*
* If the client is logged in, but the account is not fully confirmed (ie. singup not
* completed yet), this method will return API_EACCESS.
*
* If the client is not logged in, there won't be any session to transfer, but this method
* will still return the MEGA's host (ie. https://mega.app) followed by /#<path>.
*
* @param path Path inside the MEGA's host that we want to open with the current session
*
* For example, if you want to open https://mega.app/#pro, the parameter of this function
* should be "pro".
*
* @param listener MegaRequestListener to track this request
*/
void getSessionTransferURL(const char *path, MegaRequestListener *listener = NULL);
/**
* @brief Converts a Base32-encoded user handle (JID) to a MegaHandle
*
* @param base32Handle Base32-encoded handle (JID)
* @return User handle
*/
static MegaHandle base32ToHandle(const char* base32Handle);
/**
* @brief Converts a Base64-encoded node handle to a MegaHandle
*
* The returned value can be used to recover a MegaNode using MegaApi::getNodeByHandle
* You can revert this operation using MegaApi::handleToBase64
*
* @param base64Handle Base64-encoded node handle
* @return Node handle
*/
static MegaHandle base64ToHandle(const char* base64Handle);
/**
* @brief Converts a Base64-encoded user handle to a MegaHandle
*
* You can revert this operation using MegaApi::userHandleToBase64
*
* @param base64Handle Base64-encoded user handle
* @return User handle
*/
static MegaHandle base64ToUserHandle(const char* base64Handle);
/**
* @brief
* Converts a Base64-encoded backup ID to a MegaHandle.
*
* You can revert this operation using MegaApi::backupIdToBase64.
*
* @param backupId
* Base64-encoded Backup ID.
*
* @return
* Backup ID.
*/
static MegaHandle base64ToBackupId(const char* backupId);
/**
* @brief Converts the handle of a node to a Base64-encoded string
*
* You take ownership of the returned value. Use delete[] to release the memory.
* You can revert this operation using MegaApi::base64ToHandle
*
* @param handle Node handle to be converted
* @return Base64-encoded node handle
*/
static char* handleToBase64(MegaHandle handle);
/**
* @brief Converts a MegaHandle to a Base64-encoded string
*
* You take ownership of the returned value. Use delete[] to release the memory.
* You can revert this operation using MegaApi::base64ToUserHandle
*
* @param handle User handle to be converted
* @return Base64-encoded user handle
*/
static char* userHandleToBase64(MegaHandle handle);
/**
* @brief
* Converts a Backup ID into a Base64-encoded string.
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @param backupId
* Backup ID to be converted.
*
* @return
* Base64-encoded backup ID.
*/
static const char* backupIdToBase64(MegaHandle backupId);
/**
* @brief Convert binary data to a base 64 encoded string
*
* For some operations such as background uploads, binary data must be converted to a format
* suitable to be passed to the MegaApi interface. Use this function to do so.
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @param binaryData A pointer to the start of the binary data
* @param length The number of bytes in the binary data
* @return A newly allocated NULL-terminated string consisting of base64 characters.
*/
static char *binaryToBase64(const char* binaryData, size_t length);
/**
* @brief Convert data encoded in a base 64 string back to binary.
*
* This operation is the inverse of binaryToString64.
*
* You take ownership of the pointer assigned to *binary.
*
* @param base64string The base 64 encoded string to decode.
* @param binary A pointer to a pointer to assign with a `new unsigned char[]`
* allocated buffer containing the decoded binary data.
* @param binarysize A pointer to a variable that will be assigned the size of the buffer allocated.
*/
static void base64ToBinary(const char *base64string, unsigned char **binary, size_t* binarysize);
/**
* @brief Add entropy to internal random number generators
*
* It's recommended to call this function with random data specially to
* enhance security,
*
* @param data Byte array with random data
* @param size Size of the byte array (in bytes)
*/
void addEntropy(char* data, unsigned int size);
/**
* @brief Retry all pending requests
*
* When requests fails they wait some time before being retried. That delay grows exponentially if the request
* fails again. For this reason, and since this request is very lightweight, it's recommended to call it with
* the default parameters on every user interaction with the application. This will prevent very big delays
* completing requests.
*
* The associated request type with this request is MegaRequest::TYPE_RETRY_PENDING_CONNECTIONS.
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getFlag - Returns the first parameter
* - MegaRequest::getNumber - Returns the second parameter
*
* If not possible to retrieve the DNS servers from the system, in iOS, this request will fail with
* the error code MegaError::API_EACCESS in onRequestFinish().
*
* @param disconnect true if you want to disconnect already connected requests
* It's not recommended to set this flag to true if you are not fully sure about what are you doing. If you
* send a request that needs some time to complete and you disconnect it in a loop without giving it enough time,
* it could be retrying forever.
* Using true in this parameter will trigger the callback MegaGlobalListener::onEvent and the callback
* MegaListener::onEvent with the event type MegaEvent::EVENT_DISCONNECT.
*
* @param includexfers true to retry also transfers
* It's not recommended to set this flag. Transfer has a retry counter and are aborted after a number of retries
* MegaTransfer::getMaxRetries. Setting this flag to true, you will force more immediate retries and your transfers
* could fail faster.
*
* @param listener MegaRequestListener to track this request
*/
void retryPendingConnections(bool disconnect = false, bool includexfers = false, MegaRequestListener* listener = NULL);
/**
* @brief Use custom DNS servers
*
* The SDK tries to automatically get and use DNS servers configured in the system at
* startup. This function can be used to override that automatic detection and use a custom
* list of DNS servers. It is also useful to provide working DNS servers to the SDK in
* platforms in which it can't get them from the system.
*
* Since the usage of this function implies a change in DNS servers used by the SDK, all
* connections are closed and restarted using the new list of new DNS servers, so calling
* this function too often can cause many retries and problems to complete requests. Please
* use it only at startup or when DNS servers need to be changed.
*
* To use this functionality the curl library should have been built with support for
* c-ares. If there's no support for c-ares in the curl library, the error code provivded
* in onRequestFinish is MegaError::API_ENOENT.
*
* The associated request type with this request is
* MegaRequest::TYPE_RETRY_PENDING_CONNECTIONS. Valid data in the MegaRequest object
* received on callbacks:
* - MegaRequest::getText - Returns the new list of DNS servers
*
* @param dnsServers New list of DNS servers. It must be a list of IPs separated by a comma
* character ",". IPv6 servers are allowed (without brackets). An empty list can be used to
* return the SDK to the default DNS resolution configuration.
*
* The usage of this function will trigger the callback MegaGlobalListener::onEvent and the
* callback MegaListener::onEvent with the event type MegaEvent::EVENT_DISCONNECT.
*
* @param listener MegaRequestListener to track this request
*/
void setDnsServers(const char *dnsServers, MegaRequestListener* listener = NULL);
/**
* @brief Check if server-side Rubbish Bin autopurging is enabled for the current account
*
* This function will NOT return a valid value until the callback onEvent with
* type MegaApi::EVENT_MISC_FLAGS_READY is received. You can also rely on the completion of
* a fetchnodes to check this value.
*
* @return True if this feature is enabled. Otherwise false.
*/
bool serverSideRubbishBinAutopurgeEnabled();
/**
* @brief Check if the account has VOIP push enabled
*
* This function will NOT return a valid value until the callback onEvent with
* type MegaApi::EVENT_MISC_FLAGS_READY is received. You can also rely on the completion of
* a fetchnodes to check this value.
*
* @return True if this feature is enabled. Otherwise false.
*/
bool appleVoipPushEnabled();
/**
* @brief Check if the new format for public links is enabled
*
* This function will NOT return a valid value until the callback onEvent with
* type MegaApi::EVENT_MISC_FLAGS_READY is received. You can also rely on the completion of
* a fetchnodes to check this value.
*
* For not logged-in mode, you need to call MegaApi::getMiscFlags first.
*
* @return True if this feature is enabled. Otherwise, false.
*/
bool newLinkFormatEnabled();
/**
* @brief Check if the logged in account is considered new
*
* This function will NOT return a valid value until the callback onEvent with
* type MegaApi::EVENT_MISC_FLAGS_READY is received. You can also rely on the completion of
* a fetchnodes to check this value.
*
* @return True if account is considered new. Otherwise, false.
*/
bool accountIsNew() const;
/**
* @brief Get the value of an A/B Test flag
*
* Any value greater than 0 means the flag is active.
*
* @param flag Name or key of the value to be retrieved.
*
* @return An unsigned integer with the value of the flag.
*/
unsigned int getABTestValue(const char* flag);
/**
* @brief Check if the opt-in or account unblocking SMS is allowed
*
* The result indicated whether the MegaApi::sendSMSVerificationCode function can be used.
*
* This function will NOT return a valid value until the callback onEvent with
* type MegaApi::EVENT_MISC_FLAGS_READY is received. You can also rely on the completion of
* a fetchnodes to check this value.
*
* For not logged-in mode, you need to call MegaApi::getMiscFlags first.
*
* @return 2 = Opt-in and unblock SMS allowed. 1 = Only unblock SMS allowed. 0 = No SMS
* allowed
*
* @deprecated SMS verification was deprecated. This function is deprecated. Please don't
* use it in new code.
*/
MEGA_DEPRECATED
int smsAllowedState();
/**
* @brief Get the verified phone number for the account logged in
*
* Returns the phone number previously confirmed with MegaApi::sendSMSVerificationCode
* and MegaApi::checkSMSVerificationCode.
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @return NULL if there is no verified number, otherwise a string containing that phone
* number.
*
* @deprecated SMS verification was deprecated. This function is deprecated. Please don't
* use it in new code.
*/
MEGA_DEPRECATED
char* smsVerifiedPhoneNumber();
/**
* @brief Check if multi-factor authentication can be enabled for the current account.
*
* This function will NOT return a valid value until the callback onEvent with
* type MegaApi::EVENT_MISC_FLAGS_READY is received. You can also rely on the completion of
* a fetchnodes to check this value.
*
* For not logged-in mode, you need to call MegaApi::getMiscFlags first.
*
* @return True if multi-factor authentication can be enabled for the current account, otherwise false.
*/
bool multiFactorAuthAvailable();
/**
* @brief Reset the verified phone number for the account logged in.
*
* The associated request type with this request is
* MegaRequest::TYPE_RESET_SMS_VERIFIED_NUMBER.
* If there's no verified phone number associated for the account logged in, the error code
* provided in onRequestFinish is MegaError::API_ENOENT.
*
* @param listener MegaRequestListener to track this request
*
* @deprecated SMS verification was deprecated. This function is deprecated. Please don't
* use it in new code.
*/
MEGA_DEPRECATED
void resetSmsVerifiedPhoneNumber(MegaRequestListener *listener = NULL);
/**
* @brief Check if multi-factor authentication is enabled for an account
*
* The associated request type with this request is MegaRequest::TYPE_MULTI_FACTOR_AUTH_CHECK
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getEmail - Returns the email sent in the first parameter
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getFlag - Returns true if multi-factor authentication is enabled or false if it's disabled.
*
* @param email Email to check
* @param listener MegaRequestListener to track this request
*/
void multiFactorAuthCheck(const char *email, MegaRequestListener *listener = NULL);
/**
* @brief Get the secret code of the account to enable multi-factor authentication
* The MegaApi object must be logged into an account to successfully use this function.
*
* The associated request type with this request is MegaRequest::TYPE_MULTI_FACTOR_AUTH_GET
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getText - Returns the Base32 secret code needed to configure multi-factor authentication.
*
* @param listener MegaRequestListener to track this request
*/
void multiFactorAuthGetCode(MegaRequestListener *listener = NULL);
/**
* @brief Enable multi-factor authentication for the account
* The MegaApi object must be logged into an account to successfully use this function.
*
* The associated request type with this request is MegaRequest::TYPE_MULTI_FACTOR_AUTH_SET
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getFlag - Returns true
* - MegaRequest::getPassword - Returns the pin sent in the first parameter
*
* @param pin Valid pin code for multi-factor authentication
* @param listener MegaRequestListener to track this request
*/
void multiFactorAuthEnable(const char *pin, MegaRequestListener *listener = NULL);
/**
* @brief Disable multi-factor authentication for the account
* The MegaApi object must be logged into an account to successfully use this function.
*
* The associated request type with this request is MegaRequest::TYPE_MULTI_FACTOR_AUTH_SET
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getFlag - Returns false
* - MegaRequest::getPassword - Returns the pin sent in the first parameter
*
* @param pin Valid pin code for multi-factor authentication
* @param listener MegaRequestListener to track this request
*/
void multiFactorAuthDisable(const char *pin, MegaRequestListener *listener = NULL);
/**
* @brief Log in to a MEGA account with multi-factor authentication enabled
*
* The associated request type with this request is MegaRequest::TYPE_LOGIN.
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getEmail - Returns the first parameter
* - MegaRequest::getPassword - Returns the second parameter
* - MegaRequest::getText - Returns the third parameter
*
* If the email/password aren't valid the error code provided in onRequestFinish is
* MegaError::API_ENOENT.
*
* @param email Email of the user
* @param password Password
* @param pin Pin code for multi-factor authentication
* @param listener MegaRequestListener to track this request
*/
void multiFactorAuthLogin(const char* email, const char* password, const char* pin, MegaRequestListener *listener = NULL);
/**
* @brief Change the password of a MEGA account with multi-factor authentication enabled
*
* The associated request type with this request is MegaRequest::TYPE_CHANGE_PW
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getPassword - Returns the old password (if it was passed as parameter)
* - MegaRequest::getNewPassword - Returns the new password
* - MegaRequest::getText - Returns the pin code for multi-factor authentication
*
* @param oldPassword Old password (optional, it can be NULL to not check the old password)
* @param newPassword New password
* @param pin Pin code for multi-factor authentication
* @param listener MegaRequestListener to track this request
*/
void multiFactorAuthChangePassword(const char *oldPassword, const char *newPassword, const char* pin, MegaRequestListener *listener = NULL);
/**
* @brief Initialize the change of the email address associated to an account with multi-factor authentication enabled.
*
* The associated request type with this request is MegaRequest::TYPE_GET_CHANGE_EMAIL_LINK.
* Valid data in the MegaRequest object received on all callbacks:
* - MegaRequest::getEmail - Returns the email for the account
* - MegaRequest::getText - Returns the pin code for multi-factor authentication
*
* If this request succeeds, a change-email link will be sent to the specified email address.
* If no user is logged in, you will get the error code MegaError::API_EACCESS in onRequestFinish().
*
* If the MEGA account is a sub-user business account, onRequestFinish will
* be called with the error code MegaError::API_EMASTERONLY.
*
* @param email The new email to be associated to the account.
* @param pin Pin code for multi-factor authentication
* @param listener MegaRequestListener to track this request
*/
void multiFactorAuthChangeEmail(const char *email, const char* pin, MegaRequestListener *listener = NULL);
/**
* @brief Initialize the cancellation of an account.
*
* The associated request type with this request is MegaRequest::TYPE_GET_CANCEL_LINK.
*
* If this request succeeds, a cancellation link will be sent to the email address of the user.
* If no user is logged in, you will get the error code MegaError::API_EACCESS in onRequestFinish().
*
* Valid data in the MegaRequest object received on all callbacks:
* - MegaRequest::getText - Returns the pin code for multi-factor authentication
*
* If the MEGA account is a sub-user business account, onRequestFinish will
* be called with the error code MegaError::API_EMASTERONLY.
*
* @see MegaApi::confirmCancelAccount
*
* @param pin Pin code for multi-factor authentication
* @param listener MegaRequestListener to track this request
*/
void multiFactorAuthCancelAccount(const char* pin, MegaRequestListener *listener = NULL);
/**
* @brief Fetch details related to time zones and the current default
*
* The associated request type with this request is MegaRequest::TYPE_FETCH_TIMEZONE.
*
* Valid data in the MegaRequest object received on all callbacks:
* - MegaRequest::getFlag - Returns true to indicate that we want to force API request
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getMegaTimeZoneDetails - Returns details about timezones and the current default
*
* @param listener MegaRequestListener to track this request
*/
void fetchTimeZone(MegaRequestListener* listener = NULL);
/**
* @brief Fetch details related to time zones and the current default.
*
* This method checks if we already have that information locally, to avoid an unnecessary API request,
* otherwise we will request the information to API.
*
* The associated request type with this request is MegaRequest::TYPE_FETCH_TIMEZONE.
*
* Valid data in the MegaRequest object received on all callbacks:
* - MegaRequest::getFlag - Returns false to indicate that we don't want to force API request
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getMegaTimeZoneDetails - Returns details about timezones and the current default
*
* @param listener MegaRequestListener to track this request
*/
void fetchTimeZoneFromLocal(MegaRequestListener* listener = NULL);
/**
* @brief Log in to a MEGA account
*
* The associated request type with this request is MegaRequest::TYPE_LOGIN.
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getEmail - Returns the first parameter
* - MegaRequest::getPassword - Returns the second parameter
* - MegaRequest::getTransferredBytes - Returns a relative epoch (global counter starting
* from 0). This is used internally to early exit from expensive computations when a
* cancellation request (ex: locallogout) needs to be executed quickly.
*
* If the email/password aren't valid the error code provided in onRequestFinish is
* MegaError::API_ENOENT.
*
* @param email Email of the user
* @param password Password
* @param listener MegaRequestListener to track this request
*/
virtual void login(const char* email, const char* password, MegaRequestListener *listener = NULL);
/**
* @brief Log in to a public folder using a folder link
*
* After a successful login, you should call MegaApi::fetchNodes to get filesystem and
* start working with the folder.
*
* The associated request type with this request is MegaRequest::TYPE_LOGIN.
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getEmail - Retuns the string "FOLDER"
* - MegaRequest::getLink - Returns the public link to the folder
* - MegaRequest::getTransferredBytes - See MegaApi::login()
*
* @param megaFolderLink Public link to a folder in MEGA
* @param listener MegaRequestListener to track this request
*/
void loginToFolder(const char* megaFolderLink, MegaRequestListener *listener = NULL);
/**
* @brief Log in to a public folder using a folder link
*
* After a successful login, you should call MegaApi::fetchNodes to get filesystem and
* start working with the folder.
*
* The associated request type with this request is MegaRequest::TYPE_LOGIN.
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getEmail - Retuns the string "FOLDER"
* - MegaRequest::getLink - Returns the public link to the folder
* - MegaRequest::getPassword - Returns the auth link used for writting
*
* If the provided authKey is not valid, onRequestFinish will
* be called with the error code MegaError::API_EACCESS.
*
* @param megaFolderLink Public link to a folder in MEGA
* @param authKey Authentication key to write into the folder link
* @param listener MegaRequestListener to track this request
*/
void loginToFolder(const char* megaFolderLink, const char *authKey, MegaRequestListener *listener = NULL);
/**
* @brief Log in to a public folder using a folder link
*
* After a successful login, you should call MegaApi::fetchNodes to get filesystem and
* start working with the folder.
*
* The associated request type with this request is MegaRequest::TYPE_LOGIN.
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getEmail - Retuns the string "FOLDER"
* - MegaRequest::getLink - Returns the public link to the folder
* - MegaRequest::getPassword - Returns the auth link used for writting
* - MegaRequest::getFlag - Returns True if it will attempt to restore the folder link from
* the cache, or False if it will fetch the nodes instead.
*
* If the provided authKey is not valid, onRequestFinish will
* be called with the error code MegaError::API_EACCESS.
*
* @param megaFolderLink Public link to a folder in MEGA
* @param authKey Authentication key to write into the folder link
* @param tryToResumeFolderLinkFromCache If True and the folder link exists in the cache,
* attempt to restore it; otherwise, fetch the nodes.
* @param listener MegaRequestListener to track this request
*/
void loginToFolder(const char* megaFolderLink,
const char* authKey,
bool tryToResumeFolderLinkFromCache,
MegaRequestListener* listener = nullptr);
/**
* @brief Log in to a MEGA account using a session key
*
* The associated request type with this request is MegaRequest::TYPE_LOGIN.
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getSessionKey - Returns the session key
* - MegaRequest::getTransferredBytes - See MegaApi::login()
*
* @param session Session key previously dumped with MegaApi::dumpSession
* @param listener MegaRequestListener to track this request
*/
void fastLogin(const char* session, MegaRequestListener *listener = NULL);
/**
* @brief Close a MEGA session
*
* All clients using this session will be automatically logged out.
*
* You can get session information using MegaApi::getExtendedAccountDetails.
* Then use MegaAccountDetails::getNumSessions and MegaAccountDetails::getSession
* to get session info.
* MegaAccountSession::getHandle provides the handle that this function needs.
*
* If you use mega::INVALID_HANDLE, all sessions except the current one will be closed
*
* @param sessionHandle Handle of the session. Use mega::INVALID_HANDLE to cancel all sessions except the current one
* @param listener MegaRequestListener to track this request
*/
void killSession(MegaHandle sessionHandle, MegaRequestListener *listener = NULL);
/**
* @brief Get data about the logged account
*
* The associated request type with this request is MegaRequest::TYPE_GET_USER_DATA.
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getName - Returns the name of the logged user
* - MegaRequest::getPassword - Returns the the public RSA key of the account, Base64-encoded
* - MegaRequest::getPrivateKey - Returns the private RSA key of the account, Base64-encoded
*
* @param listener MegaRequestListener to track this request
*/
void getUserData(MegaRequestListener *listener = NULL);
/**
* @brief Get data about a contact
*
* The associated request type with this request is MegaRequest::TYPE_GET_USER_DATA.
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getEmail - Returns the email of the contact
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getPassword - Returns the public RSA key of the contact, Base64-encoded
*
* @param user Contact to get the data
* @param listener MegaRequestListener to track this request
*/
void getUserData(MegaUser *user, MegaRequestListener *listener = NULL);
/**
* @brief Get information about a MEGA user
*
* The associated request type with this request is MegaRequest::TYPE_GET_USER_DATA.
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getEmail - Returns the email or the Base64 handle of the user,
* depending on the value provided as user parameter
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getPassword - Returns the public RSA key of the user, Base64-encoded
*
* @param user Email or Base64 handle of the user
* @param listener MegaRequestListener to track this request
*/
void getUserData(const char *user, MegaRequestListener *listener = NULL);
/**
* @brief Fetch miscellaneous flags when not logged in
*
* The associated request type with this request is MegaRequest::TYPE_GET_MISC_FLAGS.
*
* When onRequestFinish is called with MegaError::API_OK, the miscellaneous flags are available.
* If you are logged in into an account, the error code provided in onRequestFinish is
* MegaError::API_EACCESS.
*
* @see MegaApi::multiFactorAuthAvailable
* @see MegaApi::newLinkFormatEnabled
* @see MegaApi::smsAllowedState
*
* @param listener MegaRequestListener to track this request
*/
void getMiscFlags(MegaRequestListener *listener = NULL);
/**
* @brief Trigger special account state changes for own accounts, for testing
*
* The associated request type with this request is MegaRequest::TYPE_SEND_DEV_COMMAND.
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getName - Returns the first parameter
* - MegaRequest::getEmail - Returns the second parameter
*
* Possible errors are:
* - EACCESS if the calling account is not allowed to perform this method (not a mega email account, not the right IP, etc).
* - EARGS if the subcommand is not present or is invalid
* - EBLOCKED if the target account is not allowed (this could also happen if the target account does not exist)
*
* Possible commands:
* - "aodq" - Advance ODQ Warning State
* If called, this will advance your ODQ warning state until the final warning state,
* at which point it will turn on the ODQ paywall for your account. It requires an account lock on the target account.
* This subcommand will return the 'step' of the warning flow you have advanced to - 1, 2, 3 or 4
* (the paywall is turned on at step 4)
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code is MegaError::API_OK:
* + MegaRequest::getNumber - Returns the number of warnings (1, 2, 3 or 4).
*
* Possible errors in addition to the standard dev ones are:
* + EFAILED - your account is not in the RED stoplight state
*
* @param command The subcommand for the specific operation
* @param email Optional email of the target email's account. If null, it will use the logged-in account
* @param listener MegaRequestListener to track this request
* @deprecated Use MegaApi::sendOdqDevCommand instead, for new API dev commands, a new public method will
* be created for each one
*/
void sendDevCommand(const char *command, const char *email = nullptr, MegaRequestListener *listener = nullptr);
/**
* @brief Send dev API command, Advance ODQ Warning State for own accounts (for testing purposes)
*
* If called, this will advance your ODQ warning state until the final warning state,
* at which point it will turn on the ODQ paywall for your account. It requires an account lock on the target account.
* This subcommand will return the 'step' of the warning flow you have advanced to - 1, 2, 3 or 4
* (the paywall is turned on at step 4)
*
* The associated request type with this request is MegaRequest::TYPE_SEND_DEV_COMMAND.
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getName - Returns the API dev command ("aodq")
* - MegaRequest::getEmail - Returns the target email account, or NULL if target is the logged-in account
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code is MegaError::API_OK:
* - MegaRequest::getNumber - Returns the number of warnings (1, 2, 3 or 4).
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - EACCESS if the calling account is not allowed to perform this method (not a mega email account, not the right IP, etc).
* - EARGS if the subcommand is not present or is invalid
* - EBLOCKED if the target account is not allowed (this could also happen if the target account does not exist)
* - EFAILED - your account is not in the RED stoplight state
*
* @param email Optional email of the target email's account. If null, it will use the logged-in account
* @param listener MegaRequestListener to track this request
*/
void sendOdqDevCommand(const char *email = nullptr, MegaRequestListener *listener = nullptr);
/**
* @brief Send dev API command, Set used transfer quota for own accounts (for testing purposes)
*
* Sets the amount of transfer quota the target user has used from their PRO allocation.
* This subcommand can only be run with PRO users.
*
* The associated request type with this request is MegaRequest::TYPE_SEND_DEV_COMMAND.
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getName - Returns the API dev command ("tq")
* - MegaRequest::getEmail - Returns the target email account, or NULL if target is the logged-in account
* - MegaRequest::getTotalBytes - Returns the amount of transfer quota the target has used, in bytes
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - EACCESS if the calling account is not allowed to perform this method (not a mega email account, not the right IP, etc).
* - EARGS if the subcommand is not present or is invalid, or if target account is not PRO
* - EBLOCKED if the target account is not allowed (this could also happen if the target account does not exist)
* - EMASTERONLY - if the target is the business internal account as they don't login
*
* @param quota The amount of transfer quota the target has used, in bytes
* @param email Optional email of the target email's account. If null, it will use the logged-in account
* @param listener MegaRequestListener to track this request
*/
void sendUsedTransferQuotaDevCommand(long long quota, const char *email = nullptr, MegaRequestListener *listener = nullptr);
/**
* @brief Send dev API command, Set business status for own accounts (for testing purposes)
*
* Sets the status of the business account. The target user can be the business internal account,
* or a master or sub-user in the business. The status set by this method is permanent until removed,
* it does not transition to grace period and expired over time.
*
* The following values are valid for business status:
* - set the business expired = -1
* - clear the status override and set the business back to status of their payments = 0
* - set the business active = 1
* - set the business in grace period = 2
*
* The associated request type with this request is MegaRequest::TYPE_SEND_DEV_COMMAND.
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getName - Returns the API dev command ("bs")
* - MegaRequest::getEmail - Returns the target email account, or NULL if target is the logged-in account
* - MegaRequest::getAccess - Returns the business status
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - EACCESS if the calling account is not allowed to perform this method (not a mega email account, not the right IP, etc).
* - EARGS if the subcommand is not present or is invalid, or if target account is not part of a business account
* - EBLOCKED if the target account is not allowed (this could also happen if the target account does not exist)
*
* @param businessStatus The business status
* @param email Optional email of the target email's account. If null, it will use the logged-in account
* @param listener MegaRequestListener to track this request
*/
void sendBusinessStatusDevCommand(int businessStatus, const char *email = nullptr, MegaRequestListener *listener = nullptr);
/**
* @brief Send dev API command, set account status (for testing purposes)
*
* Modifies the status of a user's account.
*
* The associated request type with this request is MegaRequest::TYPE_SEND_DEV_COMMAND.
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getName - Returns the API dev command ("sal")
* - MegaRequest::getEmail - Returns the target email account, or NULL if target is the
* logged-in account
* - MegaRequest::getNumDetails - Returns the account level.
* - MegaRequest::getTotalBytes - Returns the quota length in months.
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - EACCESS if the calling account is not allowed to perform this method (not a mega email
* account, not the right IP, etc).
* - EARGS if the subcommand is not present or is invalid.
*
* @param accountLevel Desired account level.
* @param quotaLengthInMonths Length of quota in months.
* @param email Optional email of the target email's account. If null, it will use the
* logged-in account
* @param listener MegaRequestListener to track this request
*/
void sendSetAccountLevelDevCommand(int accountLevel,
int quotaLengthInMonths,
const char* email = nullptr,
MegaRequestListener* listener = nullptr);
/**
* @brief Send dev API command, Set user status for own accounts (for testing purposes)
*
* Sets the status of a user.
*
* The following values are valid for user status:
* - Enabled = 0
* - Suspended (generic) = 2
* - Suspended (for payment, but not used) = 3
* - Suspended (copyright complaint) = 4
* - Suspended (admin full disable) = 5
* - Suspended (admin partial disable) = 6
* - Suspended (Emergency Takedown) = 7
* - Suspended until SMS verified = 8 (obsolete)
* - Suspended until Email verified = 9
*
* Note that Action packets are not sent for a suspended user, but next command or action
* packet request will give a EBLOCKED error.
*
* The associated request type with this request is MegaRequest::TYPE_SEND_DEV_COMMAND.
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getName - Returns the API dev command ("us")
* - MegaRequest::getEmail - Returns the target email account, or NULL if target is the
* logged-in account
* - MegaRequest::getNumDetails - Returns the user status
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - EACCESS if the calling account is not allowed to perform this method (not a mega email
* account, not the right IP, etc).
* - EARGS if the subcommand is not present or is invalid, if the status is out of range or
* the target is a business internal account
* - EBLOCKED if the target account is not allowed (this could also happen if the target
* account does not exist)
*
* @param userStatus The user status
* @param email Optional email of the target email's account. If null, it will use the
* logged-in account
* @param listener MegaRequestListener to track this request
*/
void sendUserStatusDevCommand(int userStatus, const char *email = nullptr, MegaRequestListener *listener = nullptr);
/**
* @brief Returns the current session key
*
* You have to be logged in to get a valid session key. Otherwise,
* this function returns NULL.
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @return Current session key
*/
char *dumpSession();
/**
* @brief Returns the current sequence number
*
* The sequence number indicates the state of a MEGA account known by the SDK.
* When external changes are received via actionpackets, the sequence number is
* updated and changes are commited to the local cache.
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @return The current sequence number
*/
char *getSequenceNumber();
/**
* @brief Returns the current sequence tag
*
* The sequence tag indicates the state of a MEGA account known by the SDK.
* When external changes (*) are received via actionpackets, the sequence tag is
* updated and changes are commited to the local cache.
* Contrary to sequence numbers, sequence tags can be compared.
* (*) external changes occurred in v3 enabled clients.
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @return The current sequence tag
*/
char *getSequenceTag();
/**
* @brief Get an authentication token that can be used to identify the user account
*
* If this MegaApi object is not logged into an account, this function will return NULL
*
* The value returned by this function can be used in other instances of MegaApi
* thanks to the function MegaApi::setAccountAuth.
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @return Authentication token
*/
char *getAccountAuth();
/**
* @brief Use an authentication token to identify an account while accessing public folders
*
* This function is useful to preserve the PRO status when a public folder is being
* used. The identifier will be sent in all API requests made after the call to this function.
*
* To stop using the current authentication token, it's needed to explicitly call
* this function with NULL as parameter. Otherwise, the value set would continue
* being used despite this MegaApi object is logged in or logged out.
*
* It's recommended to call this function before the usage of MegaApi::loginToFolder
*
* @param auth Authentication token used to identify the account of the user.
* You can get it using MegaApi::getAccountAuth with an instance of MegaApi logged into
* an account.
*/
void setAccountAuth(const char* auth);
/**
* @brief Initialize the creation of a new MEGA account, with firstname and lastname
*
* The associated request type with this request is MegaRequest::TYPE_CREATE_ACCOUNT.
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getEmail - Returns the email for the account
* - MegaRequest::getPassword - Returns the password for the account
* - MegaRequest::getName - Returns the firstname of the user
* - MegaRequest::getText - Returns the lastname of the user
* - MegaRequest::getParamType - Returns the value MegaApi::CREATE_ACCOUNT
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getSessionKey - Returns the session id to resume the process
*
* If this request succeeds, a new ephemeral account will be created for the new user
* and a confirmation email will be sent to the specified email address. The app may
* resume the create-account process by using MegaApi::resumeCreateAccount.
*
* If an account with the same email already exists, you will get the error code
* MegaError::API_EEXIST in onRequestFinish
*
* @param email Email for the account
* @param password Password for the account
* @param firstname Firstname of the user
* @param lastname Lastname of the user
* @param listener MegaRequestListener to track this request
*/
void createAccount(const char* email, const char* password, const char* firstname, const char* lastname, MegaRequestListener *listener = NULL);
/**
* @brief Create Ephemeral++ account
*
* This kind of account allows to join chat links and to keep the session in the device
* where it was created.
*
* The associated request type with this request is MegaRequest::TYPE_CREATE_ACCOUNT.
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getName - Returns the firstname of the user
* - MegaRequest::getText - Returns the lastname of the user
* - MegaRequest::getParamType - Returns the value MegaApi:CREATE_EPLUSPLUS_ACCOUNT
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getSessionKey - Returns the session id to resume the process
*
* If this request succeeds, a new ephemeral++ account will be created for the new user.
* The app may resume the create-account process by using MegaApi::resumeCreateAccountEphemeralPlusPlus.
*
* @note This account should be confirmed in same device it was created
*
* @param firstname Firstname of the user
* @param lastname Lastname of the user
* @param listener MegaRequestListener to track this request
*/
void createEphemeralAccountPlusPlus(const char* firstname, const char* lastname, MegaRequestListener *listener = NULL);
/**
* @brief Resume a registration process
*
* When a user begins the account registration process by calling MegaApi::createAccount,
* an ephemeral account is created.
*
* Until the user successfully confirms the signup link sent to the provided email address,
* you can resume the ephemeral session in order to change the email address, resend the
* signup link (@see MegaApi::sendSignupLink) and also to receive notifications in case the
* user confirms the account using another client (MegaGlobalListener::onEvent or
* MegaListener::onEvent, EVENT_ACCOUNT_CONFIRMATION). It is also possible to cancel the
* registration process by MegaApi::cancelCreateAccount, which invalidates the signup link
* associated to the ephemeral session (the session will be still valid).
*
* The associated request type with this request is MegaRequest::TYPE_CREATE_ACCOUNT.
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getSessionKey - Returns the session id to resume the process
* - MegaRequest::getParamType - Returns the value MegaApi::RESUME_ACCOUNT
*
* In case the account is already confirmed, the associated request will fail with
* error MegaError::API_EARGS.
*
* @param sid Session id valid for the ephemeral account (@see MegaApi::createAccount)
* @param listener MegaRequestListener to track this request
*/
void resumeCreateAccount(const char* sid, MegaRequestListener *listener = NULL);
/**
* @brief Resume a registration process for an Ephemeral++ account
*
* When a user begins the account registration process by calling
* MegaApi::createEphemeralAccountPlusPlus an ephemeral++ account is created.
*
* Until the user successfully confirms the signup link sent to the provided email address,
* you can resume the ephemeral session in order to change the email address, resend the
* signup link (@see MegaApi::sendSignupLink) and also to receive notifications in case the
* user confirms the account using another client (MegaGlobalListener::onEvent or
* MegaListener::onEvent, EVENT_ACCOUNT_CONFIRMATION). It is also possible to cancel the
* registration process by MegaApi::cancelCreateAccount, which invalidates the signup link
* associated to the ephemeral session (the session will be still valid).
*
* The associated request type with this request is MegaRequest::TYPE_CREATE_ACCOUNT.
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getSessionKey - Returns the session id to resume the process
* - MegaRequest::getParamType - Returns the value MegaApi::RESUME_EPLUSPLUS_ACCOUNT
*
* In case the account is already confirmed, the associated request will fail with
* error MegaError::API_EARGS.
*
* @param sid Session id valid for the ephemeral++ account (@see
* MegaApi::createEphemeralAccountPlusPlus)
* @param listener MegaRequestListener to track this request
*/
void resumeCreateAccountEphemeralPlusPlus(const char* sid, MegaRequestListener *listener = NULL);
/**
* @brief Cancel a registration process
*
* If a signup link has been generated during registration process, call this function
* to invalidate it. The ephemeral session will not be invalidated, only the signup link.
*
* The associated request type with this request is MegaRequest::TYPE_CREATE_ACCOUNT.
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the value MegaApi::CANCEL_ACCOUNT
*
* @param listener MegaRequestListener to track this request
*/
void cancelCreateAccount(MegaRequestListener *listener = NULL);
/**
* @brief Sends the confirmation email for a new account
*
* This function is useful to send the confirmation link again or to send it to a different
* email address, in case the user mistyped the email at the registration form. It can only
* be used after a successful call to MegaApi::createAccount or
* MegaApi::resumeCreateAccount.
*
* The associated request type with this request is MegaRequest::TYPE_SEND_SIGNUP_LINK.
*
* @param email Email for the account
* @param name Fullname of the user (firstname + lastname)
* @param listener MegaRequestListener to track this request
*/
void resendSignupLink(const char* email, const char *name, MegaRequestListener *listener = NULL);
/**
* @brief Get information about a confirmation link or a new signup link
*
* The associated request type with this request is MegaRequest::TYPE_QUERY_SIGNUP_LINK.
* Valid data in the MegaRequest object received on all callbacks:
* - MegaRequest::getLink - Returns the confirmation link
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getEmail - Return the email associated with the link
* - MegaRequest::getName - Returns the name associated with the link (available only for confirmation links)
* - MegaRequest::getFlag - Returns true if the account was automatically confirmed, otherwise false
*
* If already logged-in into a different account, you will get the error code MegaError::API_EACCESS
* in onRequestFinish.
* If logged-in into the account that is attempted to confirm and the account is already confirmed, you
* will get the error code MegaError::API_EEXPIRED in onRequestFinish.
* In both cases, the MegaRequest::getEmail will return the email of the account that was attempted
* to confirm, and the MegaRequest::getName will return the name.
*
* @param link Confirmation link (confirm) or new signup link (newsignup)
* @param listener MegaRequestListener to track this request
*/
void querySignupLink(const char* link, MegaRequestListener *listener = NULL);
/**
* @brief Confirm a MEGA account using a confirmation link and the user password
*
* The associated request type with this request is MegaRequest::TYPE_CONFIRM_ACCOUNT
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getLink - Returns the confirmation link
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getEmail - Email of the account
* - MegaRequest::getName - Name of the user
*
* As a result of a successful confirmation, the app will receive callbacks
* MegaListener::onEvent and MegaGlobalListener::onEvent with events of type
* MegaEvent::EVENT_ACCOUNT_CONFIRMATION. You can check the email used to confirm
* the account by checking MegaEvent::getText. @see MegaListener::onEvent.
*
* If already logged-in into a different account, you will get the error code
* MegaError::API_EACCESS in onRequestFinish. If logged-in into the account that is
* attempted to confirm and the account is already confirmed, you will get the error code
* MegaError::API_EEXPIRED in onRequestFinish. In both cases, the MegaRequest::getEmail will
* return the email of the account that was attempted to confirm, and the
* MegaRequest::getName will return the name.
*
* @param link Confirmation link
* @param listener MegaRequestListener to track this request
*/
void confirmAccount(const char* link, MegaRequestListener* listener = NULL);
/**
* @deprecated Use the signature without the \c password parameter
*/
MEGA_DEPRECATED
void confirmAccount(const char* link, const char *password, MegaRequestListener *listener = NULL);
/**
* @brief Initialize the reset of the existing password, with and without the Master Key.
*
* The associated request type with this request is MegaRequest::TYPE_GET_RECOVERY_LINK.
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getEmail - Returns the email for the account
* - MegaRequest::getFlag - Returns whether the user has a backup of the master key or not.
*
* If this request succeeds, a recovery link will be sent to the user.
* If no account is registered under the provided email, you will get the error code
* MegaError::API_ENOENT in onRequestFinish
*
* @param email Email used to register the account whose password wants to be reset.
* @param hasMasterKey True if the user has a backup of the master key. Otherwise, false.
* @param listener MegaRequestListener to track this request
*/
void resetPassword(const char *email, bool hasMasterKey, MegaRequestListener *listener = NULL);
/**
* @brief Get information about a recovery link created by MegaApi::resetPassword.
*
* The associated request type with this request is MegaRequest::TYPE_QUERY_RECOVERY_LINK
* Valid data in the MegaRequest object received on all callbacks:
* - MegaRequest::getLink - Returns the recovery link
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getEmail - Return the email associated with the link
* - MegaRequest::getFlag - Return whether the link requires masterkey to reset password.
*
* @param link Recovery link (recover)
* @param listener MegaRequestListener to track this request
*/
void queryResetPasswordLink(const char *link, MegaRequestListener *listener = NULL);
/**
* @brief Set a new password for the account pointed by the recovery link.
*
* Recovery links are created by calling MegaApi::resetPassword and may or may not
* require to provide the Master Key.
*
* @see The flag of the MegaRequest::TYPE_QUERY_RECOVERY_LINK in MegaApi::queryResetPasswordLink.
*
* The associated request type with this request is MegaRequest::TYPE_CONFIRM_RECOVERY_LINK
* Valid data in the MegaRequest object received on all callbacks:
* - MegaRequest::getLink - Returns the recovery link
* - MegaRequest::getPassword - Returns the new password
* - MegaRequest::getPrivateKey - Returns the Master Key, when provided
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getEmail - Return the email associated with the link
* - MegaRequest::getFlag - Return whether the link requires masterkey to reset password.
*
* If the account is logged-in into a different account than the account for which the link
* was generated, onRequestFinish will be called with the error code MegaError::API_EACCESS.
*
* @param link The recovery link sent to the user's email address.
* @param newPwd The new password to be set.
* @param masterKey Base64-encoded string containing the master key (optional).
* @param listener MegaRequestListener to track this request
*/
void confirmResetPassword(const char *link, const char *newPwd, const char *masterKey = NULL, MegaRequestListener *listener = NULL);
/**
* @brief Check that the provided recovery key (master key) is correct
*
* The associated request type with this request is MegaRequest::TYPE_CHECK_RECOVERY_KEY
* No data in the MegaRequest object received on all callbacks
*
* @param link The recovery link sent to the user's email address.
* @param recoveryKey Base64-encoded string containing the recoveryKey (masterKey).
* @param listener MegaRequestListener to track this request
*/
void checkRecoveryKey(const char* link, const char* recoveryKey, MegaRequestListener* listener = NULL);
/**
* @brief Initialize the cancellation of an account.
*
* The associated request type with this request is MegaRequest::TYPE_GET_CANCEL_LINK.
*
* If this request succeeds, a cancellation link will be sent to the email address of the user.
* If no user is logged in, you will get the error code MegaError::API_EACCESS in onRequestFinish().
*
* If the MEGA account is a sub-user business account, onRequestFinish will
* be called with the error code MegaError::API_EMASTERONLY.
*
* @see MegaApi::confirmCancelAccount
*
* @param listener MegaRequestListener to track this request
*/
void cancelAccount(MegaRequestListener *listener = NULL);
/**
* @brief Get information about a cancel link created by MegaApi::cancelAccount.
*
* The associated request type with this request is MegaRequest::TYPE_QUERY_RECOVERY_LINK
* Valid data in the MegaRequest object received on all callbacks:
* - MegaRequest::getLink - Returns the cancel link
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getEmail - Return the email associated with the link
*
* @param link Cancel link (cancel)
* @param listener MegaRequestListener to track this request
*/
void queryCancelLink(const char *link, MegaRequestListener *listener = NULL);
/**
* @brief Effectively parks the user's account without creating a new fresh account.
*
* If no user is logged in, you will get the error code MegaError::API_EACCESS in onRequestFinish().
*
* The contents of the account will then be purged after 60 days. Once the account is
* parked, the user needs to contact MEGA support to restore the account.
*
* The associated request type with this request is MegaRequest::TYPE_CONFIRM_CANCEL_LINK.
* Valid data in the MegaRequest object received on all callbacks:
* - MegaRequest::getLink - Returns the recovery link
* - MegaRequest::getPassword - Returns the new password
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getEmail - Return the email associated with the link
*
* @param link Cancellation link sent to the user's email address;
* @param pwd Password for the account.
* @param listener MegaRequestListener to track this request
*/
void confirmCancelAccount(const char *link, const char *pwd, MegaRequestListener *listener = NULL);
/**
* @brief Allow to resend the verification email for Weak Account Protection
*
* The verification email will be resent to the same address as it was previously sent to.
*
* This function can be called if the reason for being blocked is:
* 700: the account is supended for Weak Account Protection.
*
* If the logged in account is not suspended or is suspended for some other reason,
* onRequestFinish will be called with the error code MegaError::API_EACCESS.
*
* If the logged in account has not been sent the unlock email before,
* onRequestFinish will be called with the error code MegaError::API_EARGS.
*
* If the logged in account has already sent the unlock email and until it's available again,
* onRequestFinish will be called with the error code MegaError::API_ETEMPUNAVAIL.
*
* @param listener MegaRequestListener to track this request
*/
void resendVerificationEmail(MegaRequestListener *listener = NULL);
/**
* @brief Initialize the change of the email address associated to the account.
*
* The associated request type with this request is MegaRequest::TYPE_GET_CHANGE_EMAIL_LINK.
* Valid data in the MegaRequest object received on all callbacks:
* - MegaRequest::getEmail - Returns the email for the account
*
* If this request succeeds, a change-email link will be sent to the specified email address.
* If no user is logged in, you will get the error code MegaError::API_EACCESS in onRequestFinish().
*
* If the MEGA account is a sub-user business account, onRequestFinish will
* be called with the error code MegaError::API_EMASTERONLY.
*
* @param email The new email to be associated to the account.
* @param listener MegaRequestListener to track this request
*/
void changeEmail(const char *email, MegaRequestListener *listener = NULL);
/**
* @brief Get information about a change-email link created by MegaApi::changeEmail.
*
* The associated request type with this request is MegaRequest::TYPE_QUERY_RECOVERY_LINK
* Valid data in the MegaRequest object received on all callbacks:
* - MegaRequest::getLink - Returns the change-email link
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getEmail - Return the email associated with the link
*
* If the account is logged-in into a different account than the account for which the link
* was generated, onRequestFinish will be called with the error code MegaError::API_EACCESS.
*
* @param link Change-email link (verify)
* @param listener MegaRequestListener to track this request
*/
void queryChangeEmailLink(const char *link, MegaRequestListener *listener = NULL);
/**
* @brief Effectively changes the email address associated to the account.
*
* If no user is logged in, you will get the error code MegaError::API_EACCESS in onRequestFinish().
*
* The associated request type with this request is MegaRequest::TYPE_CONFIRM_CHANGE_EMAIL_LINK.
* Valid data in the MegaRequest object received on all callbacks:
* - MegaRequest::getLink - Returns the change-email link
* - MegaRequest::getPassword - Returns the password
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getEmail - Return the email associated with the link
*
* If the account is logged-in into a different account than the account for which the link
* was generated, onRequestFinish will be called with the error code MegaError::API_EACCESS.
*
* @param link Change-email link sent to the user's email address.
* @param pwd Password for the account.
* @param listener MegaRequestListener to track this request
*/
void confirmChangeEmail(const char *link, const char *pwd, MegaRequestListener *listener = NULL);
/**
* @brief Set proxy settings
*
* The SDK will start using the provided proxy settings as soon as this function returns.
*
* @param proxySettings Proxy settings. PROXY_AUTO is not supported and will be treated as
* PROXY_NONE
* @param listener MegaRequestListener to track this request
* @see MegaProxy
*/
void setProxySettings(MegaProxy *proxySettings, MegaRequestListener *listener = NULL);
/**
* @brief Detect the system's proxy settings.
*
* This function attempts to automatically detect the system's proxy settings.
* Proxy detection is currently supported on Windows, macOS, and Linux.
* On unsupported platforms, it returns a `MegaProxy` object of type
* `MegaProxy::PROXY_NONE`.
*
* - **Windows**: Retrieves the Internet Explorer proxy configuration for the current user.
* - **macOS**: Retrieves the current internet proxy settings.
* - **Linux**: Checks environment variables `http_proxy`, `HTTP_PROXY`, `https_proxy`, and
* `HTTPS_PROXY` for proxy configuration.
*
* The caller takes ownership of the returned `MegaProxy` object.
*
* @return A `MegaProxy` object containing the detected proxy settings.
*/
MegaProxy *getAutoProxySettings();
/**
* @brief Check if the MegaApi object is logged in
* @return 0 if not logged in, Otherwise, a number > 0
*/
int isLoggedIn();
/**
* @brief Check if we are logged in into an Ephemeral account ++
* @return true if logged into an Ephemeral account ++, Otherwise return false
*/
bool isEphemeralPlusPlus();
/**
* @brief Check the reason of being blocked.
*
* The associated request type with this request is MegaRequest::TYPE_WHY_AM_I_BLOCKED.
*
* This request can be sent internally at anytime (whenever an account gets blocked), so
* a MegaGlobalListener should process the result, show the reason and logout.
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getText - Returns the reason string (in English)
* - MegaRequest::getNumber - Returns the reason code. Possible values:
* - MegaApi::ACCOUNT_NOT_BLOCKED = 0
* Account is not blocked in any way.
*
* - MegaApi::ACCOUNT_BLOCKED_TOS_COPYRIGHT = 200
* Suspension only for multiple copyright violations.
*
* - MegaApi::ACCOUNT_BLOCKED_TOS_NON_COPYRIGHT = 300
* Suspension message for any type of suspension, but copyright suspension.
*
* - MegaApi::ACCOUNT_BLOCKED_SUBUSER_DISABLED = 400
* Subuser of the business account has been disabled.
*
* - MegaApi::ACCOUNT_BLOCKED_SUBUSER_REMOVED = 401
* Subuser of business account has been removed.
*
* - MegaApi::ACCOUNT_BLOCKED_VERIFICATION_EMAIL = 700
* The account is temporary blocked and needs to be verified by email (Weak Account Protection).
*
* If the error code in the MegaRequest object received in onRequestFinish
* is MegaError::API_OK, the user is not blocked.
*/
void whyAmIBlocked(MegaRequestListener *listener = NULL);
/**
* @brief Create a contact link
*
* The associated request type with this request is MegaRequest::TYPE_CONTACT_LINK_CREATE.
*
* Valid data in the MegaRequest object received on all callbacks:
* - MegaRequest::getFlag - Returns the value of \c renew parameter
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getNodeHandle - Return the handle of the new contact link
*
* @param renew True to invalidate the previous contact link (if any).
* @param listener MegaRequestListener to track this request
*/
void contactLinkCreate(bool renew = false, MegaRequestListener *listener = NULL);
/**
* @brief Get information about a contact link
*
* The associated request type with this request is MegaRequest::TYPE_CONTACT_LINK_QUERY.
*
* Valid data in the MegaRequest object received on all callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the contact link
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getParentHandle - Returns the userhandle of the contact
* - MegaRequest::getEmail - Returns the email of the contact
* - MegaRequest::getName - Returns the first name of the contact
* - MegaRequest::getText - Returns the last name of the contact
* - MegaRequest::getFile - Returns the avatar of the contact (JPG with Base64 encoding)
*
* @param handle Handle of the contact link to check
* @param listener MegaRequestListener to track this request
*/
void contactLinkQuery(MegaHandle handle, MegaRequestListener *listener = NULL);
/**
* @brief Delete a contact link
*
* The associated request type with this request is MegaRequest::TYPE_CONTACT_LINK_DELETE.
*
* Valid data in the MegaRequest object received on all callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the contact link
*
* @param handle Handle of the contact link to delete
* If the parameter is INVALID_HANDLE, the active contact link is deleted
*
* @param listener MegaRequestListener to track this request
*/
void contactLinkDelete(MegaHandle handle = INVALID_HANDLE, MegaRequestListener *listener = NULL);
/**
* @brief Command to keep mobile apps alive when needed
*
* When this feature is enabled, API servers will regularly send push notifications
* to keep the application running. Before using this function, it's needed to register
* a notification token using MegaApi::registerPushNotifications
*
* The associated request type with this request is MegaRequest::TYPE_KEEP_ME_ALIVE.
*
* Valid data in the MegaRequest object received on all callbacks:
* - MegaRequest::getParamType - Returns the type send in the first parameter
* - MegaRequest::getFlag - Returns true when the feature is being enabled, otherwise false
*
* @param type Type of keep alive desired
* Valid values for this parameter:
* - MegaApi::KEEP_ALIVE_CAMERA_UPLOADS = 0
*
* @param enable True to enable this feature, false to disable it
* @param listener MegaRequestListener to track this request
*
* @see MegaApi::registerPushNotifications
*/
void keepMeAlive(int type, bool enable, MegaRequestListener *listener = NULL);
/**
* @brief Get the next PSA (Public Service Announcement) that should be shown to the user
*
* After the PSA has been accepted or dismissed by the user, app should
* use MegaApi::setPSA to notify API servers about this event and
* do not get the same PSA again in the next call to this function.
*
* The associated request type with this request is MegaRequest::TYPE_GET_PSA.
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getNumber - Returns the id of the PSA (useful to call MegaApi::setPSA later)
* - MegaRequest::getName - Returns the title of the PSA
* - MegaRequest::getText - Returns the text of the PSA
* - MegaRequest::getFile - Returns the URL of the image of the PSA
* - MegaRequest::getPassword - Returns the text for the possitive button (or an empty string)
* - MegaRequest::getLink - Returns the link for the possitive button (or an empty string)
*
* If there isn't any new PSA to show, onRequestFinish will be called with the error
* code MegaError::API_ENOENT.
*
* @param listener MegaRequestListener to track this request
* @see MegaApi::setPSA
*/
void getPSA(MegaRequestListener *listener = NULL);
/**
* @brief Get the next PSA (Public Service Announcement) that should be shown to the user
*
* After the PSA has been accepted or dismissed by the user, app should
* use MegaApi::setPSA to notify API servers about this event and
* do not get the same PSA again in the next call to this function.
*
* The associated request type with this request is MegaRequest::TYPE_GET_PSA.
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getNumber - Returns the id of the PSA (useful to call MegaApi::setPSA later)
* Depending on the format of the PSA, the request may additionally return, for the new format:
* - MegaRequest::getEmail - Returns the URL (or an empty string))
* - MegaRequest::getName - Returns the title of the PSA
* - MegaRequest::getText - Returns the text of the PSA
* - MegaRequest::getFile - Returns the URL of the image of the PSA
* - MegaRequest::getPassword - Returns the text for the possitive button (or an empty string)
* - MegaRequest::getLink - Returns the link for the possitive button (or an empty string)
*
* If there isn't any new PSA to show, onRequestFinish will be called with the error
* code MegaError::API_ENOENT.
*
* @param listener MegaRequestListener to track this request
* @see MegaApi::setPSA
*/
void getPSAWithUrl(MegaRequestListener *listener = NULL);
/**
* @brief Notify API servers that a PSA (Public Service Announcement) has been already seen
*
* The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER.
*
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the value MegaApi::USER_ATTR_LAST_PSA
* - MegaRequest::getText - Returns the id passed in the first parameter (as a string)
*
* @param id Identifier of the PSA
* @param listener MegaRequestListener to track this request
*
* @see MegaApi::getPSA
*/
void setPSA(int id, MegaRequestListener *listener = NULL);
/**
* @brief Command to acknowledge user alerts.
*
* Other clients will be notified that alerts to this point have been seen.
*
* The associated request type with this request is MegaRequest::TYPE_USERALERT_ACKNOWLEDGE.
*
* @param listener MegaRequestListener to track this request
*
* @see MegaApi::getUserAlerts
*/
void acknowledgeUserAlerts(MegaRequestListener *listener = NULL);
/**
* @brief Retuns the email of the currently open account
*
* If the MegaApi object isn't logged in or the email isn't available,
* this function returns NULL
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @return Email of the account
*/
char* getMyEmail();
/**
* @brief Get the timestamp when the account was created
* @return Timestamp when the account was created
*/
int64_t getAccountCreationTs();
/**
* @brief Returns the user handle of the currently open account
*
* If the MegaApi object isn't logged in,
* this function returns NULL
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @return User handle of the account
*/
char* getMyUserHandle();
/**
* @brief Returns the user handle of the currently open account
*
* If the MegaApi object isn't logged in,
* this function returns INVALID_HANDLE
*
* @return User handle of the account
*/
MegaHandle getMyUserHandleBinary();
/**
* @brief Get the MegaUser of the currently open account
*
* If the MegaApi object isn't logged in, this function returns NULL.
*
* You take the ownership of the returned value
*
* @note The visibility of your own user is undefined and shouldn't be used.
* @return MegaUser of the currently open account, otherwise NULL
*/
MegaUser* getMyUser();
/**
* @brief Returns whether MEGA Achievements are enabled for the open account
* @return True if enabled, false otherwise.
*/
bool isAchievementsEnabled();
/**
* @brief Check if the account is a Pro Flexi account.
*
* @return returns true if it's a Pro Flexi account, otherwise false
*/
bool isProFlexiAccount();
/**
* @brief Check if the account is a business account.
*
* For accounts under Pro Flexi plans, this method also returns true.
*
* @return returns true if it's a business account, otherwise false
*/
bool isBusinessAccount();
/**
* @brief Check if the account is a master account.
*
* When a business account is a sub-user, not the master, some user actions will be blocked.
* In result, the API will return the error code MegaError::API_EMASTERONLY. Some examples of
* requests that may fail with this error are:
* - MegaApi::cancelAccount
* - MegaApi::changeEmail
* - MegaApi::remove
* - MegaApi::removeVersion
*
* @return returns true if it's a master account, false if it's a sub-user account
*/
bool isMasterBusinessAccount();
/**
* @brief Check if the business account is active or not.
*
* When a business account is not active, some user actions will be blocked. In result, the API
* will return the error code MegaError::API_EBUSINESSPASTDUE. Some examples of requests
* that may fail with this error are:
* - MegaApi::startDownload
* - MegaApi::startUpload
* - MegaApi::copyNode
* - MegaApi::share
* - MegaApi::cleanRubbishBin
*
* @return returns true if the account is active, otherwise false
*/
bool isBusinessAccountActive();
/**
* @brief Get the status of a business account.
*
* @return Returns the business account status, possible values:
* MegaApi::BUSINESS_STATUS_EXPIRED = -1
* MegaApi::BUSINESS_STATUS_INACTIVE = 0
* MegaApi::BUSINESS_STATUS_ACTIVE = 1
* MegaApi::BUSINESS_STATUS_GRACE_PERIOD = 2
*/
int getBusinessStatus();
/**
* @brief Returns the deadline to remedy the storage overquota situation
*
* This value is valid only when MegaApi::getUserData has been called after
* receiving a callback MegaListener/MegaGlobalListener::onEvent of type
* MegaEvent::EVENT_STORAGE, reporting STORAGE_STATE_PAYWALL.
* The value will become invalid once the state of storage changes.
*
* @return Timestamp representing the deadline to remedy the overquota
*/
int64_t getOverquotaDeadlineTs();
/**
* @brief Returns when the user was warned about overquota state
*
* This value is valid only when MegaApi::getUserData has been called after
* receiving a callback MegaListener/MegaGlobalListener::onEvent of type
* MegaEvent::EVENT_STORAGE, reporting STORAGE_STATE_PAYWALL.
* The value will become invalid once the state of storage changes.
*
* You take the ownership of the returned value.
*
* @return MegaIntegerList with the timestamp corresponding to each warning
*/
MegaIntegerList *getOverquotaWarningsTs();
/**
* @brief Check if the password is correct for the current account
* @param password Password to check
* @return True if the password is correct for the current account, otherwise false.
*/
bool checkPassword(const char *password);
/**
* @brief Returns the credentials of the currently open account
*
* If the MegaApi object isn't logged in or there's no signing key available,
* this function returns NULL
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @return Fingerprint of the signing key of the current account
*/
char* getMyCredentials();
/**
* Returns the credentials of a given user
*
* The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns MegaApi::USER_ATTR_ED25519_PUBLIC_KEY
* - MegaRequest::getFlag - Returns true
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getPassword - Returns the credentials in hexadecimal format
*
* @param user MegaUser of the contact (see MegaApi::getContact) to get the fingerprint
* @param listener MegaRequestListener to track this request
*/
void getUserCredentials(MegaUser *user, MegaRequestListener *listener = NULL);
/**
* @brief Checks if credentials are verified for the given user
*
* @param user MegaUser of the contact whose credentiasl want to be checked
* @return true if verified, false otherwise
*/
bool areCredentialsVerified(MegaUser *user);
/**
* @brief Verify credentials of a given user
*
* This function allow to tag credentials of a user as verified. It should be called when the
* logged in user compares the fingerprint of the user (provided by an independent and secure
* method) with the fingerprint shown by the app (@see MegaApi::getUserCredentials).
*
* The associated request type with this request is MegaRequest::TYPE_VERIFY_CREDENTIALS
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns userhandle
*
* @param user MegaUser of the contact whose credentials want to be verified
* @param listener MegaRequestListener to track this request
*/
void verifyCredentials(MegaUser *user, MegaRequestListener *listener = NULL);
/**
* @brief Reset credentials of a given user
*
* Call this function to undo the verification of credentials done by MegaApi::verifyCrendentials
*
* The associated request type with this request is MegaRequest::TYPE_VERIFY_CREDENTIALS
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns userhandle
* - MegaRequest::getFlag - Returns true
*
* @param user MegaUser of the contact whose credentials want to be reset
* @param listener MegaRequestListener to track this request
*/
void resetCredentials(MegaUser *user, MegaRequestListener *listener = NULL);
/**
* @brief Set the active log level
*
* This function sets the log level of the logging system. Any log listener registered by
* MegaApi::addLoggerObject will receive logs with the same or a lower level than
* the one passed to this function.
*
* @param logLevel Active log level
*
* These are the valid values for this parameter:
* - MegaApi::LOG_LEVEL_FATAL = 0
* - MegaApi::LOG_LEVEL_ERROR = 1
* - MegaApi::LOG_LEVEL_WARNING = 2
* - MegaApi::LOG_LEVEL_INFO = 3
* - MegaApi::LOG_LEVEL_DEBUG = 4
* - MegaApi::LOG_LEVEL_VERBOSE = 5
* - MegaApi::LOG_LEVEL_MAX = 5
*/
static void setLogLevel(int logLevel);
/**
* @brief Turn on extra detailed logging for some modules
*
* Sometimes we need super detailed logging to investigate complicated issues
* However for log size under normal conditions it's not practical to turn that on
* This function allows that super detailed logging to be enabled just for
* the module in question.
*
* @param networking Enable detailed extra logging for networking
* @param syncs Enable detailed extra logging for syncs
*/
void setLogExtraForModules(bool networking, bool syncs);
/**
* @brief Set the maximum size limit for request payload logging
*
* This function controls the maximum size of request payloads that will be logged
* in full. When a payload exceeds this limit, it will be truncated in the middle
* with "[...]" inserted between the first and last portions to indicate truncation.
*
* @param maxSize Maximum payload size in bytes that will be logged without truncation.
* Use 0 to use the max size limit.
*
*/
static void setMaxPayloadLogSize(size_t maxSize);
/**
* @brief Enable log to console
*
* This function is only relevant if non-exclusive loggers are used.
* For exclusive logging (ie, only one logger and no locking before it's called back)
* the exclusive logger can easily output to console itself.
*
* By default, log to console is false. Logging to console is serialized via a mutex to
* avoid interleaving by multiple threads, even in performance mode.
*
* @param enable True to show messages in console, false to skip them.
*/
static void setLogToConsole(bool enable);
/**
* @brief
* Enable full JSON logging.
*
* This function allows an application to control whether JSON
* requests and responses are logged in full. When enable is true,
* JSON content will always be logged and will not be truncated.
* When false, JSON may be logged in some situations but only if
* the content is less than the logger's maximum payload size.
*
* @see MegaApi::setMaxPayloadLogSize
* @see MegaApi::setLogJSON
*
* @deprecated This function is deprecated and will be removed in future releases. Use
* setLogJSON and setMaxPlayloadLogSize instead.
*/
MEGA_DEPRECATED
static void setLogJSONContent(bool enable);
/**
* @brief Configure JSON request and response logging options
*
* This function controls how JSON requests and responses are logged by the SDK.
* Use bitwise OR to combine multiple logging options.
*
* Available logging flags:
* - MegaApi::JSON_LOG_NONE = 0
* Disable all JSON logging if no other flags are set
*
* - MegaApi::JSON_LOG_CHUNK_RECEIVED = 1
* Enable logging of received JSON chunked data
* @see MegaApi::setMaxPayloadLogSize for size limits
*
* - MegaApi::JSON_LOG_CHUNK_PROCESSING = 2
* Enable logging of JSON chunked data during processing
*
* - MegaApi::JSON_LOG_CHUNK_CONSUMED = 4
* Enable logging of consumed JSON chunked data (enabled by default)
*
* - MegaApi::JSON_LOG_SENDING = 8
* Enable logging of JSON data being sent to the server (enabled by default)
*
* - MegaApi::JSON_LOG_NONCHUNK_RECEIVED = 16
* Enable logging of received non-chunked JSON data (enabled by default)
*
* @param value Bitwise combination of logging flags
*
* Example usage:
* @code
* // Enable received and consumed logging
* MegaApi::setLogJSON(MegaApi::JSON_LOG_CHUNK_RECEIVED | MegaApi::JSON_LOG_CHUNK_CONSUMED);
*
* // Disable all JSON logging
* MegaApi::setLogJSON(MegaApi::JSON_LOG_NONE);
* @endcode
*/
static void setLogJSON(uint32_t value);
/**
* @brief Get the current JSON logging configuration settings
*
* This function retrieves the currently active JSON logging flags that control
* how JSON requests and responses are logged by the SDK.
*
* @return Current JSON logging configuration as a bitwise combination of flags
*
* @see MegaApi::setLogJSON for configuring these settings
* @see MegaApi::setMaxPayloadLogSize for controlling log size limits
*/
static uint32_t getLogJSON();
/**
* @brief Add a MegaLogger implementation to receive SDK logs
*
* Logs received by this objects depends on the active log level.
* By default, it is MegaApi::LOG_LEVEL_INFO. You can change it
* using MegaApi::setLogLevel.
*
* You can remove the existing logger by using MegaApi::removeLoggerObject.
*
* In performance mode, it is assumed that this is only called on startup and
* not while actively logging.
*
* @param megaLogger MegaLogger implementation
* @param singleExclusiveLogger If set, this is the only logger that will be called, and no mutexes will be locked before calling it.
*/
static void addLoggerObject(MegaLogger *megaLogger, bool singleExclusiveLogger = false);
/**
* @brief Remove a MegaLogger implementation to stop receiving SDK logs
*
* If the logger was registered in the past, it will stop receiving log
* messages after the call to this function.
*
* In exclusive mode, it is assumed that this is only called on shutdown and
* not while actively logging. There is no locking on the exclusive log callback pointer,
* so there may already be threads deep in the logging functions. Clearing this
* callback pointer won't stop those or wait for them to complete. So you can't
* immediately delete the logger after calling this, unless you know for sure
* that no threads are logging. Recommendation is to stop all other threads before calling this.
*
* @param megaLogger Previously registered MegaLogger implementation
* @param singleExclusiveLogger If an exclusive logger was previously set, use this flag to remove it.
*/
static void removeLoggerObject(MegaLogger *megaLogger, bool singleExclusiveLogger = false);
/**
* @brief Send a log to the logging system
*
* This log will be received by the active logger object (MegaApi::setLoggerObject) if
* the log level is the same or lower than the active log level (MegaApi::setLogLevel)
*
* The third and the fouth parameter are optional. You may want to use __FILE__ and __LINE__
* to complete them.
*
* In performance mode, only logging to console is serialized through a mutex.
* Logging to `MegaLogger`s is not serialized and has to be done by the subclasses if needed.
*
* @param logLevel Log level for this message
* @param message Message for the logging system
* @param filename Origin of the log message
* @param line Line of code where this message was generated
*/
static void log(int logLevel, const char* message, const char *filename = "", int line = -1);
/**
* @brief Differentiate MegaApi log output from different instances.
*
* If multiple MegaApi instances are used in a single application, it can be useful to
* distinguish their activity in the log. Setting a name here for this instance will
* cause some particularly relevant log lines to contain it.
* A very short name is best to avoid increasing the log size too much.
*
* @param loggingName Name of this instance, to be output in log messages from this MegaApi
* or NULL to clear a previous logging name.
*/
void setLoggingName(const char* loggingName);
/**
* @brief Create a folder in the MEGA account
*
* The associated request type with this request is MegaRequest::TYPE_CREATE_FOLDER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParentHandle - Returns the handle of the parent folder
* - MegaRequest::getName - Returns the name of the new folder
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getNodeHandle - Handle of the new folder
* - MegaRequest::getFlag - True if target folder (\c parent) was overriden
*
* If there already is a folder in target path with the same name, error code API_EEXIST is
* returned and the existing folder MegaHandle included in MegaRequest::getNodeHandle.
*
* If the MEGA account is a business account and it's status is expired, onRequestFinish will
* be called with the error code MegaError::API_EBUSINESSPASTDUE.
*
* @param name Name of the new folder
* @param parent Parent folder
* @param listener MegaRequestListener to track this request
*/
void createFolder(const char* name, MegaNode *parent, MegaRequestListener *listener = NULL);
/**
* @brief Get Password Manager Base folder node from the MEGA account
*
* The associated request type with this request is
* MegaRequest::TYPE_CREATE_PASSWORD_MANAGER_BASE Valid data in the MegaRequest object
* received on callbacks:
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getNodeHandle - Handle of the folder
*
* A successfully completed fetchNodes request is required before calling getNodeByHandle
* with the MegaHandle returned by this request. Otherwise, getNodeByHandle will return
* NULL.
*
* @param listener MegaRequestListener to track this request
*/
void getPasswordManagerBase(MegaRequestListener *listener = NULL);
/**
* @brief Returns true if provided MegaHandle is of a Password Node Folder
*
* A folder is considered a Password Node Folder if Password Manager Base is its
* ancestor, or if the node is the Password Manager Base folder itself.
*
* @param node MegaHandle of the node to check if it is a Password Node Folder
* @return true if this node is a Password Node Folder, false otherwise.
* In case node doesn't exists this method will also returns false.
*
* @deprecated Moved to isPasswordManagerNodeFolder.
*/
MEGA_DEPRECATED
virtual bool isPasswordNodeFolder(MegaHandle node) const;
/**
* @brief Returns true if provided MegaHandle belongs to a Password Manager Node Folder
*
* A folder is considered a Password Manager Node Folder if Password Manager Base is its
* ancestor, or if the node is the Password Manager Base folder itself.
*
* @param node MegaHandle of the node to check if it is a Password Manager Node Folder
* @return true if this node is a Password Manager Node Folder, false otherwise.
* In case node doesn't exists this method will also returns false.
*/
virtual bool isPasswordManagerNodeFolder(MegaHandle node) const;
/**
* @brief Create a new Credit Card Node in your Password Manager tree
*
* The associated request type with this request is MegaRequest::TYPE_CREATE_PASSWORD_NODE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParentHandle - Handle of the parent provided as an argument
* - MegaRequest::getName - name for the new Password Node provided as an argument
* - MegaRequest::getParamType - MegaApi::PWM_NODE_TYPE_CREDIT_CARD
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getNodeHandle - Handle of the new Password Node
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_EBUSINESSPASTDUE:
* + If the MEGA account is a business account and it's status is expired
* - MegaError::API_EARGS:
* + If `name` is nullptr or empty string
* + If `data` is nullptr
* + If `parent` does belong to a passwordNodeFolder
* - MegaError::API_EEXIST:
* + If there already is a Password Manager Node in the target path with the same name. In
* that case, the existing Password Manager Node MegaHandle can be retrieved by
* MegaRequest::getNodeHandle.
* - MegaError::API_EAPPKEY:
* + If the `data` is ill-formed. These are the format requirements for the data in the
* CreditCardNodeData object:
* - `cardNumber`: Mandatory (not nullptr nor empty string). Can only contain digits (no
* spaces or other characters are allowed)
* - `cvv`: Optional. If defined, must contain only digits (no spaces or other
* characters are allowed)
* - `expirationDate`: Optional. If defined must follow exactly the format: MM/YY, where
* MM and YY are digits and MM must be between 01 and 12. Some examples:
* + Valid inputs: 01/11, 12/25, 05/99.
* + Invalid inputs: 13/25, 1/30, 03/5.
* - `notes` and `cardHolderName`: Optionals and with no format restrictions.
*
* @param name Name for the new Credit Card Node
* @param data Credit Card Node data for the Credit Card Node
* @param parent Parent folder for the new Credit Card Node
* @param listener MegaRequestListener to track this request
*/
virtual void createCreditCardNode(const char* name,
const MegaNode::CreditCardNodeData* data,
MegaHandle parent,
MegaRequestListener* listener = NULL);
/**
* @brief Create a new Password Node in your Password Manager tree
*
* The associated request type with this request is MegaRequest::TYPE_CREATE_PASSWORD_NODE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParentHandle - Handle of the parent provided as an argument
* - MegaRequest::getName - name for the new Password Node provided as an argument
* - MegaRequest::getParamType - MegaApi::PWM_NODE_TYPE_PASSWORD
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getNodeHandle - Handle of the new Password Node
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_EBUSINESSPASTDUE:
* + If the MEGA account is a business account and it's status is expired
* - MegaError::API_EARGS:
* + If `name` is nullptr or empty string
* + If `data` is nullptr
* + If `parent` does belong to a passwordNodeFolder
* - MegaError::API_EEXIST:
* + If there already is a Password Manager Node in the target path with the same name. In
* that case, the existing Password Manager Node MegaHandle can be retrieved by
* MegaRequest::getNodeHandle.
* - MegaError::API_EAPPKEY:
* + If the `data` is ill-formed. These are the format requirements for the data in the
* PasswordNodeData object:
* - `password`: Mandatory (not nullptr nor empty string).
* - `cvv`: Optional. If defined, must contain only digits (no spaces or other
* characters are allowed)
* - `totp`: Optional. If defined all their field must have valid values, i.e., the
* `TotpData::Validation` object get from `TotpData::getValidation()` must return true
* on `TotpData::Validation::isValidForCreate()`. See `TotpData::Validation` class
* documentation for more information.
* - `notes`, `url` and `userName`: Optionals and with no format restrictions.
*
* @param name Name for the new Password Node
* @param data Password Node data for the Password Node
* @param parent Parent folder for the new Password Node
* @param listener MegaRequestListener to track this request
*/
void createPasswordNode(const char *name, const MegaNode::PasswordNodeData *data, MegaHandle parent,
MegaRequestListener *listener = NULL);
/**
* @brief Update a Creadit Card Node in the MEGA account according to the parameters
*
* The associated request type with this request is MegaRequest::TYPE_UPDATE_PASSWORD_NODE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - handle provided of the Password Node to update
* - MegaRequest::getParamType - MegaApi::PWM_NODE_TYPE_CREDIT_CARD
*
* If the MEGA account is a business account and it's status is expired, onRequestFinish
* will be called with the error code MegaError::API_EBUSINESSPASTDUE.
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_EBUSINESSPASTDUE:
* + If the MEGA account is a business account and it's status is expired
* - MegaError::API_EARGS:
* + If `newData` is nullptr or empty
* + If `node` does not exist or does not belong to a Credit Card Node
* - MegaError::API_EAPPKEY:
* + If the node ends up in an invalid state after applying the provided updates in
* `newData`. See `MegaApi::createCreditCardNode` documentation for more details on the
* expected format of each field if specified for the update.
*
* @param node Node to modify
* @param newData New data for the Credit Card Node to update
* @param listener MegaRequestListener to track this request
*/
void updateCreditCardNode(MegaHandle node,
const MegaNode::CreditCardNodeData* newData,
MegaRequestListener* listener = NULL);
/**
* @brief Update a Password Node in the MEGA account according to the parameters
*
* The associated request type with this request is MegaRequest::TYPE_UPDATE_PASSWORD_NODE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - handle provided of the Password Node to update
* - MegaRequest::getParamType - MegaApi::PWM_NODE_TYPE_PASSWORD
*
* If the MEGA account is a business account and it's status is expired, onRequestFinish
* will be called with the error code MegaError::API_EBUSINESSPASTDUE.
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_EBUSINESSPASTDUE:
* + If the MEGA account is a business account and it's status is expired
* - MegaError::API_EARGS:
* + If `newData` is nullptr or empty
* + If `node` does not exist or does not belong to a password node
* - MegaError::API_EAPPKEY:
* + If the node ends up in an invalid state after applying the provided updates in
* `newData`. See `MegaApi::createPasswordNode` documentation for more details on the
* expected format of each field if specified for the update.
*
* @param node Node to modify
* @param newData New data for the Password Node to update
* @param listener MegaRequestListener to track this request
*/
void updatePasswordNode(MegaHandle node, const MegaNode::PasswordNodeData* newData,
MegaRequestListener *listener = NULL);
/**
* @brief Import passwords from a file into your Password Manager tree
*
* The associated request type with this request is
* MegaRequest::TYPE_IMPORT_PASSWORDS_FROM_FILE. Valid data in the MegaRequest object
* received on callbacks:
* - MegaRequest::getFile - Path of the file provided as an argument.
* - MegaRequest::getParamType - Source of the file provided as an argument (see
* fileSource documentation).
* - MegaRequest::getParentHandle - Handle of the parent provided as an argument.
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getMegaHandleList - A list with all the handles for all the new imported
* Password Nodes.
* - MegaRequest::getMegaStringIntegerMap - A map with problematic content as key and error
* code as value
* Possible error codes are:
* IMPORTED_PASSWORD_ERROR_PARSER = 1
* IMPORTED_PASSWORD_ERROR_MISSINGPASSWORD = 2
* IMPORTED_PASSWORD_ERROR_MISSINGNAME = 3
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_EARGS:
* + Invalid parent (parent doesn't exist or isn't password node)
* + Invalid fileSource
* + NULL at filePath
* + File with wrong format
* - MegaError::API_EREAD:
* + File can't be opened
* - MegaError::API_EACESS
* + File is empty
*
* @param filePath Path to the file containing the passwords to import.
* @param fileSource Type for the source from where the file was exported.
* Valid values are:
* - IMPORT_PASSWORD_SOURCE_GOOGLE = 0
* @param parent Parent handle for node that will contain new nodes as children.
* @param listener MegaRequestListener to track this request.
*/
void importPasswordsFromFile(const char* filePath,
const int fileSource,
MegaHandle parent,
MegaRequestListener* listener = NULL);
/**
* @brief Create a new empty folder in your local file system
*
* @param localPath Path of the new folder
* @return True if the local folder was successfully created, otherwise false.
*/
bool createLocalFolder(const char* localPath);
/**
* @brief Move a node in the MEGA account
*
* The associated request type with this request is MegaRequest::TYPE_MOVE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the node to move
* - MegaRequest::getParentHandle - Returns the handle of the new parent for the node
*
* If the MEGA account is a business account and it's status is expired, onRequestFinish will
* be called with the error code MegaError::API_EBUSINESSPASTDUE.
*
* @param node Node to move
* @param newParent New parent for the node
* @param listener MegaRequestListener to track this request
*/
void moveNode(MegaNode* node, MegaNode* newParent, MegaRequestListener *listener = NULL);
/**
* @brief Move a node in the MEGA account changing the file name
*
* The associated request type with this request is MegaRequest::TYPE_MOVE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the node to move
* - MegaRequest::getParentHandle - Returns the handle of the new parent for the node
* - MegaRequest::getName - Returns the name for the new node
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getFlag - True if target folder (\c newParent) was overriden
*
* If the MEGA account is a business account and it's status is expired, onRequestFinish will
* be called with the error code MegaError::API_EBUSINESSPASTDUE.
*
* @param node Node to move
* @param newParent New parent for the node
* @param newName Name for the new node
* @param listener MegaRequestListener to track this request
*/
void moveNode(MegaNode* node, MegaNode* newParent, const char* newName, MegaRequestListener *listener = NULL);
/**
* @brief Copy a node in the MEGA account
*
* The associated request type with this request is MegaRequest::TYPE_COPY
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the node to copy
* - MegaRequest::getParentHandle - Returns the handle of the new parent for the new node
* - MegaRequest::getPublicMegaNode - Returns the node to copy (if it is a public node)
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getNodeHandle - Handle of the new node
* - MegaRequest::getFlag - True if target folder (\c newParent) was overriden
*
* @note In case the target folder was overriden, the MegaRequest::getParentHandle still keeps
* the handle of the original target folder. You can check the final parent by checking the
* value returned by MegaNode::getParentHandle
*
* If the status of the business account is expired, onRequestFinish will be called with the error
* code MegaError::API_EBUSINESSPASTDUE.
*
* @param node Node to copy
* @param newParent Parent for the new node
* @param listener MegaRequestListener to track this request
*/
void copyNode(MegaNode* node, MegaNode *newParent, MegaRequestListener *listener = NULL);
/**
* @brief Copy a node in the MEGA account changing the file name
*
* The associated request type with this request is MegaRequest::TYPE_COPY
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the node to copy
* - MegaRequest::getParentHandle - Returns the handle of the new parent for the new node
* - MegaRequest::getPublicMegaNode - Returns the node to copy
* - MegaRequest::getName - Returns the name for the new node
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getNodeHandle - Handle of the new node
*
* If the status of the business account is expired, onRequestFinish will be called with the error
* code MegaError::API_EBUSINESSPASTDUE.
*
* @param node Node to copy
* @param newParent Parent for the new node
* @param newName Name for the new node
* @param listener MegaRequestListener to track this request
*/
void copyNode(MegaNode* node, MegaNode *newParent, const char* newName, MegaRequestListener *listener = NULL);
/**
* @brief Rename a node in the MEGA account
*
* The associated request type with this request is MegaRequest::TYPE_RENAME
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the node to rename
* - MegaRequest::getName - Returns the new name for the node
*
* If the MEGA account is a business account and it's status is expired, onRequestFinish will
* be called with the error code MegaError::API_EBUSINESSPASTDUE.
*
* @param node Node to modify
* @param newName New name for the node
* @param listener MegaRequestListener to track this request
*/
void renameNode(MegaNode* node, const char* newName, MegaRequestListener *listener = NULL);
/**
* @brief Remove a node from the MEGA account
*
* This function doesn't move the node to the Rubbish Bin, it fully removes the node. To move
* the node to the Rubbish Bin use MegaApi::moveNode
*
* If the node has previous versions, they will be deleted too
*
* The associated request type with this request is MegaRequest::TYPE_REMOVE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the node to remove
* - MegaRequest::getFlag - Returns false because previous versions won't be preserved
*
* If the MEGA account is a sub-user business account, onRequestFinish will
* be called with the error code MegaError::API_EMASTERONLY.
*
* @param node Node to remove
* @param listener MegaRequestListener to track this request
*/
void remove(MegaNode* node, MegaRequestListener *listener = NULL);
/**
* @brief Remove all versions from the MEGA account
*
* The associated request type with this request is MegaRequest::TYPE_REMOVE_VERSIONS
*
* When the request finishes, file versions might not be deleted yet.
* Deletions are notified using onNodesUpdate callbacks.
*
* @param listener MegaRequestListener to track this request
*/
void removeVersions(MegaRequestListener *listener = NULL);
/**
* @brief Remove a version of a file from the MEGA account
*
* This function doesn't move the node to the Rubbish Bin, it fully removes the node. To move
* the node to the Rubbish Bin use MegaApi::moveNode.
*
* If the node has previous versions, they won't be deleted.
*
* The associated request type with this request is MegaRequest::TYPE_REMOVE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the node to remove
* - MegaRequest::getFlag - Returns true because previous versions will be preserved
*
* If the MEGA account is a sub-user business account, onRequestFinish will
* be called with the error code MegaError::API_EMASTERONLY.
*
* @param node Node to remove
* @param listener MegaRequestListener to track this request
*/
void removeVersion(MegaNode* node, MegaRequestListener *listener = NULL);
/**
* @brief Restore a previous version of a file
*
* Only versions of a file can be restored, not the current version (because it's already current).
* The node will be copied and set as current. All the version history will be preserved without changes,
* being the old current node the previous version of the new current node, and keeping the restored
* node also in its previous place in the version history.
*
* The associated request type with this request is MegaRequest::TYPE_RESTORE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the node to restore
*
* If the MEGA account is a business account and it's status is expired, onRequestFinish will
* be called with the error code MegaError::API_EBUSINESSPASTDUE.
*
* @param version Node with the version to restore
* @param listener MegaRequestListener to track this request
*/
void restoreVersion(MegaNode *version, MegaRequestListener *listener = NULL);
/**
* @brief Clean the Rubbish Bin in the MEGA account
*
* This function effectively removes every node contained in the Rubbish Bin. In order to
* avoid accidental deletions, you might want to warn the user about the action.
*
* The associated request type with this request is MegaRequest::TYPE_CLEAN_RUBBISH_BIN. This
* request returns MegaError::API_ENOENT if the Rubbish bin is already empty.
*
* If the MEGA account is a business account and it's status is expired, onRequestFinish will
* be called with the error code MegaError::API_EBUSINESSPASTDUE.
*
* @param listener MegaRequestListener to track this request
*/
void cleanRubbishBin(MegaRequestListener *listener = NULL);
/**
* @brief Send a node to the Inbox of another MEGA user using a MegaUser
*
* The associated request type with this request is MegaRequest::TYPE_COPY
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the node to send
* - MegaRequest::getEmail - Returns the email of the user that receives the node
*
* If the MEGA account is a business account and it's status is expired, onRequestFinish will
* be called with the error code MegaError::API_EBUSINESSPASTDUE.
*
* @obsolete The Inbox rootnode has been recycled for Vault and will no longer
* accept to put nodes in user's Inbox. This method could be removed in the future.
*
* @param node Node to send
* @param user User that receives the node
* @param listener MegaRequestListener to track this request
*/
void sendFileToUser(MegaNode *node, MegaUser *user, MegaRequestListener *listener = NULL);
/**
* @brief Send a node to the Inbox of another MEGA user using his email
*
* The associated request type with this request is MegaRequest::TYPE_COPY
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the node to send
* - MegaRequest::getEmail - Returns the email of the user that receives the node
*
* If the MEGA account is a business account and it's status is expired, onRequestFinish will
* be called with the error code MegaError::API_EBUSINESSPASTDUE.
*
* @obsolete The Inbox rootnode has been recycled for Vault and will no longer
* accept to put nodes in user's Inbox. This method could be removed in the future.
*
* @param node Node to send
* @param email Email of the user that receives the node
* @param listener MegaRequestListener to track this request
*/
void sendFileToUser(MegaNode *node, const char* email, MegaRequestListener *listener = NULL);
/**
* @brief Upgrade cryptographic security
*
* This should be called only after MegaEvent::EVENT_UPGRADE_SECURITY event is received to effectively
* proceed with the cryptographic upgrade process.
* This should happen only once per account.
*
* The associated request type with this request is MegaRequest::TYPE_UPGRADE_SECURITY
*
* @param listener MegaRequestListener to track this request
*/
void upgradeSecurity(MegaRequestListener* listener = NULL);
/**
* @brief Get the contact verification warning flag status
*
* It returns if showing the warnings to verify contacts is enabled.
*
* @return True if showing the warnings are enabled, false otherwise.
*/
bool contactVerificationWarningEnabled();
/**
* @brief Allows to change the hardcoded value of the "Manual Verification" flag
*
* With this feature flag set, the client will require manual verification of
* contact credentials of users (both sharers AND sharees) in order to decrypt
* shared folders correctly if the "secure" flag is set to true.
*
* The default value is "false".
*
* @note If the "secure" flag is disabled, "Manual Verification" flag has no
* effect.
*
* @param enable New value of the flag
*/
void setManualVerificationFlag(bool enable);
/**
* @brief Creates a new share key for the node if there is no share key already created.
*
* Apps should call it before starting any new share (MegaApi::share). Otherwise, the
* share request may fail.
*
* Note that it's safe to call this method for the same node multiple times.
*
* The associated request type with this request is MegaRequest::TYPE_OPEN_SHARE_DIALOG
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the node to share
*
* @param node The folder to share. It must be a non-root folder
* @param listener MegaRequestListener to track this request
*/
void openShareDialog(MegaNode *node, MegaRequestListener *listener = NULL);
/**
* @brief Share or stop sharing a folder in MEGA with another user using a MegaUser
*
* To share a folder with an user, set the desired access level in the level parameter. If you
* want to stop sharing a folder use the access level MegaShare::ACCESS_UNKNOWN
*
* Before calling this method, the app should call MegaApi::openShareDialog in order to
* ensure that a share-key exists. If it doesn't exist, it will be created by the call to
* MegaApi::openShareDialog. If the app doesn't call it in advance, this method will return
* API_EKEY (unless there are other shares already for this node)
*
* The associated request type with this request is MegaRequest::TYPE_SHARE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the folder to share
* - MegaRequest::getEmail - Returns the email of the user that receives the shared folder
* - MegaRequest::getAccess - Returns the access that is granted to the user
*
* If the MEGA account is a business account and it's status is expired, onRequestFinish will
* be called with the error code MegaError::API_EBUSINESSPASTDUE.
*
* @param node The folder to share. It must be a non-root folder
* @param user User that receives the shared folder
* @param level Permissions that are granted to the user
* Valid values for this parameter:
* - MegaShare::ACCESS_UNKNOWN = -1
* Stop sharing a folder with this user
*
* - MegaShare::ACCESS_READ = 0
* - MegaShare::ACCESS_READWRITE = 1
* - MegaShare::ACCESS_FULL = 2
* - MegaShare::ACCESS_OWNER = 3
*
* @param listener MegaRequestListener to track this request
*/
void share(MegaNode *node, MegaUser* user, int level, MegaRequestListener *listener = NULL);
/**
* @brief Share or stop sharing a folder in MEGA with another user using his email
*
* To share a folder with an user, set the desired access level in the level parameter. If you
* want to stop sharing a folder use the access level MegaShare::ACCESS_UNKNOWN
*
* Before calling this method, the app should call MegaApi::openShareDialog in order to
* ensure that a share-key exists. If it doesn't exist, it will be created by the call to
* MegaApi::openShareDialog. If the app doesn't call it in advance, this method will return
* API_EKEY (unless there are other shares already for this node)
*
* The associated request type with this request is MegaRequest::TYPE_SHARE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the folder to share
* - MegaRequest::getEmail - Returns the email of the user that receives the shared folder
* - MegaRequest::getAccess - Returns the access that is granted to the user
*
* If the MEGA account is a business account and it's status is expired, onRequestFinish will
* be called with the error code MegaError::API_EBUSINESSPASTDUE.
*
* @param node The folder to share. It must be a non-root folder
* @param email Email of the user that receives the shared folder. If it doesn't have a MEGA account, the folder will be shared anyway
* and the user will be invited to register an account.
*
* @param level Permissions that are granted to the user
* Valid values for this parameter:
* - MegaShare::ACCESS_UNKNOWN = -1
* Stop sharing a folder with this user
*
* - MegaShare::ACCESS_READ = 0
* - MegaShare::ACCESS_READWRITE = 1
* - MegaShare::ACCESS_FULL = 2
* - MegaShare::ACCESS_OWNER = 3
*
* @param listener MegaRequestListener to track this request
*/
void share(MegaNode *node, const char* email, int level, MegaRequestListener *listener = NULL);
/**
* @brief Import a public link to the account
*
* The associated request type with this request is MegaRequest::TYPE_IMPORT_LINK
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getLink - Returns the public link to the file
* - MegaRequest::getParentHandle - Returns the folder that receives the imported file
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getNodeHandle - Handle of the new node in the account
* - MegaRequest::getFlag - True if target folder (\c parent) was overriden
*
* If the MEGA account is a business account and it's status is expired, onRequestFinish will
* be called with the error code MegaError::API_EBUSINESSPASTDUE.
*
* @param megaFileLink Public link to a file in MEGA
* @param parent Parent folder for the imported file
* @param listener MegaRequestListener to track this request
*/
void importFileLink(const char* megaFileLink, MegaNode* parent, MegaRequestListener *listener = NULL);
/**
* @brief Decrypt password-protected public link
*
* The associated request type with this request is MegaRequest::TYPE_PASSWORD_LINK
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getLink - Returns the encrypted public link to the file/folder
* - MegaRequest::getPassword - Returns the password to decrypt the link
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getText - Decrypted public link
*
* @param link Password/protected public link to a file/folder in MEGA
* @param password Password to decrypt the link
* @param listener MegaRequestListener to track this request
*/
void decryptPasswordProtectedLink(const char* link, const char* password, MegaRequestListener *listener = NULL);
/**
* @brief Encrypt public link with password
*
* The associated request type with this request is MegaRequest::TYPE_PASSWORD_LINK
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getLink - Returns the public link to be encrypted
* - MegaRequest::getPassword - Returns the password to encrypt the link
* - MegaRequest::getFlag - Returns true
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getText - Encrypted public link
*
* @param link Public link to be encrypted, including encryption key for the link
* @param password Password to encrypt the link
* @param listener MegaRequestListener to track this request
*/
void encryptLinkWithPassword(const char* link, const char* password, MegaRequestListener *listener = NULL);
/**
* @brief Get a MegaNode from a public link to a file
*
* A public node can be imported using MegaApi::copyNode or downloaded using MegaApi::startDownload
*
* The associated request type with this request is MegaRequest::TYPE_GET_PUBLIC_NODE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getLink - Returns the public link to the file
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getPublicMegaNode - Public MegaNode corresponding to the public link
* - MegaRequest::getFlag - Return true if the provided key along the link is invalid.
*
* If the MEGA account is a business account and it's status is expired, onRequestFinish will
* be called with the error code MegaError::API_EBUSINESSPASTDUE.
*
* @param megaFileLink Public link to a file in MEGA
* @param listener MegaRequestListener to track this request
*/
void getPublicNode(const char* megaFileLink, MegaRequestListener *listener = NULL);
/**
* @brief Get downloads urls for a node
*
* The associated request type with this request is MegaRequest::TYPE_GET_DOWNLOAD_URLS
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getName - Returns semicolon-separated download URL(s) to the file
* - MegaRequest::getLink - Returns semicolon-separated IPv4 of the server in the URL(s)
* - MegaRequest::getText - Returns semicolon-separated IPv6 of the server in the URL(s)
* - MegaRequest::getMegaStringMap - Returns a {node handle, file handle} pair for the given
* file node
*
* If the MEGA account is a business account and it's status is expired, onRequestFinish
* will be called with the error code MegaError::API_EBUSINESSPASTDUE.
*
* @param node Node to get the downloads URLs
* @param singleUrl Always return one URL (even for raided files)
* @param listener MegaRequestListener to track this request
*/
void getDownloadUrl(MegaNode* node, bool singleUrl, MegaRequestListener *listener = nullptr);
/**
* @brief Build the URL for a public link
*
* @note This function does not create the public link itself. It simply builds the URL
* from the provided data.
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @param publicHandle Public handle of the link, in B64url encoding.
* @param key Encryption key of the link.
* @param isFolder True for folder links, false for file links.
* @return The public link for the provided data
*/
const char *buildPublicLink(const char *publicHandle, const char *key, bool isFolder);
/**
* @brief Get the thumbnail of a node
*
* If the node doesn't have a thumbnail the request fails with the MegaError::API_ENOENT
* error code
*
* The associated request type with this request is MegaRequest::TYPE_GET_ATTR_FILE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the node
* - MegaRequest::getText - Returns the file attribute string if \c node is an attached node from chats. NULL otherwise
* - MegaRequest::getFile - Returns the destination path
* - MegaRequest::getParamType - Returns MegaApi::ATTR_TYPE_THUMBNAIL
* - MegaRequest::getBase64Key - Returns the nodekey in Base64 (only when node has file attributes)
* - MegaRequest::getPrivateKey - Returns the file-attribute string (only when node has file attributes)
*
* @param node Node to get the thumbnail
* @param dstFilePath Destination path for the thumbnail.
* If this path is a local folder, it must end with a '\' or '/' character and (Base64-encoded handle + "0.jpg")
* will be used as the file name inside that folder. If the path doesn't finish with
* one of these characters, the file will be downloaded to a file in that path.
*
* @param listener MegaRequestListener to track this request
*/
void getThumbnail(MegaNode* node, const char *dstFilePath, MegaRequestListener *listener = NULL);
/**
* @brief Get the thumbnail of a node by its handle
*
* If the node doesn't have a thumbnail, the request fails with the MegaError::API_ENOENT
* error code.
*
* The associated request type with this request is MegaRequest::TYPE_GET_ATTR_FILE.
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the node
* - MegaRequest::getFile - Returns the destination path
* - MegaRequest::getParamType - Returns MegaApi::ATTR_TYPE_THUMBNAIL
*
* @param handle Handle of the node to get the thumbnail.
* @param dstFilePath Destination path for the thumbnail.
* If this path is a local folder, it must end with a '\' or '/' character and
* (Base64-encoded handle + "0.jpg") will be used as the file name inside that folder. If
* the path doesn't finish with one of these characters, the file will be downloaded to a
* file in that path.
*
* @param listener MegaRequestListener to track this request
*/
void getThumbnail(MegaHandle handle,
const char* dstFilePath,
MegaRequestListener* listener = nullptr);
/**
* @brief Get the preview of a node
*
* If the node doesn't have a preview the request fails with the MegaError::API_ENOENT
* error code
*
* The associated request type with this request is MegaRequest::TYPE_GET_ATTR_FILE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the node
* - MegaRequest::getText - Returns the file attribute string if \c node is an attached node from chats. NULL otherwise
* - MegaRequest::getFile - Returns the destination path
* - MegaRequest::getParamType - Returns MegaApi::ATTR_TYPE_PREVIEW
* - MegaRequest::getBase64Key - Returns the nodekey in Base64 (only when node has file attributes)
* - MegaRequest::getPrivateKey - Returns the file-attribute string (only when node has file attributes)
*
* @param node Node to get the preview
* @param dstFilePath Destination path for the preview.
* If this path is a local folder, it must end with a '\' or '/' character and (Base64-encoded handle + "1.jpg")
* will be used as the file name inside that folder. If the path doesn't finish with
* one of these characters, the file will be downloaded to a file in that path.
*
* @param listener MegaRequestListener to track this request
*/
void getPreview(MegaNode* node, const char *dstFilePath, MegaRequestListener *listener = NULL);
/**
* @brief Get the avatar of a MegaUser
*
* The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getFile - Returns the destination path
* - MegaRequest::getEmail - Returns the email of the user
*
* @param user MegaUser to get the avatar. If this parameter is set to NULL, the avatar is obtained
* for the active account
* @param dstFilePath Destination path for the avatar. It has to be a path to a file, not to a folder.
* If this path is a local folder, it must end with a '\' or '/' character and (email + "0.jpg")
* will be used as the file name inside that folder. If the path doesn't finish with
* one of these characters, the file will be downloaded to a file in that path.
*
* @param listener MegaRequestListener to track this request
*
* @see MegaApi::setAvatar
*/
void getUserAvatar(MegaUser* user, const char *dstFilePath, MegaRequestListener *listener = NULL);
/**
* @brief Get the avatar of any user in MEGA
*
* The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getFile - Returns the destination path
* - MegaRequest::getEmail - Returns the email or the handle of the user (the provided one as parameter)
*
* @param email_or_handle Email or user handle (Base64 encoded) to get the avatar. If this parameter is
* set to NULL, the avatar is obtained for the active account
* @param dstFilePath Destination path for the avatar. It has to be a path to a file, not to a folder.
* If this path is a local folder, it must end with a '\' or '/' character and (email + "0.jpg")
* will be used as the file name inside that folder. If the path doesn't finish with
* one of these characters, the file will be downloaded to a file in that path.
*
* @param listener MegaRequestListener to track this request
*
* @see MegaApi::setAvatar
*/
void getUserAvatar(const char *email_or_handle, const char *dstFilePath, MegaRequestListener *listener = NULL);
/**
* @brief Get the avatar of the active account
*
* The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getFile - Returns the destination path
* - MegaRequest::getEmail - Returns the email of the user
*
* @param dstFilePath Destination path for the avatar. It has to be a path to a file, not to a folder.
* If this path is a local folder, it must end with a '\' or '/' character and (email + "0.jpg")
* will be used as the file name inside that folder. If the path doesn't finish with
* one of these characters, the file will be downloaded to a file in that path.
*
* @param listener MegaRequestListener to track this request
*
* @see MegaApi::setAvatar
*/
void getUserAvatar(const char *dstFilePath, MegaRequestListener *listener = NULL);
/**
* @brief Get the default color for the avatar.
*
* This color should be used only when the user doesn't have an avatar.
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @param user MegaUser to get the color of the avatar.
* @return The RGB color as a string with 3 components in hex: #RGB. Ie. "#FF6A19"
*/
static char *getUserAvatarColor(MegaUser *user);
/**
* @brief Get the default color for the avatar.
*
* This color should be used only when the user doesn't have an avatar.
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @param userhandle User handle (Base64 encoded) to get the avatar.
* @return The RGB color as a string with 3 components in hex: #RGB. Ie. "#FF6A19"
*/
static char *getUserAvatarColor(const char *userhandle);
/**
* @brief Get the secondary color for the avatar.
*
* This color should be used only when the user doesn't have an avatar, making a
* gradient in combination with the color returned from getUserAvatarColor.
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @param user MegaUser to get the color of the avatar.
* @return The RGB color as a string with 3 components in hex: #RGB. Ie. "#FF6A19"
*/
static char *getUserAvatarSecondaryColor(MegaUser *user);
/**
* @brief Get the secondary color for the avatar.
*
* This color should be used only when the user doesn't have an avatar, making a
* gradient in combination with the color returned from getUserAvatarColor.
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @param userhandle User handle (Base64 encoded) to get the avatar.
* @return The RGB color as a string with 3 components in hex: #RGB. Ie. "#FF6A19"
*/
static char *getUserAvatarSecondaryColor(const char *userhandle);
/**
* @brief Get an attribute of a MegaUser.
*
* User attributes can be private or public. Private attributes are accessible only by
* your own user, while public ones are retrievable by any of your contacts.
*
* The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getText - Returns the value for public attributes
* - MegaRequest::getMegaStringMap - Returns the value for private attributes
* - MegaRequest::getFlag - Returns true for external drive, in case attribute type was
* USER_ATTR_DEVICE_NAMES
*
* @param user MegaUser to get the attribute. If this parameter is set to NULL, the
* attribute is obtained for the active account
* @param type Attribute type
*
* Valid values are:
*
* MegaApi::USER_ATTR_FIRSTNAME = 1
* Get the firstname of the user (public)
* MegaApi::USER_ATTR_LASTNAME = 2
* Get the lastname of the user (public)
* MegaApi::USER_ATTR_AUTHRING = 3
* Get the authentication ring of the user (private)
* MegaApi::USER_ATTR_LAST_INTERACTION = 4
* Get the last interaction of the contacts of the user (private)
* MegaApi::USER_ATTR_ED25519_PUBLIC_KEY = 5
* Get the public key Ed25519 of the user (public)
* MegaApi::USER_ATTR_CU25519_PUBLIC_KEY = 6
* Get the public key Cu25519 of the user (public)
* MegaApi::USER_ATTR_KEYRING = 7
* Get the key ring of the user: private keys for Cu25519 and Ed25519 (private)
* MegaApi::USER_ATTR_SIG_RSA_PUBLIC_KEY = 8
* Get the signature of RSA public key of the user (public)
* MegaApi::USER_ATTR_SIG_CU255_PUBLIC_KEY = 9
* Get the signature of Cu25519 public key of the user (public)
* MegaApi::USER_ATTR_LANGUAGE = 14
* Get the preferred language of the user (private, non-encrypted)
* MegaApi::USER_ATTR_PWD_REMINDER = 15
* Get the password-reminder-dialog information (private, non-encrypted)
* MegaApi::USER_ATTR_DISABLE_VERSIONS = 16
* Get whether user has versions disabled or enabled (private, non-encrypted)
* MegaApi::USER_ATTR_CONTACT_LINK_VERIFICATION = 17
* Get whether user needs contact link verification (private)
* MegaApi::USER_ATTR_RICH_PREVIEWS = 18
* Get whether user generates rich-link messages or not (private)
* MegaApi::USER_ATTR_RUBBISH_TIME = 19
* Get number of days for rubbish-bin cleaning scheduler (private non-encrypted)
* MegaApi::USER_ATTR_LAST_PSA = 20
* Get the ID of last PSA seen by the user (private)
* MegaApi::USER_ATTR_STORAGE_STATE = 21
* Get the state of the storage (private non-encrypted)
* MegaApi::USER_ATTR_GEOLOCATION = 22
* Get the user geolocation (private)
* MegaApi::USER_ATTR_CAMERA_UPLOADS_FOLDER = 23
* Get the target folder for Camera Uploads (private)
* MegaApi::USER_ATTR_MY_CHAT_FILES_FOLDER = 24
* Get the target folder for My chat files (private)
* MegaApi::USER_ATTR_PUSH_SETTINGS = 25
* Get whether user has push settings enabled (private)
* MegaApi::USER_ATTR_ALIAS = 27
* Get the list of the users's aliases (private)
* MegaApi::USER_ATTR_DEVICE_NAMES = 30
* Get the list of device or external drive names (private)
* MegaApi::USER_ATTR_MY_BACKUPS_FOLDER = 31
* Get the target folder for My Backups (private)
* MegaApi::USER_ATTR_COOKIE_SETTINGS = 33
* Get whether user has Cookie Settings enabled
* MegaApi::USER_ATTR_JSON_SYNC_CONFIG_DATA = 34
* Get name and key to cypher sync-configs file
* MegaApi::USER_ATTR_NO_CALLKIT = 36
* Get whether user has iOS CallKit disabled or enabled (private, non-encrypted)
* MegaApi::USER_ATTR_APPS_PREFS = 38
* Get app preferences (private)
* MegaApi::USER_ATTR_CC_PREFS = 39
* Get preferences for consumed content (private)
* MegaApi::USER_ATTR_VISIBLE_WELCOME_DIALOG = 40
* Get visibility for welcome dialog (private)
* MegaApi::USER_ATTR_VISIBLE_TERMS_OF_SERVICE = 41
* Get visibility for Terms of Service (private)
* MegaApi::USER_ATTR_PWM_BASE = 42
* Get Password Manager Base (private)
* MegaApi::USER_ATTR_LAST_READ_NOTIFICATION = 44
* Get last read notification (private)
* MegaApi::USER_ATTR_LAST_ACTIONED_BANNER = 45
* Get last actioned banner (private)
* MegaApi::USER_ATTR_RECENT_CLEAR_TIMESTAMP = 52 (private, encrypted)
* Get the epoch time (in seconds) used as the recent actions history clear timestamp.
* @param listener MegaRequestListener to track this request
*/
void getUserAttribute(MegaUser* user, int type, MegaRequestListener *listener = NULL);
/**
* @brief Get public attributes of participants of public chats during preview mode.
*
* Other's public attributes are retrievable by contacts and users who participates in your
* chats. During a preview of a public chat, the user does not fullfil the above
* requirements, so the public handle of the chat being previewed is required as
* authorization.
*
* The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type
* - MegaRequest::getEmail - Returns the email or the handle of the user (the provided one
* as parameter)
* - MegaRequest::getSessionKey - Returns the public handle of the chat
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getText - Returns the value for public attributes
*
* @param email_or_handle Email or user handle (Base64 encoded) to get the attribute.
* This parameter cannot be NULL.
* @param type Attribute type
*
* Valid values are:
*
* MegaApi::USER_ATTR_AVATAR = 0
* Get the avatar of the user (public)
* MegaApi::USER_ATTR_FIRSTNAME = 1
* Get the firstname of the user (public)
* MegaApi::USER_ATTR_LASTNAME = 2
* Get the lastname of the user (public)
* MegaApi::USER_ATTR_ED25519_PUBLIC_KEY = 5
* Get the public key Ed25519 of the user (public)
* MegaApi::USER_ATTR_CU25519_PUBLIC_KEY = 6
* Get the public key Cu25519 of the user (public)
*
* @param ph Public handle of the chat link the user participates.
* @param listener MegaRequestListener to track this request
*/
void getChatUserAttribute(const char *email_or_handle, int type, const char *ph, MegaRequestListener *listener = NULL);
/**
* @brief Get an attribute of any user in MEGA.
*
* User attributes can be private or public. Private attributes are accessible only by
* your own user, while public ones are retrievable by any of your contacts.
*
* The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type
* - MegaRequest::getEmail - Returns the email or the handle of the user (the provided one as parameter)
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getText - Returns the value for public attributes
* - MegaRequest::getMegaStringMap - Returns the value for private attributes
*
* @param email_or_handle Email or user handle (Base64 encoded) to get the attribute.
* If this parameter is set to NULL, the attribute is obtained for the active account.
* @param type Attribute type
* Valid values are the same as the ones in the previous overload.
*
* @param listener MegaRequestListener to track this request
*/
void getUserAttribute(const char *email_or_handle, int type, MegaRequestListener *listener = NULL);
/**
* @brief Get an attribute of the current account.
*
* User attributes can be private or public. Private attributes are accessible only by
* your own user, while public ones are retrievable by any of your contacts.
*
* The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getText - Returns the value for public attributes
* - MegaRequest::getMegaStringMap - Returns the value for private attributes
*
* @param type Attribute type
* Valid values are the same as the ones in the previous overload.
*
* @param listener MegaRequestListener to track this request
*/
void getUserAttribute(int type, MegaRequestListener *listener = NULL);
/**
* @brief Get the name associated to a user attribute
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @param attr Attribute
* @return name associated to the user attribute
*/
const char *userAttributeToString(int attr);
/**
* @brief Get the long descriptive name associated to a user attribute
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @param attr Attribute
* @return descriptive name associated to the user attribute
*/
const char *userAttributeToLongName(int attr);
/**
* @brief Get numeric value for user attribute given a string
* @param name Name of the attribute
* @return numeric value for user attribute
*/
int userAttributeFromString(const char *name);
/**
* @brief Get the email address of any user in MEGA.
*
* The associated request type with this request is MegaRequest::TYPE_GET_USER_EMAIL
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the user (the provided one as parameter)
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getEmail - Returns the email address
*
* @param handle Handle of the user to get the attribute.
* @param listener MegaRequestListener to track this request
*/
void getUserEmail(MegaHandle handle, MegaRequestListener *listener = NULL);
/**
* @brief Cancel the retrieval of a thumbnail
*
* The associated request type with this request is MegaRequest::TYPE_CANCEL_ATTR_FILE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the node
* - MegaRequest::getParamType - Returns MegaApi::ATTR_TYPE_THUMBNAIL
*
* @param node Node to cancel the retrieval of the thumbnail
* @param listener MegaRequestListener to track this request
*
* @see MegaApi::getThumbnail
*/
void cancelGetThumbnail(MegaNode* node, MegaRequestListener *listener = NULL);
/**
* @brief Cancel the retrieval of a preview
*
* The associated request type with this request is MegaRequest::TYPE_CANCEL_ATTR_FILE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the node
* - MegaRequest::getParamType - Returns MegaApi::ATTR_TYPE_PREVIEW
*
* @param node Node to cancel the retrieval of the preview
* @param listener MegaRequestListener to track this request
*
* @see MegaApi::getPreview
*/
void cancelGetPreview(MegaNode* node, MegaRequestListener *listener = NULL);
/**
* @brief Set the thumbnail of a MegaNode
*
* It is good practice to set the Preview file attribute (see MegaApi::setPreview)
* and this attribute with the same original image to keep consistency. In order to
* ensure the correct ratio for the Thumbnail you may call MegaApi::createThumbnail
* and provide it's output image to this method.
*
* The associated request type with this request is MegaRequest::TYPE_SET_ATTR_FILE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the node
* - MegaRequest::getFile - Returns the source path
* - MegaRequest::getParamType - Returns MegaApi::ATTR_TYPE_THUMBNAIL
*
* @param node MegaNode to set the thumbnail
* @param srcFilePath Source path of the file that will be set as thumbnail. This
* image must be square (ratio) and it should contain the image's primary content for a
* better UX
* @param listener MegaRequestListener to track this request
*/
void setThumbnail(MegaNode* node, const char *srcFilePath, MegaRequestListener *listener = NULL);
/**
* @brief Uploads a thumbnail as part of a background media file upload
*
* It is good practice to set the Preview file attribute (see MegaApi::setPreview)
* and this attribute with the same original image to keep consistency. In order to
* ensure the correct ratio for the Thumbnail you may call MegaApi::createThumbnail
* and provide it's output image to this method.
*
* The associated request type with this request is MegaRequest::TYPE_SET_ATTR_FILE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getMegaBackgroundMediaUploadPtr - Returns the background upload object
* - MegaRequest::getFile - Returns the source path
* - MegaRequest::getParamType - Returns MegaApi::ATTR_TYPE_THUMBNAIL
*
* This value is valid for these requests in onRequestFinish when the
* error code is MegaError::API_OK:
* - MegaRequest::getNodeHandle - The handle of the uploaded file attribute.
*
* Use the result in the MegaRequest::getNodeHandle as the thumbnail handle in the
* call to MegaApi::backgroundMediaUploadComplete.
*
* @param bu the MegaBackgroundMediaUpload that the fingernail will be assoicated with
* @param srcFilePath Source path of the file that will be set as thumbnail. This
* image must be square (ratio) and it should contain the image's primary content for a
* better UX
* @param listener MegaRequestListener to track this request
*/
void putThumbnail(MegaBackgroundMediaUpload* bu, const char *srcFilePath, MegaRequestListener *listener = NULL);
/**
* @brief Set the thumbnail of a MegaNode, via the result of MegaApi::putThumbnail
*
* It is good practice to set the Preview file attribute (see MegaApi::setPreview)
* and this attribute with the same original image to keep consistency. In order to
* ensure the correct ratio for the Thumbnail you may call MegaApi::createThumbnail
* and provide it's output image to this method.
*
* The associated request type with this request is MegaRequest::TYPE_SET_ATTR_FILE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the node
* - MegaRequest::getNumber - Returns the attribute handle
* - MegaRequest::getParamType - Returns MegaApi::ATTR_TYPE_THUMBNAIL
*
* @param node MegaNode to set the thumbnail
* @param fileattribute The result handle from a previous call to MegaApi::putThumbnail
* @param listener MegaRequestListener to track this request
*/
void setThumbnailByHandle(MegaNode* node, MegaHandle fileattribute, MegaRequestListener *listener = NULL);
/**
* @brief Set the preview of a MegaNode
*
* It is good practice to set the Thumbnail file attribute (see MegaApi::setThumbnail)
* and this attribute with the same original image to keep consistency. In order to
* ensure the correct ratio for the Preview you may call MegaApi::createPreview
* and provide it's output image to this method.
*
* The associated request type with this request is MegaRequest::TYPE_SET_ATTR_FILE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the node
* - MegaRequest::getFile - Returns the source path
* - MegaRequest::getParamType - Returns MegaApi::ATTR_TYPE_PREVIEW
*
* @param node MegaNode to set the preview
* @param srcFilePath Source path of the file that will be set as preview. This
* image must be of the same ratio and contain completely the original image for a
* better UX
* @param listener MegaRequestListener to track this request
*/
void setPreview(MegaNode* node, const char *srcFilePath, MegaRequestListener *listener = NULL);
/**
* @brief Uploads a preview as part of a background media file upload
*
* It is good practice to set the Thumbnail file attribute (see MegaApi::setThumbnail)
* and this attribute with the same original image to keep consistency. In order to
* ensure the correct ratio for the Preview you may call MegaApi::createPreview
* and provide it's output image to this method.
*
* The associated request type with this request is MegaRequest::TYPE_SET_ATTR_FILE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getMegaBackgroundMediaUploadPtr - Returns the background upload object
* - MegaRequest::getFile - Returns the source path
* - MegaRequest::getParamType - Returns MegaApi::ATTR_TYPE_THUMBNAIL
*
* This value is valid for these requests in onRequestFinish when the
* error code is MegaError::API_OK:
* - MegaRequest::getNodeHandle - The handle of the uploaded file attribute.
*
* Use the result in the MegaRequest::getNodeHandle as the preview handle in the
* call to MegaApi::backgroundMediaUploadComplete.
*
* @param bu the MegaBackgroundMediaUpload that the fingernail will be assoicated with
* @param srcFilePath Source path of the file that will be set as preview. This
* image must be of the same ratio and contain completely the original image for a
* better UX
* @param listener MegaRequestListener to track this request
*/
void putPreview(MegaBackgroundMediaUpload* bu, const char *srcFilePath, MegaRequestListener *listener = NULL);
/**
* @brief Set the preview of a MegaNode, via the result of MegaApi::putPreview
*
* It is good practice to set the Thumbnail file attribute (see MegaApi::setThumbnail)
* and this attribute with the same original image to keep consistency. In order to
* ensure the correct ratio for the Preview you may call MegaApi::createPreview
* and provide it's output image to this method.
*
* @note For consistence same source image must be used for both attributes (check
* MegaApi::createPreview and MegaApi::createThumbnail).
*
* The associated request type with this request is MegaRequest::TYPE_SET_ATTR_FILE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the node
* - MegaRequest::getNumber - Returns the attribute handle
* - MegaRequest::getParamType - Returns MegaApi::ATTR_TYPE_PREVIEW
*
* @param node MegaNode to set the preview of
* @param fileattribute The result handle from a previous call to MegaApi::putPreview
* @param listener MegaRequestListener to track this request
*/
void setPreviewByHandle(MegaNode* node, MegaHandle fileattribute, MegaRequestListener *listener = NULL);
/**
* @brief Set/Remove the avatar of the MEGA account
*
* The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getFile - Returns the source path (optional)
*
* @param srcFilePath Source path of the file that will be set as avatar.
* If NULL, the existing avatar will be removed (if any).
* In case the avatar never existed before, removing the avatar returns
* MegaError::API_ENOENT
* @param listener MegaRequestListener to track this request
*
* @see MegaApi::getUserAvatar
*/
void setAvatar(const char *srcFilePath, MegaRequestListener *listener = NULL);
enum {
PRIVATE_KEY_ED25519 = 1,
PRIVATE_KEY_CU25519,
};
/**
* @brief Returns private key from desired type in base64-encoded
*
* This method returns invalid value until fetch nodes has finished
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @param type private key type
* It can take this values:
* - PRIVATE_KEY_ED25519 1
* - PRIVATE_KEY_CU25519 2
* @return Private key
*/
char* getPrivateKey(int type);
/**
* @brief Confirm available memory to avoid OOM situations
*
* Before queueing a thumbnail or preview upload (or other memory intensive task),
* it may be useful on some devices to check if there is plenty of memory available
* in the memory pool used by MegaApi (especially since some platforms may not have
* the facility to check for themselves, and/or deallocation may need to wait on a GC)
* and if not, delay until any current resource constraints (eg. other current operations,
* or other RAM-hungry apps in the device), have finished. This function just
* makes several memory allocations and then immediately releases them. If all allocations
* succeeded, it returns true, indicating that memory is (probably) available.
* Of course, another app or operation may grab that memory immediately so it's not a
* guarantee. However it may help to reduce the frequency of OOM situations on phones for example.
*
* @param allocCount The number of allocations to make
* @param allocSize The size of those memory allocations.
* @return True if all the allocations succeeded
*/
bool testAllocation(unsigned allocCount, size_t allocSize);
/**
* @brief Set a public attribute of the current user
*
* The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type
* - MegaRequest::getText - Returns the new value for the attribute
*
* @param type Attribute type
*
* Valid values are:
*
* MegaApi::USER_ATTR_FIRSTNAME = 1
* Set the firstname of the user (protected)
* MegaApi::USER_ATTR_LASTNAME = 2
* Set the lastname of the user (protected)
* MegaApi::USER_ATTR_LANGUAGE = 14
* Set the language for the user (private)
* MegaApi::USER_ATTR_DISABLE_VERSIONS = 16
* Set file versioning disabled for the user (private)
* MegaApi::USER_ATTR_CONTACT_LINK_VERIFICATION = 17
* Set contact link verification for the user (private)
* MegaApi::USER_ATTR_RUBBISH_TIME = 19
* Set number of days for rubbish-bin cleaning scheduler (private non-encrypted)
* MegaApi::USER_ATTR_LAST_PSA = 20
* Set last PSA for the user (private)
* MegaApi::USER_PUSH_SETTINGS = 25
* Enable/disable push notifications for the user (private)
* MegaApi::USER_ATTR_NO_CALLKIT = 36
* Set whether user has iOS CallKit disabled or enabled (private, non-encrypted)
* MegaApi::USER_ATTR_VISIBLE_WELCOME_DIALOG = 40
* Show/hide welcome dialog for the user (private)
* MegaApi::USER_ATTR_VISIBLE_TERMS_OF_SERVICE = 41
* Show/hide Terms of Service for the user (private)
* MegaApi::USER_ATTR_LAST_READ_NOTIFICATION = 44
* Set last read notification for the user (private)
* MegaApi::USER_ATTR_LAST_ACTIONED_BANNER = 45
* Set last actioned banner for the user (private)
*
* If the MEGA account is a sub-user business account, and the value of the parameter
* type is equal to MegaApi::USER_ATTR_FIRSTNAME or MegaApi::USER_ATTR_LASTNAME
* onRequestFinish will be called with the error code MegaError::API_EMASTERONLY.
*
* @param value New attribute value
* @param listener MegaRequestListener to track this request
*/
void setUserAttribute(int type, const char* value, MegaRequestListener *listener = NULL);
/**
* @brief Set a private attribute of the current user
*
* The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type
* - MegaRequest::getMegaStringMap - Returns the new value for the attribute
*
* You can remove existing records/keypairs from the following attributes:
* - MegaApi::USER_ATTR_ALIAS
* - MegaApi::USER_ATTR_DEVICE_NAMES
* - MegaApi::USER_ATTR_APPS_PREFS
* - MegaApi::USER_ATTR_CC_PREFS
* by adding a keypair into MegaStringMap with the key to remove and an empty C-string null
* terminated as value.
*
* @param type Attribute type
*
* Valid values are:
*
* MegaApi::USER_ATTR_AUTHRING = 3
* Get the authentication ring of the user (private)
* MegaApi::USER_ATTR_LAST_INTERACTION = 4
* Get the last interaction of the contacts of the user (private)
* MegaApi::USER_ATTR_KEYRING = 7
* Get the key ring of the user: private keys for Cu25519 and Ed25519 (private)
* MegaApi::USER_ATTR_RICH_PREVIEWS = 18
* Get whether user generates rich-link messages or not (private)
* MegaApi::USER_ATTR_GEOLOCATION = 22
* Set whether the user can send geolocation messages (private)
* MegaApi::USER_ATTR_ALIAS = 27
* Set the list of users's aliases (private)
* MegaApi::USER_ATTR_DEVICE_NAMES = 30
* Set the list of device names (private)
* MegaApi::USER_ATTR_APPS_PREFS = 38
* Set the apps prefs (private)
* MegaApi::USER_ATTR_CC_PREFS = 39
* Set the content consumption prefs (private)
*
* @param value New attribute value
* @param listener MegaRequestListener to track this request
*/
void setUserAttribute(int type, const MegaStringMap *value, MegaRequestListener *listener = NULL);
/**
* @brief Set a custom attribute for the node
*
* The associated request type with this request is MegaRequest::TYPE_SET_ATTR_NODE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the node that receive the attribute
* - MegaRequest::getName - Returns the name of the custom attribute
* - MegaRequest::getText - Returns the text for the attribute
* - MegaRequest::getFlag - Returns false (not official attribute)
*
* The attribute name must be an UTF8 string with between 1 and 7 bytes
* If the attribute already has a value, it will be replaced
* If value is NULL, the attribute will be removed from the node
*
* If the MEGA account is a business account and it's status is expired, onRequestFinish will
* be called with the error code MegaError::API_EBUSINESSPASTDUE.
*
* @param node Node that will receive the attribute
* @param attrName Name of the custom attribute.
* The length of this parameter must be between 1 and 7 UTF8 bytes
* @param value Value for the attribute
* @param listener MegaRequestListener to track this request
*/
void setCustomNodeAttribute(MegaNode *node, const char *attrName, const char* value, MegaRequestListener *listener = NULL);
/**
* @brief Set s4 attribute for the node
*
* The associated request type with this request is MegaRequest::TYPE_SET_ATTR_NODE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the node that receive the attribute
* - MegaRequest::getText - Returns the text for the attribute
* - MegaRequest::getFlag - Returns true (official attribute)
*
* The attribute name must be an UTF8 string with between 1 and 7 bytes
* If the attribute already has a value, it will be replaced
* If value is NULL, the attribute will be removed from the node
*
* If the MEGA account is a business account and it's status is expired, onRequestFinish will
* be called with the error code MegaError::API_EBUSINESSPASTDUE.
*
* @param node Node that will receive the attribute
* @param value Value for the attribute
* @param listener MegaRequestListener to track this request
*/
void setNodeS4(MegaNode *node, const char *value, MegaRequestListener *listener);
/**
* @brief Returns true if S4 object storage is enabled
*
* This method doesn't need to block the SDK mutex: do not cache the value in the app.
*
* @return True if enabled, false if disabled
*/
bool isS4Enabled();
/**
* @brief Returns the node's handle of the S4 container
*
* S4 requires a folder in the root of the Cloud Drive to operate.
* This method returns the handle of the related node, or INVALID_HANDLE if the
* S4 service is disabled.
*
* This method doesn't need to block the SDK mutex: do not cache the value in the app.
*
* @return The node's handle, or INVALID_HANDLE if not set.
*/
MegaHandle getS4Container();
/**
* @brief Set node label as a node attribute.
* Valid values for label attribute are:
* - MegaNode::NODE_LBL_RED = 1
* - MegaNode::NODE_LBL_ORANGE = 2
* - MegaNode::NODE_LBL_YELLOW = 3
* - MegaNode::NODE_LBL_GREEN = 4
* - MegaNode::NODE_LBL_BLUE = 5
* - MegaNode::NODE_LBL_PURPLE = 6
* - MegaNode::NODE_LBL_GREY = 7
*
* The associated request type with this request is MegaRequest::TYPE_SET_ATTR_NODE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the node that receive the attribute
* - MegaRequest::getNumDetails - Returns the label for the node
* - MegaRequest::getFlag - Returns true (official attribute)
* - MegaRequest::getParamType - Returns MegaApi::NODE_ATTR_LABEL
*
* @param node Node that will receive the information.
* @param label Label of the node
* @param listener MegaRequestListener to track this request
*/
void setNodeLabel(MegaNode *node, int label, MegaRequestListener *listener = NULL);
/**
* @brief Remove node label
*
* The associated request type with this request is MegaRequest::TYPE_SET_ATTR_NODE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the node that receive the attribute
* - MegaRequest::getFlag - Returns true (official attribute)
* - MegaRequest::getParamType - Returns MegaApi::NODE_ATTR_LABEL
*
* @param node Node that will receive the information.
* @param listener MegaRequestListener to track this request
*/
void resetNodeLabel(MegaNode *node, MegaRequestListener *listener = NULL);
/**
* @brief Set node favourite as a node attribute.
*
* The associated request type with this request is MegaRequest::TYPE_SET_ATTR_NODE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the node that receive the attribute
* - MegaRequest::getNumDetails - Returns 1 if node is set as favourite, otherwise return 0
* - MegaRequest::getFlag - Returns true (official attribute)
* - MegaRequest::getParamType - Returns MegaApi::NODE_ATTR_FAV
*
* @param node Node that will receive the information.
* @param fav if true set node as favourite, otherwise remove the attribute
* @param listener MegaRequestListener to track this request
*/
void setNodeFavourite(MegaNode *node, bool fav, MegaRequestListener *listener = NULL);
/**
* @brief Mark a node as sensitive
*
* @note Descendants will inherit the sensitive property.
*
* The associated request type with this request is MegaRequest::TYPE_SET_ATTR_NODE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the node that receive the attribute
* - MegaRequest::getNumDetails - Returns 1 if node is set as sensitive, otherwise return 0
* - MegaRequest::getFlag - Returns true (official attribute)
* - MegaRequest::getParamType - Returns MegaApi::NODE_ATTR_SENSITIVE
*
* @param node Node that will receive the information.
* @param sensitive if true set node as sensitive, otherwise remove the attribute
* @param listener MegaRequestListener to track this request
*/
void setNodeSensitive(MegaNode* node, bool sensitive, MegaRequestListener* listener = NULL);
/**
* @brief Ascertain if the node is marked as sensitive or a descendent of such
*
* see MegaNode::isMarkedSensitive to see if the node is sensitive
*
* @param node node to inspect
*/
bool isSensitiveInherited(MegaNode* node);
/**
* @brief Get a list of favourite nodes.
*
* The associated request type with this request is MegaRequest::TYPE_GET_ATTR_NODE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the node provided
* - MegaRequest::getParamType - Returns MegaApi::NODE_ATTR_FAV
* - MegaRequest::getNumDetails - Returns the count requested
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getMegaHandleList - List of handles of favourite nodes
*
* @param node Node and its children that will be searched for favourites. Search all nodes if null
* @param count if count is zero return all favourite nodes, otherwise return only 'count' favourite nodes
* @param listener MegaRequestListener to track this request
*
* @deprecated use alternatives instead:
* - for recursive searches use search(const MegaSearchFilter* filter, int order, MegaCancelToken* cancelToken)
* - for non-recursive searches use getChildren(const MegaSearchFilter* filter, int order, MegaCancelToken* cancelToken)
* Remember to call the filter->byFavourite(true) to get only nodes marked as favourite
*/
void getFavourites(MegaNode* node, int count, MegaRequestListener* listener = nullptr);
/**
* @brief Set the GPS coordinates of image files as a node attribute.
*
* To remove the existing coordinates, set both the latitude and longitude to
* the value MegaNode::INVALID_COORDINATE.
*
* The associated request type with this request is MegaRequest::TYPE_SET_ATTR_NODE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the node that receive the attribute
* - MegaRequest::getFlag - Returns true (official attribute)
* - MegaRequest::getParamType - Returns MegaApi::NODE_ATTR_COORDINATES
* - MegaRequest::getNumDetails - Returns the longitude, scaled to integer in the range of [0, 2^24]
* - MegaRequest::getTransferTag() - Returns the latitude, scaled to integer in the range of [0, 2^24)
*
* If the MEGA account is a business account and it's status is expired, onRequestFinish will
* be called with the error code MegaError::API_EBUSINESSPASTDUE.
*
* @param node Node that will receive the information.
* @param latitude Latitude in signed decimal degrees notation
* @param longitude Longitude in signed decimal degrees notation
* @param listener MegaRequestListener to track this request
*/
void setNodeCoordinates(MegaNode *node, double latitude, double longitude, MegaRequestListener *listener = NULL);
/**
* @brief Set the GPS coordinates of media files as a node attribute that is private
*
* To remove the existing coordinates, set both the latitude and longitude to
* the value MegaNode::INVALID_COORDINATE.
*
* Compared to MegaApi::setNodeCoordinates, this function stores the coordinates with an extra
* layer of encryption which only this user can decrypt, so that even if this node is shared
* with others, they cannot read the coordinates.
*
* The associated request type with this request is MegaRequest::TYPE_SET_ATTR_NODE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the node that receive the attribute
* - MegaRequest::getFlag - Returns true (official attribute)
* - MegaRequest::getParamType - Returns MegaApi::NODE_ATTR_COORDINATES
* - MegaRequest::getNumDetails - Returns the longitude, scaled to integer in the range of [0, 2^24]
* - MegaRequest::getTransferTag() - Returns the latitude, scaled to integer in the range of [0, 2^24)
*
* @param node Node that will receive the information.
* @param latitude Latitude in signed decimal degrees notation
* @param longitude Longitude in signed decimal degrees notation
* @param listener MegaRequestListener to track this request
*/
void setUnshareableNodeCoordinates(MegaNode *node, double latitude, double longitude, MegaRequestListener *listener = NULL);
/**
* @brief Set the GPS coordinates of media files as a node attribute that is private
*
* To remove the existing coordinates, set both the latitude and longitude to
* the value MegaNode::INVALID_COORDINATE.
*
* Compared to MegaApi::setNodeCoordinates, this function stores the coordinates with an
* extra layer of encryption which only this user can decrypt, so that even if this node is
* shared with others, they cannot read the coordinates.
*
* The associated request type with this request is MegaRequest::TYPE_SET_ATTR_NODE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the node that receive the attribute
* - MegaRequest::getFlag - Returns true (official attribute)
* - MegaRequest::getParamType - Returns MegaApi::NODE_ATTR_COORDINATES
* - MegaRequest::getNumDetails - Returns the longitude, scaled to integer in the range of
* [0, 2^24]
* - MegaRequest::getTransferTag() - Returns the latitude, scaled to integer in the range of
* [0, 2^24)
*
* @param nodeHandle Node handle of the node that will receive the information.
* @param latitude Latitude in signed decimal degrees notation
* @param longitude Longitude in signed decimal degrees notation
* @param listener MegaRequestListener to track this request
*/
void setUnshareableNodeCoordinates(MegaHandle nodeHandle,
double latitude,
double longitude,
MegaRequestListener* listener = nullptr);
/**
* @brief Set node description as a node attribute
*
* To remove node description, set description to NULL
*
* The associated request type with this request is MegaRequest::TYPE_SET_ATTR_NODE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the node that received the attribute
* - MegaRequest::getFlag - Returns true (official attribute)
* - MegaRequest::getParamType - Returns MegaApi::NODE_ATTR_DESCRIPTION
* - MegaRequest::getText - Returns node description
*
* If the size of the description is greater than MAX_NODE_DESCRIPTION_SIZE, onRequestFinish will be
* called with the error code MegaError::API_EARGS.
*
* If the MEGA account is a business account and its status is expired, onRequestFinish will
* be called with the error code MegaError::API_EBUSINESSPASTDUE.
*
* @param node Node that will receive the information.
* @param description Node description
* @param listener MegaRequestListener to track this request
*/
void setNodeDescription(MegaNode* node,
const char* description,
MegaRequestListener* listener = NULL);
/**
* @brief Add new tag stored as node attribute
*
* The associated request type with this request is MegaRequest::TYPE_TAG_NODE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the node that received the tag
* - MegaRequest::getParamType - Returns operation type (0 - Add tag, 1 - Remove tag, 2 - Update tag)
* - MegaRequest::getText - Returns tag
*
* ',' is an invalid character to be used in a tag. If it is contained in the tag,
* onRequestFinish will be called with the error code MegaError::API_EARGS.
*
* If the length of all tags is higher than 3000 onRequestFinish will be called with
* the error code MegaError::API_EARGS
*
* If tag already exists, onRequestFinish will be called with the error code MegaError::API_EEXISTS
*
* If number of tags exceed the maximum number of tags (10),
* onRequestFinish will be called with the error code MegaError::API_ETOOMANY
*
* If the MEGA account is a business account and its status is expired, onRequestFinish will
* be called with the error code MegaError::API_EBUSINESSPASTDUE.
*
* @param node Node that will receive the information.
* @param tag New tag
* @param listener MegaRequestListener to track this request
*/
void addNodeTag(MegaNode* node, const char* tag, MegaRequestListener* listener = NULL);
/**
* @brief Remove a tag stored as a node attribute
*
* The associated request type with this request is MegaRequest::TYPE_TAG_NODE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the node that received the tag
* - MegaRequest::getParamType - Returns operation type (0 - Add tag, 1 - Temove tag, 2 - Update tag)
* - MegaRequest::getText - Returns tag
*
* If tag doesn't exist, onRequestFinish will be called with the error code MegaError::API_ENOENT
*
* If the MEGA account is a business account and its status is expired, onRequestFinish will
* be called with the error code MegaError::API_EBUSINESSPASTDUE.
*
* @param node Node that will receive the information.
* @param tag Tag to be removed
* @param listener MegaRequestListener to track this request
*/
void removeNodeTag(MegaNode* node, const char* tag, MegaRequestListener* listener = NULL);
/**
* @brief Update a tag stored as a node attribute
*
* The associated request type with this request is MegaRequest::TYPE_TAG_NODE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the node that received the tag
* - MegaRequest::getParamType - Returns operation type (0 - Add tag, 1 - Temove tag, 2 - Update tag)
* - MegaRequest::getText - Returns new tag
* - MegaRequest::getName - Returns old tag
*
* ',' is an invalid character to be used in a tag. If it is contained in the tag,
* onRequestFinish will be called with the error code MegaError::API_EARGS.
*
* If the length of all tags is higher than 3000 characters onRequestFinish will be called with
* the error code MegaError::API_EARGS
*
* If newTag already exists, onRequestFinish will be called with the error code MegaError::API_EEXISTS
* If oldTag doesn't exist, onRequestFinish will be called with the error code MegaError::API_ENOENT
*
* If the MEGA account is a business account and its status is expired, onRequestFinish will
* be called with the error code MegaError::API_EBUSINESSPASTDUE.
*
* @param node Node that will receive the information.
* @param newTag New tag value
* @param oldTag Old tag value
* @param listener MegaRequestListener to track this request
*/
void updateNodeTag(MegaNode* node,
const char* newTag,
const char* oldTag,
MegaRequestListener* listener = NULL);
/**
* @brief Retrieve all unique node tags present across all nodes in the account
*
* @note If the pattern contains invalid characters, such as ',', an empty list will be
* returned.
*
* @note This function allows to cancel the processing at any time by passing a
* MegaCancelToken and calling to MegaCancelToken::setCancelFlag(true).
*
* You take ownership of the returned value.
*
* @param pattern Optional parameter to filter the tags based on a specific search
* string. If set to nullptr, all node tags will be retrieved.
*
* @param cancelToken MegaCancelToken to be able to cancel the processing at any time.
*
* @return All the unique node tags that match the search criteria.
*/
MegaStringList* getAllNodeTags(const char* pattern = nullptr,
MegaCancelToken* cancelToken = nullptr);
/**
* @brief
* Retrieve all unique node tags present at or below the specified node.
*
* You take ownership of the returned value.
*
* @param node
* The node we want to search for tags below.
*
* @param pattern
* An optional pattern to be used to filter which tags we retrieve.
*
* All tags will be retrieved if no pattern is specified.
*
* @param cancelToken
* A token that can be used to cancel the query.
*
* @return
* A string list containing all unique tags found at or below node.
*/
MegaStringList* getAllNodeTagsBelow(const MegaNode* node,
const char* pattern = nullptr,
MegaCancelToken* cancelToken = nullptr);
/**
* @brief
* Retrieve all unique node tags present at or below the specified node.
*
* You take ownership of the returned value.
*
* @param handle
* A handle specifying the node we want to search for tags below.
*
* When UNDEF, we will search for tags below each of this account's
* root nodes.
*
* @param pattern
* An optional pattern to be used to filter which tags we retrieve.
*
* All tags will be retrieved if no pattern is specified.
*
* @param cancelToken
* A token that can be used to cancel the query.
*
* @return
* A string list containing all unique tags found at or below node.
*/
MegaStringList* getAllNodeTagsBelow(MegaHandle handle,
const char* pattern = nullptr,
MegaCancelToken* cancelToken = nullptr);
/**
* @brief Generate a public link of a file/folder in MEGA
*
* The associated request type with this request is MegaRequest::TYPE_EXPORT
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the node
* - MegaRequest::getAccess - Returns true
* - MegaRequest::getNumber - Returns expire time
* - MegaRequest::getFlag - Returns true if writable
* - MegaRequest::getTransferTag - Returns if share key is shared with mega
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getLink - Public link
* - MegaRequest::getPrivateKey - Authentication token (only if writable=true)
* - MegaRequest::getPassword - Returns base64 encryption key used for share-key (only if
* writable=true and megaHosted=true)
*
* If the MEGA account is a business account and it's status is expired, onRequestFinish
* will be called with the error code MegaError::API_EBUSINESSPASTDUE.
*
* @param node MegaNode to get the public link
* @param expireTime Unix timestamp until the public link will be valid
* @param writable if the link should be writable.
* @param megaHosted if the share key should be shared with MEGA
* @param listener MegaRequestListener to track this request
*/
void exportNode(MegaNode *node, int64_t expireTime, bool writable, bool megaHosted, MegaRequestListener *listener = NULL);
/**
* @brief Stop sharing a file/folder
*
* The associated request type with this request is MegaRequest::TYPE_EXPORT
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the node
* - MegaRequest::getAccess - Returns false
*
* If the MEGA account is a business account and it's status is expired, onRequestFinish will
* be called with the error code MegaError::API_EBUSINESSPASTDUE.
*
* @param node MegaNode to stop sharing
* @param listener MegaRequestListener to track this request
*/
void disableExport(MegaNode *node, MegaRequestListener *listener = NULL);
/**
* @brief Fetch the filesystem in MEGA and resumes syncs following a successful fetch
*
* The MegaApi object must be logged in in an account or a public folder
* to successfully complete this request.
*
* The associated request type with this request is MegaRequest::TYPE_FETCH_NODES
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getFlag - Returns true if logged in into a folder and the provided key is invalid. Otherwise, false.
* - MegaRequest::getNodeHandle - Returns the public handle if logged into a public folder. Otherwise, INVALID_HANDLE
*
* @param listener MegaRequestListener to track this request
*/
void fetchNodes(MegaRequestListener *listener = NULL);
/**
* @brief Get the sum of sizes of all the files stored in the MEGA cloud.
*
* The SDK keeps a running total of the sum of the sizes of all the files stored in the cloud.
* This function retrieves that sum, via listener in order to avoid any blocking when called
* from a GUI thread. Provided the local state is caught up, the number will match the
* storageUsed from MegaApi::getAccountDetails which requests data from the servers, and is much
* quicker to retrieve.
*
* The MegaApi object must be logged in in an account or a public folder
* to successfully complete this request.
*
* The associated request type with this request is MegaRequest::TYPE_GET_CLOUDSTORAGEUSED
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getNumber - returns the cloud storage bytes used (calculated locally from the node data structures)
*
* @param listener MegaRequestListener to track this request
*/
void getCloudStorageUsed(MegaRequestListener *listener = NULL);
/**
* @brief Get details about the MEGA account
*
* Only basic data will be available. If you can get more data (sessions, transactions, purchases),
* use MegaApi::getExtendedAccountDetails.
*
* The associated request type with this request is MegaRequest::TYPE_ACCOUNT_DETAILS
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getMegaAccountDetails - Details of the MEGA account
* - MegaRequest::getNumDetails - Requested flags
*
* The available flags are:
* - storage quota: (numDetails & 0x01)
* - transfer quota: (numDetails & 0x02)
* - pro level: (numDetails & 0x04)
*
* @param listener MegaRequestListener to track this request
*/
void getAccountDetails(MegaRequestListener *listener = NULL);
/**
* @brief Get details about the MEGA account
*
* Only basic data will be available. If you need more data (sessions, transactions, purchases),
* use MegaApi::getExtendedAccountDetails.
*
* The associated request type with this request is MegaRequest::TYPE_ACCOUNT_DETAILS
*
* Use this version of the function to get just the details you need, to minimise server load
* and keep the system highly available for all. At least one flag must be set.
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getMegaAccountDetails - Details of the MEGA account
* - MegaRequest::getNumDetails - Requested flags
*
* The available flags are:
* - storage quota: (numDetails & 0x01)
* - transfer quota: (numDetails & 0x02)
* - pro level: (numDetails & 0x04)
*
* In case none of the flags are set, the associated request will fail with error MegaError::API_EARGS.
*
* @param storage If true, account storage details are requested
* @param transfer If true, account transfer details are requested
* @param pro If true, pro level of account is requested
* @param source code associated to trace the origin of storage requests, used for debugging purposes
* @param listener MegaRequestListener to track this request
*/
void getSpecificAccountDetails(bool storage, bool transfer, bool pro, int source = -1, MegaRequestListener *listener = NULL);
/**
* @brief Get details about the MEGA account
*
* This function allows to optionally get data about sessions, transactions and purchases related to the account.
*
* The associated request type with this request is MegaRequest::TYPE_ACCOUNT_DETAILS
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getMegaAccountDetails - Details of the MEGA account
* - MegaRequest::getNumDetails - Requested flags
*
* The available flags are:
* - transactions: (numDetails & 0x08)
* - purchases: (numDetails & 0x10)
* - sessions: (numDetails & 0x020)
*
* In case none of the flags are set, the associated request will fail with error MegaError::API_EARGS.
*
* @param sessions If true, sessions are requested
* @param purchases If true, purchases are requested
* @param transactions If true, transactions are requested
* @param listener MegaRequestListener to track this request
*/
void getExtendedAccountDetails(bool sessions = false, bool purchases = false, bool transactions = false, MegaRequestListener *listener = NULL);
/**
* @brief Check if the available transfer quota is enough to transfer an amount of bytes
*
* The associated request type with this request is MegaRequest::TYPE_QUERY_TRANSFER_QUOTA
*
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNumber - Returns the amount of bytes to be transferred
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getFlag - True if it is expected to get an overquota error, otherwise false
*
* @param size Amount of bytes to be transferred
* @param listener MegaRequestListener to track this request
*/
void queryTransferQuota(long long size, MegaRequestListener *listener = NULL);
/**
* @brief Get the available pricing plans to upgrade a MEGA account
*
* You can get a payment ID for any of the pricing plans provided by this function
* using MegaApi::getPaymentId
*
* The associated request type with this request is MegaRequest::TYPE_GET_PRICING
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getPricing - MegaPricing object with all pricing plans
* - MegaRequest::getCurrency - MegaCurrency object with currency data related to prices
*
* @param listener MegaRequestListener to track this request
*
* @see MegaApi::getPaymentId
*/
void getPricing(MegaRequestListener *listener = NULL);
/**
* @brief Get the available pricing plans to upgrade a MEGA account in a specifc currency.
*
* If you need the pricing plans in the default currency for the account, please use
* the overload avobe.
*
* You can get a payment ID for any of the pricing plans provided by this function
* using MegaApi::getPaymentId
*
* The associated request type with this request is MegaRequest::TYPE_GET_PRICING
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getPricing - MegaPricing object with all pricing plans
* - MegaRequest::getCurrency - MegaCurrency object with currency data related to prices
*
* @param countryCode Optional country code for which the currency and prices will be
* localized
* @param listener MegaRequestListener to track this request
*
* @see MegaApi::getPaymentId
* @see MegaApi::getPricing
*/
void getPricing(const char* countryCode, MegaRequestListener* listener = nullptr);
/**
* @brief Get the recommended PRO level. The smallest plan that is an upgrade (free -> lite -> proi -> proii -> proiii)
* and has enough space.
*
* The associated request type with this request is MegaRequest::TYPE_GET_RECOMMENDED_PRO_PLAN
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getNumber: the recommended PRO level:
* Valid values are (there are other account types):
* - MegaAccountDetails::ACCOUNT_TYPE_PROI = 1
* - MegaAccountDetails::ACCOUNT_TYPE_PROII = 2
* - MegaAccountDetails::ACCOUNT_TYPE_PROIII = 3
* - MegaAccountDetails::ACCOUNT_TYPE_LITE = 4
* - MegaAccountDetails::ACCOUNT_TYPE_STARTER = 11
* - MegaAccountDetails::ACCOUNT_TYPE_BASIC = 12
* - MegaAccountDetails::ACCOUNT_TYPE_ESSENTIAL = 13
*
* @param listener MegaRequestListener to track this request
*/
void getRecommendedProLevel(MegaRequestListener* listener = NULL);
/**
* @brief Get the payment URL for an upgrade
*
* The associated request type with this request is MegaRequest::TYPE_GET_PAYMENT_ID
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the product
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getLink - Payment ID
*
* @param productHandle Handle of the product (see MegaApi::getPricing)
* @param listener MegaRequestListener to track this request
*
* @see MegaApi::getPricing
*/
void getPaymentId(MegaHandle productHandle, MegaRequestListener *listener = NULL);
/**
* @brief Upgrade an account
* @param productHandle Product handle to purchase
*
* It's possible to get all pricing plans with their product handles using
* MegaApi::getPricing
*
* The associated request type with this request is MegaRequest::TYPE_UPGRADE_ACCOUNT
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the product
* - MegaRequest::getNumber - Returns the payment method
*
* @param paymentMethod Payment method
* Valid values are:
* - MegaApi::PAYMENT_METHOD_BALANCE = 0
* Use the account balance for the payment
*
* - MegaApi::PAYMENT_METHOD_CREDIT_CARD = 8
* Complete the payment with your credit card. Use MegaApi::creditCardStore to add
* a credit card to your account
*
* @param listener MegaRequestListener to track this request
*/
void upgradeAccount(MegaHandle productHandle, int paymentMethod, MegaRequestListener *listener = NULL);
/**
* @brief Submit a purchase receipt for verification
*
* The associated request type with this request is MegaRequest::TYPE_SUBMIT_PURCHASE_RECEIPT
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNumber - Returns the payment gateway
* - MegaRequest::getText - Returns the purchase receipt
*
* @param gateway Payment gateway
* Currently supported payment gateways are:
* - MegaApi::PAYMENT_METHOD_ITUNES = 2
* - MegaApi::PAYMENT_METHOD_GOOGLE_WALLET = 3
* - MegaApi::PAYMENT_METHOD_WINDOWS_STORE = 13
*
* @param receipt Purchase receipt
* @param listener MegaRequestListener to track this request
*/
void submitPurchaseReceipt(int gateway, const char* receipt, MegaRequestListener *listener = NULL);
/**
* @brief Submit a purchase receipt for verification
*
* The associated request type with this request is
* MegaRequest::TYPE_SUBMIT_PURCHASE_RECEIPT
*
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNumber - Returns the payment gateway
* - MegaRequest::getText - Returns the purchase receipt
* - MegaRequest::getNodeHandle - Returns the last public node handle accessed
*
* @param gateway Payment gateway
* Currently supported payment gateways are:
* - MegaApi::PAYMENT_METHOD_ITUNES = 2
* - MegaApi::PAYMENT_METHOD_GOOGLE_WALLET = 3
* - MegaApi::PAYMENT_METHOD_WINDOWS_STORE = 13
*
* @param receipt Purchase receipt
* @param lastPublicHandle Last public node handle accessed by the user in the last 24h
* @param listener MegaRequestListener to track this request
*
* @deprecated This version of the function is deprecated. Please, use the non-deprecated
* ones.
*/
MEGA_DEPRECATED
void submitPurchaseReceipt(int gateway, const char* receipt, MegaHandle lastPublicHandle, MegaRequestListener *listener = NULL);
/**
* @brief Submit a purchase receipt for verification
*
* The associated request type with this request is
* MegaRequest::TYPE_SUBMIT_PURCHASE_RECEIPT
*
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNumber - Returns the payment gateway
* - MegaRequest::getText - Returns the purchase receipt
* - MegaRequest::getNodeHandle - Returns the last public node handle accessed
* - MegaRequest::getParamType - Returns the type of lastPublicHandle
* - MegaRequest::getTransferredBytes - Returns the timestamp of the last access
*
* @param gateway Payment gateway
* Currently supported payment gateways are:
* - MegaApi::PAYMENT_METHOD_ITUNES = 2
* - MegaApi::PAYMENT_METHOD_GOOGLE_WALLET = 3
* - MegaApi::PAYMENT_METHOD_WINDOWS_STORE = 13
*
* @param receipt Purchase receipt
* @param lastPublicHandle Last public node handle accessed by the user in the last 24h
* @param lastPublicHandleType Indicates the type of lastPublicHandle, valid values are:
* - MegaApi::AFFILIATE_TYPE_ID = 1
* - MegaApi::AFFILIATE_TYPE_FILE_FOLDER = 2
* - MegaApi::AFFILIATE_TYPE_CHAT = 3
* - MegaApi::AFFILIATE_TYPE_CONTACT = 4
*
* @param lastAccessTimestamp Timestamp of the last access
* @param listener MegaRequestListener to track this request
*
* @deprecated This version of the function is deprecated. Please, use the non-deprecated
* one.
*/
MEGA_DEPRECATED
void submitPurchaseReceipt(int gateway, const char *receipt, MegaHandle lastPublicHandle, int lastPublicHandleType, int64_t lastAccessTimestamp, MegaRequestListener *listener = NULL);
/**
* @brief Store a credit card
*
* The associated request type with this request is MegaRequest::TYPE_CREDIT_CARD_STORE
*
* @param address1 Billing address
* @param address2 Second line of the billing address (optional)
* @param city City of the billing address
* @param province Province of the billing address
* @param country Contry of the billing address
* @param postalcode Postal code of the billing address
* @param firstname Firstname of the owner of the credit card
* @param lastname Lastname of the owner of the credit card
* @param creditcard Credit card number. Only digits, no spaces nor dashes
* @param expire_month Expire month of the credit card. Must have two digits ("03" for example)
* @param expire_year Expire year of the credit card. Must have four digits ("2010" for example)
* @param cv2 Security code of the credit card (3 digits)
* @param listener MegaRequestListener to track this request
*/
void creditCardStore(const char* address1, const char* address2, const char* city,
const char* province, const char* country, const char *postalcode,
const char* firstname, const char* lastname, const char* creditcard,
const char* expire_month, const char* expire_year, const char* cv2,
MegaRequestListener *listener = NULL);
/**
* @brief Get the credit card subscriptions of the account
*
* The associated request type with this request is MegaRequest::TYPE_CREDIT_CARD_QUERY_SUBSCRIPTIONS
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getNumber - Number of credit card subscriptions
*
* @param listener MegaRequestListener to track this request
*/
void creditCardQuerySubscriptions(MegaRequestListener *listener = NULL);
/**
* @brief Cancel the credit card subscriptions of the account
*
* The associated request type with this request is
* MegaRequest::TYPE_CREDIT_CARD_CANCEL_SUBSCRIPTIONS
* @param reason The reason for the cancellation. It can be NULL.
* @param id The subscription ID for the cancellation. If null or empty, all subscriptions
* will be cancelled.
* @param canContact Whether the user has permitted MEGA to contact them for the
* cancellation.
* - MegaApi::CREDIT_CARD_CANCEL_SUBSCRIPTIONS_CAN_CONTACT_NO = 0
* - MegaApi::CREDIT_CARD_CANCEL_SUBSCRIPTIONS_CAN_CONTACT_YES = 1
* @param listener MegaRequestListener to track this request
*/
void creditCardCancelSubscriptions(const char* reason,
const char* id,
int canContact,
MegaRequestListener* listener = NULL);
/**
* @brief Cancel credit card subscriptions of the account
*
* The associated request type with this request is
* MegaRequest::TYPE_CREDIT_CARD_CANCEL_SUBSCRIPTIONS
*
* @param reasonList List of reasons for the cancellation. It can be null.
* @param id The ID of the subscription to be cancelled. If null or empty, all subscriptions
* will be cancelled.
* @param canContact Whether the user has permitted MEGA to contact them about the
* cancellation.
* - MegaApi::CREDIT_CARD_CANCEL_SUBSCRIPTIONS_CAN_CONTACT_NO = 0
* - MegaApi::CREDIT_CARD_CANCEL_SUBSCRIPTIONS_CAN_CONTACT_YES = 1
* @param listener MegaRequestListener to track this request
*/
void creditCardCancelSubscriptions(const MegaCancelSubscriptionReasonList* reasonList,
const char* id,
int canContact,
MegaRequestListener* listener = nullptr);
/**
* @brief Get the available payment methods
*
* The associated request type with this request is MegaRequest::TYPE_GET_PAYMENT_METHODS
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getNumber - Bitfield with available payment methods
*
* To know if a payment method is available, you can do a check like this one:
* request->getNumber() & (1 << MegaApi::PAYMENT_METHOD_CREDIT_CARD)
*
* @param listener MegaRequestListener to track this request
*/
void getPaymentMethods(MegaRequestListener *listener = NULL);
/**
* @brief Export the master key of the account
*
* The returned value is a Base64-encoded string
*
* With the master key, it's possible to start the recovery of an account when the
* password is lost:
* - MegaApi::resetPassword()
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @return Base64-encoded master key
*/
char *exportMasterKey();
/**
* @brief Notify the user has exported the master key
*
* This function should be called when the user exports the master key by
* clicking on "Copy" or "Save file" options.
*
* As result, the user attribute MegaApi::USER_ATTR_PWD_REMINDER will be updated
* to remember the user has a backup of his/her master key. In consequence,
* MEGA will not ask the user to remind the password for the account.
*
* The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_PWD_REMINDER
* - MegaRequest::getText - Returns the new value for the attribute
*
* @param listener MegaRequestListener to track this request
*/
void masterKeyExported(MegaRequestListener *listener = NULL);
/**
* @brief Notify the user has successfully checked his password
*
* This function should be called when the user demonstrates that he remembers
* the password to access the account
*
* As result, the user attribute MegaApi::USER_ATTR_PWD_REMINDER will be updated
* to remember this event. In consequence, MEGA will not continue asking the user
* to remind the password for the account in a short time.
*
* The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_PWD_REMINDER
* - MegaRequest::getText - Returns the new value for the attribute
*
* @param listener MegaRequestListener to track this request
*/
void passwordReminderDialogSucceeded(MegaRequestListener *listener = NULL);
/**
* @brief Notify the user has successfully skipped the password check
*
* This function should be called when the user skips the verification of
* the password to access the account
*
* As result, the user attribute MegaApi::USER_ATTR_PWD_REMINDER will be updated
* to remember this event. In consequence, MEGA will not continue asking the user
* to remind the password for the account in a short time.
*
* The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_PWD_REMINDER
* - MegaRequest::getText - Returns the new value for the attribute
*
* @param listener MegaRequestListener to track this request
*/
void passwordReminderDialogSkipped(MegaRequestListener *listener = NULL);
/**
* @brief Notify the user wants to totally disable the password check
*
* This function should be called when the user rejects to verify that he remembers
* the password to access the account and doesn't want to see the reminder again.
*
* As result, the user attribute MegaApi::USER_ATTR_PWD_REMINDER will be updated
* to remember this event. In consequence, MEGA will not ask the user
* to remind the password for the account again.
*
* The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_PWD_REMINDER
* - MegaRequest::getText - Returns the new value for the attribute
*
* @param listener MegaRequestListener to track this request
*/
void passwordReminderDialogBlocked(MegaRequestListener *listener = NULL);
/**
* @brief Check if the app should show the password reminder dialog to the user
*
* The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_PWD_REMINDER
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getFlag - Returns true if the password reminder dialog should be shown
*
* If the corresponding user attribute is not set yet, the request will fail with the
* error code MegaError::API_ENOENT but the value of MegaRequest::getFlag will still
* be valid.
*
* @param atLogout True if the check is being done just before a logout
* @param listener MegaRequestListener to track this request
*/
void shouldShowPasswordReminderDialog(bool atLogout, MegaRequestListener *listener = NULL);
/**
* @brief Check if the master key has been exported
*
* The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_PWD_REMINDER
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getAccess - Returns true if the master key has been exported
*
* If the corresponding user attribute is not set yet, the request will fail with the
* error code MegaError::API_ENOENT.
*
* @param listener MegaRequestListener to track this request
*/
void isMasterKeyExported(MegaRequestListener *listener = NULL);
#ifdef ENABLE_CHAT
/**
* @brief Enable or disable the generation of rich previews
*
* The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_RICH_PREVIEWS
*
* @param enable True to enable the generation of rich previews
* @param listener MegaRequestListener to track this request
*/
void enableRichPreviews(bool enable, MegaRequestListener *listener = NULL);
/**
* @brief Check if rich previews are automatically generated
*
* The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_RICH_PREVIEWS
* - MegaRequest::getNumDetails - Returns zero
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getFlag - Returns true if generation of rich previews is enabled
* - MegaRequest::getMegaStringMap - Returns the raw content of the atribute: [<key><value>]*
*
* If the corresponding user attribute is not set yet, the request will fail with the
* error code MegaError::API_ENOENT, but the value of MegaRequest::getFlag will still be valid (false).
*
* @param listener MegaRequestListener to track this request
*/
void isRichPreviewsEnabled(MegaRequestListener *listener = NULL);
/**
* @brief Check if the app should show the rich link warning dialog to the user
*
* The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_RICH_PREVIEWS
* - MegaRequest::getNumDetails - Returns one
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getFlag - Returns true if it is necessary to show the rich link warning
* - MegaRequest::getNumber - Returns the number of times that user has indicated that doesn't want
* modify the message with a rich link. If number is bigger than three, the extra option "Never"
* must be added to the warning dialog.
* - MegaRequest::getMegaStringMap - Returns the raw content of the atribute: [<key><value>]*
*
* If the corresponding user attribute is not set yet, the request will fail with the
* error code MegaError::API_ENOENT, but the value of MegaRequest::getFlag will still be valid (true).
*
* @param listener MegaRequestListener to track this request
*/
void shouldShowRichLinkWarning(MegaRequestListener *listener = NULL);
/**
* @brief Set the number of times "Not now" option has been selected in the rich link warning dialog
*
* The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_RICH_PREVIEWS
*
* @param value Number of times "Not now" option has been selected
* @param listener MegaRequestListener to track this request
*/
void setRichLinkWarningCounterValue(int value, MegaRequestListener *listener = NULL);
/**
* @brief Enable the sending of geolocation messages
*
* The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_GEOLOCATION
*
* @param listener MegaRequestListener to track this request
*/
void enableGeolocation(MegaRequestListener *listener = NULL);
/**
* @brief Check if the sending of geolocation messages is enabled
*
* The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_GEOLOCATION
*
* Sending a Geolocation message is enabled if the MegaRequest object, received in onRequestFinish,
* has error code MegaError::API_OK. In other cases, send geolocation messages is not enabled and
* the application has to answer before send a message of this type.
*
* @param listener MegaRequestListener to track this request
*/
void isGeolocationEnabled(MegaRequestListener *listener = NULL);
#endif
/**
* @brief Set My Chat Files target folder.
*
* The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_MY_CHAT_FILES_FOLDER
* - MegaRequest::getMegaStringMap - Returns a MegaStringMap.
* The key "h" in the map contains the nodehandle specified as parameter encoded in B64
*
* @param nodehandle MegaHandle of the node to be used as target folder
* @param listener MegaRequestListener to track this request
*/
void setMyChatFilesFolder(MegaHandle nodehandle, MegaRequestListener *listener = NULL);
/**
* @brief Gets My chat files target folder.
*
* The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_MY_CHAT_FILES_FOLDER
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getNodehandle - Returns the handle of the node where My Chat Files are stored
*
* If the folder is not set, the request will fail with the error code MegaError::API_ENOENT.
*
* @param listener MegaRequestListener to track this request
*/
void getMyChatFilesFolder(MegaRequestListener *listener = NULL);
/**
* @brief Set Camera Uploads primary target folder.
*
* The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_CAMERA_UPLOADS_FOLDER
* - MegaRequest::getFlag - Returns false
* - MegaRequest::getNodehandle - Returns the provided node handle
* - MegaRequest::getMegaStringMap - Returns a MegaStringMap.
* The key "h" in the map contains the nodehandle specified as parameter encoded in B64
*
* @param nodehandle MegaHandle of the node to be used as primary target folder
* @param listener MegaRequestListener to track this request
*/
void setCameraUploadsFolder(MegaHandle nodehandle, MegaRequestListener *listener = NULL);
/**
* @brief Set Camera Uploads for both primary and secondary target folder.
*
* If only one of the target folders wants to be set, simply pass a INVALID_HANDLE to
* as the other target folder and it will remain untouched.
*
* The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_CAMERA_UPLOADS_FOLDER
* - MegaRequest::getNodehandle - Returns the provided node handle for primary folder
* - MegaRequest::getParentHandle - Returns the provided node handle for secondary folder
*
* @param primaryFolder MegaHandle of the node to be used as primary target folder
* @param secondaryFolder MegaHandle of the node to be used as secondary target folder
* @param listener MegaRequestListener to track this request
*/
void setCameraUploadsFolders(MegaHandle primaryFolder, MegaHandle secondaryFolder, MegaRequestListener *listener = NULL);
/**
* @brief Gets Camera Uploads primary target folder.
*
* The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_CAMERA_UPLOADS_FOLDER
* - MegaRequest::getFlag - Returns false
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getNodehandle - Returns the handle of the primary node where Camera Uploads files are stored
*
* If the folder is not set, the request will fail with the error code MegaError::API_ENOENT.
*
* @param listener MegaRequestListener to track this request
*/
void getCameraUploadsFolder(MegaRequestListener *listener = NULL);
/**
* @brief Gets Camera Uploads secondary target folder.
*
* The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_CAMERA_UPLOADS_FOLDER
* - MegaRequest::getFlag - Returns true
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getNodehandle - Returns the handle of the secondary node where Camera Uploads files are stored
*
* If the secondary folder is not set, the request will fail with the error code MegaError::API_ENOENT.
*
* @param listener MegaRequestListener to track this request
*/
void getCameraUploadsFolderSecondary(MegaRequestListener *listener = NULL);
/**
* @brief Creates the special folder for backups ("My backups")
*
* It creates a new folder inside the Vault rootnode and later stores the node's
* handle in a user's attribute, MegaApi::USER_ATTR_MY_BACKUPS_FOLDER.
*
* Apps should first check if this folder exists already, by calling
* MegaApi::getUserAttribute for the corresponding attribute.
*
* The associated request type with this request is MegaRequest::TYPE_SET_MY_BACKUPS
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getText - Returns the name provided as parameter
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getNodehandle - Returns the node handle of the folder created
*
* If no user was logged in, the request will fail with the error API_EACCESS.
* If the folder for backups already existed, the request will fail with the error API_EEXIST.
*
* @param localizedName Localized name for "My backups" folder
* @param listener MegaRequestListener to track this request
*/
void setMyBackupsFolder(const char *localizedName, MegaRequestListener *listener = nullptr);
/**
* @brief Gets the alias for an user
*
* The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_ALIAS
* - MegaRequest::getNodeHandle - user handle in binary
* - MegaRequest::getText - user handle encoded in B64
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getName - Returns the user alias
*
* If the user alias doesn't exists the request will fail with the error code MegaError::API_ENOENT.
*
* @param uh handle of the user in binary
* @param listener MegaRequestListener to track this request
*/
void getUserAlias(MegaHandle uh, MegaRequestListener *listener = NULL);
/**
* @brief Set or reset an alias for a user
*
* The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_ALIAS
* - MegaRequest::getNodeHandle - Returns the user handle in binary
* - MegaRequest::getText - Returns the user alias
*
* @param uh handle of the user in binary
* @param alias the user alias, or null to reset the existing
* @param listener MegaRequestListener to track this request
*/
void setUserAlias(MegaHandle uh, const char *alias, MegaRequestListener *listener = NULL);
/**
* @brief Get push notification settings
*
* The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_PUSH_SETTINGS
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getMegaPushNotificationSettings - Returns settings for push notifications
*
* @see MegaPushNotificationSettings class for more details.
*
* @param listener MegaRequestListener to track this request
*/
void getPushNotificationSettings(MegaRequestListener *listener = NULL);
/**
* @brief Set push notification settings
*
* The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_PUSH_SETTINGS
* - MegaRequest::getMegaPushNotificationSettings - Returns settings for push notifications
*
* @see MegaPushNotificationSettings class for more details. You can prepare a new object by
* calling MegaPushNotificationSettings::createInstance.
*
* @param settings MegaPushNotificationSettings with the new settings
* @param listener MegaRequestListener to track this request
*/
void setPushNotificationSettings(MegaPushNotificationSettings *settings, MegaRequestListener *listener = NULL);
/**
* @brief Get the number of days for rubbish-bin cleaning scheduler
*
* The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_RUBBISH_TIME
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getNumber - Returns the days for rubbish-bin cleaning scheduler.
* Zero means that the rubbish-bin cleaning scheduler is disabled (only if the account is PRO)
* Any negative value means that the configured value is invalid.
*
* @param listener MegaRequestListener to track this request
*/
void getRubbishBinAutopurgePeriod(MegaRequestListener *listener = NULL);
/**
* @brief Set the number of days for rubbish-bin cleaning scheduler
*
* The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_RUBBISH_TIME
* - MegaRequest::getNumber - Returns the days for rubbish-bin cleaning scheduler passed as parameter
*
* @param days Number of days for rubbish-bin cleaning scheduler. It must be >= 0.
* The value zero disables the rubbish-bin cleaning scheduler (only for PRO accounts).
*
* @param listener MegaRequestListener to track this request
*/
void setRubbishBinAutopurgePeriod(int days, MegaRequestListener *listener = NULL);
/**
* @brief Returns the id of this device
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @return The id of this device
*/
const char* getDeviceId() const;
/**
* @brief Returns the name previously set for a device
*
* The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_DEVICE_NAMES
* - MegaRequest::getText - Returns passed device id (or the value returned by getDeviceId()
* if deviceId was initially passed as null).
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getName - Returns device name.
*
* @param deviceId The id of the device to get the name for. If null, the value returned
* by getDeviceId() will be used instead.
* @param listener MegaRequestListener to track this request
*/
void getDeviceName(const char *deviceId, MegaRequestListener *listener = NULL);
/**
* @brief Sets name for specified device
*
* The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_DEVICE_NAMES
* - MegaRequest::getName - Returns device name.
* - MegaRequest::getText - Returns passed device id (or the value returned by getDeviceId()
* if deviceId was initially passed as null).
*
* @param deviceId The id of the device to set the name for If null, the value returned
* by getDeviceId() will be used instead.
* @param deviceName String with device name
* @param listener MegaRequestListener to track this request
*/
void setDeviceName(const char* deviceId, const char* deviceName, MegaRequestListener *listener = NULL);
/**
* @brief Returns the name set for this drive
*
* The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_DEVICE_NAMES
* - MegaRequest::getFile - Returns the path to the drive
* - MegaRequest::getFlag - Returns true
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getName - Returns drive name.
*
* @param pathToDrive Path to the root of the external drive
* @param listener MegaRequestListener to track this request
*/
void getDriveName(const char *pathToDrive, MegaRequestListener *listener = NULL);
/**
* @brief Sets drive name
*
* The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_DEVICE_NAMES
* - MegaRequest::getName - Returns drive name.
* - MegaRequest::getFile - Returns the path to the drive
* - MegaRequest::getFlag - Returns true
*
* @param pathToDrive Path to the root of the external drive
* @param driveName String with drive name
* @param listener MegaRequestListener to track this request
*/
void setDriveName(const char* pathToDrive, const char *driveName, MegaRequestListener *listener = NULL);
/**
* @brief Change the password of the MEGA account
*
* The associated request type with this request is MegaRequest::TYPE_CHANGE_PW
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getPassword - Returns the old password (if it was passed as parameter)
* - MegaRequest::getNewPassword - Returns the new password
*
* @param oldPassword Old password (optional, it can be NULL to not check the old password)
* @param newPassword New password
* @param listener MegaRequestListener to track this request
*/
void changePassword(const char *oldPassword, const char *newPassword, MegaRequestListener *listener = NULL);
/**
* @brief Invite another person to be your MEGA contact
*
* The user doesn't need to be registered on MEGA. If the email isn't associated with
* a MEGA account, an invitation email will be sent with the text in the "message" parameter.
*
* The associated request type with this request is MegaRequest::TYPE_INVITE_CONTACT
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getEmail - Returns the email of the contact
* - MegaRequest::getText - Returns the text of the invitation
* - MegaRequest::getNumber - Returns the action
*
* Sending a reminder within a two week period since you started or your last reminder will
* fail the API returning the error code MegaError::API_EACCESS.
*
* @param email Email of the new contact
* @param message Message for the user (can be NULL)
* @param action Action for this contact request. Valid values are:
* - MegaContactRequest::INVITE_ACTION_ADD = 0
* - MegaContactRequest::INVITE_ACTION_DELETE = 1
* - MegaContactRequest::INVITE_ACTION_REMIND = 2
*
* @param listener MegaRequestListener to track this request
*/
void inviteContact(const char* email, const char* message, int action, MegaRequestListener* listener = NULL);
/**
* @brief Invite another person to be your MEGA contact using a contact link handle
*
* The associated request type with this request is MegaRequest::TYPE_INVITE_CONTACT
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getEmail - Returns the email of the contact
* - MegaRequest::getText - Returns the text of the invitation
* - MegaRequest::getNumber - Returns the action
* - MegaRequest::getNodeHandle - Returns the contact link handle
*
* Sending a reminder within a two week period since you started or your last reminder will
* fail the API returning the error code MegaError::API_EACCESS.
*
* @param email Email of the new contact
* @param message Message for the user (can be NULL)
* @param action Action for this contact request. Valid values are:
* - MegaContactRequest::INVITE_ACTION_ADD = 0
* - MegaContactRequest::INVITE_ACTION_DELETE = 1
* - MegaContactRequest::INVITE_ACTION_REMIND = 2
* @param contactLink Contact link handle of the other account. This parameter is considered only if the
* \c action is MegaContactRequest::INVITE_ACTION_ADD. Otherwise, it's ignored and it has no effect.
*
* @param listener MegaRequestListener to track this request
*/
void inviteContact(const char* email, const char* message, int action, MegaHandle contactLink, MegaRequestListener* listener = NULL);
/**
* @brief Reply to a contact request
* @param request Contact request. You can get your pending contact requests using MegaApi::getIncomingContactRequests
* @param action Action for this contact request. Valid values are:
* - MegaContactRequest::REPLY_ACTION_ACCEPT = 0
* - MegaContactRequest::REPLY_ACTION_DENY = 1
* - MegaContactRequest::REPLY_ACTION_IGNORE = 2
*
* The associated request type with this request is MegaRequest::TYPE_REPLY_CONTACT_REQUEST
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the contact request
* - MegaRequest::getNumber - Returns the action
*
* @param listener MegaRequestListener to track this request
*/
void replyContactRequest(const MegaContactRequest* request,
int action,
MegaRequestListener* listener = NULL);
/**
* @brief Remove a contact to the MEGA account
*
* The associated request type with this request is MegaRequest::TYPE_REMOVE_CONTACT
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getEmail - Returns the email of the contact
*
* @param user MegaUser of the contact (see MegaApi::getContact)
* @param listener MegaRequestListener to track this request
*/
void removeContact(MegaUser *user, MegaRequestListener* listener = NULL);
/**
* @brief Logout of the MEGA account invalidating the session
*
* The associated request type with this request is MegaRequest::TYPE_LOGOUT
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getTransferTag - Returns the keepSyncConfigsFile
* - MegaRequest::getFlag - Returns true
*
* Under certain circumstances, this request might return the error code
* MegaError::API_ESID. It should not be taken as an error, since the reason
* is that the logout action has been notified before the reception of the
* logout response itself.
*
* In case of an automatic logout (ie. when the account become blocked by
* ToS infringment), the MegaRequest::getParamType indicates the error that
* triggered the automatic logout (MegaError::API_EBLOCKED for the example).
*
* @param keepSyncConfigsFile Allow sync configs to be recovered if the same user logs in again
* The file containing sync configs is encrypted so there's no privacy issue.
* This is provided for backward compatibility for MEGAsync.
* @param listener MegaRequestListener to track this request
*/
#ifdef ENABLE_SYNC
void logout(bool keepSyncConfigsFile, MegaRequestListener *listener);
#else
void logout(MegaRequestListener *listener = nullptr);
#endif
/**
* @brief Logout of the MEGA account without invalidating the session
*
* The associated request type with this request is MegaRequest::TYPE_LOGOUT
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getFlag - Returns false
*
* @param listener MegaRequestListener to track this request
*/
void localLogout(MegaRequestListener *listener = NULL);
/**
* @brief Invalidate the existing cache and create a fresh one
*/
void invalidateCache();
/**
* @brief Estimate the strength of a password
*
* Possible return values are:
* - PASSWORD_STRENGTH_VERYWEAK = 0
* - PASSWORD_STRENGTH_WEAK = 1
* - PASSWORD_STRENGTH_MEDIUM = 2
* - PASSWORD_STRENGTH_GOOD = 3
* - PASSWORD_STRENGTH_STRONG = 4
*
* @param password Password to check
* @return Estimated strength of the password
*/
int getPasswordStrength(const char *password);
/**
* @brief Generate a new pseudo-randomly characters-based password
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @param t bool indicating if at least 1 upper case letter shall be included
* @param t bool indicating if at least 1 digit shall be included
* @param t bool indicating if at least 1 symbol from !@#$%^&*() shall be included
* @param length unsigned int with the number of characters that will be included.
* Minimum valid length is 8 and maximum valid is 64.
* @return Null-terminated char string containing the newly generated password.
*/
static char* generateRandomCharsPassword(bool useUpper, bool useDigit, bool useSymbol, unsigned int length);
/**
* @brief Submit feedback about the app
*
* The associated request type with this request is MegaRequest::TYPE_SUBMIT_FEEDBACK
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getText - Retuns the comment about the app
* - MegaRequest::getNumber - Returns the rating for the app
* - MegaRequest::getFlag - Returns a flag used to differentiate feedback about transfers
* from other types. In this case, it will always be false since we are not sending transfer
* feedback.
*
* @param rating Integer to rate the app. Valid values: from 1 to 5.
* @param comment Comment about the app
* @param listener MegaRequestListener to track this request
*/
void submitFeedback(int rating, const char *comment, MegaRequestListener *listener = NULL);
/**
* @brief Submit feedback about transfers
*
* The associated request type with this request is MegaRequest::TYPE_SUBMIT_FEEDBACK
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getText - Retuns the comment about the app
* - MegaRequest::getNumber - Returns the rating for the app
* - MegaRequest::getFlag - Returns a flag used to differentiate feedback about transfers
* from other types. In this case, it will always be true since we are sending transfer
* feedback.
* - MegaRequest::getParamType - Returns the type of transfer we want to give feedback
* Valid values are:
* + TRANSFER_STATS_DOWNLOAD = 0,
* + TRANSFER_STATS_UPLOAD = 1,
* + TRANSFER_STATS_BOTH = 2,
*
* @param rating Integer to rate the app. Valid values: from 1 to 5.
* @param comment Comment about the app
* @param comment transferType type of transfer we want to give feedback. Valid values are:
* TRANSFER_STATS_DOWNLOAD (0) and TRANSFER_STATS_UPLOAD (1) TRANSFER_STATS_BOTH (2),
* @param listener MegaRequestListener to track this request
*/
void submitFeedbackForTransfers(int rating,
const char* comment,
int transferType,
MegaRequestListener* listener = NULL);
/**
* @brief Send events to the stats server
*
* The associated request type with this request is MegaRequest::TYPE_SEND_EVENT
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNumber - Returns the event type
* - MegaRequest::getText - Returns the event message
* - MegaRequest::getFlag - Returns the addJourneyId flag
* - MegaRequest::getSessionKey - Returns the ViewID
*
* @param eventType Event type
* @param message Event message
* @param addJourneyId True if JourneyID should be included. Otherwise, false.
* @param viewId ViewID value (C-string null-terminated) to be sent with the event.
* This value should have been generated with MegaApi::generateViewId method.
* @param listener MegaRequestListener to track this request
*
* @devonly This function is for internal usage of MEGA apps for debug purposes. This info
* is sent to MEGA servers.
*
* @note Event types are restricted to the following ranges:
* - MEGAcmd: [98900, 99000)
* - MEGAchat: [99000, 99199)
* - Android: [99200, 99300)
* - iOS: [99300, 99400)
* - MEGA SDK: [99400, 99500)
* - MEGAsync: [99500, 99600)
* - Webclient: [99600, 99800]
*/
void sendEvent(int eventType, const char* message, bool addJourneyId, const char* viewId, MegaRequestListener *listener = NULL);
/**
* @brief Create a new ticket for support with attached description
*
* The associated request type with this request is MegaRequest::TYPE_SUPPORT_TICKET
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the type of the ticket
* - MegaRequest::getText - Returns the description of the issue
*
* @param message Description of the issue for support
* @param type Ticket type. These are the available types:
* 0 for General Enquiry
* 1 for Technical Issue
* 2 for Payment Issue
* 3 for Forgotten Password
* 4 for Transfer Issue
* 5 for Contact/Sharing Issue
* 6 for MEGAsync Issue
* 7 for Missing/Invisible Data
* 8 for help-centre clarifications
* 9 for iOS issue
* 10 for Android issue
* @param listener MegaRequestListener to track this request
*/
void createSupportTicket(const char* message, int type = 1, MegaRequestListener *listener = NULL);
/**
* @brief Send a debug report
*
* The User-Agent is used to identify the app. It can be set in MegaApi::MegaApi
*
* The associated request type with this request is MegaRequest::TYPE_REPORT_EVENT
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns MegaApi::EVENT_DEBUG
* - MegaRequest::getText - Retuns the debug message
*
* @param text Debug message
* @param listener MegaRequestListener to track this request
*
* @devonly This function is for internal usage of MEGA apps. This feedback
* is sent to MEGA servers.
*/
void reportDebugEvent(const char *text, MegaRequestListener *listener = NULL);
/**
* @brief Use HTTPS communications only
*
* The default behavior is to use HTTP for transfers and the persistent connection
* to wait for external events. Those communications don't require HTTPS because
* all transfer data is already end-to-end encrypted and no data is transmitted
* over the connection to wait for events (it's just closed when there are new events).
*
* This feature should only be enabled if there are problems to contact MEGA servers
* through HTTP because otherwise it doesn't have any benefit and will cause a
* higher CPU usage.
*
* See MegaApi::usingHttpsOnly
*
* @param httpsOnly True to use HTTPS communications only
* @param listener MegaRequestListener to track this request
*/
void useHttpsOnly(bool httpsOnly, MegaRequestListener *listener = NULL);
/**
* @brief Check if the SDK is using HTTPS communications only
*
* The default behavior is to use HTTP for transfers and the persistent connection
* to wait for external events. Those communications don't require HTTPS because
* all transfer data is already end-to-end encrypted and no data is transmitted
* over the connection to wait for events (it's just closed when there are new events).
*
* See MegaApi::useHttpsOnly
*
* @return True if the SDK is using HTTPS communications only. Otherwise false.
*/
bool usingHttpsOnly();
/////////////////// TRANSFERS ///////////////////
/**
* @brief Upload a file to support
*
* If the status of the business account is expired, onTransferFinish will be called with
* the error code MegaError::API_EBUSINESSPASTDUE. In this case, apps should show a warning
* message similar to "Your business account is overdue, please contact your administrator."
*
* For folders, onTransferFinish will be called with error MegaError:API_EARGS;
*
* @param localPath Local path of the file
* @param isSourceTemporary Pass the ownership of the file to the SDK, that will DELETE it
* when the upload finishes. This parameter is intended to automatically delete temporary
* files that are only created to be uploaded. Use this parameter with caution. Set it to
* true only if you are sure about what are you doing.
* @param listener MegaTransferListener to track this transfer
*
* @note In case we find a node in cloud drive with the same content but a different mtime
* than the file to be uploaded, this function will try to update it's mtime instead of
* starting a new file upload. If setting the mtime fails, the transfer will fail with
* API_EWRITE.
*/
void startUploadForSupport(const char* localPath, bool isSourceTemporary = false, MegaTransferListener *listener=NULL);
/**
* @brief Upload a file or a folder
*
* If the status of the business account is expired, onTransferFinish will be called with
* the error code MegaError::API_EBUSINESSPASTDUE. In this case, apps should show a warning
* message similar to "Your business account is overdue, please contact your administrator."
*
* When user wants to upload a batch of items that at least contains one folder, SDK mutex
* will be partially locked until:
* - we have received onTransferStart for every file in the batch
* - we have received onTransferUpdate with MegaTransfer::getStage ==
* MegaTransfer::STAGE_TRANSFERRING_FILES for every folder in the batch
*
* During this period, the only safe method (to avoid deadlocks) to cancel transfers is by
* calling CancelToken::cancel(true). This method will cancel all transfers(not finished
* yet).
*
* Important considerations:
* - A cancel token instance can be shared by multiple transfers, and calling
* CancelToken::cancel(true) will affect all of those transfers.
*
* - It's app responsibility, to keep cancel token instance alive until receive
* MegaTransferListener::onTransferFinish for all MegaTransfers that shares the same cancel
* token instance.
*
* For more information about MegaTransfer stages please refer to onTransferUpdate
* documentation.
*
* @param localPath Local path of the file or folder
* @param parent Parent node for the file or folder in the MEGA account
* @param fileName Custom file name for the file or folder in MEGA
* + If you don't need this param provide NULL as value
* @param mtime Custom modification time for the file in MEGA (in seconds since the epoch)
* + If you don't need this param provide MegaApi::INVALID_CUSTOM_MOD_TIME as value
* @param appData Custom app data to save in the MegaTransfer object
* The data in this parameter can be accessed using MegaTransfer::getAppData in callbacks
* related to the transfer. If a transfer is started with exactly the same data
* (local path and target parent) as another one in the transfer queue, the new transfer
* fails with the error API_EEXISTS and the appData of the new transfer is appended to
* the appData of the old transfer, using a '!' separator if the old transfer had already
* appData.
* + If you don't need this param provide NULL as value
* @param isSourceTemporary Pass the ownership of the file to the SDK, that will DELETE it
* when the upload finishes. This parameter is intended to automatically delete temporary
* files that are only created to be uploaded. Use this parameter with caution. Set it to
* true only if you are sure about what are you doing.
* + If you don't need this param provide false as value
* @param startFirst puts the transfer on top of the upload queue
* + If you don't need this param provide false as value
* @param cancelToken MegaCancelToken to be able to cancel a folder/file upload process.
* This param is required to be able to cancel the transfer safely.
* App retains the ownership of this param.
* @param listener MegaTransferListener to track this transfer
*
* @note In case we find a node in cloud drive with the same content but a different mtime
* than the file to be uploaded, this function will try to update it's mtime instead of
* starting a new file upload. If setting the mtime fails, the transfer will fail with
* API_EWRITE.
*
* @deprecated This version of the function is deprecated. Please, use the non-deprecated
* one.
*/
MEGA_DEPRECATED
void startUpload(const char *localPath, MegaNode *parent, const char *fileName, int64_t mtime, const char *appData, bool isSourceTemporary, bool startFirst, MegaCancelToken *cancelToken, MegaTransferListener *listener=NULL);
/**
* @brief Upload a file or a folder
*
* This method should be used ONLY to share by chat a local file. In case the file
* is already uploaded, but the corresponding node is missing the thumbnail and/or preview,
* this method will force a new upload from the scratch (ensuring the file attributes are
* set), instead of doing a remote copy.
*
* This method always puts the transfer on top of the upload queue.
*
* If the status of the business account is expired, onTransferFinish will be called with
* the error code MegaError::API_EBUSINESSPASTDUE. In this case, apps should show a warning
* message similar to "Your business account is overdue, please contact your administrator."
*
* @param localPath Local path of the file or folder
* @param parent Parent node for the file or folder in the MEGA account
* @param appData Custom app data to save in the MegaTransfer object
* The data in this parameter can be accessed using MegaTransfer::getAppData in callbacks
* related to the transfer. If a transfer is started with exactly the same data
* (local path and target parent) as another one in the transfer queue, the new transfer
* fails with the error API_EEXISTS and the appData of the new transfer is appended to
* the appData of the old transfer, using a '!' separator if the old transfer had already
* appData.
* @param isSourceTemporary Pass the ownership of the file to the SDK, that will DELETE it
* when the upload finishes. This parameter is intended to automatically delete temporary
* files that are only created to be uploaded. Use this parameter with caution. Set it to
* true only if you are sure about what are you doing.
* @param fileName Custom file name for the file or folder in MEGA
* @param listener MegaTransferListener to track this transfer
*
* @note In case we find a node in cloud drive with the same content but a different mtime
* than the file to be uploaded, this function will try to update it's mtime instead of
* starting a new file upload. If setting the mtime fails, the transfer will fail with
* API_EWRITE.
*
* @deprecated Deprecated in favor of startUpload() with MegaUploadOptions passed via the
* uploadOptions parameter.
*/
MEGA_DEPRECATED
void startUploadForChat(const char *localPath, MegaNode *parent, const char *appData, bool isSourceTemporary, const char* fileName, MegaTransferListener *listener = NULL);
/**
* @brief Upload a file or a folder.
*
* This method starts an upload transfer for a local file or folder into the specified
* parent node.
*
* Business account overdue:
* If the status of the business account is expired/overdue,
* MegaTransferListener::onTransferFinish() will be called with error code
* MegaError::API_EBUSINESSPASTDUE. In this case, apps should show a warning message similar
* to "Your business account is overdue, please contact your administrator."
*
* Folder batch deadlock considerations:
* When uploading a batch of items that contains at least one folder, the SDK mutex will be
* partially locked until:
* - onTransferStart has been received for every file in the batch, and
* - onTransferUpdate has been received with MegaTransfer::getStage() ==
* MegaTransfer::STAGE_TRANSFERRING_FILES for every folder in the batch.
*
* During this period, the only safe method (to avoid deadlocks) to cancel transfers is by
* calling CancelToken::cancel(true). This cancels all transfers (not finished yet)
* associated with that cancel token instance.
*
* Important considerations about cancel tokens:
* - A MegaCancelToken instance can be shared by multiple transfers. Calling cancel(true)
* affects all transfers that share the token.
* - It is the app responsibility to keep the MegaCancelToken instance alive until
* MegaTransferListener::onTransferFinish() is received for all MegaTransfers that share
* it.
*
* For more information about MegaTransfer stages please refer to
* MegaTransferListener::onTransferUpdate documentation.
*
* @param localPath Local path of the file or folder to upload.
* @param parent Parent node where the file/folder will be created in the MEGA account.
* @param cancelToken MegaCancelToken used to cancel the upload process safely (required for
* safe cancellation). App retains ownership and must keep it alive as described above.
* @param options Optional upload customization parameters.
* @param listener Optional MegaTransferListener to track this transfer. The app retains the
* ownership of the object. It can be deleted after the call returns.
* @note In case we find a node in cloud drive with the same content but a different mtime
* than the file to be uploaded, this function will try to update it's mtime instead of
* starting a new file upload. If setting the mtime fails, the transfer will fail with
* API_EWRITE.
*/
void startUpload(const std::string& localPath,
MegaNode* parent,
MegaCancelToken* cancelToken,
const MegaUploadOptions* options,
MegaTransferListener* listener = nullptr);
/**
* @brief Download a file or a folder from MEGA, saving custom app data during the transfer
*
* If the status of the business account is expired, onTransferFinish will be called with the error
* code MegaError::API_EBUSINESSPASTDUE. In this case, apps should show a warning message similar to
* "Your business account is overdue, please contact your administrator."
*
* If the node, or the account to which the node belongs, has been taken down or suspended, onTransferFinish will be called with
* the error code MegaError::API_ETOOMANY. In this case, the application should show a warning message similar to
* "The file that you are downloading (or the account it belongs to) has been suspended for violating our Terms of Service."
*
* When user wants to download a batch of items that at least contains one folder, SDK mutex will be partially
* locked until:
* - we have received onTransferStart for every file in the batch
* - we have received onTransferUpdate with MegaTransfer::getStage == MegaTransfer::STAGE_TRANSFERRING_FILES
* for every folder in the batch
*
* During this period, the only safe method (to avoid deadlocks) to cancel transfers is by calling CancelToken::cancel(true).
* This method will cancel all transfers(not finished yet).
*
* Important considerations:
* - A cancel token instance can be shared by multiple transfers, and calling CancelToken::cancel(true) will affect all
* of those transfers.
*
* - It's app responsibility, to keep cancel token instance alive until receive MegaTransferListener::onTransferFinish for all MegaTransfers
* that shares the same cancel token instance.
*
* For more information about MegaTransfer stages please refer to onTransferUpdate documentation.
*
* @param node MegaNode that identifies the file or folder
* @param localPath Destination path for the file or folder
* If this path is a local folder, it must end with a '\' or '/' character and the file name
* in MEGA will be used to store a file inside that folder. If the path doesn't finish with
* one of these characters, the file will be downloaded to a file in that path.
* @param customName Custom file name for the file or folder in local destination
* + If you don't need this param provide NULL as value
* @param appData Custom app data to save in the MegaTransfer object
* The data in this parameter can be accessed using MegaTransfer::getAppData in callbacks
* related to the transfer.
* + If you don't need this param provide NULL as value
* @param startFirst puts the transfer on top of the download queue
* + If you don't need this param provide false as value
* @param cancelToken MegaCancelToken to be able to cancel a folder/file download process.
* This param is required to be able to cancel transfers safely.
* App retains the ownership of this param.
* @param collisionCheck Indicates the collision check on same files, valid values are:
* - MegaTransfer::COLLISION_CHECK_ASSUMESAME = 1,
* - MegaTransfer::COLLISION_CHECK_ALWAYSERROR = 2,
* - MegaTransfer::COLLISION_CHECK_FINGERPRINT = 3,
* - MegaTransfer::COLLISION_CHECK_METAMAC = 4,
* - MegaTransfer::COLLISION_CHECK_ASSUMEDIFFERENT = 5,
*
* @param collisionResolution Indicates how to save same files, valid values are:
* - MegaTransfer::COLLISION_RESOLUTION_OVERWRITE = 1,
* - MegaTransfer::COLLISION_RESOLUTION_NEW_WITH_N = 2,
* - MegaTransfer::COLLISION_RESOLUTION_EXISTING_TO_OLDN = 3,
*
* @param undelete Indicates a special request for a node that has been completely deleted
* (even from Rubbish Bin); allowed only for accounts with PRO level
*
* @param listener MegaTransferListener to track this transfer
*/
void startDownload(MegaNode* node, const char* localPath, const char *customName, const char *appData, bool startFirst, MegaCancelToken *cancelToken, int collisionCheck, int collisionResolution, bool undelete, MegaTransferListener *listener = NULL);
/**
* @brief Start an streaming download for a file in MEGA
*
* Streaming downloads don't save the downloaded data into a local file. It is provided
* in MegaTransferListener::onTransferUpdate in a byte buffer. The pointer is returned by
* MegaTransfer::getLastBytes and the size of the buffer in MegaTransfer::getDeltaSize
*
* The same byte array is also provided in the callback MegaTransferListener::onTransferData for
* compatibility with other programming languages. Only the MegaTransferListener passed to this function
* will receive MegaTransferListener::onTransferData callbacks. MegaTransferListener objects registered
* with MegaApi::addTransferListener won't receive them for performance reasons
*
* If the status of the business account is expired, onTransferFinish will be called with the error
* code MegaError::API_EBUSINESSPASTDUE. In this case, apps should show a warning message similar to
* "Your business account is overdue, please contact your administrator."
*
* @param node MegaNode that identifies the file
* @param startPos First byte to download from the file
* @param size Size of the data to download
* @param listener MegaTransferListener to track this transfer
*/
void startStreaming(MegaNode* node, int64_t startPos, int64_t size, MegaTransferListener *listener);
/**
* @brief Set the miniumum acceptable streaming speed for streaming transfers
*
* When streaming a file with startStreaming(), the SDK monitors the transfer rate.
* After a few seconds grace period, the monitoring starts. If the average rate is below
* the minimum rate specified (determined by this function, or by default a reasonable rate
* for audio/video, then the streaming operation will fail with MegaError::API_EAGAIN.
*
* @param bytesPerSecond The minimum acceptable rate for streaming.
* Use -1 to use the default built into the library.
* Use 0 to prevent the check.
*/
void setStreamingMinimumRate(int bytesPerSecond);
/**
* @brief Cancel a transfer
*
* When a transfer is cancelled, it will finish and will provide the error code
* MegaError::API_EINCOMPLETE in MegaTransferListener::onTransferFinish and
* MegaListener::onTransferFinish
*
* The associated request type with this request is MegaRequest::TYPE_CANCEL_TRANSFER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getTransferTag - Returns the tag of the cancelled transfer (MegaTransfer::getTag)
*
* @param transfer MegaTransfer object that identifies the transfer
* You can get this object in any MegaTransferListener callback or any MegaListener callback
* related to transfers.
*
* @param listener MegaRequestListener to track this request
*/
void cancelTransfer(MegaTransfer *transfer, MegaRequestListener *listener = NULL);
/**
* @brief Retry a transfer
*
* This function allows to start a transfer based on a MegaTransfer object. It can be used,
* for example, to retry transfers that finished with an error. To do it, you can retain the
* MegaTransfer object in onTransferFinish (calling MegaTransfer::copy to take the ownership)
* and use it later with this function.
*
* If the transfer parameter is NULL or is not of type MegaTransfer::TYPE_DOWNLOAD or
* MegaTransfer::TYPE_UPLOAD (transfers started with MegaApi::startDownload or
* MegaApi::startUpload) the function returns without doing anything.
*
* Note that retried transfers will always start first, so the user see them progressing
* immediately.
*
* @param transfer Transfer to be retried
* @param listener MegaTransferListener to track this transfer
*/
void retryTransfer(MegaTransfer *transfer, MegaTransferListener *listener = NULL);
/**
* @brief Move a transfer one position up in the transfer queue
*
* If the transfer is successfully moved, onTransferUpdate will be called
* for the corresponding listeners of the moved transfer and the new priority
* of the transfer will be available using MegaTransfer::getPriority
*
* The associated request type with this request is MegaRequest::TYPE_MOVE_TRANSFER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getTransferTag - Returns the tag of the transfer to move
* - MegaRequest::getFlag - Returns true (it means that it's an automatic move)
* - MegaRequest::getNumber - Returns MegaTransfer::MOVE_TYPE_UP
*
* @param transfer Transfer to move
* @param listener MegaRequestListener to track this request
*/
void moveTransferUp(MegaTransfer *transfer, MegaRequestListener *listener = NULL);
/**
* @brief Move a transfer one position up in the transfer queue
*
* If the transfer is successfully moved, onTransferUpdate will be called
* for the corresponding listeners of the moved transfer and the new priority
* of the transfer will be available using MegaTransfer::getPriority
*
* The associated request type with this request is MegaRequest::TYPE_MOVE_TRANSFER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getTransferTag - Returns the tag of the transfer to move
* - MegaRequest::getFlag - Returns true (it means that it's an automatic move)
* - MegaRequest::getNumber - Returns MegaTransfer::MOVE_TYPE_UP
*
* @param transferTag Tag of the transfer to move
* @param listener MegaRequestListener to track this request
*/
void moveTransferUpByTag(int transferTag, MegaRequestListener *listener = NULL);
/**
* @brief Move a transfer one position down in the transfer queue
*
* If the transfer is successfully moved, onTransferUpdate will be called
* for the corresponding listeners of the moved transfer and the new priority
* of the transfer will be available using MegaTransfer::getPriority
*
* The associated request type with this request is MegaRequest::TYPE_MOVE_TRANSFER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getTransferTag - Returns the tag of the transfer to move
* - MegaRequest::getFlag - Returns true (it means that it's an automatic move)
* - MegaRequest::getNumber - Returns MegaTransfer::MOVE_TYPE_DOWN
*
* @param transfer Transfer to move
* @param listener MegaRequestListener to track this request
*/
void moveTransferDown(MegaTransfer *transfer, MegaRequestListener *listener = NULL);
/**
* @brief Move a transfer one position down in the transfer queue
*
* If the transfer is successfully moved, onTransferUpdate will be called
* for the corresponding listeners of the moved transfer and the new priority
* of the transfer will be available using MegaTransfer::getPriority
*
* The associated request type with this request is MegaRequest::TYPE_MOVE_TRANSFER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getTransferTag - Returns the tag of the transfer to move
* - MegaRequest::getFlag - Returns true (it means that it's an automatic move)
* - MegaRequest::getNumber - Returns MegaTransfer::MOVE_TYPE_DOWN
*
* @param transferTag Tag of the transfer to move
* @param listener MegaRequestListener to track this request
*/
void moveTransferDownByTag(int transferTag, MegaRequestListener *listener = NULL);
/**
* @brief Move a transfer to the top of the transfer queue
*
* If the transfer is successfully moved, onTransferUpdate will be called
* for the corresponding listeners of the moved transfer and the new priority
* of the transfer will be available using MegaTransfer::getPriority
*
* The associated request type with this request is MegaRequest::TYPE_MOVE_TRANSFER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getTransferTag - Returns the tag of the transfer to move
* - MegaRequest::getFlag - Returns true (it means that it's an automatic move)
* - MegaRequest::getNumber - Returns MegaTransfer::MOVE_TYPE_TOP
*
* @param transfer Transfer to move
* @param listener MegaRequestListener to track this request
*/
void moveTransferToFirst(MegaTransfer *transfer, MegaRequestListener *listener = NULL);
/**
* @brief Move a transfer to the top of the transfer queue
*
* If the transfer is successfully moved, onTransferUpdate will be called
* for the corresponding listeners of the moved transfer and the new priority
* of the transfer will be available using MegaTransfer::getPriority
*
* The associated request type with this request is MegaRequest::TYPE_MOVE_TRANSFER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getTransferTag - Returns the tag of the transfer to move
* - MegaRequest::getFlag - Returns true (it means that it's an automatic move)
* - MegaRequest::getNumber - Returns MegaTransfer::MOVE_TYPE_TOP
*
* @param transferTag Tag of the transfer to move
* @param listener MegaRequestListener to track this request
*/
void moveTransferToFirstByTag(int transferTag, MegaRequestListener *listener = NULL);
/**
* @brief Move a transfer to the bottom of the transfer queue
*
* If the transfer is successfully moved, onTransferUpdate will be called
* for the corresponding listeners of the moved transfer and the new priority
* of the transfer will be available using MegaTransfer::getPriority
*
* The associated request type with this request is MegaRequest::TYPE_MOVE_TRANSFER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getTransferTag - Returns the tag of the transfer to move
* - MegaRequest::getFlag - Returns true (it means that it's an automatic move)
* - MegaRequest::getNumber - Returns MegaTransfer::MOVE_TYPE_BOTTOM
*
* @param transfer Transfer to move
* @param listener MegaRequestListener to track this request
*/
void moveTransferToLast(MegaTransfer *transfer, MegaRequestListener *listener = NULL);
/**
* @brief Move a transfer to the bottom of the transfer queue
*
* If the transfer is successfully moved, onTransferUpdate will be called
* for the corresponding listeners of the moved transfer and the new priority
* of the transfer will be available using MegaTransfer::getPriority
*
* The associated request type with this request is MegaRequest::TYPE_MOVE_TRANSFER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getTransferTag - Returns the tag of the transfer to move
* - MegaRequest::getFlag - Returns true (it means that it's an automatic move)
* - MegaRequest::getNumber - Returns MegaTransfer::MOVE_TYPE_BOTTOM
*
* @param transferTag Tag of the transfer to move
* @param listener MegaRequestListener to track this request
*/
void moveTransferToLastByTag(int transferTag, MegaRequestListener *listener = NULL);
/**
* @brief Move a transfer before another one in the transfer queue
*
* If the transfer is successfully moved, onTransferUpdate will be called
* for the corresponding listeners of the moved transfer and the new priority
* of the transfer will be available using MegaTransfer::getPriority
*
* The associated request type with this request is MegaRequest::TYPE_MOVE_TRANSFER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getTransferTag - Returns the tag of the transfer to move
* - MegaRequest::getFlag - Returns false (it means that it's a manual move)
* - MegaRequest::getNumber - Returns the tag of the transfer with the target position
*
* @param transfer Transfer to move
* @param prevTransfer Transfer with the target position
* @param listener MegaRequestListener to track this request
*/
void moveTransferBefore(MegaTransfer *transfer, MegaTransfer *prevTransfer, MegaRequestListener *listener = NULL);
/**
* @brief Move a transfer before another one in the transfer queue
*
* If the transfer is successfully moved, onTransferUpdate will be called
* for the corresponding listeners of the moved transfer and the new priority
* of the transfer will be available using MegaTransfer::getPriority
*
* The associated request type with this request is MegaRequest::TYPE_MOVE_TRANSFER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getTransferTag - Returns the tag of the transfer to move
* - MegaRequest::getFlag - Returns false (it means that it's a manual move)
* - MegaRequest::getNumber - Returns the tag of the transfer with the target position
*
* @param transferTag Tag of the transfer to move
* @param prevTransferTag Tag of the transfer with the target position
* @param listener MegaRequestListener to track this request
*/
void moveTransferBeforeByTag(int transferTag, int prevTransferTag, MegaRequestListener *listener = NULL);
/**
* @brief Cancel the transfer with a specific tag
*
* When a transfer is cancelled, it will finish and will provide the error code
* MegaError::API_EINCOMPLETE in MegaTransferListener::onTransferFinish and
* MegaListener::onTransferFinish
*
* The associated request type with this request is MegaRequest::TYPE_CANCEL_TRANSFER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getTransferTag - Returns the tag of the cancelled transfer (MegaTransfer::getTag)
*
* @param transferTag tag that identifies the transfer
* You can get this tag using MegaTransfer::getTag
*
* @param listener MegaRequestListener to track this request
*/
void cancelTransferByTag(int transferTag, MegaRequestListener *listener = NULL);
/**
* @brief Cancel all transfers of the same type
*
* The associated request type with this request is MegaRequest::TYPE_CANCEL_TRANSFERS
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the first parameter
*
* @param type Type of transfers to cancel.
* Valid values are:
* - MegaTransfer::TYPE_DOWNLOAD = 0
* - MegaTransfer::TYPE_UPLOAD = 1
*
* @param listener MegaRequestListener to track this request
*/
void cancelTransfers(int type, MegaRequestListener *listener = NULL);
/**
* @brief Pause/resume all transfers
*
* The associated request type with this request is MegaRequest::TYPE_PAUSE_TRANSFERS
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getFlag - Returns the first parameter
*
* @param pause true to pause all transfers / false to resume all transfers
* @param listener MegaRequestListener to track this request
*/
void pauseTransfers(bool pause, MegaRequestListener* listener = NULL);
/**
* @brief Pause/resume all transfers in one direction (uploads or downloads)
*
* The associated request type with this request is MegaRequest::TYPE_PAUSE_TRANSFERS
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getFlag - Returns the first parameter
* - MegaRequest::getNumber - Returns the direction of the transfers to pause/resume
*
* @param pause true to pause transfers / false to resume transfers
* @param direction Direction of transfers to pause/resume
* Valid values for this parameter are:
* - MegaTransfer::TYPE_DOWNLOAD = 0
* - MegaTransfer::TYPE_UPLOAD = 1
*
* @param listener MegaRequestListener to track this request
*/
void pauseTransfers(bool pause, int direction, MegaRequestListener* listener = NULL);
/**
* @brief Pause/resume a transfer
*
* The request finishes with MegaError::API_OK if the state of the transfer is the
* desired one at that moment. That means that the request succeed when the transfer
* is successfully paused or resumed, but also if the transfer was already in the
* desired state and it wasn't needed to change anything.
*
* Resumed transfers don't necessarily continue just after the resumption. They
* are tagged as queued and are processed according to its position on the request queue.
*
* The associated request type with this request is MegaRequest::TYPE_PAUSE_TRANSFER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getTransferTag - Returns the tag of the transfer to pause or resume
* - MegaRequest::getFlag - Returns true if the transfer has to be pause or false if it has to be resumed
*
* @param transfer Transfer to pause or resume
* @param pause True to pause the transfer or false to resume it
* @param listener MegaRequestListener to track this request
*/
void pauseTransfer(MegaTransfer *transfer, bool pause, MegaRequestListener* listener = NULL);
/**
* @brief Pause/resume a transfer
*
* The request finishes with MegaError::API_OK if the state of the transfer is the
* desired one at that moment. That means that the request succeed when the transfer
* is successfully paused or resumed, but also if the transfer was already in the
* desired state and it wasn't needed to change anything.
*
* Resumed transfers don't necessarily continue just after the resumption. They
* are tagged as queued and are processed according to its position on the request queue.
*
* The associated request type with this request is MegaRequest::TYPE_PAUSE_TRANSFER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getTransferTag - Returns the tag of the transfer to pause or resume
* - MegaRequest::getFlag - Returns true if the transfer has to be pause or false if it has to be resumed
*
* @param transferTag Tag of the transfer to pause or resume
* @param pause True to pause the transfer or false to resume it
* @param listener MegaRequestListener to track this request
*/
void pauseTransferByTag(int transferTag, bool pause, MegaRequestListener* listener = NULL);
/**
* @brief Returns the state (paused/unpaused) of transfers
* @param direction Direction of transfers to check
* Valid values for this parameter are:
* - MegaTransfer::TYPE_DOWNLOAD = 0
* - MegaTransfer::TYPE_UPLOAD = 1
*
* @return true if transfers on that direction are paused, false otherwise
*/
bool areTransfersPaused(int direction);
/**
* @brief Resume incomplete transfers started while not logged in
*
* This method resumes transfers that were cached while using a non-logged-in MegaApi
* instance
*
* This method can be called when the app detects that there is no session to resume.
* If a valid session exists, the app should proceed with resuming it, and calling
* this method will have no effect.
*
* @note If there are transfers in progress and the app logs in,
* any incomplete transfers will be aborted immediately.
*
* Please avoid calling this method when logged in.
*/
void resumeTransfersForNotLoggedInInstance();
/**
* @deprecated This version of the function is deprecated. Please, use \c setMaxUploadSpeed.
*/
MEGA_DEPRECATED
void setUploadLimit(int bpslimit);
/**
* @brief Set the maximum number of connections per transfer
*
* The maximum number of allowed connections is 100. If a higher number of connections is
* passed to this function, it will fail with the error code API_ETOOMANY.
*
* The associated request type with this request is MegaRequest::TYPE_SET_MAX_CONNECTIONS
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the value for \c direction parameter
* - MegaRequest::getNumber - Returns the number of \c connections
*
* @param direction Direction of transfers
* Valid values for this parameter are:
* - MegaTransfer::TYPE_DOWNLOAD = 0
* - MegaTransfer::TYPE_UPLOAD = 1
* @param connections Maximum number of connection (it should between 1 and 100)
*/
void setMaxConnections(int direction, int connections, MegaRequestListener* listener = NULL);
/**
* @brief Set the maximum number of connections per transfer for downloads and uploads
*
* The maximum number of allowed connections is 100. If a higher number of connections is
* passed to this function, it will fail with the error code API_ETOOMANY.
*
* The associated request type with this request is MegaRequest::TYPE_SET_MAX_CONNECTIONS
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNumber - Returns the number of connections
*
* @param connections Maximum number of connection (it should between 1 and 100)
*/
void setMaxConnections(int connections, MegaRequestListener* listener = NULL);
/**
* @brief Get the maximum number of connections per upload transfer.
*
* The associated request type with this request is MegaRequest::TYPE_GET_MAX_CONNECTIONS
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the value for transfer direction (PUT)
* - MegaRequest::getNumber - Returns the max number of connections for uploads.
*
* Possible return values for this function are:
* - MegaError::API_OK if successfully retrieved the max number of connections for uploads
* - MegaError::API_EINTERNAL if there was an internal issue when setting the transfer
* direction.
*/
void getMaxUploadConnections(MegaRequestListener* const listener);
/**
* @brief Get the maximum number of connections per download transfer.
*
* The associated request type with this request is MegaRequest::TYPE_GET_MAX_CONNECTIONS
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the value for transfer direction (GET)
* - MegaRequest::getNumber - Returns the max number of connections for downloads.
*
* Possible return values for this function are the same ones as getMaxUploadConnections()
*/
void getMaxDownloadConnections(MegaRequestListener* const listener);
/**
* @brief Set the transfer method for downloads
*
* Valid methods are:
* - TRANSFER_METHOD_NORMAL = 0
* HTTP transfers using port 80. Data is already encrypted.
*
* - TRANSFER_METHOD_ALTERNATIVE_PORT = 1
* HTTP transfers using port 8080. Data is already encrypted.
*
* - TRANSFER_METHOD_AUTO = 2
* The SDK selects the transfer method automatically
*
* - TRANSFER_METHOD_AUTO_NORMAL = 3
* The SDK selects the transfer method automatically starting with port 80.
*
* - TRANSFER_METHOD_AUTO_ALTERNATIVE = 4
* The SDK selects the transfer method automatically starting with alternative port 8080.
*
* @param method Selected transfer method for downloads
*/
void setDownloadMethod(int method);
/**
* @brief Set the transfer method for uploads
*
* Valid methods are:
* - TRANSFER_METHOD_NORMAL = 0
* HTTP transfers using port 80. Data is already encrypted.
*
* - TRANSFER_METHOD_ALTERNATIVE_PORT = 1
* HTTP transfers using port 8080. Data is already encrypted.
*
* - TRANSFER_METHOD_AUTO = 2
* The SDK selects the transfer method automatically
*
* - TRANSFER_METHOD_AUTO_NORMAL = 3
* The SDK selects the transfer method automatically starting with port 80.
*
* - TRANSFER_METHOD_AUTO_ALTERNATIVE = 4
* The SDK selects the transfer method automatically starting with alternative port 8080.
*
* @param method Selected transfer method for uploads
*/
void setUploadMethod(int method);
/**
* @brief Set the maximum download speed in bytes per second
*
* You can check if the function will have effect
* by checking the return value. If it's true, the value will be applied. Otherwise,
* this function returns false.
*
* A value <= 0 means unlimited speed
*
* @param bpslimit Download speed in bytes per second
* @return true if the network layer allows to control the download speed, otherwise false
*/
bool setMaxDownloadSpeed(long long bpslimit);
/**
* @brief Set the maximum upload speed in bytes per second
*
* You can check if the function will have effect
* by checking the return value. If it's true, the value will be applied. Otherwise,
* this function returns false.
*
* A value <= 0 means unlimited speed
*
* @param bpslimit Upload speed in bytes per second
* @return true if the network layer allows to control the upload speed, otherwise false
*/
bool setMaxUploadSpeed(long long bpslimit);
/**
* @brief Get the maximum download speed in bytes per second
*
* The value 0 means unlimited speed
*
* @return Download speed in bytes per second
*/
int getMaxDownloadSpeed();
/**
* @brief Get the maximum upload speed in bytes per second
*
* The value 0 means unlimited speed
*
* @return Upload speed in bytes per second
*/
int getMaxUploadSpeed();
/**
* @brief Return the current download speed
* @return Download speed in bytes per second
*/
int getCurrentDownloadSpeed();
/**
* @brief Return the current download speed
* @return Download speed in bytes per second
*/
int getCurrentUploadSpeed();
/**
* @brief Return the current transfer speed
* @param type Type of transfer to get the speed.
* Valid values are MegaTransfer::TYPE_DOWNLOAD or MegaTransfer::TYPE_UPLOAD
* @return Transfer speed for the transfer type, or 0 if the parameter is invalid
*/
int getCurrentSpeed(int type);
/**
* @brief Get the active transfer method for downloads
*
* Valid values for the return parameter are:
* - TRANSFER_METHOD_NORMAL = 0
* HTTP transfers using port 80. Data is already encrypted.
*
* - TRANSFER_METHOD_ALTERNATIVE_PORT = 1
* HTTP transfers using port 8080. Data is already encrypted.
*
* - TRANSFER_METHOD_AUTO = 2
* The SDK selects the transfer method automatically
*
* - TRANSFER_METHOD_AUTO_NORMAL = 3
* The SDK selects the transfer method automatically starting with port 80.
*
* - TRANSFER_METHOD_AUTO_ALTERNATIVE = 4
* The SDK selects the transfer method automatically starting with alternative port 8080.
*
* @return Active transfer method for downloads
*/
int getDownloadMethod();
/**
* @brief Get the active transfer method for uploads
*
* Valid values for the return parameter are:
* - TRANSFER_METHOD_NORMAL = 0
* HTTP transfers using port 80. Data is already encrypted.
*
* - TRANSFER_METHOD_ALTERNATIVE_PORT = 1
* HTTP transfers using port 8080. Data is already encrypted.
*
* - TRANSFER_METHOD_AUTO = 2
* The SDK selects the transfer method automatically
*
* - TRANSFER_METHOD_AUTO_NORMAL = 3
* The SDK selects the transfer method automatically starting with port 80.
*
* - TRANSFER_METHOD_AUTO_ALTERNATIVE = 4
* The SDK selects the transfer method automatically starting with alternative port 8080.
*
* @return Active transfer method for uploads
*/
int getUploadMethod();
/**
* @brief Get information about transfer queues
*
* You take the ownership of the returned value.
*
* @param listener MegaTransferListener to start receiving information about transfers
* @return Information about transfer queues
*/
MegaTransferData *getTransferData(MegaTransferListener *listener = NULL);
/**
* @brief Get the first transfer in a transfer queue
*
* You take the ownership of the returned value.
*
* @param type Transfer queue to get the first transfer (MegaTransfer::TYPE_DOWNLOAD or MegaTransfer::TYPE_UPLOAD)
* @return MegaTransfer object related to the first transfer in the queue or NULL if there isn't any transfer
*/
MegaTransfer *getFirstTransfer(int type);
/**
* @brief Force an onTransferUpdate callback for the specified transfer
*
* The callback will be received by transfer listeners registered to receive all
* callbacks related to callbacks and additionally by the listener in the last
* parameter of this function, if it's not NULL.
*
* @param transfer Transfer that will be provided in the onTransferUpdate callback
* @param listener Listener that will receive the callback
*/
void notifyTransfer(MegaTransfer *transfer, MegaTransferListener *listener = NULL);
/**
* @brief Force an onTransferUpdate callback for the specified transfer
*
* The callback will be received by transfer listeners registered to receive all
* callbacks related to callbacks and additionally by the listener in the last
* parameter of this function, if it's not NULL.
*
* @param transferTag Tag of the transfer that will be provided in the onTransferUpdate callback
* @param listener Listener that will receive the callback
*/
void notifyTransferByTag(int transferTag, MegaTransferListener *listener = NULL);
/**
* @brief Get all active transfers
*
* You take the ownership of the returned value
*
* @return List with all active transfers
* @see MegaApi::startUpload, MegaApi::startDownload
*/
MegaTransferList *getTransfers();
/**
* @brief Get all active streaming transfers
*
* You take the ownership of the returned value
*
* @return List with all active streaming transfers
* @see MegaApi::startStreaming
*/
MegaTransferList *getStreamingTransfers();
/**
* @brief Get the transfer with a unique id
*
* That unique identifier of a transfer can be retrieved using MegaTransfer::getUniqueId
*
* You take the ownership of the returned value
*
* @param transferUniqueId unique Id to find
* @return MegaTransfer object with that unique Id, or nullptr if there isn't any
* active transfer with it
*
*/
MegaTransfer* getTransferByUniqueId(uint32_t transferUniqueId) const;
/**
* @brief Get the transfer with a transfer tag
*
* That tag can be got using MegaTransfer::getTag
*
* You take the ownership of the returned value
*
* @param transferTag tag to check
* @return MegaTransfer object with that tag, or NULL if there isn't any
* active transfer with it
*
*/
MegaTransfer* getTransferByTag(int transferTag);
/**
* @brief Get all transfers of a specific type (downloads or uploads)
*
* If the parameter isn't MegaTransfer::TYPE_DOWNLOAD or MegaTransfer::TYPE_UPLOAD
* this function returns an empty list.
*
* You take the ownership of the returned value
*
* @param type MegaTransfer::TYPE_DOWNLOAD or MegaTransfer::TYPE_UPLOAD
* @return List with transfers of the desired type
*/
MegaTransferList *getTransfers(int type);
/**
* @brief Get a list of transfers that belong to a folder transfer
*
* This function provides the list of transfers started in the context
* of a folder transfer.
*
* If the tag in the parameter doesn't belong to a folder transfer,
* this function returns an empty list.
*
* The transfers provided by this function are the ones that are added to the
* transfer queue when this function is called. Finished transfers, or transfers
* not added to the transfer queue yet (for example, uploads that are waiting for
* the creation of the parent folder in MEGA) are not returned by this function.
*
* You take the ownership of the returned value
*
* @param transferTag Tag of the folder transfer to check
* @return List of transfers in the context of the selected folder transfer
* @see MegaTransfer::isFolderTransfer, MegaTransfer::getFolderTransferTag
*/
MegaTransferList *getChildTransfers(int transferTag);
/**
* @brief Returns the folder paths of a backup
*
* You take ownership of the returned value.
*
* @param backuptag backup tag
* @return Folder paths that contain each of the backups or NULL if tag not found.
*/
MegaStringList *getBackupFolders(int backuptag) const;
/**
* @brief Starts a backup of a local folder into a remote location
*
* Determined by the selected period several backups will be stored in the selected location
* If a backup with the same local folder and remote location exists, its parameters will be updated
*
* The associated request type with this request is MegaRequest::TYPE_ADD_SCHEDULED_COPY
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNumber - Returns the period between backups in deciseconds (-1 if cron time used)
* - MegaRequest::getText - Returns the cron like time string to define period
* - MegaRequest::getFile - Returns the path of the local folder
* - MegaRequest::getNumRetry - Returns the maximun number of backups to keep
* - MegaRequest::getTransferTag - Returns the tag asociated with the backup
* - MegaRequest::getFlag - Returns whether to attend past backups (ocurred while not running)
*
*
* @param localPath Local path of the folder
* @param parent MEGA folder to hold the backups
* @param attendPastBackups attend backups that ought to have started before
* @param period period between backups in deciseconds
* @param periodstring cron like time string to define period
* @param numBackups maximun number of backups to keep
* @param listener MegaRequestListener to track this request
*
*/
void setScheduledCopy(const char* localPath, MegaNode *parent, bool attendPastBackups, int64_t period, const char *periodstring, int numBackups, MegaRequestListener *listener=NULL);
/**
* @brief Remove a backup
*
* The backup will stop being performed. No files in the local nor in the remote folder
* will be deleted due to the usage of this function.
*
* The associated request type with this request is MegaRequest::TYPE_REMOVE_SCHEDULED_COPY
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNumber - Returns the tag of the deleted backup
*
* @param tag tag of the backup to delete
* @param listener MegaRequestListener to track this request
*/
void removeScheduledCopy(int tag, MegaRequestListener *listener=NULL);
/**
* @brief Aborts current ONGOING backup.
*
* This will cancell all current active backups.
*
* The associated request type with this request is MegaRequest::TYPE_ABORT_CURRENT_SCHEDULED_COPY
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNumber - Returns the tag of the aborted backup
*
* Possible return values for this function are:
* - MegaError::API_OK if successfully aborted an ongoing backup
* - MegaError::API_ENOENT if backup could not be found or no ongoing backup found
*
* @param tag tag of the backup to delete
*/
void abortCurrentScheduledCopy(int tag, MegaRequestListener *listener=NULL);
/**
* @brief Starts a timer.
*
* This, besides the classic timer usage, can be used to enforce a loop of the SDK thread when the time passes
*
* The associated request type with this request is MegaRequest::TYPE_TIMER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNumber - Returns the selected period
* An OnRequestFinish will be caled when the time is passed
*
* @param period time to wait
* @param listener MegaRequestListener to track this request
*
*/
void startTimer(int64_t period, MegaRequestListener *listener = NULL);
#ifdef ENABLE_SYNC
/////////////////// SYNCHRONIZATION ///////////////////
/**
* @brief Get the synchronization state of a local file
* @param Path of the local file
* @return Synchronization state of the local file.
* Valid values are:
* - STATE_NONE = 0
* The file isn't inside a synced folder
*
* - MegaApi::STATE_SYNCED = 1
* The file is in sync with the MEGA account
*
* - MegaApi::STATE_PENDING = 2
* The file is pending to be synced with the MEGA account
*
* - MegaApi::STATE_SYNCING = 3
* The file is being synced with the MEGA account
*
* - MegaApi::STATE_IGNORED = 4
* The file is inside a synced folder, but it is ignored
* by the selected exclusion filters
*
*/
int syncPathState(std::string *path);
/**
* @brief Get the MegaNode associated with a local synced file
*
* You take ownership of the returned value.
*
* @param path Local path of the file
* @return The same file in MEGA or NULL if the file isn't synced
*/
MegaNode *getSyncedNode(std::string *path);
/**
* @brief Start a Sync or Backup between a local folder and a folder in MEGA
*
* Check the syncFolder() function below for the full documentation.
*
* @param excludePath deprecated parameter, never used.
*
* @deprecated This function is deprecated. Please don't use it in new code. Use the one
* below. It's the same one, but without the unused excludePath and with std types.
*/
void syncFolder(const MegaSync::SyncType syncType,
const char* localSyncRootFolder,
const char* name,
const MegaHandle remoteSyncRootFolder,
const char* driveRootIfExternal,
MegaRequestListener* const listener,
const char* excludePath = nullptr);
/**
* @brief Start a Sync or Backup between a local folder and a folder in MEGA
*
* This function should be used to add a new synchronization/backup task for the MegaApi.
* To resume a previously configured task folder, use MegaApi::enableSync.
*
* Both TYPE_TWOWAY and TYPE_BACKUP are supported for the first parameter.
*
* The sync/backup's name is optional. If not provided, it will take the name of the leaf
* folder of the local path. In example, for "/home/user/Documents", it will become
* "Documents".
*
* The remote sync root folder should be INVALID_HANDLE for syncs of TYPE_BACKUP. The handle
* of the remote node, which is created as part of this request, will be set to the
* MegaRequest::getNodeHandle.
*
* The associated request type with this request is MegaRequest::TYPE_ADD_SYNC
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the folder in MEGA
* - MegaRequest::getFile - Returns the path of the local folder
* - MegaRequest::getName - Returns the name of the sync
* - MegaRequest::getParamType - Returns the type of the sync
* - MegaRequest::getLink - Returns the drive root if external backup
* - MegaRequest::getListener - Returns the MegaRequestListener to track this request
* - MegaRequest::getNumDetails - If different than NO_SYNC_ERROR, it returns additional
* info for the specific sync error (MegaSync::Error). It could happen both when the request
* has succeeded (API_OK) and also in some cases of failure, when the request error is not
* accurate enough.
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is other than MegaError::API_OK:
* - MegaRequest::getParentHandle - Returns the sync backupId
*
* On the onRequestFinish error, the error code associated to the MegaError
* (MegaError::getErrorCode()) can be:
* - MegaError::API_EARGS - If the local folder was not set or is not a folder.
* - MegaError::API_EACCESS - If the user was invalid, or did not have an attribute for "My
* Backups" folder, or the attribute was invalid, or "My Backups"/`DEVICE_NAME` existed but
* was not a folder, or it had the wrong 'dev-id'/'drv-id' tag.
* - MegaError::API_EINTERNAL - If the user attribute for "My Backups" folder did not have a
* record containing the handle.
* - MegaError::API_ENOENT - If the handle of "My Backups" folder contained in the user
* attribute was invalid
* - or the node could not be found.
* - MegaError::API_EINCOMPLETE - If device id was not set, or if current user did not have
* an attribute for device name, or the attribute was invalid, or the attribute did not
* contain a record for the device name, or device name was empty.
* - MegaError::API_EEXIST - If this is a new device, but a folder with the same device-name
* already exists.
*
* The MegaError can also contain a SyncError (MegaError::getSyncError()), with the same
* value as MegaRequest::getNumDetails() See MegaApi::isNodeSyncableWithError() for specific
* SyncError codes depending on the specific MegaError code.
*
* @param syncType Type of sync. Currently supported: TYPE_TWOWAY and TYPE_BACKUP.
* @param localSyncRootFolder Path of the Local folder to sync/backup.
* @param name Name given to the sync. You can pass NULL, and the folder name will be used
* instead.
* @param remoteSyncRootFolder Handle of MEGA folder. If you have a MegaNode for that
* folder, use its getHandle()
* @param driveRootIfExternal Only relevant for backups, and only if the backup is on an
* external disk. Otherwise use an empty string.
* @param listener MegaRequestListener to track this request
*/
void syncFolder(const MegaSync::SyncType syncType,
const std::string& localSyncRootFolder,
const std::string& name,
const MegaHandle remoteSyncRootFolder,
const std::string& driveRootIfExternal,
MegaRequestListener* const listener);
/**
* @brief Prevalidates a Sync or Backup addition between a local folder and a folder in
* MEGA.
*
* This function could be used to pre-check most of the typical validations that would take
* place when calling MegaApi::syncFolder. This function does not create the sync, nor a
* related sync config would exist afterwards.
*
* Most of the documentation of MegaApi::syncFolder applies to this method, with the
* following differences:
*
* The associated request type with this request is MegaRequest::TYPE_ADD_SYNC_PREVALIDATION
*
* The handle of the remote node for syncs of TYPE_BACKUP is temporarily created as part of
* this request for validation purposes, so it will NOT be set to the
* MegaRequest::getNodeHandle. This method would return an undefined handle after the call.
* Moreover, for syncs of TYPE_BACKUP, the device name is created as part of the validation
* if it didn't exist before. It will not be cleared after the call.
*
* The final difference is that there is no additional data received in onRequestFinish: no
* fingerprint or backupID, as the ID is never generated.
*/
void prevalidateSyncFolder(const MegaSync::SyncType syncType,
const std::string& localSyncRootFolder,
const std::string& name,
const MegaHandle remoteSyncRootFolder,
const std::string& driveRootIfExternal,
MegaRequestListener* const listener);
/**
* @deprecated This version of the function is deprecated. It results on API_EINTERNAL.
*/
MEGA_DEPRECATED
void copySyncDataToCache(const char *localFolder, const char *name, MegaHandle megaHandle, const char *remotePath,
long long localfp, bool enabled, bool temporaryDisabled, MegaRequestListener *listener = NULL);
/**
* @deprecated This version of the function is deprecated. It results on API_EINTERNAL.
*/
MEGA_DEPRECATED
void copySyncDataToCache(const char *localFolder, MegaHandle megaHandle, const char *remotePath,
long long localfp, bool enabled, bool temporaryDisabled, MegaRequestListener *listener = NULL);
/**
* @deprecated This version of the function is deprecated. It results on API_EINTERNAL.
*/
MEGA_DEPRECATED
void copyCachedStatus(int storageStatus, int blockStatus, int businessStatus, MegaRequestListener *listener = NULL);
/**
* @brief Check the external drive specified to see if it has any Backup Syncs set up on it.
*
* If any are present, their configurations will be loaded, in a disabled state.
* External Backups will overwrite whatever is in the corrsponding cloud folder, making it the same on disk.
* Therefore you must check with the user if they wish to resume any or all of them, otherwise they may lose data.
* You can find the one added by iterating all syncs and checking the external drive path for each.
* For those that the user wishes to resume, use MegaApi::enableSync()
*
* The associated request type with this request is MegaRequest::TYPE_LOAD_EXTERNAL_BACKUPS
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getFile - Returns the path of the drive root
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - The MegaSync records have been added. You can access them with MegaApi::getSyncs()
* and check each one's drive path.
*
* @param externalDriveRoot The filesystem path to the root of the external drive.
* @param listener MegaRequestListener to track this request
*
*/
void loadExternalBackupSyncsFromExternalDrive(const char* externalDriveRoot, MegaRequestListener* listener);
/**
* @brief Prepare any external backup syncs on the specified drive, for that drive be ejected/disconnected
*
* If any are present and active, the sync activity is stopped, any changes to sync/backup config for
* those backups is flushed to disk,and all assoicated file/folder handles are closed, allowing the
* drive to be ejected. All backup sync configs from that drive are removed from memory.
*
* This function may also be useful if the user just prefers not to have any sync/backup activity
* going on ont that disk.
*
* The associated request type with this request is MegaRequest::TYPE_LOAD_EXTERNAL_BACKUPS
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getFile - Returns the path of the drive root
*
* @param externalDriveRoot The filesystem path to the root of the external drive.
* @param listener MegaRequestListener to track this request
*
*/
void closeExternalBackupSyncsFromExternalDrive(const char* externalDriveRoot, MegaRequestListener* listener);
/**
* @brief De-configure the sync/backup of a folder
*
* The folder will stop being synced. No files in the local nor in the remote folder
* will be deleted due to the usage of this function.
*
* The synchronization will stop and the local sync database will be deleted
* The backupId of this sync will be invalid going forward.
*
* The associated request type with this request is MegaRequest::TYPE_REMOVE_SYNC
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParentHandle - Returns sync backupId
* - MegaRequest::getFlag - Returns true
* - MegaRequest::getFile - Returns the path of the local folder (for active syncs only)
*
* @param backupId Identifier of the Sync (unique per user, provided by API)
* @param listener MegaRequestListener to track this request
*/
void removeSync(MegaHandle backupId, MegaRequestListener *listener = NULL);
/**
* @brief Run/Pause/Suspend/Disable a synced folder
*
* Attempt to Start, Pause, Suspend, or Disable a sync.
*
* Specify the new state to try to move the sync to. In case there is
* a problem, the cause will be returned in the listener callabck.
*
* The associated request type with this request is MegaRequest::TYPE_SET_SYNC_RUNSTATE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParentHandle - Returns sync backupId
*
* @param backupId Identifier of the Sync (unique per user, provided by API)
* @param listener MegaRequestListener to track this request
*/
void setSyncRunState(MegaHandle backupId, MegaSync::SyncRunningState targetState, MegaRequestListener *listener = NULL);
/**
* @brief Cause one or all syncs' local folder tree to be rescanned
*
* The scanning will start, and the usual scanning callbacks notify
* about when scanning is going on, or is resolved.
*
* @param backupId Identifier of the single Sync, or INVALID_HANDLE to rescan all.
* @param reFingerprint If true, files on disk will be re-fingerprinted in case of changes not detectable by mtime etc
*/
void rescanSync(MegaHandle backupId, bool reFingerprint);
/**
* @brief
* Imports internal sync configs from JSON.
*
* @param configs
* A JSON string encoding the internal sync configs to import.
*
* @param listener
* Listener to call back when the import has completed.
*
* @see exportSyncConfigs
*/
void importSyncConfigs(const char* configs, MegaRequestListener* listener);
/**
* @brief
* Exports all internal sync configs to JSON.
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @return
* A JSON string encoding all internal sync configs.
*
* @see importSyncConfigs
*/
const char* exportSyncConfigs();
/**
* @brief Get all configured syncs
*
* You take the ownership of the returned value
*
* @return List of MegaSync objects with all syncs
*/
MegaSyncList* getSyncs();
/**
* @brief Check if the synchronization engine is scanning files
* @return true if it is scanning, otherwise false
*/
bool isScanning();
/**
* @brief Check if any synchronization is in state syncing or pending
* @return true if it is syncing, otherwise false
*/
bool isSyncing();
/**
* @deprecated This function is deprecated and it will be removed in future updates.
*/
MEGA_DEPRECATED
void setLegacyExcludedNames(std::vector<std::string>* excludedNames);
/**
* @deprecated This function is deprecated and it will be removed in future updates.
*/
MEGA_DEPRECATED
void setLegacyExcludedPaths(std::vector<std::string>* excludedPaths);
/**
* @deprecated This function is deprecated and it will be removed in future updates.
*/
MEGA_DEPRECATED
void setLegacyExclusionLowerSizeLimit(unsigned long long limit);
/**
* @deprecated This function is deprecated and it will be removed in future updates.
*/
MEGA_DEPRECATED
void setLegacyExclusionUpperSizeLimit(unsigned long long limit);
/**
* @deprecated This function is deprecated and it will be removed in future updates.
*/
MEGA_DEPRECATED
MegaError* exportLegacyExclusionRules(const char* absolutePath);
/**
* @brief Check if it's possible to start synchronizing a folder node.
*
* Possible return values for this function are:
* - MegaError::API_OK if the folder is syncable
* - MegaError::API_ENOENT if the node doesn't exist in the account
* - MegaError::API_EARGS if the node is NULL or is not a folder
* - MegaError::API_EACCESS if the node doesn't have full access
* - MegaError::API_EEXIST if there is a conflicting synchronization (nodes can't be synced twice)
* - MegaError::API_EINCOMPLETE if the SDK hasn't been built with support for synchronization
*
* @param Folder node to check
* @return MegaError::API_OK if the node is syncable, otherwise it returns an error.
*/
int isNodeSyncable(MegaNode *node);
/**
* @brief Check if it's possible to start synchronizing a folder node.
*
* Return MegaError codes (MegaError::getErrorCode()) and SyncError codes (MegaError::getSyncError()).
*
* Possible return values for this function are:
* - MegaError::API_OK if the folder is syncable
* - MegaError::API_ENOENT if the node doesn't exist in the account
* - MegaError::API_EARGS if the node is NULL or is not a folder
*
* - MegaError::API_EACCESS:
* SyncError: SHARE_NON_FULL_ACCESS An ancestor node does not have full access
* SyncError: REMOTE_NODE_INSIDE_RUBBISH
* - MegaError::API_EEXIST if there is a conflicting synchronization (nodes can't be synced twice)
* SyncError: ACTIVE_SYNC_BELOW_PATH - There's a synced node below the path to be synced
* SyncError: ACTIVE_SYNC_ABOVE_PATH - There's a synced node above the path to be synced
* SyncError: ACTIVE_SYNC_SAME_PATH - There's a synced node at the path to be synced
* - MegaError::API_EINCOMPLETE if the SDK hasn't been built with support for synchronization
*
* You take the ownership of the returned value.
*
* @return API_OK if syncable. Error otherwise sets syncError in the returned MegaError
* caller must free
*/
MegaError* isNodeSyncableWithError(MegaNode* node);
/**
* @brief Get the synchronization identified with a backupId
*
* You take the ownership of the returned value
*
* @param backupId Identifier of the Sync (unique per user, provided by API)
* @return Synchronization identified by the backupId
*/
MegaSync *getSyncByBackupId(MegaHandle backupId);
/**
* @brief getSyncByNode Get the synchronization associated with a node
*
* You take the ownership of the returned value
*
* @param node Root node of the synchronization
* @return Synchronization with the specified root node
*/
MegaSync *getSyncByNode(MegaNode *node);
/**
* @brief getSyncByPath Get the synchronization associated with a local path
*
* You take the ownership of the returned value
*
* @param localPath Root local path of the synchronization
* @return Synchronization with the specified root local path
*/
MegaSync *getSyncByPath(const char *localPath);
/**
* @brief Get the total number of local nodes in the account
* @return Total number of local nodes in the account
*/
long long getNumLocalNodes();
/**
* @brief Query the sync engine to find out what is causing sync stalls
*
* The associated request type with this request is MegaRequest::TYPE_GET_SYNC_STALL_LIST.
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code is
* MegaError::API_OK:
* - MegaRequest::getMegaSyncStallList - Returns a List of synchronization stall conflicts
*
* @param listener A MegaRequestListener with which to track the request.
*
*/
void getMegaSyncStallList(MegaRequestListener* listener);
/**
* @brief Query the sync engine to find out what is causing sync stalls
*
* The associated request type with this request is MegaRequest::TYPE_GET_SYNC_STALL_LIST.
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getFlag - Returns true
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code is
* MegaError::API_OK:
* - MegaRequest::getMegaSyncStallMap - Returns a Map of BackupId to synchronization stall
* conflicts list
*
* @param listener A MegaRequestListener with which to track the request.
*
*/
void getMegaSyncStallMap(MegaRequestListener* listener);
/**
* @brief
* Clear a stall item in case the user Refreshes the list again
* before the sync code has re-iterated the tree to generate a new list
*
* @param stallCloudPath
* The stall item (or a copy of it) that was addressed but for which the
* sync code might not have noticed yet.
*/
void clearStalledPath(MegaSyncStall* originalStall);
/**
* @brief Move local path to sync debris folder
*
* The associated request type with this request is MegaRequest::TYPE_MOVE_TO_DEBRIS.
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getText - Returns local path.
* - MegaRequest::getNodeHandle - Returns sync backup Id
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_EARGS - Invalid path or backup id
* - MegaError::API_ENOENT - There is no sync with this id
* - MegaError::API_EINTERNAL - failure moving to sync debris
*
* @param path local path
* @param syncBackupId handle to the sync
* @param listener MegaRequestListener to track this request
*/
void moveToDebris(const char* path, MegaHandle syncBackupId, MegaRequestListener* listener = nullptr);
/**
* @brief Change the node that is being used as remote root for a sync.
*
* @important If the sync is active when executing this method, it will be temporary
* suspended to perform the change, meaning that any ongoing transfer will be automatically
* stopped.
*
* @note This operation is only allowed with syncs of TYPE_TWOWAY.
*
* The associated request type with this request is MegaRequest::TYPE_CHANGE_SYNC_ROOT
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParentHandle - Returns the handle of the new remote root in MEGA
* - MegaRequest::getNodeHandle - Returns the affected sync backupId
* - MegaRequest::getListener - Returns the MegaRequestListener to track this request
* - MegaRequest::getNumDetails - If different than NO_SYNC_ERROR, it returns additional
* info about the specific sync error (MegaSync::Error). It could happen both when the
* request has succeeded (API_OK) and also in some cases of failure, when the request error
* is not accurate enough.
*
* On the onRequestFinish callback, the error code associated with the MegaError
* (MegaError::getErrorCode()) and the SyncError (if relevant, MegaError::getSyncError())
* can be:
* - MegaError::API_OK:
* + SyncError::NO_SYNC_ERROR the new root has been changed successfully
* - MegaError::API_EARGS:
* + SyncError::NO_SYNC_ERROR The given syncBackupId or newRootNodeHandle are UNDEF
* + SyncError::REMOTE_NODE_NOT_FOUND The given newRootNodeHandle does not map to an
* existing node in the cloud
* + SyncError::UNKNOWN_ERROR The given syncBackupId does not map to an existing two way
* sync
* - MegaError::API_EWRITE:
* + SyncError::SYNC_CONFIG_WRITE_FAILURE We couldn't write into the database to commit
* the change.
* - MegaError::API_EEXISTS:
* + SyncError::UNKNOWN_ERROR the given newRootNodeHandle matches with the one that is
* already the root of the sync
*
* Additionally, error codes associated to the MegaApi::isNodeSyncableWithError() method
* can also be reported by this method. See MegaApi::isNodeSyncableWithError() for specific
* SyncError codes depending on the specific MegaError code.
*
* @param syncBackupId handle of the sync to change its remote root
* @param newRootNodeHandle Handle of the MEGA node to set as new sync remote root
* @param listener MegaRequestListener to track this request
*/
void changeSyncRemoteRoot(const MegaHandle syncBackupId,
const MegaHandle newRootNodeHandle,
MegaRequestListener* listener = nullptr);
/**
* @brief Change the local path that is being used as root for a sync.
*
* The associated request type with this request is MegaRequest::TYPE_CHANGE_SYNC_ROOT.
*
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getFile - Returns the path of the new local folder to use as root
* - MegaRequest::getNodeHandle - Returns the affected sync backup ID.
* - MegaRequest::getListener - Returns the MegaRequestListener to track this request.
* - MegaRequest::getNumDetails - If different than NO_SYNC_ERROR, it returns additional
* info for the specific sync error (MegaSync::Error). This can occur both when the
* request has succeeded (API_OK) and in some cases of failure when the request error is
* not sufficiently descriptive.
*
* On the onRequestFinish callback, the error code associated with the MegaError
* (MegaError::getErrorCode()) and the SyncError (if relevant, MegaError::getSyncError())
* can be:
* - MegaError::API_OK:
* + SyncError::NO_SYNC_ERROR the new root has been changed successfully
* - MegaError::API_EARGS:
* + SyncError::LOCAL_PATH_UNAVAILABLE the given path is nullptr or is empty
* + SyncError::UNKNOWN_ERROR The given backupId does not match any of the registered
* syncs
* + SyncError::LOCAL_PATH_SYNC_COLLISION The local path conflicts with existing
* synchronization paths (nested syncs are not allowed)
* + SyncError::FILESYSTEM_ID_UNAVAILABLE unable to get the file system fingerprint with
* the given path
* + SyncError::LOCAL_FILESYSTEM_MISMATCH The given path is in a different file system
* comparing with the previous one. We don't allow this operation
* + SyncError::UNABLE_TO_RETRIEVE_ROOT_FSID The new root directory cannot be opened
* + SyncError::BACKUP_SOURCE_NOT_BELOW_DRIVE The new root directory is not contained in
* the previous external path. That operation is not allowed.
* - MegaError::API_EWRITE:
* + SyncError::SYNC_CONFIG_WRITE_FAILURE We couldn't write into the database to commit
* the change.
* - MegaError::API_EFAILED:
* + SyncError::LOCAL_PATH_MOUNTED trying to sync bellow a FUSE mount point
* + SyncError::UNSUPPORTED_FILE_SYSTEM the given path is in a not supported file system
* - MegaError::API_ETEMPUNAVAIL:
* + SyncError::LOCAL_PATH_TEMPORARY_UNAVAILABLE the given new path is temporarily
* unavailable
* - MegaError::API_ENOENT:
* + SyncError::LOCAL_PATH_UNAVAILABLE the given new path is not available
* - MegaError::API_EACCESS:
* + SyncError::INVALID_LOCAL_TYPE the given path is not a directory
*
* @param syncBackupId The handle (backup ID) of the sync whose local root is to be changed.
* @param newLocalSyncRootPath The new local path to set as the sync root.
* @param listener A MegaRequestListener to track this request. This parameter is optional.
*/
void changeSyncLocalRoot(const MegaHandle syncBackupId,
const char* newLocalSyncRootPath,
MegaRequestListener* listener = nullptr);
/**
* @brief Set the throttle update rate for sync-uploads.
*
* @note The values set by this method will be overwritten upon resuming/starting
* application, and every 24-hours runtime (Those values will be received from API). We
* highly recommend to rely on API values instead of setting custom ones.
*
* The associated request type with this request is
* MegaRequest::TYPE_SET_SYNC_UPLOAD_THROTTLE_VALUES
*
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNumber - Returns the throttle update rate in seconds.
* MegaError:
* - MegaError::API_OK if the update rate was updated correctly.
* - MegaError::API_EARGS if the update rate is below the minimum or above the maximum.
*
* @param updateRateInSeconds The update rate for the throttling queue in seconds.
* @param listener A MegaRequestListener to track this request.
*/
void setSyncUploadThrottleUpdateRate(const unsigned updateRateInSeconds,
MegaRequestListener* const listener);
/**
* @brief Set the max number of sync uploads per file before applying throttling logic.
*
* @note The values set by this method will be overwritten upon resuming/starting
* application, and every 24-hours runtime (Those values will be received from API). We
* highly recommend to rely on API values instead of setting custom ones.
*
* The associated request type with this request is
* MegaRequest::TYPE_SET_SYNC_UPLOAD_THROTTLE_VALUES
*
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getTotalBytes - Returns the max number of uploads before throttle.
* MegaError:
* - MegaError::API_OK if the new max number of uploads before throttle was set correctly.
* - MegaError::API_EARGS if the max uploads before throttle value is below the minimum or
* above the maximum.
*
* @param maxUploadsBeforeThrottle The number of uploads that are allowed to go unthrottled.
* @param listener A MegaRequestListener to track this request.
*/
void setSyncMaxUploadsBeforeThrottle(const unsigned maxUploadsBeforeThrottle,
MegaRequestListener* const listener);
/**
* @brief Get the configurable throttle values for sync-uploads.
*
* The associated request type with this request is
* MegaRequest::TYPE_GET_SYNC_UPLOAD_THROTTLE_VALUES
*
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNumber - Returns the throttle update rate in seconds.
* - MegaRequest::getTotalBytes - Returns the max number of uploads before throttle.
*
* @param listener A MegaRequestListener to track this request.
*/
void getSyncUploadThrottleValues(MegaRequestListener* const listener);
/**
* @brief Get the lower limits of configurable throttle for sync-uploads.
*
* The associated request type with this request is
* MegaRequest::TYPE_GET_SYNC_UPLOAD_THROTTLE_LIMITS
*
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNumber - Returns the minimum allowed for throttle update rate in
* seconds.
* - MegaRequest::getTotalBytes - Returns the minimum allowed for max number of uploads
* before throttle.
* - MegaRequest::getFlag - Returns false (this is set to false/0 for lower limits).
*
* @param listener A MegaRequestListener to track this request.
*/
void getSyncUploadThrottleLowerLimits(MegaRequestListener* const listener);
/**
* @brief Get the upper limits of configurable throttle values for sync-uploads.
*
* The associated request type with this request is
* MegaRequest::TYPE_GET_SYNC_UPLOAD_THROTTLE_LIMITS
*
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNumber - Returns the maximum allowed for throttle update rate in
* seconds.
* - MegaRequest::getTotalBytes - Returns the maximum allowed for max number of uploads
* before throttle.
* - MegaRequest::getFlag - Returns true (this is set to true/1 for upper limits).
*
* @param listener A MegaRequestListener to track this request.
*/
void getSyncUploadThrottleUpperLimits(MegaRequestListener* const listener);
/**
* @brief Check if there are delayed/throttled uploads pending to be processed.
* When delayed/throttled uploads are pending, those files are not fully synchronized. In
* that case, the sync state would be Syncing.
*
* The associated request type with this request is
* MegaRequest::TYPE_CHECK_SYNC_UPLOAD_THROTTLED_ELEMENTS
*
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getFlag - Returns true if there are delayed uploads waiting for
* processing, false otherwise.
*
* @param listener A MegaRequestListener to track this request.
*
* @warning It is not guaranteed that the delayed uploads pending to be processed are valid.
* They could be invalid if the files have been removed, or if the upload transfer has been
* reset for other reasons. This is not checked until they are processed after the
* throttlingUpdateRate time. The caller should consider this method as an extra check: if
* the sync is in Syncing state, there are no stall issues nor MegaTransfers being processed
* nor other situations explaining the Syncing state, it could be expected that there are
* delayed uploads pending to be processed. Note that, if the delayed uploads are not valid
* anymore (for example, because the underlying files have been removed), even when this
* method could return true, the sync shouldn't be in Syncing state.
*/
void checkSyncUploadsThrottled(MegaRequestListener* const listener);
#endif // ENABLE_SYNC
/**
* @brief Move or Remove the nodes that used to be part of backup.
*
* The folder must be in folder Vault/<device>/, and will be moved, or permanently deleted.
* Deletion is permanent (not to trash) and is selected with destination INVALID_HANDLE.
* To move the nodes instead, specify the destination folder in backupDestination.
*
* These nodes cannot be deleted with the usual remove() function as they are in the Vault.
*
* The associated request type with this request is
* MegaRequest::TYPE_REMOVE_OLD_BACKUP_NODES. Valid data in the MegaRequest object received
* on callbacks:
* - MegaRequest::getNodeHandle - Returns the deconfiguredBackupRoot handle
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_ENOENT - deconfiguredBackupRoot was not valid
* - MegaError::API_EARGS - deconfiguredBackupRoot was not in the Vault,
* or backupDestination was not in Files or Rubbish
* - MegaError::API_EEXIST - The destination already contains a node with the same name.
*
* @param deconfiguredBackupRoot Identifier of the Sync (unique per user, provided by API)
* @param backupDestination If INVALID_HANDLE, files will be permanently deleted, otherwise
* files will be moved there.
* @param listener MegaRequestListener to track this request
*/
void moveOrRemoveDeconfiguredBackupNodes(MegaHandle deconfiguredBackupRoot, MegaHandle backupDestination, MegaRequestListener* listener = NULL);
/**
* @brief Get the backup identified with a tag
*
* You take the ownership of the returned value
*
* @param tag Tag that identifies the backup
* @return Backup identified by the tag
*/
MegaScheduledCopy *getScheduledCopyByTag(int tag);
/**
* @brief getScheduledCopyByNode Get the backup associated with a node
*
* You take the ownership of the returned value
* Caveat: Two backups can have the same parent node, the first one encountered is returned
*
* @param node Root node of the backup
* @return Backup with the specified root node
*/
MegaScheduledCopy *getScheduledCopyByNode(MegaNode *node);
/**
* @brief getScheduledCopyByPath Get the backup associated with a local path
*
* You take the ownership of the returned value
*
* @param localPath Root local path of the backup
* @return Backup with the specified root local path
*/
MegaScheduledCopy *getScheduledCopyByPath(const char *localPath);
/**
* @brief Check if the SDK is waiting to complete a request and get the reason
* @return State of SDK.
*
* Valid values are:
* - MegaApi::RETRY_NONE = 0
* SDK is not waiting for the server to complete a request
*
* - MegaApi::RETRY_CONNECTIVITY = 1
* SDK is waiting for the server to complete a request due to connectivity issues
*
* - MegaApi::RETRY_SERVERS_BUSY = 2
* SDK is waiting for the server to complete a request due to a HTTP error 500
*
* - MegaApi::RETRY_API_LOCK = 3
* SDK is waiting for the server to complete a request due to an API lock (API error -3)
*
* - MegaApi::RETRY_RATE_LIMIT = 4,
* SDK is waiting for the server to complete a request due to a rate limit (API error -4)
*
* - MegaApi::RETRY_LOCAL_LOCK = 5
* SDK is waiting for a local locked file
*
* - MegaApi::RETRY_UNKNOWN = 6
* SDK is waiting for the server to complete a request with unknown reason
*
*/
int isWaiting();
/**
* @brief Find out if the syncs need User intervention for some files/folders
*
* use getMegaSyncStallList() to find out what needs attention.
*
* @return true if the User is needs to intervene.
*
*/
bool isSyncStalled();
/**
* @brief Find out if the stall/conflict list has changed (increased/decreased).
*
* Note that this is meant to be used while MegaApi::isSyncStalled() is true.
*
* use getMegaSyncStallList() to find out what needs attention.
*
* @return true if the stall/conflict list has changed.
*
*/
bool isSyncStalledChanged();
/**
* @brief Get the total number of nodes in the account
*
* @note This method doesn't lock SDK mutex, returned value may not be up to date
* Nodes can be removed or added but this value is updated at the end of MegaClient::notityPurge
*
* @return Total number of nodes in the account
*/
unsigned long long getNumNodes();
/** @brief Get the total number of nodes in the account
*
* @note This method locks SDK mutex, returned value is up to date
* This calls gets blocked if it's called between a node is added or removed and
* nodes count is updated
*
* @return Total number of nodes in the account
*/
unsigned long long getAccurateNumNodes();
/**
* @brief Set LRU cache size
*
* By default it's defined at unsigned long long max value
*
* @param size LRU cache size
*/
void setLRUCacheSize(unsigned long long size);
/**
* @brief Returns number of nodes stored at cache LRU
*
* @return Number of nodes at cache LRU
*/
unsigned long long getNumNodesAtCacheLRU() const;
enum
{
ORDER_NONE = 0,
ORDER_DEFAULT_ASC = 1,
ORDER_DEFAULT_DESC = 2,
ORDER_SIZE_ASC = 3,
ORDER_SIZE_DESC = 4,
ORDER_CREATION_ASC = 5,
ORDER_CREATION_DESC = 6,
ORDER_MODIFICATION_ASC = 7,
ORDER_MODIFICATION_DESC = 8,
// ORDER_ALPHABETICAL_ASC = 9, (obsolete)
// ORDER_ALPHABETICAL_DESC = 10, (obsolete)
// ORDER_PHOTO_ASC = 11, (obsolete)
// ORDER_PHOTO_DESC = 12, (obsolete)
// ORDER_VIDEO_ASC = 13, (obsolete)
// ORDER_VIDEO_DESC = 14, (obsolete)
ORDER_LINK_CREATION_ASC = 15,
ORDER_LINK_CREATION_DESC = 16,
ORDER_LABEL_ASC = 17,
ORDER_LABEL_DESC = 18,
ORDER_FAV_ASC = 19,
ORDER_FAV_DESC = 20,
ORDER_SHARE_CREATION_ASC = 21,
ORDER_SHARE_CREATION_DESC = 22,
};
enum { FILE_TYPE_DEFAULT = 0, // FILE_TYPE_UNKNOWN already exists at WinBase.h
FILE_TYPE_PHOTO,
FILE_TYPE_AUDIO,
FILE_TYPE_VIDEO,
FILE_TYPE_DOCUMENT,
FILE_TYPE_PDF,
FILE_TYPE_PRESENTATION,
FILE_TYPE_ARCHIVE,
FILE_TYPE_PROGRAM,
FILE_TYPE_MISC,
FILE_TYPE_SPREADSHEET,
FILE_TYPE_ALL_DOCS, // any of {DOCUMENT, PDF, PRESENTATION, SPREADSHEET}
FILE_TYPE_OTHERS,
FILE_TYPE_ALL_VISUAL_MEDIA, // any of {PHOTO, VIDEO}
FILE_TYPE_LAST = FILE_TYPE_ALL_VISUAL_MEDIA,
};
enum { SEARCH_TARGET_INSHARE = 0,
SEARCH_TARGET_OUTSHARE,
SEARCH_TARGET_PUBLICLINK,
SEARCH_TARGET_ROOTNODE, // search in Cloud and Vault rootnodes
SEARCH_TARGET_ALL, };
/**
* @brief Get the number of child nodes
*
* If the node doesn't exist in MEGA or isn't a folder,
* this function returns 0
*
* This function doesn't search recursively, only returns the direct child nodes.
*
* @param parent Parent node
* @return Number of child nodes
*/
int getNumChildren(MegaNode* parent);
/**
* @brief Get the number of child files of a node
*
* If the node doesn't exist in MEGA or isn't a folder,
* this function returns 0
*
* This function doesn't search recursively, only returns the direct child files.
*
* @param parent Parent node
* @return Number of child files
*/
int getNumChildFiles(MegaNode* parent);
/**
* @brief Get the number of child folders of a node
*
* If the node doesn't exist in MEGA or isn't a folder,
* this function returns 0
*
* This function doesn't search recursively, only returns the direct child folders.
*
* @param parent Parent node
* @return Number of child folders
*/
int getNumChildFolders(MegaNode* parent);
/**
* @brief Get all children of a MegaNode
*
* If the parent node doesn't exist or it isn't a folder, this function
* returns an empty list
*
* You take the ownership of the returned value
*
* This function allows to cancel the processing at any time by passing a MegaCancelToken
* and calling to MegaCancelToken::setCancelFlag(true).
*
* @param parent Parent node
* @param order Order for the returned list
*
* Note: First, the nodes are always sorted by type, being folders always first. Then, the
* specified option is applied in each type block
*
* Valid values for this parameter are:
* - MegaApi::ORDER_NONE = 0
* Undefined order
*
* - MegaApi::ORDER_DEFAULT_ASC = 1
* Alphabetical order, e.g. bar, Car, foo
*
* - MegaApi::ORDER_DEFAULT_DESC = 2
* Alphabetical inverse order, e.g. foo, Car, bar
*
* - MegaApi::ORDER_SIZE_ASC = 3
* Sort by size, small elements first
*
* - MegaApi::ORDER_SIZE_DESC = 4
* Sort by size, small elements last
*
* - MegaApi::ORDER_CREATION_ASC = 5
* Sort by creation time in MEGA, older elements first
*
* - MegaApi::ORDER_CREATION_DESC = 6
* Sort by creation time in MEGA, older elements last
*
* - MegaApi::ORDER_MODIFICATION_ASC = 7
* Sort by modification time of the original file, older modification times first
*
* - MegaApi::ORDER_MODIFICATION_DESC = 8
* Sort by modification time of the original file, older modification times last
*
* - MegaApi::ORDER_LABEL_ASC = 17
* Sort by color label, nodes with colors first
*
* - MegaApi::ORDER_LABEL_DESC = 18
* Sort by color label, nodes with colors last
*
* - MegaApi::ORDER_FAV_ASC = 19
* Sort nodes with favourite attr first
*
* - MegaApi::ORDER_FAV_DESC = 20
* Sort nodes with favourite attr last
*
* @param cancelToken MegaCancelToken to be able to cancel the processing at any time.
* @return List with all child MegaNode objects
*/
MegaNodeList* getChildren(MegaNode *parent, int order = 1, MegaCancelToken *cancelToken = nullptr);
/**
* @brief Get children of a particular parent or a predefined location, and allow filtering
* the results. @see MegaSearchFilter
* The look-up is case-insensitive.
* For invalid filtering options, this function returns an empty list.
*
* You take the ownership of the returned value
*
* This function allows to cancel the processing at any time by passing a MegaCancelToken and calling
* to MegaCancelToken::setCancelFlag(true).
*
* @param filter Container for filtering options. In order to be considered valid it must
* - be not null
* - have valid ancestor handle (different than INVALID_HANDLE) set by calling byLocationHandle(),
* and in consequence it must have default value for location (SEARCH_TARGET_ALL)
* @param order Order for the returned list
*
* Note: First, the nodes are always sorted by type, being folders always first. Then, the
* specified option is applied in each type block
*
* Valid values for this parameter are:
* - MegaApi::ORDER_NONE = 0
* Undefined order
*
* - MegaApi::ORDER_DEFAULT_ASC = 1
* Alphabetical order, e.g. bar, Car, foo
*
* - MegaApi::ORDER_DEFAULT_DESC = 2
* Alphabetical inverse order, e.g. foo, Car, bar
*
* - MegaApi::ORDER_SIZE_ASC = 3
* Sort by size, small elements first
*
* - MegaApi::ORDER_SIZE_DESC = 4
* Sort by size, small elements last
*
* - MegaApi::ORDER_CREATION_ASC = 5
* Sort by creation time in MEGA, older elements first
*
* - MegaApi::ORDER_CREATION_DESC = 6
* Sort by creation time in MEGA, older elements last
*
* - MegaApi::ORDER_MODIFICATION_ASC = 7
* Sort by modification time of the original file, older modification times first
*
* - MegaApi::ORDER_MODIFICATION_DESC = 8
* Sort by modification time of the original file, older modification times last
*
* - MegaApi::ORDER_LABEL_ASC = 17
* Sort by color label, nodes with colors first
*
* - MegaApi::ORDER_LABEL_DESC = 18
* Sort by color label, nodes with colors last
*
* - MegaApi::ORDER_FAV_ASC = 19
* Sort nodes with favourite attr first
*
* - MegaApi::ORDER_FAV_DESC = 20
* Sort nodes with favourite attr last
*
* @param cancelToken MegaCancelToken to be able to cancel the processing at any time.
* @param searchPage Container for pagination options; if null, all results will be returned
*
* @return List with found children as MegaNode objects
*/
MegaNodeList* getChildren(const MegaSearchFilter *filter, int order = ORDER_NONE, MegaCancelToken *cancelToken = nullptr, const MegaSearchPage* searchPage = nullptr);
/**
* @brief Get all children of a list of MegaNodes
*
* If any parent node doesn't exist or it isn't a folder, that parent
* will be skipped.
*
* You take the ownership of the returned value
*
* @param parentNodes List of parent nodes
* @param order Order for the returned list
*
* Note: First, the nodes are always sorted by type, being folders always first. Then, the
* specified option is applied in each type block
*
* Valid values for this parameter are:
* - MegaApi::ORDER_NONE = 0
* Undefined order
*
* - MegaApi::ORDER_DEFAULT_ASC = 1
* Alphabetical order, e.g. bar, Car, foo
*
* - MegaApi::ORDER_DEFAULT_DESC = 2
* Alphabetical inverse order, e.g. foo, Car, bar
*
* - MegaApi::ORDER_SIZE_ASC = 3
* Sort by size, small elements first
*
* - MegaApi::ORDER_SIZE_DESC = 4
* Sort by size, small elements last
*
* - MegaApi::ORDER_CREATION_ASC = 5
* Sort by creation time in MEGA, older elements first
*
* - MegaApi::ORDER_CREATION_DESC = 6
* Sort by creation time in MEGA, older elements last
*
* - MegaApi::ORDER_MODIFICATION_ASC = 7
* Sort by modification time of the original file, older modification times first
*
* - MegaApi::ORDER_MODIFICATION_DESC = 8
* Sort by modification time of the original file, older modification times last
*
* - MegaApi::ORDER_LABEL_ASC = 17
* Sort by color label, nodes with colors first
*
* - MegaApi::ORDER_LABEL_DESC = 18
* Sort by color label, nodes with colors last
*
* - MegaApi::ORDER_FAV_ASC = 19
* Sort nodes with favourite attr first
*
* - MegaApi::ORDER_FAV_DESC = 20
* Sort nodes with favourite attr last
*
* @return List with all child MegaNode objects
*/
MegaNodeList* getChildren(MegaNodeList *parentNodes, int order = 1);
/**
* @brief Get all versions of a file
*
* You take ownership of the returned value.
*
* @param node Node to check
* @return List with all versions of the node, including the current version
*/
MegaNodeList* getVersions(MegaNode *node);
/**
* @brief Get the number of versions of a file
* @param node Node to check
* @return Number of versions of the node, including the current version
*/
int getNumVersions(MegaNode *node);
/**
* @brief Check if a file has previous versions
* @param node Node to check
* @return true if the node has any previous version
*/
bool hasVersions(MegaNode *node);
/**
* @brief Get information about the contents of a folder
*
* The associated request type with this request is MegaRequest::TYPE_FOLDER_INFO
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getMegaFolderInfo - MegaFolderInfo object with the information related to the folder
*
* @param node Folder node to inspect
* @param listener MegaRequestListener to track this request
*/
void getFolderInfo(MegaNode *node, MegaRequestListener *listener = NULL);
/**
* @brief Returns true if the node has children
* @return true if the node has children
*/
bool hasChildren(MegaNode *parent);
/**
* @brief Get the first child node with the provided name
*
* If the node doesn't exist, this function returns NULL
* It's possible to have multiple nodes with the same name.
* This function will return one of them.
* Folder nodes take precedence over file nodes.
* If you want a node of specific type, @see getChildNodeOfType
*
* You take the ownership of the returned value
*
* @param parent Parent node
* @param name Name of the node
* @return The MegaNode that has the selected parent and name
*/
MegaNode *getChildNode(MegaNode *parent, const char* name);
/**
* @brief Get the first child node with the name and type provided
*
* Allowed types for type parameter: MegaNode::TYPE_FILE, MegaNode::TYPE_FOLDER
*
* If the node doesn't exist, this function returns nullptr
* It's possible to have multiple nodes with the same name.
* This function will return one of them.
*
* You take the ownership of the returned value
*
* @param parent Parent node
* @param name Name of the node
* @param type Type of the node.
* @return The MegaNode that has the selected parent, name and type
*/
MegaNode* getChildNodeOfType(MegaNode *parent, const char *name, int type);
/**
* @brief Get the parent node of a MegaNode
*
* If the node doesn't exist in the account or
* it is a root node, this function returns NULL
*
* You take the ownership of the returned value.
*
* @param node MegaNode to get the parent
* @return The parent of the provided node
*/
MegaNode *getParentNode(MegaNode *node);
/**
* @brief Get the path of a MegaNode
*
* If the node doesn't exist, this function returns NULL.
* You can recover the node later using MegaApi::getNodeByPath
* except if the path contains names with '/' or '\' characters.
*
* Note: inshare paths have following structure "email:path"
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @param node MegaNode for which the path will be returned
* @return The path of the node
*/
char* getNodePath(MegaNode *node);
/**
* @brief Get the path of a Node given its MegaHandle
*
* If the node doesn't exist, this function returns NULL.
* You can recover the node later using MegaApi::getNodeByPath
* except if the path contains names with '/' or '\' characters.
*
* Note: inshare paths have following structure "email:path"
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @param handle MegaNode handle for which the path will be returned
* @return The path of the node
*/
char* getNodePathByNodeHandle(MegaHandle handle);
/**
* @brief Get the MegaNode in a specific path in the MEGA account
*
* The path separator character is '/'
* The Root node is /
* The Vault root node is //in/
* The Rubbish root node is //bin/
*
* Paths with names containing '/' or '\' aren't compatible
* with this function.
*
* If the path name contains ':' it needs to be escaped before
* calling this function.
*
* Note: inshare paths have following structure "email:path"
*
* It is needed to be logged in and to have successfully completed a fetchNodes
* request before calling this function. Otherwise, it will return NULL.
*
* You take the ownership of the returned value
*
* @param path Path to check
* @param n Base node if the path is relative
* @return The MegaNode object in the path, otherwise NULL
*/
MegaNode *getNodeByPath(const char *path, MegaNode *n = NULL);
/**
* @brief Get the MegaNode of the specified type, in a specific path in the MEGA account
*
* The path separator character is '/'
* The Root node is /
* The Vault root node is //in/
* The Rubbish root node is //bin/
*
* Paths with names containing '/' or '\' aren't compatible
* with this function.
*
* If the path name contains ':' it needs to be escaped before
* calling this function.
*
* Note: inshare paths have following structure "email:path"
*
* It is needed to be logged in and to have successfully completed a fetchNodes
* request before calling this function. Otherwise, it will return NULL.
*
* You take the ownership of the returned value
*
* @param path Path to check
* @param n Base node if the path is relative
* @param type Type of the node to be looked up; valid values: TYPE_FILE, TYPE_FOLDER,
* TYPE_UNKNOWN (any type, folder has precedence)
* @return The MegaNode object in the path, otherwise NULL
*/
MegaNode* getNodeByPathOfType(const char *path, MegaNode *n = nullptr, int type = MegaNode::TYPE_UNKNOWN);
/**
* @brief Get the MegaNode that has a specific handle
*
* You can get the handle of a MegaNode using MegaNode::getHandle. The same handle
* can be got in a Base64-encoded string using MegaNode::getBase64Handle. Conversions
* between these formats can be done using MegaApi::base64ToHandle and MegaApi::handleToBase64
*
* It is needed to be logged in and to have successfully completed a fetchNodes
* request before calling this function. Otherwise, it will return NULL.
*
* You take the ownership of the returned value.
*
* @param h Node handle to check
* @return MegaNode object with the handle, otherwise NULL
*/
MegaNode *getNodeByHandle(MegaHandle h);
/**
* @brief Generate a TOTP token and its lifetime with the data stored in the node with the
* given handle.
*
* @note This performs a synchronous operation.
*
* @param handle The handle of the password node with the required totp data needed to
* compute the totp token and its lifetime.
* @return A MegaTotpTokenGenResult with:
* - `errorCode`: An error code that can be one of:
* + API_EARGS: The input handle is `UNDEF`
* + API_ENOENT: The input handle does not correspond to a password node
* + API_EKEY: The input handle corresponds to a password node with no TOTP data
* + API_EINTERNAL: The TOTP data stored in the password node is ill-formed and cannot be
* used to generate valid tokens.
* + API_OK: the generation succeeded and the result can be retrieved from `second`
* - `MegaTotpTokenLifetime`:
* + `token`: The generated token
* + `remainingLifeTimeSeconds`: The remaining time
*/
MegaTotpTokenGenResult generateTotpTokenFromNode(MegaHandle handle);
/**
* @brief Get the MegaContactRequest that has a specific handle
*
* You can get the handle of a MegaContactRequest using MegaContactRequest::getHandle.
*
* You take the ownership of the returned value.
*
* @param handle Contact request handle to check
* @return MegaContactRequest object with the handle, otherwise NULL
*/
MegaContactRequest *getContactRequestByHandle(MegaHandle handle);
/**
* @brief Get all contacts of this MEGA account
*
* You take the ownership of the returned value
*
* @return List of MegaUser object with all contacts of this account
*/
MegaUserList* getContacts();
/**
* @brief Get the MegaUser that has a specific email address
*
* You can get the email of a MegaUser using MegaUser::getEmail
*
* You take the ownership of the returned value
*
* @param user Email or Base64 handle of the user
* @return MegaUser that has the email address, otherwise NULL
*/
MegaUser* getContact(const char *user);
/**
* @brief Get all MegaUserAlerts for the logged in user
*
* You take the ownership of the returned value
*
* @return List of MegaUserAlert objects
*/
MegaUserAlertList* getUserAlerts();
/**
* @brief Get the number of unread user alerts for the logged in user
*
* @return Number of unread user alerts
*/
int getNumUnreadUserAlerts();
/**
* @brief Get a list with all active inbound sharings from one MegaUser
*
* This method returns both verified and not verified shares.
*
* You take the ownership of the returned value
*
* @param user MegaUser sharing folders with this account
* @param order Sorting order to use
*
* Valid values for this parameter are:
* - MegaApi::ORDER_NONE = 0
* Undefined order
*
* - MegaApi::ORDER_DEFAULT_ASC = 1
* Alphabetical order, e.g. bar, Car, foo
*
* - MegaApi::ORDER_DEFAULT_DESC = 2
* Alphabetical inverse order, e.g. foo, Car, bar
*
* - MegaApi::ORDER_SIZE_ASC = 3
* Sort by size, small elements first
*
* - MegaApi::ORDER_SIZE_DESC = 4
* Sort by size, small elements last
*
* - MegaApi::ORDER_CREATION_ASC = 5
* Sort by creation time in MEGA, older elements first
*
* - MegaApi::ORDER_CREATION_DESC = 6
* Sort by creation time in MEGA, older elements last
*
* @return List of MegaNode objects that this user is sharing with this account
*/
MegaNodeList *getInShares(MegaUser* user, int order = ORDER_NONE);
/**
* @brief Get a list with all active inbound sharings
*
* This method returns both verified and not verified shares.
*
* You take the ownership of the returned value
*
* @param order Sorting order to use
*
* Valid values for this parameter are:
* - MegaApi::ORDER_NONE = 0
* Undefined order
*
* - MegaApi::ORDER_DEFAULT_ASC = 1
* Alphabetical order, e.g. bar, Car, foo
*
* - MegaApi::ORDER_DEFAULT_DESC = 2
* Alphabetical inverse order, e.g. foo, Car, bar
*
* - MegaApi::ORDER_SIZE_ASC = 3
* Sort by size, small elements first
*
* - MegaApi::ORDER_SIZE_DESC = 4
* Sort by size, small elements last
*
* - MegaApi::ORDER_CREATION_ASC = 5
* Sort by creation time in MEGA, older elements first
*
* - MegaApi::ORDER_CREATION_DESC = 6
* Sort by creation time in MEGA, older elements last
*
* @return List of MegaNode objects that other users are sharing with this account
*/
MegaNodeList *getInShares(int order = ORDER_NONE);
/**
* @brief Get a list with all active inbound sharings
*
* This method returns verified shares.
*
* You take the ownership of the returned value
*
* @param order Sorting order to use
*
* Valid values for this parameter are:
* - MegaApi::ORDER_NONE = 0
* Undefined order
*
* - MegaApi::ORDER_DEFAULT_ASC = 1
* Alphabetical order, e.g. bar, Car, foo
*
* - MegaApi::ORDER_DEFAULT_DESC = 2
* Alphabetical inverse order, e.g. foo, Car, bar
*
* - MegaApi::ORDER_SIZE_ASC = 3
* Sort by size, small elements first
*
* - MegaApi::ORDER_SIZE_DESC = 4
* Sort by size, small elements last
*
* - MegaApi::ORDER_CREATION_ASC = 5
* Sort by creation time in MEGA, older elements first
*
* - MegaApi::ORDER_CREATION_DESC = 6
* Sort by creation time in MEGA, older elements last
*
* @return List of MegaShare objects that other users are sharing with this account
*/
MegaShareList *getInSharesList(int order = ORDER_NONE);
/**
* @brief Get a list with all unverified inbound sharings
*
* You take the ownership of the returned value
*
* @param order Sorting order to use
*
* Valid values for this parameter are:
* - MegaApi::ORDER_NONE = 0
* Undefined order
*
* - MegaApi::ORDER_DEFAULT_ASC = 1
* Alphabetical order, e.g. bar, Car, foo
*
* - MegaApi::ORDER_DEFAULT_DESC = 2
* Alphabetical inverse order, e.g. foo, Car, bar
*
* - MegaApi::ORDER_SIZE_ASC = 3
* Sort by size, small elements first
*
* - MegaApi::ORDER_SIZE_DESC = 4
* Sort by size, small elements last
*
* - MegaApi::ORDER_CREATION_ASC = 5
* Sort by creation time in MEGA, older elements first
*
* - MegaApi::ORDER_CREATION_DESC = 6
* Sort by creation time in MEGA, older elements last
*
* @return List of MegaShare objects that other users are sharing with this account
*/
MegaShareList *getUnverifiedInShares(int order = ORDER_NONE);
/**
* @brief Get the user relative to an incoming share
*
* This function will return NULL if the node is not found
*
* When recurse is true and the root of the specified node is not an incoming share,
* this function will return NULL.
* When recurse is false and the specified node doesn't represent the root of an
* incoming share, this function will return NULL.
*
* You take the ownership of the returned value
*
* @param node Node to look for inshare user.
* @param recurse use root node corresponding to the node passed
* @return MegaUser relative to the incoming share
*/
MegaUser *getUserFromInShare(MegaNode *node, bool recurse = false);
/**
* @brief Check if a MegaNode is pending to be shared with another User. This situation
* happens when a node is to be shared with a User which is not a contact yet.
*
* For nodes that are pending to be shared, you can get a list of MegaNode
* objects using MegaApi::getPendingShares
*
* @param node Node to check
* @return true is the MegaNode is pending to be shared, otherwise false
*/
bool isPendingShare(MegaNode *node);
/**
* @brief Get a list with all active and pending outbound sharings
*
* This method returns both, verified and unverified shares.
* You take the ownership of the returned value
*
* @param order Sorting order to use
*
* Valid values for this parameter are:
* - MegaApi::ORDER_NONE = 0
* Undefined order
*
* - MegaApi::ORDER_DEFAULT_ASC = 1
* Alphabetical order, e.g. bar, Car, foo
*
* - MegaApi::ORDER_DEFAULT_DESC = 2
* Alphabetical inverse order, e.g. foo, Car, bar
*
* - MegaApi::ORDER_SIZE_ASC = 3
* Sort by size, small elements first
*
* - MegaApi::ORDER_SIZE_DESC = 4
* Sort by size, small elements last
*
* - MegaApi::ORDER_CREATION_ASC = 5
* Sort by node creation time in MEGA, older elements first
*
* - MegaApi::ORDER_CREATION_DESC = 6
* Sort by node creation time in MEGA, older elements last
*
* - MegaApi::ORDER_SHARE_CREATION_ASC = 21
* Sort by share creation time in MEGA, older elements first
*
* - MegaApi::ORDER_SHARE_CREATION_DESC = 22
* Sort by share creation time in MEGA, older elements last
*
* @return List of MegaShare objects
*/
MegaShareList *getOutShares(int order = ORDER_NONE);
/**
* @brief Get a list with the active and pending outbound sharings for a MegaNode
*
* This method returns both, verified and unverified shares.
*
* If the node doesn't exist in the account, this function returns an empty list.
*
* You take the ownership of the returned value
*
* @param node MegaNode to check
* @return List of MegaShare objects
*/
MegaShareList *getOutShares(MegaNode *node);
/**
* @brief Get a list with all pending outbound sharings
*
* This method returns both, verified and unverified shares.
*
* You take the ownership of the returned value
*
* @return List of MegaShare objects
* @deprecated Use MegaNode::getOutShares instead of this function
*/
MegaShareList *getPendingOutShares();
/**
* @brief Get a list with all pending outbound sharings
*
* This method returns both, verified and unverified shares.
*
* You take the ownership of the returned value
*
* @deprecated Use MegaNode::getOutShares instead of this function
* @return List of MegaShare objects
*/
MegaShareList *getPendingOutShares(MegaNode *node);
/**
* @brief Get a list with all unverified sharings
*
* You take the ownership of the returned value
*
* @param order Sorting order to use
*
* Valid values for this parameter are:
* - MegaApi::ORDER_NONE = 0
* Undefined order
*
* - MegaApi::ORDER_DEFAULT_ASC = 1
* Alphabetical order, e.g. bar, Car, foo
*
* - MegaApi::ORDER_DEFAULT_DESC = 2
* Alphabetical inverse order, e.g. foo, Car, bar
*
* - MegaApi::ORDER_SIZE_ASC = 3
* Sort by size, small elements first
*
* - MegaApi::ORDER_SIZE_DESC = 4
* Sort by size, small elements last
*
* - MegaApi::ORDER_CREATION_ASC = 5
* Sort by node creation time in MEGA, older elements first
*
* - MegaApi::ORDER_CREATION_DESC = 6
* Sort by node creation time in MEGA, older elements last
*
* - MegaApi::ORDER_SHARE_CREATION_ASC = 21
* Sort by share creation time in MEGA, older elements first
*
* - MegaApi::ORDER_SHARE_CREATION_DESC = 22
* Sort by share creation time in MEGA, older elements last
*
* @return List of MegaShare objects
*/
MegaShareList *getUnverifiedOutShares(int order = ORDER_NONE);
/**
* @brief Check if a node belongs to your own cloud
* @param handle Node to check
* @return True if it belongs to your own cloud
*/
bool isPrivateNode(MegaHandle handle);
/**
* @brief Check if a node does NOT belong to your own cloud
*
* In example, nodes from incoming shared folders do not belong to your cloud.
*
* @param handle Node to check
* @return True if it does NOT belong to your own cloud
*/
bool isForeignNode(MegaHandle handle);
/**
* @brief Get a list with all public links
*
* Valid value for order are: MegaApi::ORDER_NONE, MegaApi::ORDER_DEFAULT_ASC,
* MegaApi::ORDER_DEFAULT_DESC, MegaApi::ORDER_LINK_CREATION_ASC,
* MegaApi::ORDER_LINK_CREATION_DESC
*
* You take the ownership of the returned value
*
* @param order Sorting order to use
* @return List of MegaNode objects that are shared with everyone via public link
*/
MegaNodeList *getPublicLinks(int order = ORDER_NONE);
/**
* @brief Get a list with all incoming contact requests
*
* You take the ownership of the returned value
*
* @return List of MegaContactRequest objects
*/
MegaContactRequestList* getIncomingContactRequests() const;
/**
* @brief Get a list with all outgoing contact requests
*
* You take the ownership of the returned value
*
* @return List of MegaContactRequest objects
*/
MegaContactRequestList* getOutgoingContactRequests() const;
/**
* @brief Get the access level of a MegaNode
* @param node MegaNode to check
* @return Access level of the node
* Valid values are:
* - MegaShare::ACCESS_OWNER
* - MegaShare::ACCESS_FULL
* - MegaShare::ACCESS_READWRITE
* - MegaShare::ACCESS_READ
* - MegaShare::ACCESS_UNKNOWN
*/
int getAccess(MegaNode* node);
/**
* @brief Get the access level of a node
* @param nodeHandle MegaHandle of the node to check
* @return Access level of the node
* Valid values are:
* - MegaShare::ACCESS_OWNER
* - MegaShare::ACCESS_FULL
* - MegaShare::ACCESS_READWRITE
* - MegaShare::ACCESS_READ
* - MegaShare::ACCESS_UNKNOWN
*/
int getAccess(MegaHandle nodeHandle);
/**
* @brief Get the size of a node tree
*
* If the MegaNode is a file, this function returns the size of the file.
* If it's a folder, this fuction returns the sum of the sizes of all nodes
* in the node tree.
*
* @param node Parent node
* @return Size of the node tree
*/
long long getSize(MegaNode *node);
/**
* @brief Get a Base64-encoded fingerprint for a local file
*
* The fingerprint is created taking into account the modification time of the file
* and file contents. This fingerprint can be used to get a corresponding node in MEGA
* using MegaApi::getNodeByFingerprint
*
* If the file can't be found or can't be opened, this function returns NULL
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @param filePath Local file path
* @return Base64-encoded fingerprint for the file
*/
char* getFingerprint(const char *filePath);
/**
* @brief Get a Base64-encoded fingerprint from an input stream and a modification time
*
* If the input stream is NULL, has a negative size or can't be read, this function returns NULL
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @param inputStream Input stream that provides the data to create the fingerprint
* @param mtime Modification time that will be taken into account for the creation of the fingerprint
* @return Base64-encoded fingerprint
*/
char* getFingerprint(MegaInputStream *inputStream, int64_t mtime);
/**
* @brief Returns a node with the provided fingerprint
*
* If there isn't any node in the account with that fingerprint, this function returns NULL.
*
* You take the ownership of the returned value.
*
* @param fingerprint Fingerprint to check
* @return MegaNode object with the provided fingerprint
*/
MegaNode *getNodeByFingerprint(const char* fingerprint);
/**
* @brief Returns a node with the provided fingerprint
*
* If there isn't any node in the account with that fingerprint, this function returns NULL.
* If there are several nodes with the same fingerprint, nodes in the preferred
* parent folder take precedence.
*
* You take the ownership of the returned value.
*
* @param fingerprint Fingerprint to check
* @param parent Preferred parent node
* @return MegaNode object with the provided fingerprint
*/
MegaNode *getNodeByFingerprint(const char *fingerprint, MegaNode* parent);
/**
* @brief Returns all nodes that have a fingerprint
*
* If there isn't any node in the account with that fingerprint, this function returns an empty MegaNodeList.
*
* You take the ownership of the returned value.
*
* @param fingerprint Fingerprint to check
* @return List of nodes with the same fingerprint
*/
MegaNodeList *getNodesByFingerprint(const char* fingerprint);
/**
* @brief Returns all nodes that have a fingerprint (ignoring modification time)
*
* If there isn't any node in the account with that fingerprint, this function returns an
* empty MegaNodeList.
*
* You take the ownership of the returned value.
*
* @param fingerprint Fingerprint to check
* @return List of nodes with the same fingerprint (ignoring modification time)
*/
MegaNodeList* getNodesByFingerprintIgnoringMtime(const char* fingerprint);
/**
* @brief Returns nodes that have an originalFingerprint equal to the supplied value
*
* Search the node tree and return a list of nodes that have an originalFingerprint, which
* matches the supplied originalfingerprint.
*
* If the parent node supplied is not NULL, it only searches nodes below that parent folder,
* otherwise all nodes are searched. If no nodes are found with that original fingerprint,
* this function returns an empty MegaNodeList.
*
* You take the ownership of the returned value.
*
* @param originalFingerprint Original Fingerprint to check
* @param parent Only return nodes below this specified parent folder. Pass NULL to consider all nodes.
* @return List of nodes with the same original fingerprint
*/
MegaNodeList *getNodesByOriginalFingerprint(const char* originalFingerprint, MegaNode* parent);
/**
* @brief Returns a node with the provided fingerprint that can be exported
*
* If there isn't any node in the account with that fingerprint, this function returns NULL.
* If a file name is passed in the second parameter, it's also checked if nodes with a matching
* fingerprint has that name. If there isn't any matching node, this function returns NULL.
* This function ignores nodes that are inside the Rubbish Bin because public links to those nodes
* can't be downloaded.
*
* You take the ownership of the returned value.
*
* @param fingerprint Fingerprint to check
* @param name Name that the node should have (optional)
* @return Exportable node that meet the requirements
*/
MegaNode *getExportableNodeByFingerprint(const char *fingerprint, const char *name = NULL);
/**
* @brief Check if the account already has a node with the provided fingerprint
*
* A fingerprint for a local file can be generated using MegaApi::getFingerprint
*
* @param fingerprint Fingerprint to check
* @return true if the account contains a node with the same fingerprint
*/
bool hasFingerprint(const char* fingerprint);
/**
* @brief getCRC Get the CRC of a file
*
* The CRC of a file is a hash of its contents.
* If you need a more realiable method to check files, use fingerprint functions
* (MegaApi::getFingerprint, MegaApi::getNodeByFingerprint) that also takes into
* account the size and the modification time of the file to create the fingerprint.
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @param filePath Local file path
* @return Base64-encoded CRC of the file
*/
char* getCRC(const char *filePath);
/**
* @brief Get the CRC from a fingerprint
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @param fingerprint fingerprint from which we want to get the CRC
* @return Base64-encoded CRC from the fingerprint
*/
char *getCRCFromFingerprint(const char *fingerprint);
/**
* @brief getCRC Get the CRC of a node
*
* The CRC of a node is a hash of its contents.
* If you need a more realiable method to check files, use fingerprint functions
* (MegaApi::getFingerprint, MegaApi::getNodeByFingerprint) that also takes into
* account the size and the modification time of the node to create the fingerprint.
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @param node Node for which we want to get the CRC
* @return Base64-encoded CRC of the node
*/
char* getCRC(MegaNode *node);
/**
* @brief getNodeByCRC Returns a node with the provided CRC
*
* If there isn't any node in the selected folder with that CRC, this function returns NULL.
* If there are several nodes with the same CRC, anyone can be returned.
*
* You take the ownership of the returned value.
*
* @param crc CRC to check
* @param parent Parent node to scan. It must be a folder.
* @return Node with the selected CRC in the selected folder, or NULL
* if it's not found.
*/
MegaNode* getNodeByCRC(const char *crc, MegaNode* parent);
/**
* @brief Check if a node has an access level
*
* You take the ownership of the returned value
*
* @param node Node to check
* @param level Access level to check
* Valid values for this parameter are:
* - MegaShare::ACCESS_OWNER
* - MegaShare::ACCESS_FULL
* - MegaShare::ACCESS_READWRITE
* - MegaShare::ACCESS_READ
*
* @return Pointer to MegaError with the result.
* Valid values for the error code are:
* - MegaError::API_OK - The node has the required access level
* - MegaError::API_EACCESS - The node doesn't have the required access level
* - MegaError::API_ENOENT - The node doesn't exist in the account
* - MegaError::API_EARGS - Invalid parameters
*/
MegaError* checkAccessErrorExtended(MegaNode* node, int level);
/**
* @brief Check if a node can be moved to a target node
*
* You take the ownership of the returned value
*
* @param node Node to check
* @param target Target for the move operation
* @return MegaError object with the result:
* Valid values for the error code are:
* - MegaError::API_OK - The node can be moved to the target
* - MegaError::API_EACCESS - The node can't be moved because of permissions problems
* - MegaError::API_ECIRCULAR - The node can't be moved because that would create a circular linkage
* - MegaError::API_ENOENT - The node or the target doesn't exist in the account
* - MegaError::API_EARGS - Invalid parameters
*/
MegaError* checkMoveErrorExtended(MegaNode* node, MegaNode* target);
/**
* @brief Check if the MEGA filesystem is available in the local computer
*
* This function returns true after a successful call to MegaApi::fetchNodes,
* otherwise it returns false
*
* @return True if the MEGA filesystem is available
*/
bool isFilesystemAvailable();
/**
* @brief Returns the root node of the account
*
* You take the ownership of the returned value
*
* If you haven't successfully called MegaApi::fetchNodes before,
* this function returns NULL
*
* @return Root node of the account
*/
MegaNode *getRootNode();
/**
* @brief Returns the Vault node of the account
*
* You take the ownership of the returned value
*
* If you haven't successfully called MegaApi::fetchNodes before,
* this function returns NULL
*
* @return Vault node of the account
*/
MegaNode *getVaultNode();
/**
* @brief Returns the rubbish node of the account
*
* You take the ownership of the returned value
*
* If you haven't successfully called MegaApi::fetchNodes before,
* this function returns NULL
*
* @return Rubbish node of the account
*/
MegaNode *getRubbishNode();
/**
* @brief Returns the root node of one node
*
* You take the ownership of the returned value
*
* @param node Node to check
* @return Root node for the \c node
*/
MegaNode *getRootNode(MegaNode *node);
/**
* @brief Check if a node is in the Cloud Drive tree
*
* @param node Node to check
* @return True if the node is in the cloud drive
*/
bool isInCloud(MegaNode *node);
/**
* @brief Check if a node is in the Rubbish bin tree
*
* @param node Node to check
* @return True if the node is in the Rubbish bin
*/
bool isInRubbish(MegaNode *node);
/**
* @brief Check if a node is in the Vault tree
*
* @param node Node to check
* @return True if the node is in the Vault
*/
bool isInVault(MegaNode *node);
/**
* @brief Set default permissions for new files
*
* This function allows to change the permissions that will be received
* by newly created files.
*
* It's possible to change group permissions, public permissions and the
* executable permission for the user. "rw" permissions for the user will
* be always granted to prevent synchronization problems.
*
* To check the effective permissions that will be applied, please use
* MegaApi::getDefaultFilePermissions
*
* Currently, this function only works for OS X and Linux (or any other
* platform using the Posix filesystem layer). On Windows, it doesn't have
* any effect.
*
* @param permissions Permissions for new files in the same format accepted by chmod() (0755, for example)
*/
void setDefaultFilePermissions(int permissions);
/**
* @brief Get default permissions for new files
*
* This function returns the permissions that will be applied to new files.
*
* Currently, this function only works on OS X and Linux (or any other
* platform using the Posix filesystem layer). On Windows it returns 0600
*
* @return Permissions for new files in the same format accepted by chmod() (0755, for example)
*/
int getDefaultFilePermissions();
/**
* @brief Set default permissions for new folders
*
* This function allows to change the permissions that will be received
* by newly created folders.
*
* It's possible to change group permissions and public permissions.
* "rwx" permissions for the user will be always granted to prevent
* synchronization problems.
*
* To check the effective permissions that will be applied, please use
* MegaApi::getDefaultFolderPermissions
*
* Currently, this function only works for OS X and Linux (or any other
* platform using the Posix filesystem layer). On Windows, it doesn't have
* any effect.
*
* @param permissions Permissions for new folders in the same format accepted by chmod() (0755, for example)
*/
void setDefaultFolderPermissions(int permissions);
/**
* @brief Get default permissions for new folders
*
* This function returns the permissions that will be applied to new folders.
*
* Currently, this function only works on OS X and Linux (or any other
* platform using the Posix filesystem layer). On Windows, it returns 0700
*
* @return Permissions for new folders in the same format accepted by chmod() (0755, for example)
*/
int getDefaultFolderPermissions();
/**
* @brief Get the time (in seconds) during which transfers will be stopped due to a bandwidth overquota
* @return Time (in seconds) during which transfers will be stopped, otherwise 0
*/
long long getBandwidthOverquotaDelay();
/**
* @brief Search nodes and allow filtering the results.
* The search is case-insensitive.
*
* You take the ownership of the returned value.
*
* @param filter Container for filtering options, cannot be null
* @param order Order for the returned list
*
* Note: First, the nodes are always sorted by type, being folders always first. Then, the
* specified option is applied in each type block
*
* Valid values for this parameter are:
* - MegaApi::ORDER_NONE = 0
* Undefined order
*
* - MegaApi::ORDER_DEFAULT_ASC = 1
* Alphabetical order, e.g. bar, Car, foo
*
* - MegaApi::ORDER_DEFAULT_DESC = 2
* Alphabetical inverse order, e.g. foo, Car, bar
*
* - MegaApi::ORDER_SIZE_ASC = 3
* Sort by size, small elements first
*
* - MegaApi::ORDER_SIZE_DESC = 4
* Sort by size, small elements last
*
* - MegaApi::ORDER_CREATION_ASC = 5
* Sort by creation time in MEGA, older elements first
*
* - MegaApi::ORDER_CREATION_DESC = 6
* Sort by creation time in MEGA, older elements last
*
* - MegaApi::ORDER_MODIFICATION_ASC = 7
* Sort by modification time of the original file, older modification times first
*
* - MegaApi::ORDER_MODIFICATION_DESC = 8
* Sort by modification time of the original file, older modification times last
*
* - MegaApi::ORDER_LABEL_ASC = 17
* Sort by color label, nodes with colors first
*
* - MegaApi::ORDER_LABEL_DESC = 18
* Sort by color label, nodes with colors last
*
* - MegaApi::ORDER_FAV_ASC = 19
* Sort nodes with favourite attr first
*
* - MegaApi::ORDER_FAV_DESC = 20
* Sort nodes with favourite attr last
*
* @param cancelToken MegaCancelToken to be able to cancel the search at any time.
* @param searchPage Container for pagination options; if null, all results will be returned
*
* @return List with found nodes as MegaNode objects
*/
MegaNodeList* search(const MegaSearchFilter* filter, int order = ORDER_NONE, MegaCancelToken* cancelToken = nullptr, const MegaSearchPage* searchPage = nullptr);
/**
* @brief Get a list of buckets, each bucket containing a list of recently added/modified
* nodes
*
* Each bucket contains files that were added/modified in a set, by a single user.
*
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNumber - Returns the number of days since nodes will be considerated
* - MegaRequest::getParamType - Returns the maximun number of nodes
*
* The associated request type with this request is MegaRequest::TYPE_GET_RECENT_ACTIONS
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getRecentActions - Returns buckets with a list of recently added/modified
* nodes
*
* The recommended values for the following parameters are to consider
* interactions during the last 30 days and maximum 500 nodes.
*
* Note: Nodes sensitives are NOT excluded by default. Nodes are considered
* sensitive if they have that property set, or one of their ancestors has it.
* Use getRecentActionsAsync with explicit excludeSensitives flag
* to search for sensitives and filter them depending on the flag value
*
* @deprecated use getRecentActionsAsync(days, maxnodes, excludeSensitives, listener)
*
* @param days Age of actions since added/modified nodes will be considered (in days)
* @param maxnodes Maximum amount of nodes to be considered
* @param listener MegaRequestListener to track this request
*/
void getRecentActionsAsync(unsigned days, unsigned maxnodes, MegaRequestListener *listener = NULL);
/**
* @brief Get a list of buckets, each bucket containing a list of recently added/modified
* nodes
*
* Each bucket contains files that were added/modified in a set, by a single user.
*
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNumber - Returns the number of days since nodes will be considerated
* - MegaRequest::getParamType - Returns the maximun number of nodes
* - MegaRequest::getFlag - Returns true if sensitives are excluded
*
* The associated request type with this request is MegaRequest::TYPE_GET_RECENT_ACTIONS
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getRecentActions - Returns buckets with a list of recently added/modified
* nodes
*
* The recommended values for the following parameters are to consider
* interactions during the last 30 days and maximum 500 nodes.
*
* @param days Age of actions since added/modified nodes will be considered (in days)
* @param maxnodes Maximum amount of nodes to be considered
* @param excludeSensitives Set to true to filter out sensitive nodes (Nodes are considered
* sensitive if they have that property set, or one of their ancestors has it)
* @param listener MegaRequestListener to track this request
*/
void getRecentActionsAsync(unsigned days,
unsigned maxnodes,
bool excludeSensitives,
MegaRequestListener* listener = NULL);
/**
* @brief Clear the account’s recent actions history up to a given timestamp.
*
* This method clears the recent actions history on the account by setting a
* “recent clear” timestamp. All actions that occurred at or before the given
* timestamp are considered cleared.
*
* The associated request type for this operation is
* MegaRequest::TYPE_SET_ATTR_USER.
*
* Valid data available in the MegaRequest object received in callbacks:
* - MegaRequest::getParamType - Returns the user attribute type
* MegaApi::USER_ATTR_RECENT_CLEAR_TIMESTAMP
* - MegaRequest::getNumber - Returns the epoch time (in seconds) used as the recent
* actions history clear timestamp.
*
* @param until Epoch time (in seconds). Recent actions up to this time will be cleared.
* @param listener Optional MegaRequestListener to track this request.
*/
void clearRecentActionHistory(MegaTimeStamp until, MegaRequestListener* listener = nullptr);
/**
* @brief Process a node tree using a MegaTreeProcessor implementation
* @param node The parent node of the tree to explore
* @param processor MegaTreeProcessor that will receive callbacks for every node in the tree
* @param recursive True if you want to recursively process the whole node tree.
* False if you want to process the children of the node only
*
* @return True if all nodes were processed. False otherwise (the operation can be
* cancelled by MegaTreeProcessor::processMegaNode())
*/
bool processMegaTree(MegaNode* node, MegaTreeProcessor* processor, bool recursive = 1);
/**
* @brief Create a MegaNode that represents a file of a different account
*
* The resulting node can be used in MegaApi::startDownload and MegaApi::startStreaming but
* can not be copied.
*
* At least the parameters handle, key, size, mtime and auth must be correct to be able to use the resulting node.
*
* You take the ownership of the returned value.
*
* @param handle Handle of the node
* @param key Key of the node (Base64 encoded)
* @param name Name of the node (Base64 encoded)
* @param size Size of the node
* @param mtime Modification time of the node
* @param crc portion of the file's Fingerprint (base 64)
* @param parentHandle Handle of the parent node
* @param privateAuth Private authentication token to access the node
* @param publicAuth Public authentication token to access the node
* @param chatAuth Chat authentication token to access the node
* @return MegaNode object
*/
MegaNode *createForeignFileNode(MegaHandle handle, const char *key, const char *name,
int64_t size, int64_t mtime, const char* fingerprintCrc,
MegaHandle parentHandle, const char *privateAuth, const char *publicAuth, const char *chatAuth);
/**
* @brief Create a MegaNode that represents a folder of a different account
*
* The resulting node can not be successfully used in any other function of MegaApi.
* The resulting object is only useful to store the values passed as parameters.
*
* You take the ownership of the returned value.
* @param handle Handle of the node
* @param name Name of the node (Base64 encoded)
* @param parentHandle Handle of the parent node
* @param privateAuth Private authentication token to access the node
* @param publicAuth Public authentication token to access the node
* @return MegaNode object
*/
MegaNode *createForeignFolderNode(MegaHandle handle, const char *name, MegaHandle parentHandle, const char *privateAuth, const char *publicAuth);
/**
* @brief Returns a MegaNode that can be downloaded with any instance of MegaApi
*
* You can use MegaApi::startDownload with the resulting node with any instance
* of MegaApi, even if it's logged into another account, a public folder, or not
* logged in.
*
* If the first parameter is a public node or an already authorized node, this
* function returns a copy of the node, because it can be already downloaded
* with any MegaApi instance.
*
* If the node in the first parameter belongs to the account or public folder
* in which the current MegaApi object is logged in, this funtion returns an
* authorized node.
*
* If the first parameter is NULL or a node that is not a public node, is not
* already authorized and doesn't belong to the current MegaApi, this function
* returns NULL.
*
* You take the ownership of the returned value.
*
* @param node MegaNode to authorize
* @return Authorized node, or NULL if the node can't be authorized
*/
MegaNode *authorizeNode(MegaNode *node);
#ifdef ENABLE_CHAT
/**
* @brief Returns a MegaNode that can be downloaded/copied with a chat-authorization
*
* During preview of chat-links, you need to call this method to authorize the MegaNode
* from a node-attachment message, so the API allows to access to it. The parameter to
* authorize the access can be retrieved from MegaChatRoom::getAuthorizationToken when
* the chatroom in in preview mode.
*
* You can use MegaApi::startDownload and/or MegaApi::copyNode with the resulting
* node with any instance of MegaApi, even if it's logged into another account,
* a public folder, or not logged in.
*
* You take the ownership of the returned value.
*
* @param node MegaNode to authorize
* @param cauth Authorization token (public handle of the chatroom in B64url encoding)
* @return Authorized node, or NULL if the node can't be authorized
*/
MegaNode *authorizeChatNode(MegaNode *node, const char *cauth);
#endif
/**
* @brief Get the SDK version
*
* The returned string is an statically allocated array.
* Do not delete it.
*
* @return SDK version
*/
const char *getVersion();
/**
* @brief Get a string with the version of the operating system
*
* You take ownership of the returned string. Use delete[] to release the memory.
*
* @return Version of the operating system
*/
char *getOperatingSystemVersion();
/**
* @deprecated
*/
MEGA_DEPRECATED
void getLastAvailableVersion(const char *appKey = NULL, MegaRequestListener *listener = NULL);
/**
* @brief Get a SSL certificate for communications with the webclient
*
* The associated request type with this request is MegaRequest::TYPE_GET_LOCAL_SSL_CERT
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getNumber - Returns the expiration time of the certificate (in seconds since the Epoch)
* - MegaRequest::getMegaStringMap - Returns the data of the certificate
*
* The data returned in the string map is encoded in PEM format.
* The key "key" of the map contains the private key of the certificate.
* The key "cert" of the map contains the certificate.
* Intermediate certificates are provided in keys "intermediate_1" - "intermediate_X".
*
* @param listener MegaRequestListener to track this request
*/
void getLocalSSLCertificate(MegaRequestListener *listener = NULL);
/**
* @brief Get the IP of a MegaChat server
*
* This function allows to get the correct IP to connect to a MEGAchat server
* using Websockets.
*
* The associated request type with this request is MegaRequest::TYPE_QUERY_DNS
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getText - Returns the IP of the hostname.
* IPv6 addresses are returned between brackets
*
* @param hostname Hostname to resolve
* @param listener MegaRequestListener to track this request
*/
void queryDNS(const char *hostname, MegaRequestListener *listener = NULL);
/**
* @brief Download a file using a HTTP GET request
*
* The associated request type with this request is MegaRequest::TYPE_DOWNLOAD_FILE
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getNumber - Return the HTTP status code from the server
* - MegaRequest::getTotalBytes - Returns the number of bytes of the file
*
* If the request finishes with the error code MegaError::API_OK, the destination path
* contains the downloaded file. If it's not possible to write in the destination path
* the error code will be MegaError::API_EWRITE
*
* @param url URL of the file
* @param dstpath Destination path for the downloaded file
* @param listener MegaRequestListener to track this request
*/
void downloadFile(const char *url, const char *dstpath, MegaRequestListener *listener = NULL);
/**
* @brief Get the User-Agent header used by the SDK
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaApi object is deleted.
*
* @return User-Agent used by the SDK
*/
const char *getUserAgent();
/**
* @brief Get the base path set during initialization
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaApi object is deleted.
*
* @return Base path
*/
const char *getBasePath();
/**
* @brief Disable special features related to images and videos
*
* Disabling these features will avoid the upload of previews and thumbnails
* for images and videos.
*
* It's only recommended to disable these features before uploading files
* with image or video extensions that are not really images or videos,
* or that are encrypted in the local drive so they can't be analyzed anyway.
*
* By default, graphic features are enabled if the SDK was built with a valid
* graphic processor or a valid graphic processor was provided in the constructor
* of MegaApi.
*
* @param disable True to disable special features related to images and videos
*/
void disableGfxFeatures(bool disable);
/**
* @brief Check if special graphic features are disabled
*
* By default, graphic features are enabled so this function will return false.
* If graphic features were previously disabled, or the SDK wasn't built with
* a valid graphic processor and it wasn't provided in the constructor on MegaApi,
* this function will return true.
*
* @return True if special features related to images and videos are disabled
*/
bool areGfxFeaturesDisabled();
/**
* @brief Change the API URL
*
* This function allows to change the API URL.
* It's only useful for testing or debugging purposes.
*
* @param apiURL New API URL
* @param disablepkp true to disable public key pinning for this URL
*/
void changeApiUrl(const char *apiURL, bool disablepkp = false);
/**
* @brief Set the language code used by the app
* @param languageCode Language code used by the app
*
* @return True if the language code is known for the SDK, otherwise false
*/
bool setLanguage(const char* languageCode);
/**
* @brief Enables or disables database indexes used for search functionality.
*
* To optimize performance for applications that do not require search operations,
* it is possible to disable specific database indexes that are only used for search
* queries. This can reduce database overhead in apps where search is not used (S4).
*
* @note By default, this option is enabled (`true`).
*
* @note This method must be called before login and fetchnodes and its value is not reset
* upon logout. If indexes already exist, they will be removed when the database is opened.
* If indexes has been removed or never created, they won't be created
*
* @param enable Set to `true` to enable indexes for search functionality, or `false` to
* disable them.
* @return
* - `API_OK` - Operation completed successfully.
* - `API_EACCESS` - The operation could not be performed because the user is already logged
* in.
*/
int enableSearchDBIndexes(bool enable);
/**
* @brief Generate an unique ViewID
*
* The caller gets the ownership of the object. Use delete[] to release the memory.
*
* A ViewID consists of a random generated id, encoded in hexadecimal as 16 characters of a null-terminated string.
*/
const char* generateViewId();
/**
* @brief Set the preferred language of the user
*
* Valid data in the MegaRequest object received in onRequestFinish:
* - MegaRequest::getText - Return the language code
*
* If the language code is unknown for the SDK, the error code will be MegaError::API_ENOENT
*
* This attribute is automatically created by the server. Apps only need
* to set the new value when the user changes the language.
*
* @param languageCode Language code to be set
* @param listener MegaRequestListener to track this request
*/
void setLanguagePreference(const char* languageCode, MegaRequestListener *listener = NULL);
/**
* @brief Get the preferred language of the user
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getText - Return the language code
*
* @param listener MegaRequestListener to track this request
*/
void getLanguagePreference(MegaRequestListener *listener = NULL);
/**
* @brief Enable or disable file versioning
*
* The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER
*
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the value MegaApi::USER_ATTR_DISABLE_VERSIONS
*
* Valid data in the MegaRequest object received in onRequestFinish:
* - MegaRequest::getText - "1" for disable, "0" for enable
*
* @param disable True to disable file versioning. False to enable it
* @param listener MegaRequestListener to track this request
*/
void setFileVersionsOption(bool disable, MegaRequestListener *listener = NULL);
/**
* @brief Enable or disable the automatic approval of incoming contact requests using a
* contact link
*
* The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER
*
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the value
* MegaApi::USER_ATTR_CONTACT_LINK_VERIFICATION
*
* Valid data in the MegaRequest object received in onRequestFinish:
* - MegaRequest::getText - "0" for disable, "1" for enable
*
* @param enable True to enable the automatic approval of incoming contact requests using a
* contact link
* @param listener MegaRequestListener to track this request
*/
void setContactLinksOption(bool enable, MegaRequestListener* listener = NULL);
/**
* @brief Check if file versioning is enabled or disabled
*
* The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
*
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the value MegaApi::USER_ATTR_DISABLE_VERSIONS
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getText - "1" for disable, "0" for enable
* - MegaRequest::getFlag - True if disabled, false if enabled
*
* If the option has never been set, the error code will be MegaError::API_ENOENT.
* In that case, file versioning is enabled by default and MegaRequest::getFlag returns false.
*
* @param listener MegaRequestListener to track this request
*/
void getFileVersionsOption(MegaRequestListener *listener = NULL);
/**
* @brief Check if the automatic approval of incoming contact requests using contact links is enabled or disabled
*
* If the option has never been set, the error code will be MegaError::API_ENOENT.
*
* The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
*
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the value MegaApi::USER_ATTR_CONTACT_LINK_VERIFICATION
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getText - "0" for disable, "1" for enable
* - MegaRequest::getFlag - false if disabled, true if enabled
*
* @param listener MegaRequestListener to track this request
*/
void getContactLinksOption(MegaRequestListener *listener = NULL);
/**
* @brief Keep retrying when public key pinning fails
*
* By default, when the check of the MEGA public key fails, it causes an automatic
* logout. Pass false to this function to disable that automatic logout and
* keep the SDK retrying the request.
*
* Even if the automatic logout is disabled, a request of the type MegaRequest::TYPE_LOGOUT
* will be automatically created and callbacks (onRequestStart, onRequestFinish) will
* be sent. However, logout won't be really executed and in onRequestFinish the error code
* for the request will be MegaError::API_EINCOMPLETE
*
* @param enable true to keep retrying failed requests due to a fail checking the MEGA public key
* or false to perform an automatic logout in that case
*/
void retrySSLerrors(bool enable);
/**
* @brief Enable / disable the public key pinning
*
* Public key pinning is enabled by default for all sensible communications.
* It is strongly discouraged to disable this feature.
*
* @param enable true to keep public key pinning enabled, false to disable it
*/
void setPublicKeyPinning(bool enable);
/**
* @brief Pause the reception of action packets
*
* This function is intended to help apps to initialize themselves
* after the reception of nodes (MegaApi::fetchNodes) but before the reception
* of action packets.
*
* For that purpose, this function can be called synchronously in the callback
* onRequestFinish related to the fetchNodes request.
*
* After your initialization is finished, you can call MegaApi::resumeActionPackets
* to start receiving external updates.
*
* If you forget to call MegaApi::resumeActionPackets after the usage of this function
* the SDK won't work properly. Do not use this function for other purposes.
*/
void pauseActionPackets();
/**
* @brief Resume the reception of action packets
* @see MegaApi::pauseActionPackets
*/
void resumeActionPackets();
#ifdef _WIN32
/**
* @brief Convert an UTF16 string to UTF8 (Windows only)
*
* If the conversion fails, the size of the string will be 0
* If the input string is empty, the size of the result will be also 0
* You can know that the conversion failed checking if the size of the input
* is not 0 and the size of the output is zero
*
* @param utf16data UTF16 buffer
* @param utf16size Size of the UTF16 buffer (in characters)
* @param utf8string Pointer to a string that will be filled with UTF8 characters
*/
static void utf16ToUtf8(const wchar_t* utf16data, int utf16size, std::string* utf8string);
/**
* @brief Convert an UTF8 string to UTF16 (Windows only)
*
* The converted string will always be a valid UTF16 string. It will have a trailing null byte
* added to the string, that along with the null character of the string itself forms a valid
* UTF16 string terminator character. Thus, it's valid to pass utf16string->data() to any function
* accepting a UTF16 string.
*
* If the conversion fails, the size of the string will be 1 (null character)
* If the input string is empty, the size of the result will be also 1 (null character)
* You can know that the conversion failed checking if the size of the input
* is not 0 (or NULL) and the size of the output is zero
*
* @param utf8data NULL-terminated UTF8 character array
* @param utf16string Pointer to a string that will be filled with UTF16 characters
*/
static void utf8ToUtf16(const char* utf8data, std::string* utf16string);
#endif
/**
* @brief Make a name suitable for a file name in the local filesystem
*
* This function escapes (%xx) forbidden characters in the local filesystem if needed.
* You can revert this operation using MegaApi::unescapeFsIncompatible
*
* If no dstPath is provided or filesystem type it's not supported this method will
* escape characters contained in the following list: \/:?\"<>|*
* Otherwise it will check forbidden characters for local filesystem type
*
* The input string must be UTF8 encoded. The returned value will be UTF8 too.
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @param filename Name to convert (UTF8)
* @param dstPath Destination path
* @return Converted name (UTF8)
*/
char* escapeFsIncompatible(const char *filename, const char *dstPath);
/**
* @brief Unescape a file name escaped with MegaApi::escapeFsIncompatible
*
* If no localPath is provided or filesystem type it's not supported, this method will
* unescape those sequences that once has been unescaped results in any character
* of the following list: \/:?\"<>|*
* Otherwise it will unescape those characters forbidden in local filesystem type
*
* The input string must be UTF8 encoded. The returned value will be UTF8 too.
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @param name Escaped name to convert (UTF8)
* @param localPath Local path
* @return Converted name (UTF8)
*/
char* unescapeFsIncompatible(const char *name, const char *localPath);
/**
* @brief Create a thumbnail for an image
* @param imagePath Image path
* @param dstPath Destination path for the thumbnail (including the file name)
* @return True if the thumbnail was successfully created, otherwise false.
*/
bool createThumbnail(const char *imagePath, const char *dstPath);
/**
* @brief Create a preview for an image
* @param imagePath Image path
* @param dstPath Destination path for the preview (including the file name)
* @return True if the preview was successfully created, otherwise false.
*/
bool createPreview(const char *imagePath, const char *dstPath);
/**
* @brief Create an avatar from an image
* @param imagePath Image path
* @param dstPath Destination path for the avatar (including the file name)
* @return True if the avatar was successfully created, otherwise false.
*/
bool createAvatar(const char *imagePath, const char *dstPath);
/**
* @brief Request the URL suitable for uploading a media file.
*
* This function requests the URL needed for uploading the file. The URL will need the urlSuffix
* from the MegaBackgroundMediaUpload::encryptFile to be appended before actually sending.
*
* The associated request type with this request is MegaRequest::TYPE_GET_BACKGROUND_UPLOAD_URL
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getMegaBackgroundMediaUpload - The updated state of the upload with the URL in the MegaBackgroundMediaUpload::getUploadUrl
*
* Call this function just once (per file) to find out the URL to upload to, and upload all the pieces to the same
* URL. If errors are encountered and the operation must be restarted from scratch, then a new URL should be requested.
* A new URL could specify a different upload server for example.
*
* @param fullFileSize The size of the file
* @param state A pointer to the MegaBackgroundMediaUpload object tracking this upload
* @param listener MegaRequestListener to track this request
*/
void backgroundMediaUploadRequestUploadURL(int64_t fullFileSize, MegaBackgroundMediaUpload* state, MegaRequestListener *listener);
/**
* @brief Create the node after completing the upload of the file by the app.
*
* Note: added for the use of MEGAproxy and not otherwise supported
*
* Call this function after completing the upload of all the file data
* The node representing the file will be created in the cloud, with all the suitable
* attributes and file attributes attached.
*
* The associated request type with this request is MegaRequest::TYPE_COMPLETE_BACKGROUND_UPLOAD
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getPassword - Returns the original fingerprint
* - MegaRequest::getNewPassword - Returns the fingerprint
* - MegaRequest::getName - Returns the name
* - MegaRequest::getParentHandle - Returns the parent nodehandle
* - MegaRequest::getSessionKey - Returns the upload token converted to B64url encoding
* - MegaRequest::getPrivateKey - Returns the file key provided in B64url encoding
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getNodeHandle - Returns the handle of the uploaded node
* - MegaRequest::getFlag - True if target folder (\c parent) was overriden
*
* @param utf8Name The leaf name of the file, utf-8 encoded
* @param parent The folder node under which this new file should appear
* @param fingerprint The fingerprint for the uploaded file (use MegaApi::getFingerprint to generate this)
* @param fingerprintoriginal If the file uploaded is modified from the original,
* pass the fingerprint of the original file here, otherwise NULL.
* @param string64UploadToken The token returned from the upload of the last portion of the file,
* which is exactly 36 binary bytes, converted to a base 64 string with MegaApi::binaryToString64.
* @param string64FileKey file encryption key converted to a base 64 string with MegaApi::binaryToString64.
* @param listener MegaRequestListener to track this request
*/
void completeUpload(const char* utf8Name, MegaNode *parent, const char* fingerprint, const char* fingerprintoriginal,
const char *string64UploadToken, const char *string64FileKey, MegaRequestListener *listener);
/**
* @brief Request the URL suitable for uploading a file.
*
* Note: added for the use of MEGAproxy and not otherwise supported
*
* This function requests the base URL needed for uploading the file.
* The URL will need the urlSuffix resulting from encryption.
*
* The associated request type with this request is MegaRequest::TYPE_GET_BACKGROUND_UPLOAD_URL
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getName - The URL to use
* - MegaRequest::getLink - The IPv4 of the upload server
* - MegaRequest::getText - The IPv6 of the upload server
*
* Call this function just once (per file) to find out the URL to upload to, and upload all the pieces to the same
* URL. If errors are encountered and the operation must be restarted from scratch, then a new URL should be requested.
* A new URL could specify a different upload server for example.
*
* @param fullFileSize The size of the file
* @param forceSSL Enforce getting a https URL
* @param listener MegaRequestListener to track this request
*/
void getUploadURL(int64_t fullFileSize, bool forceSSL, MegaRequestListener *listener);
/**
* @brief Request the URL suitable for uploading a thubmnail for a node.
*
* Note: added for the use of MEGAproxy
*
* This function requests the base URL needed for uploading the thumbnail.
*
* The associated request type with this request is MegaRequest::TYPE_GET_FA_UPLOAD_URL
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getName - The URL to use
* - MegaRequest::getLink - The IPv4 of the upload server
* - MegaRequest::getText - The IPv6 of the upload server
*
* Call this function just once (per file) to find out the URL to upload to, and upload all the pieces to the same
* URL. If errors are encountered and the operation must be restarted from scratch, then a new URL should be requested.
* A new URL could specify a different upload server for example.
*
* @param nodehandle handle of the node
* @param fullFileSize The size of the thumbnail
* @param forceSSL Enforce getting a https URL
* @param listener MegaRequestListener to track this request
*/
void getThumbnailUploadURL(MegaHandle nodehandle, int64_t fullFileSize, bool forceSSL, MegaRequestListener *listener);
/**
* @brief Request the URL suitable for uploading a preview for a node.
*
* Note: added for the use of MEGAproxy
*
* This function requests the base URL needed for uploading the preview.
*
* The associated request type with this request is MegaRequest::TYPE_GET_FA_UPLOAD_URL
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getName - The URL to use
* - MegaRequest::getLink - The IPv4 of the upload server
* - MegaRequest::getText - The IPv6 of the upload server
*
* Call this function just once (per file) to find out the URL to upload to, and upload all the pieces to the same
* URL. If errors are encountered and the operation must be restarted from scratch, then a new URL should be requested.
* A new URL could specify a different upload server for example.
*
* @param nodehandle handle of the node
* @param fullFileSize The size of the preview
* @param forceSSL Enforce getting a https URL
* @param listener MegaRequestListener to track this request
*/
void getPreviewUploadURL(MegaHandle nodehandle, int64_t fullFileSize, bool forceSSL, MegaRequestListener *listener);
/**
* @brief Create the node after completing the background upload of the file.
*
* Call this function after completing the background upload of all the file data
* The node representing the file will be created in the cloud, with all the suitable
* attributes and file attributes attached.
*
* The associated request type with this request is MegaRequest::TYPE_COMPLETE_BACKGROUND_UPLOAD
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getMegaBackgroundMediaUploadPtr() - Returns the provided state
* - MegaRequest::getPassword - Returns the original fingerprint
* - MegaRequest::getNewPassword - Returns the fingerprint
* - MegaRequest::getName - Returns the name
* - MegaRequest::getParentHandle - Returns the parent nodehandle
* - MegaRequest::getSessionKey - Returns the upload token converted to B64url encoding
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getNodeHandle - Returns the handle of the uploaded node
* - MegaRequest::getFlag - True if target folder (\c parent) was overriden
*
* @param state The MegaBackgroundMediaUpload object tracking this upload
* @param utf8Name The leaf name of the file, utf-8 encoded
* @param parent The folder node under which this new file should appear
* @param fingerprint The fingerprint for the uploaded file (use MegaApi::getFingerprint to generate this)
* @param fingerprintoriginal If the file uploaded is modified from the original,
* pass the fingerprint of the original file here, otherwise NULL.
* @param string64UploadToken The token returned from the upload of the last portion of the file,
* which is exactly 36 binary bytes, converted to a base 64 string with MegaApi::binaryToString64.
* @param listener MegaRequestListener to track this request
*/
void backgroundMediaUploadComplete(MegaBackgroundMediaUpload* state, const char *utf8Name, MegaNode *parent,
const char *fingerprint, const char *fingerprintoriginal, const char *string64UploadToken, MegaRequestListener *listener);
/**
* @brief Call this to enable the library to attach media info attributes
*
* Those attributes allows to know if a file is a video, and play it with the correct codec.
*
* If media info is not ready, this function returns false and automatically retrieves the mappings for type names
* and MEGA encodings, required to analyse media files. When media info is received, the callbacks
* MegaListener::onEvent and MegaGlobalListener::onEvent are called with the MegaEvent::EVENT_MEDIA_INFO_READY.
*
* @return True if the library is ready, otherwise false (the request for media translation data is sent to MEGA)
*/
bool ensureMediaInfo();
/**
* @brief Set the OriginalFingerprint of a node.
*
* Use this call to attach an originalFingerprint to a node. The fingerprint must
* be generated from the file prior to modification, where this node is the modified file.
*
* The associated request type with this request is MegaRequest::TYPE_SET_ATTR_NODE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the node
* - MegaRequest::getText - Returns the specified fingerprint
* - MegaRequest::getFlag - Returns true (official attribute)
* - MegaRequest::getParamType - Returns MegaApi::NODE_ATTR_ORIGINALFINGERPRINT
*
* @param node The node to attach the originalFingerprint to.
* @param originalFingerprint The fingerprint of the file before modification
* @param listener MegaRequestListener to track this request
*/
void setOriginalFingerprint(MegaNode* node, const char* originalFingerprint, MegaRequestListener *listener);
/**
* @brief Convert a Base64 string to Base32
*
* If the input pointer is NULL, this function will return NULL.
* If the input character array isn't a valid base64 string
* the effect is undefined
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @param base64 NULL-terminated Base64 character array
* @return NULL-terminated Base32 character array
*/
static char *base64ToBase32(const char *base64);
/**
* @brief Convert a Base32 string to Base64
*
* If the input pointer is NULL, this function will return NULL.
* If the input character array isn't a valid base32 string
* the effect is undefined
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @param base32 NULL-terminated Base32 character array
* @return NULL-terminated Base64 character array
*/
static char *base32ToBase64(const char *base32);
/**
* @brief Function to copy a buffer
*
* The new buffer is allocated by new[] so you should release
* it with delete[].
* If the function is passed NULL, it will return NULL.
*
* @param buffer Character buffer to copy
* @return Copy of the character buffer
*/
static char* strdup(const char* buffer);
/**
* @brief Recursively remove all local files/folders inside a local path
* @param path Local path of a folder to start the recursive deletion
* The folder itself is not deleted
*/
static void removeRecursively(const char *path);
/**
* @brief Check if the connection with MEGA servers is OK
*
* It can briefly return false even if the connection is good enough when
* some storage servers are temporarily not available or the load of API
* servers is high.
*
* @return true if the connection is perfectly OK, otherwise false
*/
bool isOnline();
#ifdef HAVE_LIBUV
enum {
TCP_SERVER_DENY_ALL = -1,
TCP_SERVER_ALLOW_ALL = 0,
TCP_SERVER_ALLOW_CREATED_LOCAL_LINKS = 1,
TCP_SERVER_ALLOW_LAST_LOCAL_LINK = 2
};
//kept for backwards compatibility
enum {
HTTP_SERVER_DENY_ALL = -1,
HTTP_SERVER_ALLOW_ALL = 0,
HTTP_SERVER_ALLOW_CREATED_LOCAL_LINKS = 1,
HTTP_SERVER_ALLOW_LAST_LOCAL_LINK = 2
};
/**
* @brief Start an HTTP proxy server in specified port
*
* If this function returns true, that means that the server is
* ready to accept connections. The initialization is synchronous.
*
* The server will serve files using this URL format:
* http://127.0.0.1/<NodeHandle>/<NodeName>
*
* The node name must be URL encoded and must match with the node handle.
* You can generate a correct link for a MegaNode using MegaApi::httpServerGetLocalLink
*
* If the node handle belongs to a folder node, a web with the list of files
* inside the folder is returned.
*
* It's important to know that the HTTP proxy server has several configuration options
* that can restrict the nodes that will be served and the connections that will be
* accepted.
*
* These are the default options:
* - The restricted mode of the server is set to
* MegaApi::TCP_SERVER_ALLOW_CREATED_LOCAL_LINKS (see MegaApi::httpServerSetRestrictedMode)
*
* - Folder nodes are NOT allowed to be served (see MegaApi::httpServerEnableFolderServer)
* - File nodes are allowed to be served (see MegaApi::httpServerEnableFileServer)
* - Subtitles support is disabled (see MegaApi::httpServerEnableSubtitlesSupport)
*
* The HTTP server will only stream a node if it's allowed by all configuration options.
*
* @param localOnly true to listen on 127.0.0.1 only, false to listen on all network
* interfaces
* @param port Port in which the server must accept connections. A free port is selected if
* it is 0.
* @param useTLS Use TLS (default false).
* If the SDK compilation does not support TLS,
* enabling this flag will cause the function to return false.
* @param certificatepath path to certificate (PEM format)
* @param keypath path to certificate key
* @param useIPv6 true to use [::1] as host, false to use 127.0.0.1
* @return True if the server is ready, false if the initialization failed
*/
bool httpServerStart(bool localOnly = true, int port = 4443, bool useTLS = false, const char *certificatepath = NULL, const char * keypath = NULL, bool useIPv6 = false);
/**
* @brief Stop the HTTP proxy server
*
* When this function returns, the server is already shutdown.
* If the HTTP proxy server isn't running, this functions does nothing
*/
void httpServerStop();
/**
* @brief Check if the HTTP proxy server is running
* @return 0 if the server is not running. Otherwise the port in which it's listening to
*/
int httpServerIsRunning();
/**
* @brief Check if the HTTP proxy server is listening on all network interfaces
* @return true if the HTTP proxy server is listening on 127.0.0.1 only, or it's not started.
* If it's started and listening on all network interfaces, this function returns false
*/
bool httpServerIsLocalOnly();
/**
* @brief Allow/forbid to serve files
*
* By default, files are served (when the server is running)
*
* Even if files are allowed to be served by this function, restrictions related to
* other configuration options (MegaApi::httpServerSetRestrictedMode) are still applied.
*
* @param enable true to allow to server files, false to forbid it
*/
void httpServerEnableFileServer(bool enable);
/**
* @brief Check if it's allowed to serve files
*
* This function can return true even if the HTTP proxy server is not running
*
* Even if files are allowed to be served by this function, restrictions related to
* other configuration options (MegaApi::httpServerSetRestrictedMode) are still applied.
*
* @return true if it's allowed to serve files, otherwise false
*/
bool httpServerIsFileServerEnabled();
/**
* @brief Allow/forbid to serve folders
*
* By default, folders are NOT served
*
* Even if folders are allowed to be served by this function, restrictions related to
* other configuration options (MegaApi::httpServerSetRestrictedMode) are still applied.
*
* @param enable true to allow to server folders, false to forbid it
*/
void httpServerEnableFolderServer(bool enable);
/**
* @brief Check if it's allowed to serve folders
*
* This function can return true even if the HTTP proxy server is not running
*
* Even if folders are allowed to be served by this function, restrictions related to
* other configuration options (MegaApi::httpServerSetRestrictedMode) are still applied.
*
* @return true if it's allowed to serve folders, otherwise false
*/
bool httpServerIsFolderServerEnabled();
/**
* @brief Stablish FILE_ATTRIBUTE_OFFLINE attribute
*
* By default, it is not enabled
*
* This is used when serving files in WEBDAV, it will cause windows clients to not load a file
* when it is selected. It is intended to reduce unnecessary traffic.
*
* @param enable true to enable the FILE_ATTRIBUTE_OFFLINE attribute, false to disable it
*/
void httpServerEnableOfflineAttribute(bool enable);
/**
* @brief Check if FILE_ATTRIBUTE_OFFLINE it's enabled
*
* @return true if the FILE_ATTRIBUTE_OFFLINE attribute is enabled, otherwise false
*/
bool httpServerIsOfflineAttributeEnabled();
/**
* @brief Enable/disable the restricted mode of the HTTP server
*
* This function allows to restrict the nodes that are allowed to be served.
* For not allowed links, the server will return "407 Forbidden".
*
* Possible values are:
* - HTTP_SERVER_DENY_ALL = -1
* All nodes are forbidden
*
* - HTTP_SERVER_ALLOW_ALL = 0
* All nodes are allowed to be served
*
* - HTTP_SERVER_ALLOW_CREATED_LOCAL_LINKS = 1 (default)
* Only links created with MegaApi::httpServerGetLocalLink are allowed to be served
*
* - HTTP_SERVER_ALLOW_LAST_LOCAL_LINK = 2
* Only the last link created with MegaApi::httpServerGetLocalLink is allowed to be served
*
* If a different value from the list above is passed to this function, it won't have any effect and the previous
* state of this option will be preserved.
*
* The default value of this property is MegaApi::HTTP_SERVER_ALLOW_CREATED_LOCAL_LINKS
*
* The state of this option is preserved even if the HTTP server is restarted, but
* the HTTP proxy server only remembers the generated links since the last call to
* MegaApi::httpServerStart
*
* Even if nodes are allowed to be served by this function, restrictions related to
* other configuration options (MegaApi::httpServerEnableFileServer,
* MegaApi::httpServerEnableFolderServer) are still applied.
*
* @param mode Required state for the restricted mode of the HTTP proxy server
*/
void httpServerSetRestrictedMode(int mode);
/**
* @brief Check if the HTTP proxy server is working in restricted mode
*
* Possible return values are:
* - HTTP_SERVER_DENY_ALL = -1
* All nodes are forbidden
*
* - HTTP_SERVER_ALLOW_ALL = 0
* All nodes are allowed to be served
*
* - HTTP_SERVER_ALLOW_CREATED_LOCAL_LINKS = 1
* Only links created with MegaApi::httpServerGetLocalLink are allowed to be served
*
* - HTTP_SERVER_ALLOW_LAST_LOCAL_LINK = 2
* Only the last link created with MegaApi::httpServerGetLocalLink is allowed to be served
*
* The default value of this property is MegaApi::HTTP_SERVER_ALLOW_CREATED_LOCAL_LINKS
*
* See MegaApi::httpServerEnableRestrictedMode and MegaApi::httpServerStart
*
* Even if nodes are allowed to be served by this function, restrictions related to
* other configuration options (MegaApi::httpServerEnableFileServer,
* MegaApi::httpServerEnableFolderServer) are still applied.
*
* @return State of the restricted mode of the HTTP proxy server
*/
int httpServerGetRestrictedMode();
/**
* @brief Enable/disable the support for subtitles
*
* Subtitles support allows to stream some special links that otherwise wouldn't be valid.
* For example, let's suppose that the server is streaming this video:
* http://120.0.0.1:4443/<Base64Handle>/MyHolidays.avi
*
* Some media players scan HTTP servers looking for subtitle files and request links like these ones:
* http://120.0.0.1:4443/<Base64Handle>/MyHolidays.txt
* http://120.0.0.1:4443/<Base64Handle>/MyHolidays.srt
*
* Even if a file with that name is in the same folder of the MEGA account, the node wouldn't be served because
* the node handle wouldn't match.
*
* When this feature is enabled, the HTTP proxy server will check if there are files with that name
* in the same folder as the node corresponding to the handle in the link.
*
* If a matching file is found, the name is exactly the same as the node with the specified handle
* (except the extension), the node with that handle is allowed to be streamed and this feature is enabled
* the HTTP proxy server will serve that file.
*
* This feature is disabled by default.
*
* @param enable True to enable subtitles support, false to disable it
*/
void httpServerEnableSubtitlesSupport(bool enable);
/**
* @brief Check if the support for subtitles is enabled
*
* See MegaApi::httpServerEnableSubtitlesSupport.
*
* This feature is disabled by default.
*
* @return true of the support for subtibles is enables, otherwise false
*/
bool httpServerIsSubtitlesSupportEnabled();
/**
* @brief Add a listener to receive information about the HTTP proxy server
*
* This is the valid data that will be provided on callbacks:
* - MegaTransfer::getType - It will be MegaTransfer::TYPE_LOCAL_TCP_DOWNLOAD
* - MegaTransfer::getPath - URL requested to the HTTP proxy server
* - MegaTransfer::getFileName - Name of the requested file (if any, otherwise NULL)
* - MegaTransfer::getNodeHandle - Handle of the requested file (if any, otherwise NULL)
* - MegaTransfer::getTotalBytes - Total bytes of the response (response headers + file, if required)
* - MegaTransfer::getStartPos - Start position (for range requests only, otherwise -1)
* - MegaTransfer::getEndPos - End position (for range requests only, otherwise -1)
*
* On the onTransferFinish error, the error code associated to the MegaError can be:
* - MegaError::API_EINCOMPLETE - If the whole response wasn't sent
* (it's normal to get this error code sometimes because media players close connections when they have
* the data that they need)
*
* - MegaError::API_EREAD - If the connection with MEGA storage servers failed
* - MegaError::API_EAGAIN - If the download speed is too slow for streaming
* - A number > 0 means an HTTP error code returned to the client
*
* @param listener Listener to receive information about the HTTP proxy server
*/
void httpServerAddListener(MegaTransferListener *listener);
/**
* @brief Stop the reception of callbacks related to the HTTP proxy server on this listener
* @param listener Listener that won't continue receiving information
*/
void httpServerRemoveListener(MegaTransferListener *listener);
/**
* @brief Returns a URL to a node in the local HTTP proxy server
*
* The HTTP proxy server must be running before using this function, otherwise
* it will return NULL.
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @param node Node to generate the local HTTP link
* @return URL to the node in the local HTTP proxy server, otherwise NULL
*/
char *httpServerGetLocalLink(MegaNode *node);
/**
* @brief Returns a WEBDAV valid URL to a node in the local HTTP proxy server
*
* The HTTP proxy server must be running before using this function, otherwise
* it will return NULL.
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @param node Node to generate the local HTTP link
* @return URL to the node in the local HTTP proxy server, otherwise NULL
*/
char *httpServerGetLocalWebDavLink(MegaNode *node);
/**
* @brief Returns the list with the links of locations served via WEBDAV
*
* The HTTP server must be running before using this function, otherwise
* it will return NULL.
*
* You take the ownership of the returned value
*
* @return URL to the node in the local HTTP server, otherwise NULL
*/
MegaStringList *httpServerGetWebDavLinks();
/**
* @brief Returns the list of nodes served via WEBDAV
*
* The HTTP server must be running before using this function, otherwise
* it will return NULL.
*
* You take the ownership of the returned value
*
* @return URL to the node in the local HTTP server, otherwise NULL
*/
MegaNodeList *httpServerGetWebDavAllowedNodes();
/**
* @brief Stops serving a node via webdav.
* The webdav link will no longer be valid.
*
* @param handle Handle of the node to stop serving
*/
void httpServerRemoveWebDavAllowedNode(MegaHandle handle);
/**
* @brief Stops serving all nodes served via webdav.
* The webdav links will no longer be valid.
*
*/
void httpServerRemoveWebDavAllowedNodes();
/**
* @brief Set the maximum buffer size for the internal buffer and the size of packets
* sent to clients (MaxOutputSize)
*
* Current policy is to set MaxOutputSize to 10% of the param passed in this function.
* Be aware that calling this method will overwrite any previous value of MaxOutputSize.
* Therefore, any call to httpServerSetMaxOutputSize should be performed after a call to
* this method.
*
* The HTTP proxy server has an internal buffer to store the data received from MEGA
* while it's being sent to clients. When the buffer is full, the connection with
* the MEGA storage server is closed, when the buffer has few data, the connection
* with the MEGA storage server is started again.
*
* Even with very fast connections, due to the possible latency starting new connections,
* if this buffer is small the streaming can have problems due to the overhead caused by
* the excessive number of POST requests.
*
* It's recommended to set this buffer at least to 1MB
*
* For connections that request less data than the buffer size, the HTTP proxy server
* will only allocate the required memory to complete the request to minimize the
* memory usage.
*
* The new value will be taken into account since the next request received by
* the HTTP proxy server, not for ongoing requests. It's possible and effective
* to call this function even before the server has been started, and the value
* will be still active even if the server is stopped and started again.
*
* @param bufferSize Maximum buffer size (in bytes) or a number <= 0 to use the
* internal default value
*/
void httpServerSetMaxBufferSize(int bufferSize);
/**
* @brief Get the maximum size of the internal buffer size
*
* See MegaApi::httpServerSetMaxBufferSize
*
* @return Maximum size of the internal buffer size (in bytes)
*/
int httpServerGetMaxBufferSize();
/**
* @brief Set the maximum size of packets sent to clients
*
* For each connection, the HTTP proxy server only sends one write to the underlying
* socket at once. This parameter allows to set the size of that write.
*
* A small value could cause a lot of writes and would lower the performance.
*
* A big value could send too much data to the output buffer of the socket. That could
* keep the internal buffer full of data that hasn't been sent to the client yet,
* preventing the retrieval of additional data from the MEGA storage server. In that
* circumstances, the client could read a lot of data at once and the HTTP server
* could not have enough time to get more data fast enough.
*
* It's recommended to set this value to at least 8192 and no more than the 25% of
* the maximum buffer size (MegaApi::httpServerSetMaxBufferSize).
*
* The new value will be taken into account since the next request received by
* the HTTP proxy server, not for ongoing requests. It's possible and effective
* to call this function even before the server has been started, and the value
* will be still active even if the server is stopped and started again.
*
* @param outputSize Maximun size of data packets sent to clients (in bytes) or
* a number <= 0 to use the internal default value
*/
void httpServerSetMaxOutputSize(int outputSize);
/**
* @brief Get the maximum size of the packets sent to clients
*
* See MegaApi::httpServerSetMaxOutputSize
*
* @return Maximum size of the packets sent to clients (in bytes)
*/
int httpServerGetMaxOutputSize();
/**
* @brief Start an FTP server in specified port
*
* If this function returns true, that means that the server is
* ready to accept connections. The initialization is synchronous.
*
* The server will serve files using this URL format:
* ftp://127.0.0.1:PORT/<NodeHandle>/<NodeName>
*
* The node name must be URL encoded and must match with the node handle.
* You can generate a correct link for a MegaNode using MegaApi::ftpServerGetLocalLink
*
* It's important to know that the FTP server has several configuration options
* that can restrict the nodes that will be served and the connections that will be
* accepted.
*
* These are the default options:
* - The restricted mode of the server is set to
* MegaApi::FTP_SERVER_ALLOW_CREATED_LOCAL_LINKS (see MegaApi::ftpServerSetRestrictedMode)
*
* The FTP server will only stream a node if it's allowed by all configuration options.
*
* @param localOnly true to listen on 127.0.0.1 only, false to listen on all network
* interfaces
* @param port Port in which the server must accept connections. A free port is selected if
* it is 0.
* @param dataportBegin Initial port for FTP data channel
* @param dataPortEnd Final port for FTP data channel (included)
* @param useTLS Use TLS (default false)
* @param certificatepath path to certificate (PEM format)
* @param keypath path to certificate key
* @return True if the server is ready, false if the initialization failed
*/
bool ftpServerStart(bool localOnly = true, int port = 22, int dataportBegin = 1500, int dataPortEnd = 1600, bool useTLS = false, const char *certificatepath = NULL, const char * keypath = NULL);
/**
* @brief Stop the FTP server
*
* When this function returns, the server is already shutdown.
* If the FTP server isn't running, this functions does nothing
*/
void ftpServerStop();
/**
* @brief Check if the FTP server is running
* @return 0 if the server is not running. Otherwise the port in which it's listening to
*/
int ftpServerIsRunning();
/**
* @brief Check if the FTP server is listening on all network interfaces
* @return true if the FTP server is listening on 127.0.0.1 only, or it's not started.
* If it's started and listening on all network interfaces, this function returns false
*/
bool ftpServerIsLocalOnly();
/**
* @brief Enable/disable the restricted mode of the FTP server
*
* This function allows to restrict the nodes that are allowed to be served.
* For not allowed links, the server will return a corresponding "550" error.
*
* Possible values are:
* - TCP_SERVER_DENY_ALL = -1
* All nodes are forbidden
*
* - TCP_SERVER_ALLOW_ALL = 0
* All nodes are allowed to be served
*
* - TCP_SERVER_ALLOW_CREATED_LOCAL_LINKS = 1 (default)
* Only links created with MegaApi::ftpServerGetLocalLink are allowed to be served
*
* - TCP_SERVER_ALLOW_LAST_LOCAL_LINK = 2
* Only the last link created with MegaApi::ftpServerGetLocalLink is allowed to be served
*
* If a different value from the list above is passed to this function, it won't have any effect and the previous
* state of this option will be preserved.
*
* The default value of this property is MegaApi::FTP_SERVER_ALLOW_CREATED_LOCAL_LINKS
*
* The state of this option is preserved even if the FTP server is restarted, but the
* the FTP server only remembers the generated links since the last call to
* MegaApi::ftpServerStart
*
* @param mode State for the restricted mode of the FTP server
*/
void ftpServerSetRestrictedMode(int mode);
/**
* @brief Check if the FTP server is working in restricted mode
*
* Possible return values are:
* - TCP_SERVER_DENY_ALL = -1
* All nodes are forbidden
*
* - TCP_SERVER_ALLOW_ALL = 0
* All nodes are allowed to be served
*
* - TCP_SERVER_ALLOW_CREATED_LOCAL_LINKS = 1
* Only links created with MegaApi::ftpServerGetLocalLink are allowed to be served
*
* - TCP_SERVER_ALLOW_LAST_LOCAL_LINK = 2
* Only the last link created with MegaApi::ftpServerGetLocalLink is allowed to be served
*
* The default value of this property is MegaApi::FTP_SERVER_ALLOW_CREATED_LOCAL_LINKS
*
* See MegaApi::ftpServerEnableRestrictedMode and MegaApi::ftpServerStart
*
* @return State of the restricted mode of the FTP server
*/
int ftpServerGetRestrictedMode();
/**
* @brief Add a listener to receive information about the FTP server
*
* This is the valid data that will be provided on callbacks:
* - MegaTransfer::getType - It will be MegaTransfer::TYPE_LOCAL_TCP_DOWNLOAD
* - MegaTransfer::getPath - URL requested to the FTP server
* - MegaTransfer::getFileName - Name of the requested file (if any, otherwise NULL)
* - MegaTransfer::getNodeHandle - Handle of the requested file (if any, otherwise NULL)
* - MegaTransfer::getTotalBytes - Total bytes of the response (response headers + file, if required)
* - MegaTransfer::getStartPos - Start position (for range requests only, otherwise -1)
* - MegaTransfer::getEndPos - End position (for range requests only, otherwise -1)
*
* On the onTransferFinish error, the error code associated to the MegaError can be:
* - MegaError::API_EINCOMPLETE - If the whole response wasn't sent
* (it's normal to get this error code sometimes because media players close connections when they have
* the data that they need)
*
* - MegaError::API_EREAD - If the connection with MEGA storage servers failed
* - MegaError::API_EAGAIN - If the download speed is too slow for streaming
* - A number > 0 means an FTP error code returned to the client
*
* @param listener Listener to receive information about the FTP server
*/
void ftpServerAddListener(MegaTransferListener *listener);
/**
* @brief Stop the reception of callbacks related to the FTP server on this listener
* @param listener Listener that won't continue receiving information
*/
void ftpServerRemoveListener(MegaTransferListener *listener);
/**
* @brief Returns a URL to a node in the local FTP server
*
* The FTP server must be running before using this function, otherwise
* it will return NULL.
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @param node Node to generate the local FTP link
* @return URL to the node in the local FTP server, otherwise NULL
*/
char *ftpServerGetLocalLink(MegaNode *node);
/**
* @brief Returns the list with the links of locations served via FTP
*
* The FTP server must be running before using this function, otherwise
* it will return NULL.
*
* You take the ownership of the returned value
*
* @return URL to the node in the local FTP server, otherwise NULL
*/
MegaStringList *ftpServerGetLinks();
/**
* @brief Returns the list of nodes served via FTP
*
* The FTP server must be running before using this function, otherwise
* it will return NULL.
*
* You take the ownership of the returned value
*
* @return URL to the node in the local FTP server, otherwise NULL
*/
MegaNodeList *ftpServerGetAllowedNodes();
/**
* @brief Stops serving a node via ftp.
* The ftp link will no longer be valid.
*
* @param handle Handle of the node to stop serving
*/
void ftpServerRemoveAllowedNode(MegaHandle handle);
/**
* @brief Stops serving all nodes served via ftp.
* The ftp links will no longer be valid.
*
*/
void ftpServerRemoveAllowedNodes();
/**
* @brief Set the maximum buffer size for the internal buffer
*
* The FTP server has an internal buffer to store the data received from MEGA
* while it's being sent to clients. When the buffer is full, the connection with
* the MEGA storage server is closed, when the buffer has few data, the connection
* with the MEGA storage server is started again.
*
* Even with very fast connections, due to the possible latency starting new connections,
* if this buffer is small the streaming can have problems due to the overhead caused by
* the excessive number of RETR/REST requests.
*
* It's recommended to set this buffer at least to 1MB
*
* For connections that request less data than the buffer size, the FTP server
* will only allocate the required memory to complete the request to minimize the
* memory usage.
*
* The new value will be taken into account since the next request received by
* the FTP server, not for ongoing requests. It's possible and effective
* to call this function even before the server has been started, and the value
* will be still active even if the server is stopped and started again.
*
* @param bufferSize Maximum buffer size (in bytes) or a number <= 0 to use the
* internal default value
*/
void ftpServerSetMaxBufferSize(int bufferSize);
/**
* @brief Get the maximum size of the internal buffer size
*
* See MegaApi::ftpServerSetMaxBufferSize
*
* @return Maximum size of the internal buffer size (in bytes)
*/
int ftpServerGetMaxBufferSize();
/**
* @brief Set the maximum size of packets sent to clients
*
* For each connection, the FTP server only sends one write to the underlying
* socket at once. This parameter allows to set the size of that write.
*
* A small value could cause a lot of writes and would lower the performance.
*
* A big value could send too much data to the output buffer of the socket. That could
* keep the internal buffer full of data that hasn't been sent to the client yet,
* preventing the retrieval of additional data from the MEGA storage server. In that
* circumstances, the client could read a lot of data at once and the FTP server
* could not have enough time to get more data fast enough.
*
* It's recommended to set this value to at least 8192 and no more than the 25% of
* the maximum buffer size (MegaApi::ftpServerSetMaxBufferSize).
*
* The new value will be taken into account since the next request received by
* the FTP server, not for ongoing requests. It's possible and effective
* to call this function even before the server has been started, and the value
* will be still active even if the server is stopped and started again.
*
* @param outputSize Maximun size of data packets sent to clients (in bytes) or
* a number <= 0 to use the internal default value
*/
void ftpServerSetMaxOutputSize(int outputSize);
/**
* @brief Get the maximum size of the packets sent to clients
*
* See MegaApi::ftpServerSetMaxOutputSize
*
* @return Maximum size of the packets sent to clients (in bytes)
*/
int ftpServerGetMaxOutputSize();
#endif
/**
* @brief Get the MIME type associated with the extension
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @param extension File extension (with or without a leading dot)
* @return MIME type associated with the extension
*/
static char *getMimeType(const char* extension);
#ifdef ENABLE_CHAT
/**
* @brief Creates a chat for one or more participants, allowing you to specify their
* permissions and if the chat should be a group chat or not (when it is just for 2
* participants).
*
* There are two types of chat: permanent an group. A permanent chat is between two people,
* or only with ourselves (note-to-self chat), and participants can not leave it. It's also
* called 1on1 or 1:1.
*
* The creator of the chat will have moderator level privilege and should not be included in
* the list of peers.
*
* On 1:1 chats with a peer, the other participant has also moderator level privilege,
* regardless the privilege level specified.
*
* The associated request type with this request is MegaRequest::TYPE_CHAT_CREATE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getFlag - Returns if the new chat is a group chat or permanent chat
* - MegaRequest::getAccess - Returns zero (private mode)
* - MegaRequest::getMegaTextChatPeerList - List of participants and their privilege level.
* Note-to-self chats have no peers, so this function will return \c nullptr
* - MegaRequest::getText - Returns the title of the chat.
* - MegaRequest::getParamType - Returns a Bitmask with the chat options that will be
* enabled in creation
* - MegaRequest::getMegaScheduledMeetingList - returns a MegaScheduledMeetingList (with a
* MegaScheduledMeeting with data introduced by user)
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getMegaTextChatList - Returns the new chat's information
* - MegaRequest::getMegaScheduledMeetingList - returns a MegaScheduledMeetingList (with
* definitive ScheduledMeeting updated from API)
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_EACCESS - If more than 1 peer is provided for a 1on1 chatroom.
* - MegaError::API_EARGS - If chatOptions param is provided for a 1on1 chat
*
* @note If peers list contains only one person, group chat is not set and a permament chat
* already exists with that person, then this call will return the information for the
* existing chat, rather than a new chat.
*
* @param group Flag to indicate if the chat is a group chat or not
* @param peers MegaTextChatPeerList including other users and their privilege level
* @param title Byte array that contains the chat topic if exists. NULL if no custom title
* is required.
* @param chatOptions Bitmask that contains the chat options to create the chat
* @param scheduledMeeting MegaScheduledMeeting with data introduced by user
* @param listener MegaRequestListener to track this request
*/
void createChat(bool group, MegaTextChatPeerList* peers, const char* title = NULL, int chatOptions = CHAT_OPTIONS_EMPTY, const MegaScheduledMeeting* scheduledMeeting = NULL, MegaRequestListener* listener = NULL);
/**
* @brief Creates a public chatroom for multiple participants (groupchat)
*
* This function allows to create public chats, where the moderator can create chat links to share
* the access to the chatroom via a URL (chat-link). In order to create a public chat-link, the
* moderator needs to create / get a public handle for the chatroom by using \c MegaApi::chatLinkCreate.
*
* The resulting chat-link allows anyone (even users without an account in MEGA) to review the
* history of the chatroom. The \c MegaApi::getChatLinkURL provides the chatd URL to connect.
*
* Users with an account in MEGA can freely join the room by themselves (the privilege
* upon join will be standard / read-write) by using \c MegaApi::chatLinkJoin.
*
* The creator of the chat will have moderator level privilege and should not be included in the
* list of peers.
*
* The associated request type with this request is MegaChatRequest::TYPE_CREATE_CHATROOM
* Valid data in the MegaChatRequest object received on callbacks:
* - MegaChatRequest::getFlag - Returns if the new chat is a group chat or permanent chat
* - MegaRequest::getAccess - Returns one (public mode)
* - MegaChatRequest::getMegaChatPeerList - List of participants and their privilege level
* - MegaChatRequest::getMegaStringMap - MegaStringMap with handles and unified keys or each peer
* - MegaRequest::getText - Returns the title of the chat.
* - MegaRequest::getNumber - Returns if chat room is a meeting room
* - MegaRequest::getParamType - Returns a Bitmask with the chat options that will be enabled in creation
* - MegaRequest::getMegaScheduledMeetingList - returns a MegaScheduledMeetingList (with a MegaScheduledMeeting with data introduced by user)
*
* Valid data in the MegaChatRequest object received in onRequestFinish when the error code
* is MegaError::ERROR_OK:
* - MegaChatRequest::getChatHandle - Returns the handle of the new chatroom
* - MegaRequest::getMegaScheduledMeetingList - returns a MegaScheduledMeetingList (with definitive ScheduledMeeting updated from API)
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_EARGS - If the number of keys doesn't match the number of peers plus one (own user)
*
* @param peers MegaChatPeerList including other users and their privilege level
* @param title Byte array that contains the chat topic if exists. NULL if no custom title is required.
* @param userKeyMap MegaStringMap of user handles in B64 as keys, and unified keys in B64 as values. Own user included
* @param meetingRoom Boolean indicating if room is a meeting room
* @param chatOptions Bitmask that contains the chat options to create the chat
* @param scheduledMeeting MegaScheduledMeeting with data introduced by user
* @param listener MegaChatRequestListener to track this request
*/
void createPublicChat(MegaTextChatPeerList* peers, const MegaStringMap* userKeyMap, const char *title = NULL, bool meetingRoom = false, int chatOptions = CHAT_OPTIONS_EMPTY, const MegaScheduledMeeting* scheduledMeeting = NULL, MegaRequestListener* listener = NULL);
/**
* @brief Enable or disable a option for a chatroom
*
* This function allows to enable or disable one of the following chatroom options:
* - 0x01: SpeakRequest: during calls non-operator users must request permission to speak.
* - 0x02: WaitingRoom: during calls non-operator members will be placed into a waiting room, an operator level user must grant each user access to the call.
* - 0x04: OpenInvite: when enabled allows non-operator level users to invite others into the chat room.
*
* The associated request type with this request is MegaRequest::TYPE_SET_CHAT_OPTIONS
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the chat identifier
* - MegaRequest::Access - Returns the chat option we want to enable disable
* - MegaRequest::getFlag - Returns true if enabled was set true, otherwise it will return false
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_EARGS - If the chatid is invalid
* - MegaError::API_EARGS - If this method is called for a 1on1 chat
* - MegaError::API_ENOENT - If the chatroom does not exists
*
* @param chatid MegaHandle that identifies the chat room
* @param option Chat option that we want to enable/disable
* @param enabled True if we want to enable the option, otherwise false.
* @param listener MegaRequestListener to track this request
*/
void setChatOption(MegaHandle chatid, int option, bool enabled, MegaRequestListener* listener = NULL);
/**
* @brief Creates or updates a scheduled meeting
*
* @note If chatTitle is provided, this method will also update chatroom title.
*
* The associated request type with this request is MegaRequest::TYPE_ADD_UPDATE_SCHEDULED_MEETING
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getMegaScheduledMeetingList - returns a MegaScheduledMeetingList (with a MegaScheduledMeeting with data introduced by user)
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::ERROR_OK:
* MegaRequest::getMegaScheduledMeetingList - returns a MegaScheduledMeetingList (with a MegaScheduledMeeting with definitive ScheduledMeeting updated from API)
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_EARGS - if no scheduled meeting is provided
* - MegaError::API_EARGS - if chatTitle length is zero
* - MegaError::API_ENOENT - if the chatroom does not exists
*
* @param scheduledMeeting MegaScheduledMeeting with data introduced by user
* @param chatTitle Byte array representing the chatroom title, already encrypted for all participants,
* and converted to Base64url encoding.
* @param listener MegaRequestListener to track this request
*/
void createOrUpdateScheduledMeeting(const MegaScheduledMeeting* scheduledMeeting, const char *chatTitle, MegaRequestListener* listener = NULL);
/**
* @brief Removes a scheduled meeting by scheduled meeting id and chatid
*
* The associated request type with this request is MegaRequest::TYPE_DEL_SCHEDULED_MEETING
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the chatroom
* - MegaRequest::getParentHandle - Returns the scheduled meeting id
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_ENOENT - If the chatroom or scheduled meeting does not exists
*
* @param chatid MegaHandle that identifies a chat room
* @param schedId MegaHandle that identifies a scheduled meeting
* @param listener MegaRequestListener to track this request
*
* @deprecated This function is deprecated. Please don't use it in new code.
* Use createOrUpdateScheduledMeeting and set cancelled flag `True` at MegaScheduledMeeting.
* Note: You can use MegaScheduledMeeting::createInstance with cancelled param `True
*/
MEGA_DEPRECATED
void removeScheduledMeeting(MegaHandle chatid, MegaHandle schedId, MegaRequestListener* listener = NULL);
/**
* @brief Get a list of all scheduled meeting for a chatroom, or a specific scheduled meeting (given a scheduled meeting id)
*
* Important consideration:
* For every chatroom there should only exist one root scheduled meeting associated, it means that for all scheduled meeting
* returned by this method, there should be just one scheduled meeting, with an invalid parent sched Id (MegaScheduledMeeting::parentSchedId),
* for every different chatid.
*
* The associated request type with this request is MegaRequest::TYPE_FETCH_SCHEDULED_MEETING
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the chatroom
* - MegaRequest::getParentHandle - Returns the scheduled meeting id
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_ENOENT - If the chatroom does not exists
*
* @param chatid MegaHandle that identifies a chatroom
* @param schedId MegaHandle that identifies a scheduled meeting
* @param listener MegaRequestListener to track this request
*/
void fetchScheduledMeeting(MegaHandle chatid, MegaHandle schedId, MegaRequestListener* listener = NULL);
/**
* @brief Get a list of scheduled meeting occurrences for a chatroom
*
* A scheduled meetings occurrence, is a call that will happen in the future
* A scheduled meeting can produce one or multiple scheduled meeting occurrences
*
* The associated request type with this request is MegaRequest::TYPE_FETCH_SCHEDULED_MEETING_OCCURRENCES
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the handle of the chatroom
* - MegaRequest::getNumber - Returns the dateTime from which we want to fetch occurrences
* - MegaRequest::getTotalBytes - Returns the dateTime until we want to fetch occurrences
* - MegaRequest::getTransferredBytes - Returns the number of occurrences we want to fetch
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_ENOENT - If the chatroom does not exists
*
* @param chatid MegaHandle that identifies a chat room
* @param since DateTime from which we want to fetch occurrences (unix timestamp)
* @param until Datetime until we want to fetch occurrences (unix timestamp)
* @param count Number of occurrences we want to fetch
* @param listener MegaChatRequestListener to track this request
*/
void fetchScheduledMeetingEvents(MegaHandle chatid, MegaTimeStamp since, MegaTimeStamp until, unsigned int count, MegaRequestListener* listener = NULL);
/**
* @brief Adds a user to an existing chat. To do this you must have the
* operator privilege in the chat, and the chat must be a group chat in private mode.
*
* In case the chat has a title already set, the title must be encrypted for the new
* peer and passed to this function. Note that only participants with privilege level
* MegaTextChatPeerList::PRIV_MODERATOR are allowed to set the title of a chat.
*
* The associated request type with this request is MegaRequest::TYPE_CHAT_INVITE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the chat identifier
* - MegaRequest::getParentHandle - Returns the MegaHandle of the user to be invited
* - MegaRequest::getAccess - Returns the privilege level wanted for the user
* - MegaRequest::getText - Returns the title of the chat
* - MegaRequest::getFlag - Returns false (private/closed mode)
* - MegaRequest::getSessionKey - Returns the unified key for the new peer
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_EACCESS - If the logged in user doesn't have privileges to invite peers or the chatroom is in public mode.
* - MegaError::API_EINCOMPLETE - If no valid title is provided and the chatroom has a custom title already.
* - MegaError::API_ENOENT- If no valid chatid or user handle is provided, of if the chatroom does not exists.
*
* @param chatid MegaHandle that identifies the chat room
* @param uh MegaHandle that identifies the user
* @param privilege Privilege level for the new peers. Valid values are:
* - MegaTextChatPeerList::PRIV_UNKNOWN = -2
* - MegaTextChatPeerList::PRIV_RM = -1
* - MegaTextChatPeerList::PRIV_RO = 0
* - MegaTextChatPeerList::PRIV_STANDARD = 2
* - MegaTextChatPeerList::PRIV_MODERATOR = 3
* @param title Byte array representing the title that wants to be set, already encrypted and
* converted to Base64url encoding (optional).
* @param listener MegaRequestListener to track this request
*/
void inviteToChat(MegaHandle chatid, MegaHandle uh, int privilege, const char *title = NULL, MegaRequestListener *listener = NULL);
/**
* @brief Adds a user to an existing chat. To do this you must have the
* operator privilege in the chat, and the chat must be a group chat in public mode.
*
* The associated request type with this request is MegaRequest::TYPE_CHAT_INVITE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the chat identifier
* - MegaRequest::getParentHandle - Returns the MegaHandle of the user to be invited
* - MegaRequest::getAccess - Returns the privilege level wanted for the user
* - MegaRequest::getFlag - Returns true (open/public mode)
* - MegaRequest::getSessionKey - Returns the unified key for the new peer
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_EACCESS - If the logged in user doesn't have privileges to invite peers or the chatroom is in private mode.
* - MegaError::API_EARGS - If there's a title and it's not Base64url encoded.
* - MegaError::API_ENOENT- If no valid chatid or user handle is provided, of if the chatroom does not exists.
* - MegaError::API_EINCOMPLETE - If no unified key is provided.
*
* @param chatid MegaHandle that identifies the chat room
* @param uh MegaHandle that identifies the user
* @param privilege Privilege level for the new peers. Valid values are:
* - MegaTextChatPeerList::PRIV_UNKNOWN = -2
* - MegaTextChatPeerList::PRIV_RM = -1
* - MegaTextChatPeerList::PRIV_RO = 0
* - MegaTextChatPeerList::PRIV_STANDARD = 2
* - MegaTextChatPeerList::PRIV_MODERATOR = 3
* @param unifiedKey Byte array that contains the unified key, already encrypted and
* converted to Base64url encoding.
* @param listener MegaRequestListener to track this request
*/
void inviteToPublicChat(MegaHandle chatid, MegaHandle uh, int privilege, const char *unifiedKey = NULL, MegaRequestListener *listener = NULL);
/**
* @brief Remove yourself or another user from a chat. To remove a user other than
* yourself you need to have the operator privilege. Only a group chat may be left.
*
* The associated request type with this request is MegaRequest::TYPE_CHAT_REMOVE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the chat identifier
* - MegaRequest::getParentHandle - Returns the MegaHandle of the user to be removed
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_ENOENT- If no valid chatid is provided or the chatroom does not exists.
* - MegaError::API_EACCESS - If the chatroom is 1on1 or the caller is not operator or is not a
* chat member, or the target is not a chat member.
*
* @param chatid MegaHandle that identifies the chat room
* @param uh MegaHandle that identifies the user. If not provided (INVALID_HANDLE), the requester is removed
* @param listener MegaRequestListener to track this request
*/
void removeFromChat(MegaHandle chatid, MegaHandle uh = INVALID_HANDLE, MegaRequestListener *listener = NULL);
/**
* @brief Get your current, user-specific url to connect to chatd with
*
* The associated request type with this request is MegaRequest::TYPE_CHAT_URL
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the chat identifier
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getLink - Returns the user-specific URL for the chat
*
* @param chatid MegaHandle that identifies the chat room
* @param listener MegaRequestListener to track this request
*/
void getUrlChat(MegaHandle chatid, MegaRequestListener *listener = NULL);
/**
* @brief Grants another user access to download a file using MegaApi::startDownload like
* a user would do so for their own file, rather than a public link.
*
* Currently, this method only supports files, not folders.
*
* The associated request type with this request is MegaRequest::TYPE_CHAT_GRANT_ACCESS
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the node handle
* - MegaRequest::getParentHandle - Returns the chat identifier
* - MegaRequest::getEmail - Returns the MegaHandle of the user in Base64 enconding
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_ENOENT- If the chatroom, the node or the target user don't exist.
* - MegaError::API_EACCESS- If the target user is the same as caller, or if the target
* user is anonymous but the chatroom is in private mode, or if caller is not an operator
* or the target user is not a chat member.
*
* If the MEGA account is a business account and it's status is expired, onRequestFinish will
* be called with the error code MegaError::API_EBUSINESSPASTDUE.
*
* @param chatid MegaHandle that identifies the chat room
* @param n MegaNode that wants to be shared
* @param uh MegaHandle that identifies the user
* @param listener MegaRequestListener to track this request
*/
void grantAccessInChat(MegaHandle chatid, MegaNode *n, MegaHandle uh, MegaRequestListener *listener = NULL);
/**
* @brief Removes access to a node from a user you previously granted access to.
*
* The associated request type with this request is MegaRequest::TYPE_CHAT_REMOVE_ACCESS
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the node handle
* - MegaRequest::getParentHandle - Returns the chat identifier
* - MegaRequest::getEmail - Returns the MegaHandle of the user in Base64 enconding
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_ENOENT- If the chatroom, the node or the target user don't exist.
*
* @param chatid MegaHandle that identifies the chat room
* @param n MegaNode whose access wants to be revokesd
* @param uh MegaHandle that identifies the user
* @param listener MegaRequestListener to track this request
*/
void removeAccessInChat(MegaHandle chatid, MegaNode *n, MegaHandle uh, MegaRequestListener *listener = NULL);
/**
* @brief Allows a logged in operator/moderator to adjust the permissions on any other user
* in their group chat. This does not work for a 1:1 chat.
*
* The associated request type with this request is MegaRequest::TYPE_CHAT_UPDATE_PERMISSIONS
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the chat identifier
* - MegaRequest::getParentHandle - Returns the MegaHandle of the user whose permission
* is to be upgraded
* - MegaRequest::getAccess - Returns the privilege level wanted for the user
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_ENOENT- If the chatroom doesn't exist or if the user specified is not a participant.
* - MegaError::API_EACCESS- If caller is not operator or the chatroom is 1on1.
*
* @param chatid MegaHandle that identifies the chat room
* @param uh MegaHandle that identifies the user
* @param privilege Privilege level for the existing peer. Valid values are:
* - MegaTextChatPeerList::PRIV_RO = 0
* - MegaTextChatPeerList::PRIV_STANDARD = 2
* - MegaTextChatPeerList::PRIV_MODERATOR = 3
* @param listener MegaRequestListener to track this request
*/
void updateChatPermissions(MegaHandle chatid, MegaHandle uh, int privilege, MegaRequestListener *listener = NULL);
/**
* @brief Allows a logged in operator/moderator to truncate their chat, i.e. to clear
* the entire chat history up to a certain message. All earlier messages are wiped,
* but his specific message gets overridden with an API message.
*
* The associated request type with this request is MegaRequest::TYPE_CHAT_TRUNCATE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the chat identifier
* - MegaRequest::getParentHandle - Returns the message identifier to truncate from.
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_ENOENT- If the chatroom doesn't exist.
*
* @param chatid MegaHandle that identifies the chat room
* @param messageid MegaHandle that identifies the message to truncate from
* @param listener MegaRequestListener to track this request
*/
void truncateChat(MegaHandle chatid, MegaHandle messageid, MegaRequestListener *listener = NULL);
/**
* @brief Allows to set the title of a chat
*
* Only participants with privilege level MegaTextChatPeerList::PRIV_MODERATOR are allowed to
* set the title of a chat.
*
* The associated request type with this request is MegaRequest::TYPE_CHAT_SET_TITLE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getText - Returns the title of the chat.
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_EACCESS - If the logged in user doesn't have privileges to invite peers.
* - MegaError::API_EARGS - If there's a title and it's not Base64url encoded.
* - MegaError::API_ENOENT- If the chatroom doesn't exist.
*
* @param chatid MegaHandle that identifies the chat room
* @param title Byte array representing the title that wants to be set, already encrypted and
* converted to Base64url encoding.
* @param listener MegaRequestListener to track this request
*/
void setChatTitle(MegaHandle chatid, const char *title, MegaRequestListener *listener = NULL);
/**
* @brief Get your current URL to connect to the presence server
*
* The associated request type with this request is MegaRequest::TYPE_CHAT_PRESENCE_URL
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getLink - Returns the user-specific URL for the chat presence server
*
* @param listener MegaRequestListener to track this request
*/
void getChatPresenceURL(MegaRequestListener *listener = NULL);
/**
* @brief Register a token for push notifications
*
* This function attach a token to the current session, which is intended to get push notifications
* on mobile platforms like Android and iOS.
*
* The push notification mechanism is platform-dependent. Hence, the app should indicate the
* type of push notification to be registered. Currently, the different types are:
* - MegaApi::PUSH_NOTIFICATION_ANDROID = 1
* - MegaApi::PUSH_NOTIFICATION_IOS_VOIP = 2
* - MegaApi::PUSH_NOTIFICATION_IOS_STD = 3
* - MegaApi::PUSH_NOTIFICATION_ANDROID_HUAWEI = 4
*
* The associated request type with this request is MegaRequest::TYPE_REGISTER_PUSH_NOTIFICATION
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getText - Returns the token provided.
* - MegaRequest::getNumber - Returns the device type provided.
*
* @param deviceType Type of notification to be registered.
* @param token Character array representing the token to be registered.
* @param listener MegaRequestListener to track this request
*/
void registerPushNotifications(int deviceType, const char *token, MegaRequestListener *listener = NULL);
/**
* @brief Send data related to MEGAchat to the stats server
*
* The associated request type with this request is MegaRequest::TYPE_CHAT_STATS
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getName - Returns the data provided.
* - MegaRequest::getParamType - Returns number 1
* - MegaRequest::getNumber - Returns the connection port
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getNumber - Return the HTTP status code from the stats server
* - MegaRequest::getText - Returns the JSON response from the stats server
* - MegaRequest::getTotalBytes - Returns the number of bytes in the response
*
* @param data JSON data to send to the stats server
* @param port Server port to connect
* @param listener MegaRequestListener to track this request
*/
void sendChatStats(const char *data, int port = 0, MegaRequestListener *listener = NULL);
/**
* @brief Send logs related to MEGAchat to the logs server
*
* The associated request type with this request is MegaRequest::TYPE_CHAT_STATS
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getName - Returns the data provided.
* - MegaRequest::getNodeHandle - Returns the userid
* - MegaRequest::getParentHandle - Returns the provided callid
* - MegaRequest::getParamType - Returns number 2
* - MegaRequest::getNumber - Returns the connection port
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getNumber - Return the HTTP status code from the stats server
* - MegaRequest::getText - Returns the JSON response from the stats server
* - MegaRequest::getTotalBytes - Returns the number of bytes in the response
*
* @param data JSON data to send to the logs server
* @param userid handle of the user
* @param callid handle of the call
* @param port Server port to connect
* @param listener MegaRequestListener to track this request
*/
void sendChatLogs(const char *data, MegaHandle userid, MegaHandle callid = INVALID_HANDLE, int port = 0, MegaRequestListener *listener = NULL);
/**
* @brief Get the list of chatrooms for this account
*
* You take the ownership of the returned value
*
* @return A list of MegaTextChat objects with detailed information about each chatroom.
*/
MegaTextChatList *getChatList();
/**
* @brief Get the list of users with access to the specified node
*
* You take the ownership of the returned value
*
* @param chatid MegaHandle that identifies the chat room
* @param h MegaNode to check the access
*
* @return A list of user handles that have access to the node
*/
MegaHandleList *getAttachmentAccess(MegaHandle chatid, MegaHandle h);
/**
* @brief Check if the logged-in user has access to the specified node
*
* @param chatid MegaHandle that identifies the chat room
* @param h MegaHandle that identifies the node to check the access
* @param uh MegaHandle that identifies the user to check the access
*
* @return True the user has access to the node in that chat. Otherwise, it returns false
*/
bool hasAccessToAttachment(MegaHandle chatid, MegaHandle h, MegaHandle uh);
/**
* @brief Get files attributes from a node
* You take ownership of the returned value. Use delete[] to release the memory.
* @param h Handle from node
* @return char array with files attributes from the node.
*/
const char* getFileAttribute(MegaHandle h);
/**
* @brief Archive a chat
*
* The associated request type with this request is MegaRequest::TYPE_CHAT_ARCHIVE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the chat identifier
* - MegaRequest::getFlag - Returns chat desired state
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_ENOENT - If the chatroom does not exists.
*
* @param chatid MegaHandle that identifies the chat room
* @param archive Desired chat state
* @param listener MegaRequestListener to track this request
*/
void archiveChat(MegaHandle chatid, int archive, MegaRequestListener *listener = NULL);
/**
* @brief Set a retention timeframe after which older messages in the chat are automatically deleted.
*
* Allows a logged in operator/moderator to specify a message retention timeframe in seconds,
* after which older messages in the chat are automatically deleted.
*
* The associated request type with this request is MegaRequest::TYPE_SET_RETENTION_TIME
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the chat identifier
* - MegaRequest::getTotalBytes - Returns the retention timeframe
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_EARGS - If the chatid is invalid
* - MegaError::API_ENOENT - If there isn't any chat with the specified chatid.
* - MegaError::API_EACCESS - If the logged in user doesn't have operator privileges
*
* @param chatid MegaHandle that identifies the chat room
* @param period retention timeframe in seconds, after which older messages in the chat are automatically deleted
* @param listener MegaRequestListener to track this request
*/
void setChatRetentionTime(MegaHandle chatid, unsigned period, MegaRequestListener *listener = NULL);
/**
* @brief Request rich preview information for specified URL
*
* The associated request type with this request is MegaRequest::TYPE_RICH_LINK
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getLink - Returns the requested URL
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getText - Returns a JSON containing metadata from the URL
*
* @param url URL to request metadata (format: http://servername.domain)
* @param listener MegaRequestListener to track this request
*/
void requestRichPreview(const char *url, MegaRequestListener *listener = NULL);
/**
* @brief Query if there is a chat link for this chatroom
*
* This function can be called by any chat member to check and retrieve the current
* public handle for the specified chat without creating it.
*
* The associated request type with this request is MegaRequest::TYPE_CHAT_LINK_HANDLE.
*
* Valid data in the MegaRequest object received on all callbacks:
* - MegaRequest::getNodeHandle - Returns the chat identifier
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getParentHandle - Returns the public handle of the chat link, if any
*
* On the onTransferFinish error, the error code associated to the MegaError can be:
* - MegaError::API_ENOENT - If the chatroom does not have a valid chatlink, or the chatroom does not exists.
* - MegaError::API_EACCESS - If caller is not operator or the chat is not a public chat or it's a 1on1 room.
*
* @param chatid MegaHandle that identifies the chat room
* @param listener MegaRequestListener to track this request
*/
void chatLinkQuery(MegaHandle chatid, MegaRequestListener *listener = NULL);
/**
* @brief Create or retrieve the public handle of a chat link
*
* This function can be called by a chat operator to create or retrieve the current
* public handle for the specified chat. It will create a management message.
*
* The associated request type with this request is MegaRequest::TYPE_CHAT_LINK_HANDLE.
*
* Valid data in the MegaRequest object received on all callbacks:
* - MegaRequest::getNodeHandle - Returns the chat identifier
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getParentHandle - Returns the public handle of the chat link
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_ENOENT - If the chatroom does not have a valid chatlink, or the chatroom does not exists.
* - MegaError::API_EACCESS - If caller is not operator or the chat is not a public chat or it's a 1on1 room.
*
* @param chatid MegaHandle that identifies the chat room
* @param listener MegaRequestListener to track this request
*/
void chatLinkCreate(MegaHandle chatid, MegaRequestListener *listener = NULL);
/**
* @brief Delete the public handle of a chat link
*
* This function can be called by a chat operator to remove the current public handle
* for the specified chat. It will create a management message.
*
* The associated request type with this request is MegaRequest::TYPE_CHAT_LINK_HANDLE.
*
* Valid data in the MegaRequest object received on all callbacks:
* - MegaRequest::getNodeHandle - Returns the chat identifier
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_ENOENT - If the chatroom does not have a valid chatlink, or the chatroom does not exists.
* - MegaError::API_EACCESS - If caller is not operator or the chat is not a public chat or it's a 1on1 room.
*
* @param chatid MegaHandle that identifies the chat room
* @param listener MegaRequestListener to track this request
*/
void chatLinkDelete(MegaHandle chatid, MegaRequestListener *listener = NULL);
/**
* @brief Get the URL to connect to chatd for a chat link
*
* This function can be used by anonymous and registered users to request the URL to connect
* to chatd, for a given public handle. @see \c MegaApi::chatLinkCreate.
* It also returns the shard hosting the chatroom, the real chatid and the title (if any).
* The chat-topic, for public chats, can be decrypted by using the unified-key, already
* available as part of the link for previewers and available to participants as part of
* the room's information. @see \c MegaTextChat::getUnifiedKey.
*
* The associated request type with this request is MegaRequest::TYPE_CHAT_LINK_URL
*
* Valid data in the MegaRequest object received on all callbacks:
* - MegaRequest::getNodeHandle - Returns the public handle of the chat link
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getNodeHandle - Returns the public handle
* - MegaRequest::getLink - Returns the URL to connect to chatd for the chat link
* - MegaRequest::getParentHandle - Returns the chat identifier
* - MegaRequest::getAccess - Returns the shard
* - MegaRequest::getText - Returns the chat-topic (if any)
* - MegaRequest::getNumDetails - Returns the current number of participants
* - MegaRequest::getNumber - Returns the creation timestamp
* - MegaRequest::getFlag - Returns if chatRoom is a meeting Room
* - MegaRequest::getParamType - Returns 1 if chatRoom has waiting room option enabled
* - MegaRequest::getMegaHandleList - Returns a vector with one element (callid), if call doesn't exit it will be NULL
* - MegaRequest::getMegaScheduledMeetingList - Returns a MegaScheduledMeetingList (with a list of scheduled meetings associated to the chatroom) or nullptr if none.
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_ENOENT - If the public handle is not valid or the chatroom does not exists.
*
* @note This function can be called without being logged in. In that case, the returned
* URL will be different than for logged in users, so chatd knows whether user has a session.
*
* @param publichandle MegaHandle that represents the public handle of the chat link
* @param listener MegaRequestListener to track this request
*/
void getChatLinkURL(MegaHandle publichandle, MegaRequestListener *listener = NULL);
/**
* @brief Convert an public chat into a private private mode chat
*
* This function allows a chat operator to convert an existing public chat into a private
* chat (closed mode, key rotation enabled). It will create a management message.
*
* If the groupchat already has a customized title, it's required to provide the title encrypted
* to a new key, so it becomes private for non-participants.
*
* The associated request type with this request is MegaRequest::TYPE_SET_PRIVATE_MODE.
*
* Valid data in the MegaRequest object received on all callbacks:
* - MegaRequest::getNodeHandle - Returns the chat identifier
* - MegaRequest::getText - Returns the title of the chat
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_ENOENT - If the chatroom does not exists.
* - MegaError::API_EACCESS - If caller is not operator or it's a 1on1 room.
* - MegaError::API_EEXIST - If the chat is already in private mode.
* - MegaError::API_EARGS - If custom title is set and no title is provided.
*
* @param chatid MegaHandle that identifies the chat room
* @param title Byte array representing the title, already encrypted and converted to Base64url
* encoding. If the chatroom doesn't have a title yet, this parameter should be NULL.
* @param listener MegaRequestListener to track this request
*/
void chatLinkClose(MegaHandle chatid, const char *title, MegaRequestListener *listener = NULL);
/**
* @brief Allows to join a public chat
*
* This function allows any user with a MEGA account to join an open chat that has the
* specified public handle. It will create a management message like any new user join.
*
* @see \c MegaApi::chatLinkCreate
*
* The associated request type with this request is MegaRequest::TYPE_AUTOJOIN_PUBLIC_CHAT
*
* Valid data in the MegaRequest object received on all callbacks:
* - MegaRequest::getNodeHandle - Returns the public handle of the chat link
* - MegaRequest::getSessionKey - Returns the unified key of the chat link
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_ENOENT - If the public handle is not valid.
* - MegaError::API_EINCOMPLETE - If the no unified key is provided.
*
* @param publichandle MegaHandle that represents the public handle of the chat link
* @param unifiedKey Byte array that contains the unified key, already encrypted and
* converted to Base64url encoding.
* @param listener MegaRequestListener to track this request
*/
void chatLinkJoin(MegaHandle publichandle, const char *unifiedKey, MegaRequestListener *listener = NULL);
/**
* @brief Returns whether notifications about a chat have to be generated
*
* @param chatid MegaHandle that identifies the chat room
* @return true if notification has to be created
*/
bool isChatNotifiable(MegaHandle chatid);
/**
* @brief Allows to start chat call in a chat room
*
* - Waiting room will be enabled for the call, just if waiting room flag is enabled for the chatroom.
* + If notRinging param is false, all participants that answers the call, will bypass the waiting room.
* + If notRinging param is true, all participants will be redirected to waiting room,
* as soon as they answer the call
*
* - Call will ring or not depending on the value of notRinging param
*
* The associated request type with this request is MegaRequest::TYPE_START_CHAT_CALL
*
* Valid data in the MegaRequest object received on all callbacks:
* - MegaRequest::getNodeHandle - Returns the chat identifier
* - MegaChatRequest::getParentHandle() - Returns the scheduled meeting id;
* - MegaChatRequest::getAccess() - Returns the SFU id
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getText - Returns the sfu url
* - MegaRequest::getNodeHandle - Returns the call identifier
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_EARGS - If the chatid is invalid
* - MegaError::API_EEXIST - If there is a call in the chatroom
*
* @param chatid MegaHandle that identifies the chat room
* @param notRinging if true call won't ring for participants when it's started
* @param listener MegaRequestListener to track this request
*/
void startChatCall(MegaHandle chatid, bool notRinging = false, MegaRequestListener* listener = nullptr);
/**
* @brief Allow to join chat call
*
* The associated request type with this request is MegaRequest::TYPE_JOIN_CHAT_CALL
*
* * Valid data in the MegaRequest object received on all callbacks:
* - MegaRequest::getNodeHandle - Returns the chat identifier
* - MegaRequest::getParentHandle - Returns the call identifier
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getText - Returns the sfu url
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_EARGS - If the chatid or callid is invalid
*
* @param chatid MegaHandle that identifies the chat room
* @param callid MegaHandle that identifies the call
* @param listener MegaRequestListener to track this request
*/
void joinChatCall(MegaHandle chatid, MegaHandle callid, MegaRequestListener* listener = nullptr);
/**
* @brief Allow to end chat call
*
* The associated request type with this request is MegaRequest::TYPE_END_CHAT_CALL
*
* Valid data in the MegaRequest object received on all callbacks:
* - MegaRequest::getNodeHandle - Returns the chat identifier
* - MegaRequest::getParentHandle - Returns the call identifier
* - MegaRequest::getAccess - Returns the reason to end call
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_EARGS - If the chatid or callid is invalid
*
* @param chatid MegaHandle that identifies the chat room
* @param callid MegaHandle that identifies the call
* @param reason Reason to end call (Valid value END_CALL_REASON_REJECTED)
* @param listener MegaRequestListener to track this request
*/
void endChatCall(MegaHandle chatid, MegaHandle callid, int reason = 0, MegaRequestListener *listener = nullptr);
/**
* @brief This function allows a user in an existing call, to send an incoming call push notification to another user in the chat
* to notify that call is ringing..
*
* When a call is started and one user doesn't pick it up, ringing stops for that user/participant after a given time.
* This function can be used to force another ringing event at said user/participant.
*
* The associated request type with this request is MegaRequest::TYPE_RING_INDIVIDUAL_IN_CALL
* Valid data in the MegaRequest object received on callbacks:
* - MegaChatRequest::getNodeHandle - Returns the chat identifier
* - MegaChatRequest::getParentHandle - Returns the user's id to ring again
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::ERROR_OK:
*
* The request will fail with MegaChatError::ERROR_ARGS
* - if chat id provided as param is invalid
* - if user id to ring again provided as param is invalid
*
* The request will fail with MegaChatError::ERROR_NOENT
* - if the chatroom doesn't exists.
*
* @param chatId MegaChatHandle that identifies the chat room
* @param userId MegaChatHandle that identifies the user to ring again
* @param listener MegaRequestListener to track this request
*/
void ringIndividualInACall(MegaHandle chatid, MegaHandle userid, MegaRequestListener* listener = nullptr);
/**
* @brief Change the SFU id
*
* This function allows to set the SFU server where all chat calls will be started
* It's only useful for testing or debugging purposes.
*
* @param sfuid New SFU id
*/
void setSFUid(int sfuid);
#endif
/**
* @brief Returns whether notifications about incoming have to be generated
*
* @return true if notification has to be created
*/
bool isSharesNotifiable();
/**
* @brief Returns whether notifications about pending contact requests have to be generated
*
* @return true if notification has to be created
*/
bool isContactsNotifiable();
/**
* @brief Get the MEGA Achievements of the account logged in
*
* The associated request type with this request is MegaRequest::TYPE_GET_ACHIEVEMENTS
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getFlag - Always false
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getMegaAchievementsDetails - Details of the MEGA Achievements of this account
*
* @param listener MegaRequestListener to track this request
*/
void getAccountAchievements(MegaRequestListener *listener = NULL);
/**
* @brief Get the list of existing MEGA Achievements
*
* Similar to MegaApi::getAccountAchievements, this method returns only the base storage and
* the details for the different achievement classes, but not awards or rewards related to the
* account that is logged in.
* This function can be used to give an indication of what is available for advertising
* for unregistered users, despite it can be used with a logged in account with no difference.
*
* @note: if the IP address is not achievement enabled (it belongs to a country where MEGA
* Achievements are not enabled), the request will fail with MegaError::API_EACCESS.
*
* The associated request type with this request is MegaRequest::TYPE_GET_ACHIEVEMENTS
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getFlag - Always true
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getMegaAchievementsDetails - Details of the list of existing MEGA Achievements
*
* @param listener MegaRequestListener to track this request
*/
void getMegaAchievements(MegaRequestListener *listener = NULL);
/**
* @brief Catch up with API for pending actionpackets
*
* The associated request type with this request is MegaRequest::TYPE_CATCHUP
*
* When onRequestFinish is called with MegaError::API_OK, the SDK is guaranteed to be
* up to date (as for the time this function is called).
*
* @param listener MegaRequestListener to track this request
*/
void catchup(MegaRequestListener *listener = NULL);
/**
* @brief Send a verification code txt to the supplied phone number
*
* Sends a 6 digit code to the user's phone. The phone number is supplied in this function
* call. The code is sent by SMS to the user. Once the user receives it, they can type it
* into the app and the call MegaApi::checkSMSVerificationCode can be used to validate the
* user did receive the verification code, so that really is their phone number.
*
* The frequency with which this call can be used is very limited (the API allows at most
* two SMS mssages sent for phone number per 24 hour period), so it's important to get the
* number right on the first try. The result will be MegaError::API_ETEMPUNAVAIL if it has
* been tried too frequently.
*
* Make sure to test the result of MegaApi::smsAllowedState before calling this function.
*
* The associated request type with this request is
* MegaRequest::TYPE_SEND_SMS_VERIFICATIONCODE.
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getText - the phoneNumber as supplied to this function
*
* When the operation completes, onRequestFinish is called and the MegaError object can be:
* - MegaError::API_ETEMPUNAVAIL if a limit is reached.
* - MegaError::API_EACCESS if your account is already verified with an SMS number
* - MegaError::API_EEXIST if the number is already verified for some other account.
* - MegaError::API_EARGS if the phone number is badly formatted or invalid.
* - MegaError::API_OK is returned upon success.
*
* @param phoneNumber The phone number to txt the code to, supplied by the user.
* @param listener MegaRequestListener to track this request
* @param reverifying_whitelisted debug usage only. May be removed in future.
*
* @deprecated SMS verification was deprecated. This function is deprecated. Please don't
* use it in new code.
*/
MEGA_DEPRECATED
void sendSMSVerificationCode(const char* phoneNumber, MegaRequestListener *listener = NULL, bool reverifying_whitelisted = false);
/**
* @brief Check a verification code that the user should have received via txt
*
* This function validates that the user received the verification code sent by
* MegaApi::sendSMSVerificationCode.
*
* The associated request type with this request is
* MegaRequest::TYPE_CHECK_SMS_VERIFICATIONCODE.
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getText - the verificationCode as supplied to this function
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getName - the phone number that has been verified
*
* When the operation completes, onRequestFinish is called and the MegaError object can be:
* - MegaError::API_EEACCESS if you have reached the verification limits.
* - MegaError::API_EFAILED if the verification code does not match.
* - MegaError::API_EEXPIRED if the phone number was verified on a different account.
* - MegaError::API_OK is returned upon success.
*
* @param verificationCode A string supplied by the user, that they should have received via
* txt.
* @param listener MegaRequestListener to track this request
*
* @deprecated SMS verification was deprecated. This function is deprecated. Please don't
* use it in new code.
*/
MEGA_DEPRECATED
void checkSMSVerificationCode(const char* verificationCode, MegaRequestListener *listener = NULL);
/**
* @brief Requests the currently available country calling codes
*
* The response value is stored as a MegaStringListMap mapping from two-letter country code
* to a list of calling codes. For instance:
* {
* "AD": ["376"],
* "AE": ["971", "13"],
* }
*
* The associated request type with this request is
* MegaRequest::TYPE_GET_COUNTRY_CALLING_CODES.
* Valid data in the MegaRequest object received in onRequestFinish when the error code is
* MegaError::API_OK:
* - MegaRequest::getMegaStringListMap where the keys are two-letter country codes and the
* values a list of calling codes.
*
* For this command, there are currently no command specific error codes returned by the
* API.
*
* @param listener MegaRequestListener to track this request
*
* @deprecated This function is deprecated. Please don't use it in new code.
*/
MEGA_DEPRECATED
void getCountryCallingCodes(MegaRequestListener *listener = NULL);
/**
* @brief Retrieve basic information about a folder link
*
* This function retrieves basic information from a folder link, like the number of files / folders
* and the name of the folder. For folder links containing a lot of files/folders,
* this function is more efficient than a fetchnodes.
*
* Valid data in the MegaRequest object received on all callbacks:
* - MegaRequest::getLink() - Returns the public link to the folder
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getMegaFolderInfo() - Returns information about the contents of the folder
* - MegaRequest::getNodeHandle() - Returns the public handle of the folder
* - MegaRequest::getParentHandle() - Returns the handle of the owner of the folder
* - MegaRequest::getText() - Returns the name of the folder.
* If there's no name, it returns the special status string "CRYPTO_ERROR".
* If the length of the name is zero, it returns the special status string "BLANK".
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_EARGS - If the link is not a valid folder link
* - MegaError::API_EKEY - If the public link does not contain the key or it is invalid
*
* @param megaFolderLink Public link to a folder in MEGA
* @param listener MegaRequestListener to track this request
*/
void getPublicLinkInformation(const char *megaFolderLink, MegaRequestListener *listener = NULL);
/**
* @brief Get an object that can lock the MegaApi, allowing multiple quick synchronous calls.
*
* This object must be used very carefully. It is meant to be used when the application is about
* to make a burst of synchronous calls (that return data immediately, without using a listener)
* to the API over a very short time period, which could otherwise be blocked multiple times
* interrupted by the MegaApi's operation.
*
* The MegaApiLock usual use is to request it already locked, and the caller must destroy it
* when its sequence of operations are complete, which will allow the MegaApi to continue again.
* However explicit lock and unlock calls can also be made on it, which are protected from
* making more than one lock, and the destructor will make sure the lock is released.
*
* You take ownership of the returned value, and you must delete it when the sequence is complete.
*/
MegaApiLock* getMegaApiLock(bool lockNow);
/**
* @brief Call the low level function setrlimit() for NOFILE, needed for some platforms.
*
* Particularly on phones, the system default limit for the number of open files (and sockets)
* is quite low. When the SDK can be working on many files and many sockets at once,
* we need a higher limit. Those limits need to take into account the needs of the whole
* app and not just the SDK, of course. This function is provided in order that the app
* can make that call and set appropriate limits.
*
* @param newNumFileLimit The new limit of file and socket handles for the whole app.
*
* @return True when there were no errors setting the new limit (even when clipped to the maximum
* allowed value). It returns false when setting a new limit failed.
*/
bool platformSetRLimitNumFile(int newNumFileLimit) const;
/**
* @brief Call the low level function getrlimit() for NOFILE, needed for some platforms.
*
* @return The current limit for the number of open files (and sockets) for the app, or -1 if error.
*/
int platformGetRLimitNumFile() const;
/**
* @brief Requests a list of all Smart Banners available for current user.
*
* The response value is stored as a MegaBannerList.
*
* The associated request type with this request is MegaRequest::TYPE_GET_BANNERS
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getMegaBannerList: the list of banners
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_EACCESS - If called with no user being logged in.
* - MegaError::API_EINTERNAL - If the internally used user attribute exists but can't be decoded.
* - MegaError::API_ENOENT if there are no banners to return to the user.
*
* @param listener MegaRequestListener to track this request
*/
void getBanners(MegaRequestListener *listener = nullptr);
/**
* @brief No longer show the Smart Banner with the specified id to the current user.
*/
void dismissBanner(int id, MegaRequestListener *listener = nullptr);
/**
* @brief Registers a backup to display in Backup Centre
*
* Apps should register backups, like CameraUploads, in order to be listed in the
* BackupCentre. The client should send heartbeats to indicate the progress of the
* backup (see \c MegaApi::sendBackupHeartbeats).
*
* Possible types of backups:
* BACKUP_TYPE_CAMERA_UPLOADS = 3,
* BACKUP_TYPE_MEDIA_UPLOADS = 4, // Android has a secondary CU
*
* The associated request type with this request is MegaRequest::TYPE_BACKUP_PUT
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParentHandle - Returns the backupId
* - MegaRequest::getNodeHandle - Returns the target node of the backup
* - MegaRequest::getName - Returns the backup name of the remote location
* - MegaRequest::getAccess - Returns the backup state
* - MegaRequest::getFile - Returns the path of the local folder
* - MegaRequest::getTotalBytes - Returns the backup type
* - MegaRequest::getNumDetails - Returns the backup substate
* - MegaRequest::getFlag - Returns true
* - MegaRequest::getListener - Returns the MegaRequestListener to track this request
*
* @param backupType back up type requested for the service
* @param targetNode MEGA folder to hold the backups
* @param localFolder Local path of the folder
* @param backupName Name of the backup
* @param state state
* @param subState subState
* @param listener MegaRequestListener to track this request
*/
void setBackup(int backupType, MegaHandle targetNode, const char* localFolder, const char* backupName, int state, int subState, MegaRequestListener* listener = nullptr);
/**
* @brief Update the information about a registered backup for Backup Centre
*
* Possible types of backups:
* BACKUP_TYPE_INVALID = -1,
* BACKUP_TYPE_CAMERA_UPLOADS = 3,
* BACKUP_TYPE_MEDIA_UPLOADS = 4, // Android has a secondary CU
*
* Params that keep the same value are passed with invalid value to avoid to send to the server
* Invalid values:
* - type: BACKUP_TYPE_INVALID
* - nodeHandle: UNDEF
* - backupName: nullptr
* - localFolder: nullptr
* - deviceId: nullptr
* - state: -1
* - subState: -1
*
* The associated request type with this request is MegaRequest::TYPE_BACKUP_PUT
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParentHandle - Returns the backupId
* - MegaRequest::getTotalBytes - Returns the backup type
* - MegaRequest::getNodeHandle - Returns the target node of the backup
* - MegaRequest::getName - Returns the backup name of the remote location
* - MegaRequest::getFile - Returns the path of the local folder
* - MegaRequest::getAccess - Returns the backup state
* - MegaRequest::getNumDetails - Returns the backup substate
* - MegaRequest::getListener - Returns the MegaRequestListener to track this request
*
* @param backupId backup id identifying the backup to be updated
* @param backupType back up type requested for the service
* @param targetNode MEGA folder to hold the backups
* @param localFolder Local path of the folder
* @param backupName Name of the backup
* @param state backup state
* @param subState backup subState
* @param listener MegaRequestListener to track this request
*/
void updateBackup(MegaHandle backupId, int backupType, MegaHandle targetNode, const char* localFolder, const char* backupName, int state, int subState, MegaRequestListener* listener = nullptr);
/**
* @brief Unregister a backup already registered for the Backup Centre
*
* This method allows to remove a backup from the list of backups displayed in the
* Backup Centre. @see \c MegaApi::setScheduledCopy.
*
* The associated request type with this request is MegaRequest::TYPE_BACKUP_REMOVE
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParentHandle - Returns the backupId
* - MegaRequest::getListener - Returns the MegaRequestListener to track this request
*
* @param backupId backup id identifying the backup to be removed
* @param listener MegaRequestListener to track this request
*/
void removeBackup(MegaHandle backupId, MegaRequestListener *listener = nullptr);
/**
* @brief Mark a backup already registered in Backup Centre, for removal, and
* move or delete its contents. Other sync types will only be stopped.
*
* This method allows to remove a backup from the list of backups displayed in the
* Backup Centre, and completely remove its contents, either by moving them to
* moveDestination (when the latter has a valid value) or by deleting them (when
* destination is INVALID_HANDLE).
*
* The associated request type with this request is MegaRequest::TYPE_BACKUP_REMOVE_MD
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParentHandle - Returns the backup id
* - MegaRequest::getNodeHandle - Returns the node handle corresponding to the move
* destination
* - MegaRequest::getListener - Returns the MegaRequestListener to track this request
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_EEXIST - The destination already contains a node with the same name.
*
* @param backupId backup id of the backup to be removed
* @param moveDestination node handle where backup contents will be moved; if
* INVALID_HANDLE, backup contents will be deleted; for non-backup syncs it will be ignored
* @param listener MegaRequestListener to track this request
*/
void removeFromBC(MegaHandle backupId, MegaHandle moveDestination, MegaRequestListener* listener = nullptr);
/**
* @brief Simulate a backup/sync being paused from the webclient.
*
* The associated request type with this request is MegaRequest::TYPE_BACKUP_PAUSE_MD
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParentHandle - Returns the backup id
* - MegaRequest::getListener - Returns the MegaRequestListener to track this request
*
* @param backupId backup id of the backup to be paused
* @param listener MegaRequestListener to track this request
*/
void pauseFromBC(MegaHandle backupId, MegaRequestListener* listener = nullptr);
/**
* @brief Simulate a backup/sync being resumed from the webclient.
*
* The associated request type with this request is MegaRequest::TYPE_BACKUP_RESUME_MD
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParentHandle - Returns the backup id
* - MegaRequest::getListener - Returns the MegaRequestListener to track this request
*
* @param backupId backup id of the backup to be resumed
* @param listener MegaRequestListener to track this request
*/
void resumeFromBC(MegaHandle backupId, MegaRequestListener* listener = nullptr);
/**
* @brief Fetch information about all registered backups for Backup Centre
*
* The associated request type with this request is MegaRequest::TYPE_BACKUP_INFO
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getListener - Returns the MegaRequestListener to track this request
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getMegaBackupInfoList - Returns information about all registered backups
*
* @param listener MegaRequestListener to track this request
*/
void getBackupInfo(MegaRequestListener* listener = nullptr);
/**
* @brief Send heartbeat associated with an existing backup
*
* The client should call this method regularly for every registered backup, in order to
* inform about the status of the backup.
*
* Progress, last timestamp and last node are not always meaningful (ie. when the Camera
* Uploads starts a new batch, there isn't a last node, or when the CU up to date and
* inactive for long time, the progress doesn't make sense). In consequence, these parameters
* are optional. They will not be sent to API if they take the following values:
* - lastNode = INVALID_HANDLE
* - lastTs = -1
* - progress = -1
*
* The associated request type with this request is MegaRequest::TYPE_BACKUP_PUT_HEART_BEAT
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParentHandle - Returns the backupId
* - MegaRequest::getAccess - Returns the backup state
* - MegaRequest::getNumDetails - Returns the backup substate
* - MegaRequest::getParamType - Returns the number of pending upload transfers
* - MegaRequest::getTransferTag - Returns the number of pending download transfers
* - MegaRequest::getNumber - Returns the last action timestamp
* - MegaRequest::getNodeHandle - Returns the last node handle to be synced
*
* @param backupId backup id identifying the backup
* @param status backup status
* @param progress backup progress
* @param ups Number of pending upload transfers
* @param downs Number of pending download transfers
* @param ts Last action timestamp
* @param lastNode Last node handle to be synced
* @param listener MegaRequestListener to track this request
*/
void sendBackupHeartbeat(MegaHandle backupId, int status, int progress, int ups, int downs, long long ts, MegaHandle lastNode, MegaRequestListener *listener = nullptr);
/**
* @brief Fetch ads
*
* The associated request type with this request is MegaRequest::TYPE_FETCH_ADS
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNumber A bitmap flag used to communicate with the API
* - MegaRequest::getMegaStringList List of the adslot ids to fetch
* - MegaRequest::getNodeHandle Public handle that the user is visiting
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getMegaStringMap: map with relationship between ids and ius
*
* @param adFlags A bitmap flag used to communicate with the API
* Valid values are:
* - ADS_DEFAULT = 0x0
* - ADS_FORCE_ADS = 0x200
* - ADS_IGNORE_MEGA = 0x400
* - ADS_IGNORE_COUNTRY = 0x800
* - ADS_IGNORE_IP = 0x1000
* - ADS_IGNORE_PRO = 0x2000
* - ADS_FLAG_IGNORE_ROLLOUT = 0x4000
* @param adUnits A list of the adslot ids to fetch; it cannot be null nor empty
* @param publicHandle Provide the public handle that the user is visiting
* @param listener MegaRequestListener to track this request
*/
void fetchAds(int adFlags, MegaStringList *adUnits, MegaHandle publicHandle = INVALID_HANDLE, MegaRequestListener *listener = nullptr);
/**
* @brief Check if ads should show or not
*
* The associated request type with this request is MegaRequest::TYPE_QUERY_ADS
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNumber A bitmap flag used to communicate with the API
* - MegaRequest::getNodeHandle Public handle that the user is visiting
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getNumDetails Return if ads should be show or not
*
* @param adFlags A bitmap flag used to communicate with the API
* Valid values are:
* - ADS_DEFAULT = 0x0
* - ADS_FORCE_ADS = 0x200
* - ADS_IGNORE_MEGA = 0x400
* - ADS_IGNORE_COUNTRY = 0x800
* - ADS_IGNORE_IP = 0x1000
* - ADS_IGNORE_PRO = 0x2000
* - ADS_FLAG_IGNORE_ROLLOUT = 0x4000
* @param publicHandle Provide the public handle that the user is visiting
* @param listener MegaRequestListener to track this request
*/
void queryAds(int adFlags, MegaHandle publicHandle = INVALID_HANDLE, MegaRequestListener *listener = nullptr);
/**
* @brief Set a bitmap to indicate whether some cookies are enabled or not
*
* The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_COOKIE_SETTINGS
* - MegaRequest::getNumDetails - Return a bitmap with cookie settings
* - MegaRequest::getListener - Returns the MegaRequestListener to track this request
*
* @param settings A bitmap with cookie settings
* Valid bits are:
* - Bit 0: essential
* - Bit 1: preference
* - Bit 2: analytics
* - Bit 3: ads
* - Bit 4: thirdparty
* @param listener MegaRequestListener to track this request
*/
void setCookieSettings(int settings, MegaRequestListener *listener = nullptr);
/**
* @brief Get a bitmap to indicate whether some cookies are enabled or not
*
* The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the value USER_ATTR_COOKIE_SETTINGS
* - MegaRequest::getListener - Returns the MegaRequestListener to track this request
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getNumDetails Return the bitmap with cookie settings
* Valid bits are:
* - Bit 0: essential
* - Bit 1: preference
* - Bit 2: analytics
* - Bit 3: ads
* - Bit 4: thirdparty
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_EINTERNAL - If the value for cookie settings bitmap was invalid
*
* @param listener MegaRequestListener to track this request
*/
void getCookieSettings(MegaRequestListener *listener = nullptr);
/**
* @brief Check if the app can start showing the cookie banner
*
* This function will NOT return a valid value until the callback onEvent with
* type MegaApi::EVENT_MISC_FLAGS_READY is received. You can also rely on the completion of
* a fetchnodes to check this value.
*
* For not logged-in mode, you need to call MegaApi::getMiscFlags first.
*
* @return True if this feature is enabled. Otherwise, false.
*/
bool cookieBannerEnabled();
/**
* @brief Start receiving notifications for [dis]connected external drives, from the OS
*
* After a call to this function, and before another one, stopDriveMonitor() must be called,
* otherwise it will fail.
*
* @return True when notifications have been started.
* False when called while already receiving notifications, or
* notifications could not have been started due to errors or missing implementation,
*/
bool startDriveMonitor();
/**
* @brief Stop receiving notifications for [dis]connected external drives, from the OS
*/
void stopDriveMonitor();
/**
* @brief Check if drive monitor is running
* @return True if it is running, false otherwise.
*/
bool driveMonitorEnabled();
/**
* @brief Request creation of a new Set
*
* The associated request type with this request is MegaRequest::TYPE_PUT_SET
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParentHandle - Returns INVALID_HANDLE
* - MegaRequest::getText - Returns name of the Set
* - MegaRequest::getParamType - Returns CREATE_SET, possibly combined with OPTION_SET_NAME
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getMegaSet - Returns either the new Set, or null if it was not created.
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_EARGS - Malformed (from API).
* - MegaError::API_EACCESS - Permissions Error (from API).
*
* @param name the name that should be given to the new Set
* @param type the type of the Set (see MegaSet for possible types)
* @param listener MegaRequestListener to track this request
*/
void createSet(const char* name = nullptr, int type = MegaSet::SET_TYPE_ALBUM,
MegaRequestListener* listener = nullptr);
/**
* @brief Request to update the name of a Set
*
* The associated request type with this request is MegaRequest::TYPE_PUT_SET
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParentHandle - Returns id of the Set to be updated
* - MegaRequest::getText - Returns new name of the Set
* - MegaRequest::getParamType - Returns OPTION_SET_NAME
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_ENOENT - Set with the given id could not be found (before or after the request).
* - MegaError::API_EINTERNAL - Received answer could not be read.
* - MegaError::API_EARGS - Malformed (from API).
* - MegaError::API_EACCESS - Permissions Error (from API).
*
* @param sid the id of the Set to be updated
* @param name the new name that should be given to the Set
* @param listener MegaRequestListener to track this request
*/
void updateSetName(MegaHandle sid, const char* name, MegaRequestListener* listener = nullptr);
/**
* @brief Request to update the cover of a Set
*
* The associated request type with this request is MegaRequest::TYPE_PUT_SET
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParentHandle - Returns id of the Set to be updated
* - MegaRequest::getNodeHandle - Returns Element id to be set as the new cover
* - MegaRequest::getParamType - Returns OPTION_SET_COVER
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_EARGS - Given Element id was not part of the current Set; Malformed (from API).
* - MegaError::API_ENOENT - Set with the given id could not be found (before or after the request).
* - MegaError::API_EINTERNAL - Received answer could not be read.
* - MegaError::API_EACCESS - Permissions Error (from API).
*
* @param sid the id of the Set to be updated
* @param eid the id of the Element to be set as cover
* @param listener MegaRequestListener to track this request
*/
void putSetCover(MegaHandle sid, MegaHandle eid, MegaRequestListener* listener = nullptr);
/**
* @brief Request to remove a Set
*
* The associated request type with this request is MegaRequest::TYPE_REMOVE_SET
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParentHandle - Returns id of the Set to be removed
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_ENOENT - Set could not be found.
* - MegaError::API_EINTERNAL - Received answer could not be read.
* - MegaError::API_EARGS - Malformed (from API).
* - MegaError::API_EACCESS - Permissions Error (from API).
*
* @param sid the id of the Set to be removed
* @param listener MegaRequestListener to track this request
*/
void removeSet(MegaHandle sid, MegaRequestListener* listener = nullptr);
/**
* @brief Request creation of multiple Elements for a Set
*
* The associated request type with this request is MegaRequest::TYPE_PUT_SET_ELEMENTS
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getTotalBytes - Returns the id of the Set
* - MegaRequest::getMegaHandleList - Returns a list containing the file handles corresponding to the new Elements
* - MegaRequest::getMegaStringList - Returns a list containing the names corresponding to the new Elements
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getMegaSetElementList - Returns a list containing only the new Elements
* - MegaRequest::getMegaIntegerList - Returns a list containing error codes for all requested Elements
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_ENOENT - Set could not be found.
* - MegaError::API_EINTERNAL - Received answer could not be read or decrypted.
* - MegaError::API_EARGS - Malformed (from API).
* - MegaError::API_EACCESS - Permissions Error (from API).
*
* @param sid the id of the Set that will own the new Elements
* @param nodes the handles of the file-nodes that will be represented by the new Elements
* @param names the names that should be given to the new Elements (param names must be either null or have
* the same size() as param nodes)
* @param listener MegaRequestListener to track this request
*/
void createSetElements(MegaHandle sid, const MegaHandleList* nodes, const MegaStringList* names, MegaRequestListener* listener = nullptr);
/**
* @brief Request creation of a new Element for a Set
*
* The associated request type with this request is MegaRequest::TYPE_PUT_SET_ELEMENT
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParentHandle - Returns INVALID_HANDLE
* - MegaRequest::getTotalBytes - Returns the id of the Set
* - MegaRequest::getParamType - Returns CREATE_ELEMENT, possibly combined with OPTION_ELEMENT_NAME
* - MegaRequest::getText - Returns name of the Element
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getMegaSetElementList - Returns a list containing only the new Element
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_ENOENT - Set could not be found, or node could not be found.
* - MegaError::API_EKEY - File-node had no key.
* - MegaError::API_EINTERNAL - Received answer could not be read or decrypted.
* - MegaError::API_EARGS - Malformed (from API).
* - MegaError::API_EACCESS - Permissions Error (from API).
*
* @param sid the id of the Set that will own the new Element
* @param node the handle of the file-node that will be represented by the new Element
* @param name the name that should be given to the new Element
* @param listener MegaRequestListener to track this request
*/
void createSetElement(MegaHandle sid, MegaHandle node, const char* name = nullptr, MegaRequestListener* listener = nullptr);
/**
* @brief Request to update the name of an Element
*
* The associated request type with this request is MegaRequest::TYPE_PUT_SET_ELEMENT
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParentHandle - Returns id of the Element to be updated
* - MegaRequest::getTotalBytes - Returns the id of the Set
* - MegaRequest::getParamType - Returns OPTION_ELEMENT_NAME
* - MegaRequest::getText - Returns name of the Element
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_ENOENT - Element could not be found.
* - MegaError::API_EINTERNAL - Received answer could not be read or decrypted.
* - MegaError::API_EARGS - Malformed (from API).
* - MegaError::API_EACCESS - Permissions Error (from API).
*
* @param sid the id of the Set that owns the Element
* @param eid the id of the Element that will be updated
* @param name the new name that should be given to the Element
* @param listener MegaRequestListener to track this request
*/
void updateSetElementName(MegaHandle sid, MegaHandle eid, const char* name, MegaRequestListener* listener = nullptr);
/**
* @brief Request to update the order of an Element
*
* The associated request type with this request is MegaRequest::TYPE_PUT_SET_ELEMENT
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParentHandle - Returns id of the Element to be updated
* - MegaRequest::getTotalBytes - Returns the id of the Set
* - MegaRequest::getParamType - Returns OPTION_ELEMENT_ORDER
* - MegaRequest::getNumber - Returns order of the Element
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_ENOENT - Element could not be found.
* - MegaError::API_EINTERNAL - Received answer could not be read or decrypted.
* - MegaError::API_EARGS - Malformed (from API).
* - MegaError::API_EACCESS - Permissions Error (from API).
*
* @param sid the id of the Set that owns the Element
* @param eid the id of the Element that will be updated
* @param order the new order of the Element
* @param listener MegaRequestListener to track this request
*/
void updateSetElementOrder(MegaHandle sid, MegaHandle eid, int64_t order, MegaRequestListener* listener = nullptr);
/**
* @brief Request removal of multiple Elements from a Set
*
* The associated request type with this request is MegaRequest::TYPE_REMOVE_SET_ELEMENTS
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getTotalBytes - Returns the id of the Set
* - MegaRequest::getMegaHandleList - Returns a list containing the handles of Elements to be removed
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getMegaIntegerList - Returns a list containing error codes for all Elements intended for removal
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_ENOENT - Set could not be found.
* - MegaError::API_EINTERNAL - Received answer could not be read or decrypted.
* - MegaError::API_EARGS - Malformed (from API).
* - MegaError::API_EACCESS - Permissions Error (from API).
*
* @param sid the id of the Set that will own the new Elements
* @param eids the ids of Elements to be removed
* @param listener MegaRequestListener to track this request
*/
void removeSetElements(MegaHandle sid, const MegaHandleList* eids, MegaRequestListener* listener = nullptr);
/**
* @brief Request to remove an Element
*
* The associated request type with this request is MegaRequest::TYPE_REMOVE_SET_ELEMENT
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParentHandle - Returns id of the Element to be removed
* - MegaRequest::getTotalBytes - Returns the id of the Set
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_ENOENT - No Set or no Element with given ids could be found (before or after the request).
* - MegaError::API_EINTERNAL - Received answer could not be read.
* - MegaError::API_EARGS - Malformed (from API).
* - MegaError::API_EACCESS - Permissions Error (from API).
*
* @param sid the id of the Set that owns the Element
* @param eid the id of the Element to be removed
* @param listener MegaRequestListener to track this request
*/
void removeSetElement(MegaHandle sid, MegaHandle eid, MegaRequestListener* listener = nullptr);
/**
* @brief Get a list of all Sets available for current user.
*
* The response value is stored as a MegaSetList.
*
* You take the ownership of the returned value
*
* @return list of Sets
*/
MegaSetList* getSets();
/**
* @brief Get the Set with the given id, for current user.
*
* The response value is stored as a MegaSet.
*
* You take the ownership of the returned value
*
* @param sid the id of the Set to be retrieved
*
* @return the requested Set, or null if not found
*/
MegaSet* getSet(MegaHandle sid);
/**
* @brief Get the cover (Element id) of the Set with the given id, for current user.
*
* @param sid the id of the Set to retrieve the cover for
*
* @return Element id of the cover, or INVALIDHANDLE if not set or invalid id
*/
MegaHandle getSetCover(MegaHandle sid);
/**
* @brief Get Element count of the Set with the given id, for current user.
*
* @param sid the id of the Set to get Element count for
* @param includeElementsInRubbishBin consider or filter out Elements in Rubbish Bin
*
* @return Element count of requested Set, or 0 if not found
*/
unsigned getSetElementCount(MegaHandle sid, bool includeElementsInRubbishBin = true);
/**
* @brief Get all Elements in the Set with given id, for current user.
*
* The response value is stored as a MegaSetElementList.
*
* You take the ownership of the returned value
*
* @param sid the id of the Set owning the Elements
* @param includeElementsInRubbishBin consider or filter out Elements in Rubbish Bin
*
* @return all Elements in that Set, or null if not found or none added
*/
MegaSetElementList* getSetElements(MegaHandle sid, bool includeElementsInRubbishBin = true);
/**
* @brief Get a particular Element in a particular Set, for current user.
*
* The response value is stored as a MegaSetElement.
*
* You take the ownership of the returned value
*
* @param sid the id of the Set owning the Element
* @param eid the id of the Element to be retrieved
*
* @return requested Element, or null if not found
*/
MegaSetElement* getSetElement(MegaHandle sid, MegaHandle eid);
/**
* @brief Returns true if the Set has been exported (has a public link)
*
* Public links are created by calling MegaApi::exportSet
*
* @param sid the id of the Set to check
*
* @return true if param sid is an exported Set
*/
bool isExportedSet(MegaHandle sid);
/**
* @brief Generate a public link of a Set in MEGA
*
* The associated request type with this request is MegaRequest::TYPE_EXPORT_SET
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns id of the Set used as parameter
* - MegaRequest::getFlag - Returns a boolean set to true representing the call was
* meant to enable/create the export
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getMegaSet - MegaSet including the public id
* - MegaRequest::getLink - Public link
*
* MegaError::API_OK results in onSetsUpdate being triggered as well
*
* If the MEGA account is a business account and it's status is expired, onRequestFinish will
* be called with the error code MegaError::API_EBUSINESSPASTDUE.
*
* @param sid Set MegaHandle to get the public link
* @param listener MegaRequestListener to track this request
*/
void exportSet(MegaHandle sid, MegaRequestListener *listener = nullptr);
/**
* @brief Stop sharing a Set
*
* The associated request type with this request is MegaRequest::TYPE_EXPORT_SET
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns id of the Set used as parameter
* - MegaRequest::getFlag - Returns a boolean set to false representing the call was
* meant to disable the export
*
* MegaError::API_OK results in onSetsUpdate being triggered as well
*
* If the MEGA account is a business account and it's status is expired, onRequestFinish will
* be called with the error code MegaError::API_EBUSINESSPASTDUE.
*
* @param sid Set MegaHandle to stop sharing
* @param listener MegaRequestListener to track this request
*/
void disableExportSet(MegaHandle sid, MegaRequestListener *listener = nullptr);
/**
* @brief gets Set and Elements handle size
* @return Set and Elements handle size
*/
static int getSetElementHandleSize();
/**
* @brief Request to fetch a public/exported Set and its Elements.
*
* The associated request type with this request is MegaRequest::TYPE_FETCH_SET
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getLink - Returns the link used for the public Set fetch request
*
* In addition to fetching the Set (including Elements) and keeping a local/cached
* copy in SDK instance, SDK's instance is set to preview mode for the public Set.
* This mode allows downloading of foreign SetElements included in the public Set.
*
* To disable the preview mode and release resources cached by the preview Set,
* use MegaApi::stopPublicSetPreview
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getMegaSet - Returns the Set
* - MegaRequest::getMegaSetElementList - Returns the list of Elements
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_ENOENT - Set could not be found.
* - MegaError::API_EINTERNAL - Received answer could not be read.
* - MegaError::API_EKEY - Received answer could not be decrypted.
* - MegaError::API_EARGS - Malformed (from API).
* - MegaError::API_EACCESS - Permissions Error (from API).
*
* If the MEGA account is a business account and it's status is expired, onRequestFinish will
* be called with the error code MegaError::API_EBUSINESSPASTDUE.
*
* @param publicSetLink Public link to a Set in MEGA
* @param listener MegaRequestListener to track this request
*/
void fetchPublicSet(const char* publicSetLink, MegaRequestListener* listener = nullptr);
/**
* @brief Stops public Set preview mode for current SDK instance
*
* MegaApi cached Set and SetElements will be released
*
*/
void stopPublicSetPreview();
/**
* @brief Returns if this MegaApi instance is in a public/exported Set preview mode
*
* @returns True if public Set preview mode is enabled
*
*/
bool inPublicSetPreview();
/**
* @brief Get currently cached public/exported Set in Preview mode
*
* The response value is stored as a MegaSet.
*
* You take the ownership of the returned value
*
* @return Current public/exported Set in preview mode or nullptr if there is none
*
*/
MegaSet* getPublicSetInPreview();
/**
* @brief Get currently cached public/exported SetElements in Preview mode
*
* The response value is stored as a MegaSetElementList.
*
* You take the ownership of the returned value
*
* @return Current public/exported SetElements in preview mode or nullptr if there is none
*
*/
MegaSetElementList* getPublicSetElementsInPreview();
/**
* @brief Gets a MegaNode for the foreign MegaSetElement that can be used to download the Element
*
* The associated request type with this request is MegaRequest::TYPE_GET_EXPORTED_SET_ELEMENT
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getPublicMegaNode - Returns the MegaNode (ownership transferred)
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_EACCESS - Public Set preview mode is not enabled
* - MegaError::API_EARGS - MegaHandle for SetElement provided as param doesn't match any Element
* in previewed Set
* - MegaError::API_ENOENT - Node metadata was not available for the SetElement provided as param
*
* If the MEGA account is a business account and it's status is expired, onRequestFinish will
* be called with the error code MegaError::API_EBUSINESSPASTDUE.
*
* @param eid MegaHandle of target SetElement from Set in preview mode
* @param listener MegaRequestListener to track this request
*/
void getPreviewElementNode(MegaHandle eid, MegaRequestListener* listener = nullptr);
/**
* @brief Gets the public link / URL that can be used to fetch a public Set and its SetElements
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @param sid MegaHandle of target Set to get its public link/URL
*
* @return const char* with the public URL if success, nullptr otherwise
* In any case, one of the followings error codes with the result can be found in the log:
* - API_OK on success
* - API_ENOENT if sid doesn't match any owned Set or the Set is not exported
* - API_EARGS if there was an internal error composing the URL
*/
const char* getPublicLinkForExportedSet(MegaHandle sid);
/**
* @brief Enable or disable the request status monitor
*
* When it's enabled, the request status monitor generates events of type
* MegaEvent::EVENT_REQSTAT_PROGRESS with the per mille progress in
* the field MegaEvent::getNumber(), or -1 if there isn't any operation in progress.
*
* @param enable True to enable the request status monitor, or false to disable it
*/
void enableRequestStatusMonitor(bool enable);
/**
* @brief Get the status of the request status monitor
* @return True when the request status monitor is enabled, or false if it's disabled
*/
bool requestStatusMonitorEnabled();
/* MegaVpnCredentials */
/**
* @brief Gets a list with the available regions for MEGA VPN.
*
* The associated request type with this request is MegaRequest::TYPE_GET_VPN_REGIONS.
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getMegaStringList - Returns the list with the VPN regions.
*
* @param listener MegaRequestListener to track this request.
*/
void getVpnRegions(MegaRequestListener* listener = nullptr);
/**
* @brief Gets the MEGA VPN credentials currently active for the user.
*
* Important consideration:
* These credentials do NOT contain the User Private Key, which is required for VPN connection.
* Credentials containing the User Private Key are generated by
* MegaApi::putVpnCredential and cannot be retrieved afterwards.
*
* The associated request type with this request is MegaRequest::TYPE_GET_VPN_CREDENTIALS.
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getMegaVpnCredentials - Returns the MegaVpnCredentials object.
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_ENOENT - The user has no credentials registered.
*
* @see MegaApi::MegaVpnCredentials
*
* @param listener MegaRequestListener to track this request.
*/
void getVpnCredentials(MegaRequestListener* listener = nullptr);
/**
* @brief Adds new MEGA VPN credentials on an empty slot.
*
* A pair of private and public keys are generated for the user during this request.
* The User Public Key value is intented for use with MegaApi::checkVpnCredential.
* The User Private Key value is included in the VPN credentials.
* Once returned, neither of these keys can be retrieved, not even using MegaApi::getVpnCredentials.
*
* The user must be a PRO user and have unoccupied VPN slots in order to add new VPN credentials.
*
* The associated request type with this request is MegaRequest::TYPE_PUT_VPN_CREDENTIAL.
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getText - Returns the VPN region used for the VPN credentials.
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getNumber - Returns the SlotID attached to the new VPN credentials.
* - MegaRequest::getPassword - Returns the User Public Key used to register the new VPN credentials.
* - MegaRequest::getSessionKey - Returns a string with the new VPN credentials.
* The content of this string is equivalent to the conf file generated by the webclient:
* [Interface]
* PrivateKey = User Private Key
* Address = IPv4, IPv6
* DNS = IPv4, IPv6
*
* [Peer]
* PublicKey = Cluster Public Key
* AllowedIPs = 0.0.0.0/0, ::/0
* Endpoint = host:port
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_EARGS - Public Key does not have a correct format/length.
* - MegaError::API_EACCESS - User is not PRO.
* - User is not logged in.
* - Public Key is already taken.
* - MegaError::API_ETOOMANY - User has too many registered credentials.
*
* @param region The VPN region to be used on the new VPN credential.
* @param listener MegaRequestListener to track this request.
*/
void putVpnCredential(const char* region, MegaRequestListener* listener = nullptr);
/**
* @brief Delete the current MEGA VPN credentials used on a slot.
*
* The associated request type with this request is MegaRequest::TYPE_DEL_VPN_CREDENTIAL.
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNumber - Returns the SlotID used as a parameter for credential removal.
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_EARGS - SlotID is not valid.
* - MegaError::API_ENOENT - SlotID is not occupied.
*
* @param slotID The SlotID from which to remove the VPN credentials.
* @param listener MegaRequestListener to track this request.
*/
void delVpnCredential(int slotID, MegaRequestListener* listener = nullptr);
/**
* @brief Check the current status of MEGA VPN credentials using the User Public Key.
*
* The User Public Key is obtained from MegaApi::putVpnCredential.
*
* The associated request type with this request is MegaRequest::TYPE_CHECK_VPN_CREDENTIAL.
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getText - Returns the User Public Key used as a parameter to verify the status of the VPN credentials.
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_EACCESS - Public Key is not valid.
*
* @param userPubKey The User Public Key used to register the VPN credentials.
* @param listener MegaRequestListener to track this request.
*/
void checkVpnCredential(const char* userPubKey, MegaRequestListener* listener = nullptr);
/* MegaVpnCredentials END */
/**
* @brief Fetch information about the registered credit card for the user
*
* The associated request type with this request is MegaRequest::TYPE_FETCH_CREDIT_CARD_INFO.
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getMegaStringMap - map with following keys:
* - gw (gateway)
* - brand
* - last4
* - exp_month
* - exp_year
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::ENOENT - No Registered Card
*
* @param listener
*/
void fetchCreditCardInfo(MegaRequestListener* listener = nullptr);
/**
* @brief Get Welcome dialog visibility.
*
* The type associated with this request is MegaRequest::TYPE_GET_ATTR_USER
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_VISIBLE_WELCOME_DIALOG
* - MegaRequest::getFlag - Returns the Welcome dialog visibility.
*
* If the corresponding user attribute is not set yet, the request will fail with the error
* code MegaError::API_ENOENT and MegaRequest::getFlag will return the default value.
*
* @param listener MegaRequestListener to track this request.
*/
virtual void getVisibleWelcomeDialog(MegaRequestListener* listener);
/**
* @brief Set Welcome dialog visibility.
*
* The type associated with this request is MegaRequest::TYPE_SET_ATTR_USER
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_VISIBLE_WELCOME_DIALOG
*
* @param visible True to set the Welcome dialog visible, false otherwise.
* @param listener MegaRequestListener to track this request.
*/
virtual void setVisibleWelcomeDialog(bool visible, MegaRequestListener* listener);
/**
* @brief Creates a node tree.
*
* The associated request type with this request is MegaRequest::TYPE_CREATE_NODE_TREE.
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getParentHandle - Returns the node handle of the parent node in the tree
* - MegaRequest::getMegaNodeTree - Returns the Node Tree updated after it was created
* - MegaRequest::getMegaStringMap - Returns {node handle, file handle} pairs for all newly
* created files. So far a single file gets created by this command.
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_EARGS - Parameters are incorrect.
*
* @param parentNode Parent node from which to create the node tree.
* @param nodeTree Node tree to create which is fulfilled with the new node handles.
* @param listener Listener to track the request.
*/
void createNodeTree(const MegaNode* parentNode,
MegaNodeTree* nodeTree,
MegaRequestListener* listener);
/**
* @brief Creates a node tree.
*
* The associated request type with this request is MegaRequest::TYPE_CREATE_NODE_TREE.
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getParentHandle - Returns the node handle of the parent node in the tree
* - MegaRequest::getMegaNodeTree - Returns the Node Tree updated after it was created
*
* On the onRequestFinish error, the error code associated to the MegaError can be:
* - MegaError::API_EARGS - Parameters are incorrect.
*
* @param parentNode Parent node from which to create the node tree.
* @param nodeTree Node tree to create which is fulfilled with the new node handles.
* @param customerIpPort The IP and port number used by current customer. Valid format
* for IPv4 is <ip>:<port> (for example 0.0.0.0:12345) and for IPv6 is [<ip>]:<port>
* (for example [2001:db8:3333::EEEE:FFFF]:12345).
* @param listener Listener to track the request.
*/
void createNodeTree(const MegaNode* parentNode,
MegaNodeTree* nodeTree,
const char* customerIpPort,
MegaRequestListener* listener);
/**
* @brief Get Terms of Service for VPN visibility.
*
* The type associated with this request is MegaRequest::TYPE_GET_ATTR_USER
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_VISIBLE_TERMS_OF_SERVICE
* - MegaRequest::getFlag - Returns Terms of Service for VPN visibility.
*
* If the corresponding user attribute is not set yet, the request will fail with the error
* code MegaError::API_ENOENT and MegaRequest::getFlag will return the default value (true).
*
* @param listener MegaRequestListener to track this request.
*/
void getVisibleTermsOfService(MegaRequestListener* listener = nullptr);
/**
* @brief Set Terms of Service for VPN visibility.
*
* The type associated with this request is MegaRequest::TYPE_SET_ATTR_USER
*
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_VISIBLE_TERMS_OF_SERVICE
*
* @param visible True to set Terms of Service visibility on, false otherwise.
* @param listener MegaRequestListener to track this request.
*/
void setVisibleTermsOfService(bool visible, MegaRequestListener* listener = nullptr);
/**
* @brief Get the list of IDs for enabled notifications
*
* You take the ownership of the returned value
*
* @return List of IDs for enabled notifications
*/
MegaIntegerList* getEnabledNotifications();
/**
* @brief Enable test notifications
*
* The type associated with this request is MegaRequest::TYPE_SET_ATTR_USER
*
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_ENABLE_TEST_NOTIFICATIONS
* - MegaRequest::getMegaIntegerList - Returns a list containing the notification IDs to be enabled
*
* @param notificationIds list of IDs for the notifications to be enabled
* @param listener MegaRequestListener to track this request
*/
void enableTestNotifications(const MegaIntegerList* notificationIds, MegaRequestListener* listener = nullptr);
/**
* @brief Get list of available notifications for Notification Center
*
* The associated request type with this request is MegaRequest::TYPE_GET_NOTIFICATIONS.
*
* When onRequestFinish received MegaError::API_OK, valid data in the MegaRequest object is:
* - MegaRequest::getMegaNotifications - Returns the list of notifications
*
* When onRequestFinish errored, the error code associated to the MegaError can be:
* - MegaError::API_ENOENT - No such notifications exist, and MegaRequest::getMegaNotifications
* will return a non-null, empty list.
* - MegaError::API_EACCESS - No user was logged in.
* - MegaError::API_EINTERNAL - Received answer could not be read.
*
* @param listener MegaRequestListener to track this request
*/
void getNotifications(MegaRequestListener* listener = nullptr);
/**
* @brief Set last read notification for Notification Center
*
* The type associated with this request is MegaRequest::TYPE_SET_ATTR_USER
*
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_LAST_READ_NOTIFICATION
* - MegaRequest::getNumber - Returns the ID to be set as last read
*
* Note that any notifications with ID equal to or less than the given one will be marked as seen
* in Notification Center.
*
* @param notificationId ID of the notification to be set as last read. Value `0` is an invalid ID.
* Passing `0` will clear a previously set last read value.
* @param listener MegaRequestListener to track this request
*/
void setLastReadNotification(uint32_t notificationId, MegaRequestListener* listener = nullptr);
/**
* @brief Get last read notification for Notification Center
*
* The type associated with this request is MegaRequest::TYPE_GET_ATTR_USER
*
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_LAST_READ_NOTIFICATION
*
* When onRequestFinish received MegaError::API_OK, valid data in the MegaRequest object is:
* - MegaRequest::getNumber - Returns the ID of the last read Notification
* Note that when the ID returned here was `0` it means that no ID was set as last read.
* Note that the value returned here should be treated like a 32bit unsigned int.
*
* @param listener MegaRequestListener to track this request
*/
void getLastReadNotification(MegaRequestListener* listener = nullptr);
/**
* @brief Set last actioned banner for Notification Center
*
* The type associated with this request is MegaRequest::TYPE_SET_ATTR_USER
*
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_LAST_ACTIONED_BANNER
* - MegaRequest::getNumber - Returns the ID to be set as last actioned banner
*
* @param notificationId ID for which the last banner was actioned. Value `0` is an invalid ID.
* Passing `0` will clear a previously set last actioned banner.
* @param listener MegaRequestListener to track this request
*/
void setLastActionedBanner(uint32_t notificationId, MegaRequestListener* listener = nullptr);
/**
* @brief Get last actioned banner for Notification Center
*
* The type associated with this request is MegaRequest::TYPE_GET_ATTR_USER
*
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_LAST_ACTIONED_BANNER
*
* When onRequestFinish received MegaError::API_OK, valid data in the MegaRequest object is:
* - MegaRequest::getNumber - Returns the ID of the last actioned banner
* Note that when the ID returned here was `0` it means that no ID was set as last actioned banner.
* Note that the value returned here should be treated like a 32bit unsigned int.
*
* @param listener MegaRequestListener to track this request
*/
void getLastActionedBanner(MegaRequestListener* listener = nullptr);
/**
* @brief
* Add a new mount to the database.
*
* @param mount
* A description of the new mount.
*
* @param listener
* Who will be notified when the operation completes.
*
* @note
* This call will issue a new request of the type TYPE_ADD_MOUNT.
*/
void addMount(const MegaMount* mount, MegaRequestListener* listener);
/**
* @brief
* Disable an active mount.
*
* @path name
* Identifies the mount to be disabled.
*
* @param listener
* Who will be notified when the operation completes.
*
* @param remember
* True if the mount should remain diasbled after application restart.
*
* If this parameter is true and path specifies a transient mount,
* that mount will become persistent.
*
* This makes sense as remembering something about a mount implies
* that it persists for more than a single session.
*
* @note
* This call will issue a new request of the type TYPE_DISABLE_MOUNT.
*/
void disableMount(const char* name,
MegaRequestListener* listener,
bool remember);
/**
* @brief
* Enable an inactive mount.
*
* @param name
* Identifies the mount to be enabled.
*
* @param listener
* Who will be notified when the operation completes.
*
* @param remember
* True if the mount should remain enabled after application restart.
*
* If this parameter is true and path specifies a transient mount,
* that mount will become persistent.
*
* This makes sense as remembering something about a mount implies
* that it persists for more than a single session.
*
* @note
* This call will issue a new request of the type TYPE_ENABLE_MOUNT.
*/
void enableMount(const char* name,
MegaRequestListener* listener,
bool remember);
/**
* @brief
* Retrieve the FUSE subsystem's current flags.
*
* You take ownership of the returned value.
*
* @return
* The FUSE subsystem's current flags.
*/
MegaFuseFlags* getFUSEFlags();
/**
* @brief
* Retrieve an existing mount's flags.
*
* You take ownership of the returned value.
*
* @param name
* Identifies the mount we want to query.
*
* @return
* NULL if no such mount exists.
*/
MegaMountFlags* getMountFlags(const char* name);
/**
* @brief
* Retrieve a description of an existing mount.
*
* You take ownership of the returned value.
*
* @param name
* Identifies the mount we want to describe.
*
* @return
* NULL if no such mount exists.
*/
MegaMount* getMountInfo(const char* name);
/**
* @brief
* Retrieve the path of the mount associated with name.
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @param name
* A name of a previously added mount.
*
* @return
* The mounts path if any otherwise null.
*/
char* getMountPath(const char* name);
/**
* @brief
* Retrieve a list of known mounts.
*
* You take ownership of the returned value.
*
* @param enabled
* True if only enabled mounts should be returned.
*
* @return
* A list of mount descriptions.
*/
MegaMountList* listMounts(bool enabled);
/**
* @brief
* Check whether the specified file is in FUSE's cache.
*
* @param path
* Identifies the file we want to check.
*
* @return
* True if the file is in FUSE's cache.
*/
bool isCachedByPath(const char* path);
/**
* @brief
* Query whether FUSE is supported on this platform.
*
* @return
* True if FUSE is supported on this platform.
*/
bool isFUSESupported();
/**
* @brief
* Query whether a mount is enabled.
*
* @param path
* Identifies the mount we want to query.
*
* @return
* True if the mount is enabled.
*/
bool isMountEnabled(const char* path);
/**
* @brief
* Remove an existing mount from the database.
*
* @param path
* Identifies the mount to be removed.
*
* @param listener
* Who will be notified when the operation completes.
*
* @note
* This call will issue a request of the type TYPE_REMOVE_MOUNT.
*/
void removeMount(const char* path, MegaRequestListener* listener);
/**
* @brief
* Update the FUSE subsystem's flags.
*
* @param flags
* The FUSE subsystem's new flags.
*/
void setFUSEFlags(const MegaFuseFlags* flags);
/**
* @brief
* Update an exisrting mount's flags.
*
* You can use this function to change properties such as a mount's
* name or writability.
*
* @param flags
* Specifies the new values of a mount's flags.
*
* @param path
* Identifies the mount whose flags we want to update.
*
* @param listener
* Who will be notified when the operation completes.
*
* @note
* This call will issue a request of the type TYPE_SET_MOUNT_FLAGS.
*/
void setMountFlags(const MegaMountFlags* flags,
const char* path,
MegaRequestListener* listener);
/**
* You take ownership of the returned value.
* @deprecated Use getFlag(const char* flagName, bool commit) instead.
*/
MegaFlag* getFlag(const char* flagName, bool commit, MegaRequestListener* listener);
/**
* @brief Get the type and value for the flag with the given name, if present among either
* A/B Test or Feature flags.
*
* If found among A/B Test flags and commit was true, also inform the API that a user has become
* relevant for that A/B Test flag (via a request of type MegaRequest::TYPE_AB_TEST_ACTIVE,
* for which the response is not be relevant for the calling app)
*
* You take the ownership of the returned value
*
* @param flagName Name or key of the value to be retrieved (and possibly be sent to API as active).
* @param commit Determine whether an A/B Test flag will be sent to API as active.
*
* @return A MegaFlag instance with the type and value of the flag.
*/
MegaFlag* getFlag(const char* flagName, bool commit = true);
/**
* @brief Delete a user attribute of the current user, for testing
* This method is for developer use only and it requires to be logged-in into an
* account under a MEGA email. Otherwise, it will fail with API_EACCESS (except for
* attributes "gmk" and "promocode", which are not supported by SDK, but removed by
* Webclient).
*
* The associated request type with this request is MegaRequest::TYPE_DEL_ATTR_USER
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the attribute type
*
* @param type Attribute type
*
* Valid values are:
*
* MegaApi::USER_ATTR_FIRSTNAME = 1
* Delete the firstname of the user (public)
* MegaApi::USER_ATTR_LASTNAME = 2
* Delete the lastname of the user (public)
* MegaApi::USER_ATTR_AUTHRING = 3
* Delete the authentication ring of the user (private)
* MegaApi::USER_ATTR_LAST_INTERACTION = 4
* Delete the last interaction of the contacts of the user (private)
* MegaApi::USER_ATTR_ED25519_PUBLIC_KEY = 5
* Delete the public key Ed25519 of the user (public)
* MegaApi::USER_ATTR_CU25519_PUBLIC_KEY = 6
* Delete the public key Cu25519 of the user (public)
* MegaApi::USER_ATTR_KEYRING = 7
* Delete the key ring of the user: private keys for Cu25519 and Ed25519 (private)
* MegaApi::USER_ATTR_SIG_RSA_PUBLIC_KEY = 8
* Delete the signature of RSA public key of the user (public)
* MegaApi::USER_ATTR_SIG_CU255_PUBLIC_KEY = 9
* Delete the signature of Cu25519 public key of the user (public)
* MegaApi::USER_ATTR_LANGUAGE = 14
* Delete the preferred language of the user (private, non-encrypted)
* MegaApi::USER_ATTR_PWD_REMINDER = 15
* Delete the password-reminder-dialog information (private, non-encrypted)
* MegaApi::USER_ATTR_DISABLE_VERSIONS = 16
* Delete whether user has versions disabled or enabled (private, non-encrypted)
* MegaApi::USER_ATTR_RICH_PREVIEWS = 18
* Delete whether user generates rich-link messages or not (private)
* MegaApi::USER_ATTR_RUBBISH_TIME = 19
* Delete number of days for rubbish-bin cleaning scheduler (private non-encrypted)
* MegaApi::USER_ATTR_STORAGE_STATE = 21
* Delete the state of the storage (private non-encrypted)
* MegaApi::USER_ATTR_GEOLOCATION = 22
* Delete the user geolocation (private)
* MegaApi::USER_ATTR_CAMERA_UPLOADS_FOLDER = 23
* Delete the target folder for Camera Uploads (private)
* MegaApi::USER_ATTR_MY_CHAT_FILES_FOLDER = 24
* Delete the target folder for My chat files (private)
* MegaApi::USER_ATTR_PUSH_SETTINGS = 25
* Delete whether user has push settings enabled (private)
* MegaApi::USER_ATTR_ALIAS = 27
* Delete the list of the users's aliases (private)
* MegaApi::USER_ATTR_DEVICE_NAMES = 30
* Delete the list of device or external drive names (private)
* MegaApi::USER_ATTR_MY_BACKUPS_FOLDER = 31
* Delete the target folder for My Backups (private)
* MegaApi::USER_ATTR_COOKIE_SETTINGS = 33
* Delete whether user has Cookie Settings enabled
* MegaApi::USER_ATTR_JSON_SYNC_CONFIG_DATA = 34
* Delete name and key to cypher sync-configs file
* MegaApi::USER_ATTR_NO_CALLKIT = 36
* Delete whether user has iOS CallKit disabled or enabled (private, non-encrypted)
* MegaApi::USER_ATTR_RECENT_CLEAR_TIMESTAMP = 52
* Delete the timestamp for recent actions history clearing (private, encrypted)
*
* @param listener MegaRequestListener to track this request
*/
void deleteUserAttribute(int type, MegaRequestListener* listener = NULL);
/**
* @brief Retrieve active survey trigger action IDs
*
* This function fetches all active survey trigger action IDs.
*
* The associated request type for this function is
* MegaRequest::TYPE_GET_ACTIVE_SURVEY_TRIGGER_ACTIONS.
*
* On successful completion (MegaError::API_OK), the MegaRequest object received in
* onRequestFinish contains:
* - MegaRequest::getMegaIntegerList: Returns a list of active trigger action IDs.
*
* If the request fails, the MegaError code in onRequestFinish can be:
* - ENOENT: No available trigger actions.
* - EINTERNAL: Received response could not be read.
*
* @param listener MegaRequestListener to track this request
*/
void getActiveSurveyTriggerActions(MegaRequestListener* listener = nullptr);
/**
* @brief Get a survey
*
* This function retrieves the survey of the given trigger action.
*
* The associated request type for this function is MegaRequest::TYPE_GET_SURVEY.
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - Returns the trigger action ID.
*
* On successful completion (MegaError::API_OK), the MegaRequest object received in
* onRequestFinish contains:
* - MegaRequest::getNodeHandle - Returns the survey handle.
* - MegaRequest::getNumDetails - Returns the survey's maximum response value.
* - MegaRequest::getFile - Returns the name of the image to be displayed.
* - MegaRequest::getText - Returns the survey's question content.
*
* If the request fails, the MegaError code in onRequestFinish can be:
* - EACCESS - Invalid user ID
* - EARGS - Invalid trigger action
* - ENOENT - No eligible survey
* - EINTERNAL - Received answer could not be read
*
* @param triggerActionId The ID of the trigger action
* @param listener MegaRequestListener to track this request
*/
void getSurvey(unsigned int triggerActionId, MegaRequestListener* listener = nullptr);
/**
* @brief Enable test surveys
*
* This function enables the specified surveys for testing purposes. Once enabled, these
* surveys can be answered multiple times.
*
* The type associated with this request is MegaRequest::TYPE_SET_ATTR_USER
*
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getParamType - The attribute type MegaApi::USER_ATTR_ENABLE_TEST_SURVEYS
* - MegaRequest::getMegaHandleList - A list of the survey handles to be enabled
*
* @param surveyHandles The list of handles of the surveys to be enabled.
* @param listener MegaRequestListener to track this request
*/
void enableTestSurveys(const MegaHandleList* surveyHandles,
MegaRequestListener* listener = nullptr);
/**
* @brief Answer a survey
*
* This function answers a survey that the user has been asked to complete.
*
* @note: If triggerActionId is MegaApi::ACT_END_UPLOAD, response and comment params, must
* be valid null terminated c-style strings, and response must contains a string with a
* valid rating value between 1 and 5
*
* The associated request type for this function is MegaRequest::TYPE_ANSWER_SURVEY.
* Valid data in the MegaRequest object received on callbacks:
* - MegaRequest::getNodeHandle - Returns the survey handle.
* - MegaRequest::getParamType - Returns the trigger action ID.
* - MegaRequest::getText - Returns the survey response.
* - MegaRequest::getFile - Returns the response to tell us more.
*
* If the request fails, the MegaError code in onRequestFinish can be:
* - EACCESS - Invalid user ID.
* - EARGS - Invalid arguments such as invalid survey handle/invalid trigger action ID.
* Also if triggerActionId is MegaApi::ACT_END_UPLOAD, and no valid rating value is provided
* at response, or comment param is nullptr.
* - ENOENT - Survey not found, trigger action not found, or survey disabled.
* - EINTERNAL - Received answer could not be read.
*
* @param surveyHandle The survey handle
* @param triggerActionId The trigger action ID. Valid values for this field are defined at
* MegaApi::SurveyTriggerActionId
* @param response The response to the survey
* @param comment The response to tell us more
* @param listener MegaRequestListener to track this request
*/
void answerSurvey(MegaHandle surveyHandle,
unsigned int triggerActionId,
const char* response,
const char* comment = nullptr,
MegaRequestListener* listener = nullptr);
/**
* @brief Gets the public IP address and country code.
*
* The associated request type with this request is MegaRequest::TYPE_GET_MY_IP.
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getName - Returns the country code.
* - MegaRequest::getText - Returns the public IP address.
*
* @param listener MegaRequestListener to track this request.
*/
void getMyIp(MegaRequestListener* listener = nullptr);
/**
* @brief Run a network connectivity test.
*
* The associated request type with this request is
* MegaRequest::TYPE_RUN_NETWORK_CONNECTIVITY_TEST.
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getMegaNetworkConnectivityTestResults - Returns the results of the test.
*
* If the network connectivity test server could not be retrieved the test will not run and
* the request will fail with MegaError::API_ESID.
*
* @param listener MegaRequestListener to track this request.
*/
void runNetworkConnectivityTest(MegaRequestListener* listener = nullptr);
/**
* @brief Retrieve the cancellation details of a subscription
*
* This function requests information about the cancellation status of a subscription.
* If the optional original transaction ID is not provided, the details of the most recent
* subscription will be returned.
*
* The associated request type with this request is
* MegaRequest::TYPE_GET_SUBSCRIPTION_CANCELLATION_DETAILS.
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getText - Returns the original transaction ID
* - MegaRequest::getNumber - Returns the subscription's expiration timestamp
* - MegaRequest::getNumDetails - Returns the cancellation timestamp, or 0 if not cancelled
*
* Possible errors:
* - MegaError::API_EARGS - If the gateway is not provided or not equal to 2, or if the
* transaction ID is not a string
* - MegaError::API_ENOENT - If the provided transaction ID is not valid, or the user does
* not have a subscription via the specified gateway
*
* @param originalTransactionId Original transaction ID. Optional. If not provided, the last
* subscription's details will be returned.
* @param gatewayId Integer indicating the gateway.
* @param listener MegaRequestListener to track this request,
*/
void getSubscriptionCancellationDetails(unsigned int gatewayId,
const char* originalTransactionId = nullptr,
MegaRequestListener* listener = nullptr);
/**
* @brief Retrieve information about a discount code
*
* The list of valid values for \c code can be retrieved from the
* getter MegaDiscountCode::getCode. The list of available discounts
* can be retrieved by calling MegaApi::getPricing.
*
* The associated request type with this request is
* MegaRequest::TYPE_GET_DISCOUNT_CODE_INFORMATION.
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MegaError::API_OK:
* - MegaRequest::getText - Returns the discount code
* - MegaRequest::getMegaDiscountCodeInfo - Returns the discount code information
*
* Possible errors:
* - MegaError::API_EARGS - If the provided code is nullptr
* - MegaError::API_EEXPIRED - If the discount has expired
* - MegaError::API_ENOENT - If the provided code is not found
* - MegaError::API_EACCESS - If the discount is for different user
* - MegaError::API_EEXIST - If the discount has already been redeemed
*
* @param code Discount code to get information about
* @param listener MegaRequestListener to track this request
*/
void getDiscountCodeInformation(const char* code, MegaRequestListener* listener = nullptr);
protected:
MegaApiImpl *pImpl = nullptr;
friend class MegaApiImpl;
};
/**
* @brief Represents information of a Backup in MEGA
*
* It allows getting all information about a Backup.
*
* Objects of this class aren't live, they are snapshots of the state of a Backup
* when the object was created. They are immutable.
*
*/
class MegaBackupInfo
{
public:
/**
* @brief Returns Backup id.
*
* @return Backup id.
*/
virtual MegaHandle id() const { return INVALID_HANDLE; }
/**
* @brief Returns Backup type.
*
* It can be one of the MegaApi::BACKUP_TYPE_x values.
*
* @return Backup type.
*/
virtual int type() const { return MegaApi::BACKUP_TYPE_INVALID; }
/**
* @brief Returns handle of Backup root.
*
* @return Backup root handle.
*/
virtual MegaHandle root() const { return INVALID_HANDLE; }
/**
* @brief Returns the name of the backed up local folder.
*
* @return Name of the backed up local folder.
*/
virtual const char* localFolder() const { return nullptr; }
/**
* @brief Returns the id of the device where the backup originated.
*
* @return Id of the device where the backup originated.
*/
virtual const char* deviceId() const { return nullptr; }
/**
* @brief Returns the user-agent associated with the device where the backup originated.
*
* @return User-agent associated with the device where the backup originated.
*/
virtual const char* deviceUserAgent() const { return nullptr; }
/**
* @brief Possible sync state of a backup.
*/
enum // 1:1 with CommandBackupPut::SPState enum values
{
BACKUP_STATE_NOT_INITIALIZED = 0,
BACKUP_STATE_ACTIVE = 1, // Working fine (enabled)
BACKUP_STATE_FAILED = 2, // Failed (permanently disabled)
BACKUP_STATE_TEMPORARY_DISABLED = 3, // Temporarily disabled due to a transient situation (e.g: account blocked). Will be resumed when the condition passes
BACKUP_STATE_DISABLED = 4, // Disabled by the user
BACKUP_STATE_PAUSE_UP = 5, // Active but upload transfers paused in the SDK
BACKUP_STATE_PAUSE_DOWN = 6, // Active but download transfers paused in the SDK
BACKUP_STATE_PAUSE_FULL = 7, // Active but transfers paused in the SDK
BACKUP_STATE_DELETED = 8, // Sync needs to be deleted, as required by sync-desired-state received from BackupCenter (WebClient)
};
/**
* @brief Returns the sync state of the backup.
*
* It can be one of the BACKUP_STATE_x enum values.
*
* @return Sync state of the backup.
*/
virtual int state() const { return BACKUP_STATE_NOT_INITIALIZED; }
/**
* @brief Returns the sync substate of the backup.
*
* It can be one of the enum values defined at MegaSync::Error.
*
* @return Sync substate of the backup.
*/
virtual int substate() const { return 0; }
/**
* @brief Returns extra information, used as source for extracting other details.
*
* @return Extra information, used as source for extracting other details.
*/
virtual const char* extra() const { return nullptr; }
/**
* @brief Returns the name of the backup.
*
* @return Name of the backup.
*/
virtual const char* name() const { return nullptr; }
/**
* @brief Returns the timestamp of the backup, as reported by heartbeats.
*
* @return Timestamp of the backup, as reported by heartbeats.
*/
virtual uint64_t ts() const { return 0; }
/**
* @brief Possible status of a backup.
*/
enum // 1:1 with CommandBackupPutHeartBeat::SPHBStatus enum values
{
BACKUP_STATUS_NOT_INITIALIZED = 0,
BACKUP_STATUS_UPTODATE = 1, // Up to date: local and remote paths are in sync
BACKUP_STATUS_SYNCING = 2, // The sync engine is working, transfers are in progress
BACKUP_STATUS_PENDING = 3, // The sync engine is working, e.g: scanning local folders
BACKUP_STATUS_INACTIVE = 4, // Sync is not active. A state != ACTIVE should have been sent through 'sp'
BACKUP_STATUS_UNKNOWN = 5, // Unknown status
BACKUP_STATUS_STALLED = 6, // A folder is scan-blocked, or some contradictory changes occured between local and remote folders, user must pick one
};
/**
* @brief Returns the status of the backup, as reported by heartbeats.
*
* It can be one of the BACKUP_STATUS_x enum values.
*
* @return Status of the backup, as reported by heartbeats.
*/
virtual int status() const { return BACKUP_STATUS_NOT_INITIALIZED; }
/**
* @brief Returns the progress of the backup, as reported by heartbeats.
*
* @return Progress of the backup, as reported by heartbeats.
*/
virtual int progress() const { return 0; }
/**
* @brief Returns upload count.
*
* @return Upload count.
*/
virtual int uploads() const { return 0; }
/**
* @brief Returns download count.
*
* @return Download count.
*/
virtual int downloads() const { return 0; }
/**
* @brief Returns the last activity timestamp, as reported by heartbeats.
*
* @return Last activity timestamp, as reported by heartbeats.
*/
virtual uint64_t activityTs() const { return 0; }
/**
* @brief Returns handle of the last synced node.
*
* @return Handle of the last synced node.
*/
virtual MegaHandle lastSync() const { return INVALID_HANDLE; }
virtual MegaBackupInfo* copy() const { return nullptr; }
virtual ~MegaBackupInfo() = default;
};
class MegaHashSignatureImpl;
/**
* @brief Class to check a digital signatures
*
* The typical usage of this class:
* - Construct the object using a public key
* - Add data using MegaHashSignature::add (it can be called many times to add more data)
* - Call MegaHashSignature::check to know if the data matches a signature
* - Call MegaHashSignature::init and reuse the object if needed
*/
class MegaHashSignature
{
public:
/**
* @brief Initialize the object with a public key to check digital signatures
* @param base64Key Base64-encode public key.
*
* This is the public key used to distribute MEGAsync updates:
* "EACTzXPE8fdMhm6LizLe1FxV2DncybVh2cXpW3momTb8tpzRNT833r1RfySz5uHe8gdoXN1W0eM5Bk8X-LefygYYDS9RyXrRZ8qXrr9ITJ4r8ATnFIEThO5vqaCpGWTVi5pOPI5FUTJuhghVKTyAels2SpYT5CmfSQIkMKv7YVldaV7A-kY060GfrNg4--ETyIzhvaSZ_jyw-gmzYl_dwfT9kSzrrWy1vQG8JPNjKVPC4MCTZJx9SNvp1fVi77hhgT-Mc5PLcDIfjustlJkDBHtmGEjyaDnaWQf49rGq94q23mLc56MSjKpjOR1TtpsCY31d1Oy2fEXFgghM0R-1UkKswVuWhEEd8nO2PimJOl4u9ZJ2PWtJL1Ro0Hlw9OemJ12klIAxtGV-61Z60XoErbqThwWT5Uu3D2gjK9e6rL9dufSoqjC7UA2C0h7KNtfUcUHw0UWzahlR8XBNFXaLWx9Z8fRtA_a4seZcr0AhIA7JdQG5i8tOZo966KcFnkU77pfQTSprnJhCfEmYbWm9EZA122LJBWq2UrSQQN3pKc9goNaaNxy5PYU1yXyiAfMVsBDmDonhRWQh2XhdV-FWJ3rOGMe25zOwV4z1XkNBuW4T1JF2FgqGR6_q74B2ccFC8vrNGvlTEcs3MSxTI_EKLXQvBYy7hxG8EPUkrMVCaWzzTQAFEQ"
*/
MegaHashSignature(const char *base64Key);
~MegaHashSignature();
/**
* @brief Reinitialize the object
*/
void init();
/**
* @brief Add data to calculate the signature
* @param data Byte buffer with the data
* @param size Size of the buffer
*/
void add(const char *data, unsigned size);
/**
* @brief Check if the introduced data matches a signature
* @param base64Signature Base64-encoded digital signature
* @return true if the signature is correct, otherwise false
*/
bool checkSignature(const char *base64Signature);
private:
MegaHashSignatureImpl *pImpl;
};
/**
* @brief Details about a MEGA balance
*/
class MegaAccountBalance
{
public:
virtual ~MegaAccountBalance();
/**
* @brief Get the amount of the balance
* @return Amount
*/
virtual double getAmount() const;
/**
* @brief Get the currency of the amount
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @return Currency of the amount
*/
virtual char *getCurrency() const;
};
/**
* @brief Details about a MEGA session
*/
class MegaAccountSession
{
public:
virtual ~MegaAccountSession();
/**
* @brief Get the creation date of the session
*
* In seconds since the Epoch
*
* @return Creation date of the session
*/
virtual int64_t getCreationTimestamp() const;
/**
* @brief Get the timestamp of the most recent usage of the session
* @return Timestamp of the most recent usage of the session (in seconds since the Epoch)
*/
virtual int64_t getMostRecentUsage() const;
/**
* @brief Get the User-Agent of the client that created the session
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @return User-Agent of the creator of the session
*/
virtual char *getUserAgent() const;
/**
* @brief Get the IP address of the client that created the session
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @return IP address of the creator of the session
*/
virtual char *getIP() const;
/**
* @brief Get the country of the client that created the session
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @return Country of the creator of the session
*/
virtual char *getCountry() const;
/**
* @brief Retuns true if the session is the current one
* @return True if the session is the current one. Otherwise false.
*/
virtual bool isCurrent() const;
/**
* @brief Get the state of the session
* @return True if the session is alive, false otherwise
*/
virtual bool isAlive() const;
/**
* @brief Get the handle of the session
* @return Handle of the session
*/
virtual MegaHandle getHandle() const;
/**
* @brief Get the Device-id of the device where the session originated
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @return Device-id of the device where the session originated
*/
virtual char *getDeviceId() const;
};
/**
* @brief Details about a MEGA purchase
*/
class MegaAccountPurchase
{
public:
virtual ~MegaAccountPurchase();
/**
* @brief Get the timestamp of the purchase
* @return Timestamp of the purchase (in seconds since the Epoch)
*/
virtual int64_t getTimestamp() const;
/**
* @brief Get the handle of the purchase
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @return Handle of the purchase
*/
virtual char *getHandle() const;
/**
* @brief Get the currency of the purchase
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @return Currency of the purchase
*/
virtual char* getCurrency() const;
/**
* @brief Get the amount of the purchase
* @return Amount of the purchase
*/
virtual double getAmount() const;
/**
* @brief Get the method of the purchase
*
* These are the valid methods:
* - MegaApi::PAYMENT_METHOD_BALANCE = 0,
* - MegaApi::PAYMENT_METHOD_PAYPAL = 1,
* - MegaApi::PAYMENT_METHOD_ITUNES = 2,
* - MegaApi::PAYMENT_METHOD_GOOGLE_WALLET = 3,
* - MegaApi::PAYMENT_METHOD_BITCOIN = 4,
* - MegaApi::PAYMENT_METHOD_UNIONPAY = 5,
* - MegaApi::PAYMENT_METHOD_FORTUMO = 6,
* - MegaApi::PAYMENT_METHOD_CREDIT_CARD = 8
* - MegaApi::PAYMENT_METHOD_CENTILI = 9
* - MegaApi::PAYMENT_METHOD_WINDOWS_STORE = 13
*
* @return Method of the purchase
*/
virtual int getMethod() const;
};
/**
* @brief Details about a MEGA transaction
*/
class MegaAccountTransaction
{
public:
virtual ~MegaAccountTransaction();
/**
* @brief Get the timestamp of the transaction
* @return Timestamp of the transaction (in seconds since the Epoch)
*/
virtual int64_t getTimestamp() const;
/**
* @brief Get the handle of the transaction
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @return Handle of the transaction
*/
virtual char *getHandle() const;
/**
* @brief Get the currency of the transaction
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @return Currency of the transaction
*/
virtual char* getCurrency() const;
/**
* @brief Get the amount of the transaction
* @return Amount of the transaction
*/
virtual double getAmount() const;
};
/**
* @brief Details about a MEGA feature
*/
class MegaAccountFeature
{
public:
virtual ~MegaAccountFeature() = default;
/**
* @brief Get the expiry timestamp
*
* @return Expiry timestamp
*/
virtual int64_t getExpiry() const = 0;
/**
* @brief Get the ID of this feature
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @return ID of this feature
*/
virtual char* getId() const = 0;
};
/**
* @brief Details about a MEGA subscription
*/
class MegaAccountSubscription
{
public:
enum
{
SUBSCRIPTION_STATUS_NONE = 0,
SUBSCRIPTION_STATUS_VALID = 1,
SUBSCRIPTION_STATUS_INVALID = 2
};
virtual ~MegaAccountSubscription() = default;
/**
* @brief Get the ID of this subscription
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @return ID of this subscription
*/
virtual char* getId() const = 0;
/**
* @brief Check if the subscription is active
*
* If this function returns MegaAccountDetails::SUBSCRIPTION_STATUS_VALID,
* the subscription will be automatically renewed.
* See MegaAccountSubscription::getRenewTime()
*
* @return Information about the subscription status
*
* Valid return values are:
* - MegaAccountSubscription::SUBSCRIPTION_STATUS_NONE = 0
* There isn't any active subscription
*
* - MegaAccountSubscription::SUBSCRIPTION_STATUS_VALID = 1
* There is an active subscription
*
* - MegaAccountSubscription::SUBSCRIPTION_STATUS_INVALID = 2
* A subscription exists, but it uses a payment gateway that is no longer valid
*/
virtual int getStatus() const = 0;
/**
* @brief Get the subscription cycle
*
* The return value will show if the subscription will be montly or yearly renewed.
* Example return values: "1 M", "1 Y".
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @return Subscription cycle
*/
virtual char* getCycle() const = 0;
/**
* @brief Get the subscription payment provider name
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @return Payment provider name
*/
virtual char* getPaymentMethod() const = 0;
/**
* @brief Get the subscription payment provider ID
*
* @return Payment provider ID
*/
virtual int32_t getPaymentMethodId() const = 0;
/**
* @brief Get the subscription renew timestamp
*
* @return Renewal timestamp (in seconds since epoch)
*/
virtual int64_t getRenewTime() const = 0;
/**
* @brief Get the subscription account level
*
* @return Subscription account level
* Valid values for PRO plan subscriptions:
* - MegaAccountDetails::ACCOUNT_TYPE_FREE = 0
* - MegaAccountDetails::ACCOUNT_TYPE_PROI = 1
* - MegaAccountDetails::ACCOUNT_TYPE_PROII = 2
* - MegaAccountDetails::ACCOUNT_TYPE_PROIII = 3
* - MegaAccountDetails::ACCOUNT_TYPE_LITE = 4
* - MegaAccountDetails::ACCOUNT_TYPE_STARTER = 11
* - MegaAccountDetails::ACCOUNT_TYPE_BASIC = 12
* - MegaAccountDetails::ACCOUNT_TYPE_ESSENTIAL = 13
* - MegaAccountDetails::ACCOUNT_TYPE_BUSINESS = 100
* - MegaAccountDetails::ACCOUNT_TYPE_PRO_FLEXI = 101
*
* Valid value for feature plan subscriptions:
* - MegaAccountDetails::ACCOUNT_TYPE_FEATURE = 99999
*/
virtual int32_t getAccountLevel() const = 0;
/**
* @brief Get the features granted by this subscription
*
* You take the ownership of the returned value
*
* @return Features granted by this subscription.
*/
virtual MegaStringList* getFeatures() const = 0;
/**
* @brief Return if the subscription is related to an active trial
*
* @return True if the subscription is related to an active trial, otherwise false.
*/
virtual bool isTrial() const = 0;
};
class MegaAccountPlan
{
public:
virtual ~MegaAccountPlan() = default;
/**
* @brief Check if the plan is a PRO plan or a feature plan.
*
* @return True if the plan is a PRO plan
*/
virtual bool isProPlan() const = 0;
/**
* @brief Get account level of the plan
*
* @return Plan level of the MEGA account.
* Valid values for PRO plans are:
* - MegaAccountDetails::ACCOUNT_TYPE_FREE = 0
* - MegaAccountDetails::ACCOUNT_TYPE_PROI = 1
* - MegaAccountDetails::ACCOUNT_TYPE_PROII = 2
* - MegaAccountDetails::ACCOUNT_TYPE_PROIII = 3
* - MegaAccountDetails::ACCOUNT_TYPE_LITE = 4
* - MegaAccountDetails::ACCOUNT_TYPE_STARTER = 11
* - MegaAccountDetails::ACCOUNT_TYPE_BASIC = 12
* - MegaAccountDetails::ACCOUNT_TYPE_ESSENTIAL = 13
* - MegaAccountDetails::ACCOUNT_TYPE_BUSINESS = 100
* - MegaAccountDetails::ACCOUNT_TYPE_PRO_FLEXI = 101
*
* Valid value for feature plans is:
* - MegaAccountDetails::ACCOUNT_TYPE_FEATURE = 99999
*/
virtual int32_t getAccountLevel() const = 0;
/**
* @brief Get the features granted by this plan
*
* You take the ownership of the returned value
*
* @return Features granted by this plan.
*/
virtual MegaStringList* getFeatures() const = 0;
/**
* @brief Get the expiration time for the plan
*
* @return The time the plan expires
*/
virtual int64_t getExpirationTime() const = 0;
/**
* @brief The type of plan. Why it was granted.
*
* Not available for Bussiness/Pro Flexi.
*
* @return Plan type
*/
virtual int32_t getType() const = 0;
/**
* @brief Get the relating subscription ID
*
* Only available if the plan relates to a subscription.
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @return ID of this subscription
*/
virtual char* getId() const = 0;
/**
* @brief Return if the plan is related to an active trial
*
* @return True if the plan is related to an active trial, otherwise false.
*/
virtual bool isTrial() const = 0;
};
/**
* @brief Details about a MEGA account
*/
class MegaAccountDetails
{
public:
enum
{
ACCOUNT_TYPE_FREE = 0,
ACCOUNT_TYPE_PROI = 1,
ACCOUNT_TYPE_PROII = 2,
ACCOUNT_TYPE_PROIII = 3,
ACCOUNT_TYPE_LITE = 4,
ACCOUNT_TYPE_STARTER = 11,
ACCOUNT_TYPE_BASIC = 12,
ACCOUNT_TYPE_ESSENTIAL = 13,
ACCOUNT_TYPE_BUSINESS = 100,
ACCOUNT_TYPE_PRO_FLEXI = 101, // also known as PRO 4
ACCOUNT_TYPE_FEATURE = 99999
};
enum MEGA_DEPRECATED
{
SUBSCRIPTION_STATUS_NONE = 0,
SUBSCRIPTION_STATUS_VALID = 1,
SUBSCRIPTION_STATUS_INVALID = 2
};
virtual ~MegaAccountDetails();
/**
* @brief Get the PRO level of the MEGA account
* @return PRO level of the MEGA account.
* Valid values are:
* - MegaAccountDetails::ACCOUNT_TYPE_FREE = 0
* - MegaAccountDetails::ACCOUNT_TYPE_PROI = 1
* - MegaAccountDetails::ACCOUNT_TYPE_PROII = 2
* - MegaAccountDetails::ACCOUNT_TYPE_PROIII = 3
* - MegaAccountDetails::ACCOUNT_TYPE_LITE = 4
* - MegaAccountDetails::ACCOUNT_TYPE_STARTER = 11
* - MegaAccountDetails::ACCOUNT_TYPE_BASIC = 12
* - MegaAccountDetails::ACCOUNT_TYPE_ESSENTIAL = 13
* - MegaAccountDetails::ACCOUNT_TYPE_BUSINESS = 100
* - MegaAccountDetails::ACCOUNT_TYPE_PRO_FLEXI = 101
*/
virtual int getProLevel();
/**
* @brief Get the expiration time of the latest PRO plan
*
* The expiration time could be higher than the expiration time of the active PRO plan
*
* @return Expiration time for the latest PRO plan (in seconds since the Epoch)
*/
virtual int64_t getProExpiration();
/**
* @brief Check if there is a valid subscription
*
* If this function returns MegaAccountDetails::SUBSCRIPTION_STATUS_VALID,
* the PRO account will be automatically renewed.
* See MegaAccountDetails::getSubscriptionRenewTime
*
* @return Information about about the subscription status
*
* Valid return values are:
* - MegaAccountDetails::SUBSCRIPTION_STATUS_NONE = 0
* There isn't any active subscription
*
* - MegaAccountDetails::SUBSCRIPTION_STATUS_VALID = 1
* There is an active subscription
*
* - MegaAccountDetails::SUBSCRIPTION_STATUS_INVALID = 2
* A subscription exists, but it uses a payment gateway that is no longer valid
*
*/
MEGA_DEPRECATED
virtual int getSubscriptionStatus();
/**
* @brief Get the time when the the PRO account will be renewed
* @return Renewal time (in seconds since the Epoch)
*/
MEGA_DEPRECATED
virtual int64_t getSubscriptionRenewTime();
/**
* @brief Get the subscription method
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @return Subscription method. For example "Credit Card".
*/
MEGA_DEPRECATED
virtual char* getSubscriptionMethod();
/**
* @brief Get the subscription method id
*
* @return Subscription method. For example 16.
*/
MEGA_DEPRECATED
virtual int getSubscriptionMethodId();
/**
* @brief Get the subscription cycle
*
* The return value will show if the subscription will be montly or yearly renewed.
* Example return values: "1 M", "1 Y".
*
* You take ownership of the returned value. Use delete[] to release the memory.
*
* @return Subscription cycle
*/
MEGA_DEPRECATED
virtual char* getSubscriptionCycle();
/**
* @brief Get the maximum storage for the account (in bytes)
* @return Maximum storage for the account (in bytes)
*/
virtual long long getStorageMax();
/**
* @brief Get the used storage
* @return Used storage (in bytes)
*/
virtual long long getStorageUsed();
/**
* @brief Get the used storage by versions
* @return Used storage by versions (in bytes)
*/
virtual long long getVersionStorageUsed();
/**
* @brief Get the maximum available bandwidth for the account
* @return Maximum available bandwidth (in bytes)
*/
virtual long long getTransferMax();
/**
* @brief Get the used bandwidth for own user allowance
* @see: MegaAccountDetails::getTransferUsed
* @return Used bandwidth (in bytes)
*/
virtual long long getTransferOwnUsed();
/**
* @brief Get the used bandwidth served to other users
* @see: MegaAccountDetails::getTransferUsed
* @return Used bandwidth (in bytes)
*/
virtual long long getTransferSrvUsed();
/**
* @brief Get the used bandwidth allowance including own, free and served to other users
* @see: MegaAccountDetails::getTransferOwnUsed, MegaAccountDetails::getTemporalBandwidth, MegaAccountDetails::getTransferSrvUsed
* @return Used bandwidth (in bytes)
*/
virtual long long getTransferUsed();
/**
* @brief Returns the number of nodes with account usage info
*
* You can get information about each node using MegaAccountDetails::getStorageUsed,
* MegaAccountDetails::getNumFiles, MegaAccountDetails::getNumFolders
*
* This function can return:
* - 0 (no info about any node)
* - 3 (info about the root node, the vault node and the rubbish node)
* Use MegaApi::getRootNode MegaApi::getVaultNode and MegaApi::getRubbishNode to get those nodes.
*
* - >3 (info about root, vault, rubbish and incoming shares)
* Use MegaApi::getInShares to get the incoming shares
*
* @return Number of items with account usage info
*/
virtual int getNumUsageItems();
/**
* @brief Get the used storage in for a node
*
* Only root nodes are supported.
*
* @param handle Handle of the node to check
* @return Used storage (in bytes)
* @see MegaApi::getRootNode, MegaApi::getRubbishNode, MegaApi::getVaultNode
*/
virtual long long getStorageUsed(MegaHandle handle);
/**
* @brief Get the number of files in a node
*
* Only root nodes are supported.
*
* @param handle Handle of the node to check
* @return Number of files in the node
* @see MegaApi::getRootNode, MegaApi::getRubbishNode, MegaApi::getVaultNode
*/
virtual long long getNumFiles(MegaHandle handle);
/**
* @brief Get the number of folders in a node
*
* Only root nodes are supported.
*
* @param handle Handle of the node to check
* @return Number of folders in the node
* @see MegaApi::getRootNode, MegaApi::getRubbishNode, MegaApi::getVaultNode
*/
virtual long long getNumFolders(MegaHandle handle);
/**
* @brief Get the used storage by versions in for a node
*
* Only root nodes are supported.
*
* @param handle Handle of the node to check
* @return Used storage by versions (in bytes)
* @see MegaApi::getRootNode, MegaApi::getRubbishNode, MegaApi::getVaultNode
*/
virtual long long getVersionStorageUsed(MegaHandle handle);
/**
* @brief Get the number of versioned files in a node
*
* Only root nodes are supported.
*
* @param handle Handle of the node to check
* @return Number of versioned files in the node
* @see MegaApi::getRootNode, MegaApi::getRubbishNode, MegaApi::getVaultNode
*/
virtual long long getNumVersionFiles(MegaHandle handle);
/**
* @brief Creates a copy of this MegaAccountDetails object.
*
* The resulting object is fully independent of the source MegaAccountDetails,
* it contains a copy of all internal attributes, so it will be valid after
* the original object is deleted.
*
* You are the owner of the returned object
*
* @return Copy of the MegaAccountDetails object
*/
virtual MegaAccountDetails* copy();
/**
* @brief Get the number of MegaAccountBalance objects associated with the account
*
* You can use MegaAccountDetails::getBalance to get those objects.
*
* @return Number of MegaAccountBalance objects
*/
virtual int getNumBalances() const;
/**
* @brief Returns the MegaAccountBalance object associated with an index
*
* You take the ownership of the returned value
*
* @param i Index of the object
* @return MegaAccountBalance object
*/
virtual MegaAccountBalance* getBalance(int i) const;
/**
* @brief Get the number of MegaAccountSession objects associated with the account
*
* You can use MegaAccountDetails::getSession to get those objects.
*
* @return Number of MegaAccountSession objects
*/
virtual int getNumSessions() const;
/**
* @brief Returns the MegaAccountSession object associated with an index
*
* You take the ownership of the returned value
*
* @param i Index of the object
* @return MegaAccountSession object
*/
virtual MegaAccountSession* getSession(int i) const;
/**
* @brief Get the number of MegaAccountPurchase objects associated with the account
*
* You can use MegaAccountDetails::getPurchase to get those objects.
*
* @return Number of MegaAccountPurchase objects
*/
virtual int getNumPurchases() const;
/**
* @brief Returns the MegaAccountPurchase object associated with an index
*
* You take the ownership of the returned value
*
* @param i Index of the object
* @return MegaAccountPurchase object
*/
virtual MegaAccountPurchase* getPurchase(int i) const;
/**
* @brief Get the number of MegaAccountTransaction objects associated with the account
*
* You can use MegaAccountDetails::getTransaction to get those objects.
*
* @return Number of MegaAccountTransaction objects
*/
virtual int getNumTransactions() const;
/**
* @brief Returns the MegaAccountTransaction object associated with an index
*
* You take the ownership of the returned value
*
* @param i Index of the object
* @return MegaAccountTransaction object
*/
virtual MegaAccountTransaction* getTransaction(int i) const;
/**
* @brief Get the number of hours that are taken into account to calculate the free bandwidth quota
*
* The number of bytes transferred in that time is provided using MegaAccountDetails::getTemporalBandwidth
*
* @return Number of hours taken into account to calculate the free bandwidth quota
*/
virtual int getTemporalBandwidthInterval();
/**
* @brief Get the number of bytes that were recently transferred using free allowance
*
* The time interval in which those bytes were transferred
* is provided (in hours) using MegaAccountDetails::getTemporalBandwidthInterval
*
* @see: MegaAccountDetails::getTransferUsed
* @return Number of bytes that were recently transferred
*/
virtual long long getTemporalBandwidth();
/**
* @brief Check if the temporal bandwidth usage is valid after an overquota error
* @return True if the temporal bandwidth is valid, otherwise false
*/
virtual bool isTemporalBandwidthValid();
/**
* @brief Get the number of active MegaAccountFeature-s in the account
*
* You can use MegaAccountDetails::getActiveFeature to get each of those objects.
*
* @return Number of MegaAccountFeature objects
*/
virtual int getNumActiveFeatures() const = 0;
/**
* @brief Returns the MegaAccountFeature object associated with an index
*
* You take the ownership of the returned value
*
* @param featureIndex Index of the object
* @return MegaAccountFeature object
*/
virtual MegaAccountFeature* getActiveFeature(int featureIndex) const = 0;
/**
* @brief Get feature account level for feature related subscriptions
*
* @return Level for feature related subscriptions
*/
MEGA_DEPRECATED
virtual int64_t getSubscriptionLevel() const = 0;
/**
* @brief Get subscription features for this account
*
* You take the ownership of the returned value
*
* @return Subscription features for this account. The value of each feature should be treated as a 32bit unsigned int
*/
MEGA_DEPRECATED
virtual MegaStringIntegerMap* getSubscriptionFeatures() const = 0;
/**
* @brief Get the number of active subscriptions in the account.
*
* You can use MegaAccountDetails::getSubscription to get each of those objects.
*
* @return Number of active subscriptions
*/
virtual int getNumSubscriptions() const = 0;
/**
* @brief Returns the MegaAccountSubscription object associated with an index
*
* You take the ownership of the returned value
*
* @param subscriptionsIndex Index of the object
* @return MegaAccountSubscription object
*/
virtual MegaAccountSubscription* getSubscription(int subscriptionsIndex) const = 0;
/**
* @brief Get the number of active plans in the account.
*
* You can use MegaAccountDetails::getPlan to get each of those objects.
*
* @return Number of active plans
*/
virtual int getNumPlans() const = 0;
/**
* @brief Returns the MegaAccountPlan object associated with an index
*
* You take the ownership of the returned value
*
* @param plansIndex Index of the object
* @return MegaAccountPlan object
*/
virtual MegaAccountPlan* getPlan(int plansIndex) const = 0;
};
class MegaCurrency
{
public:
virtual ~MegaCurrency();
/**
* @brief Creates a copy of this MegaCurrency object.
*
* The resulting object is fully independent of the source MegaCurrency,
* it contains a copy of all internal attributes, so it will be valid after
* the original object is deleted.
*
* You are the owner of the returned object
*
* @return Copy of the MegaCurrency object
*/
virtual MegaCurrency *copy();
/**
* @brief Get the currency symbol of prices
*
* The currency symbol is encoded in B64url, since it may be a UTF-8 char.
* In example, for €, it returns "4oKs".
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaPricing object is deleted.
*
* @return currency symbol of price
*/
virtual const char* getCurrencySymbol();
/**
* @brief Get the currency name of prices, ie. EUR
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaPricing object is deleted.
*
* @return currency name of price
*/
virtual const char* getCurrencyName();
/**
* @brief Get the currency symbol of local prices
*
* The currency symbol is encoded in B64url, since it may be a UTF-8 char.
* In example, for €, it returns "4oKs".
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaPricing object is deleted.
*
* @return currency symbol of local price
*/
virtual const char* getLocalCurrencySymbol();
/**
* @brief Get the currency name of local prices, ie. NZD
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaPricing object is deleted.
*
* @return currency name of local price
*/
virtual const char* getLocalCurrencyName();
};
/**
* @brief Details about pricing plans
*
* Use MegaApi::getPricing to get the pricing plans to upgrade MEGA accounts
*/
class MegaPricing
{
public:
virtual ~MegaPricing();
/**
* @brief Get the number of available products to upgrade the account
* @return Number of available products
*/
virtual int getNumProducts();
/**
* @brief Get the handle of a product
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
* @return Handle of the product
* @see MegaApi::getPaymentId
*/
virtual MegaHandle getHandle(int productIndex);
/**
* @brief Get the PRO level associated with the product
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
* @return PRO level associated with the product:
* Valid values are:
* - MegaAccountDetails::ACCOUNT_TYPE_FREE = 0
* - MegaAccountDetails::ACCOUNT_TYPE_PROI = 1
* - MegaAccountDetails::ACCOUNT_TYPE_PROII = 2
* - MegaAccountDetails::ACCOUNT_TYPE_PROIII = 3
* - MegaAccountDetails::ACCOUNT_TYPE_LITE = 4
* - MegaAccountDetails::ACCOUNT_TYPE_STARTER = 11
* - MegaAccountDetails::ACCOUNT_TYPE_BASIC = 12
* - MegaAccountDetails::ACCOUNT_TYPE_ESSENTIAL = 13
* - MegaAccountDetails::ACCOUNT_TYPE_BUSINESS = 100
* - MegaAccountDetails::ACCOUNT_TYPE_PRO_FLEXI = 101
*/
virtual int getProLevel(int productIndex);
/**
* @brief Get the number of GB of storage associated with the product
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
* @note business plans have unlimited storage
* @return number of GB of storage, zero if index is invalid, or -1
* if pricing plan is a business plan
*/
virtual int getGBStorage(int productIndex);
/**
* @brief Get the number of GB of bandwidth associated with the product
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
* @note business plans have unlimited bandwidth
* @return number of GB of bandwidth, zero if index is invalid, or -1,
* if pricing plan is a business plan
*/
virtual int getGBTransfer(int productIndex);
/**
* @brief Get the duration of the product (in months)
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
* @return Duration of the product (in months)
*/
virtual int getMonths(int productIndex);
/**
* @brief Get the price of the product (in cents)
* If you want the price in cents with decimals call MegaPricing::getAmountWithDecimals
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
* @return Price of the product (in cents)
*/
virtual int getAmount(int productIndex);
/**
* @brief Get the price in the local currency (in cents)
* If you want the price in the local currency in cents with decimals call
* MegaPricing::getLocalPriceWithDecimals
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
* @return Price of the product (in cents)
*/
virtual int getLocalPrice(int productIndex);
/**
* @brief Get the net base price of the product without tax (in cents, with decimals)
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
* @return Net base price of the product in cents, including decimal fraction, without tax
*/
virtual double getPriceNetWithDecimals(const int /*productIndex*/) const;
/**
* @brief Get the net base price of the product in local currency without tax (in cents, with
* decimals)
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
* @return Net base price of the product in local currency in cents, including decimal fraction,
* without tax
*/
virtual double getLocalPriceNetWithDecimals(const int /*productIndex*/) const;
/**
* @brief Get the price of the product (in cents, with decimals)
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
* @return Price of the product in cents, including decimal fraction
*/
virtual double getAmountWithDecimals(const int /*productIndex*/) const;
/**
* @brief Get the price in the local currency (in cents, with decimals)
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
* @return Price in the local currency of the product in cents, including decimal fraction
*/
virtual double getLocalPriceWithDecimals(const int /*productIndex*/) const;
/**
* @brief Get the monthly price of the product (in cents, with decimals)
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
* @return Monthly price of the product in cents, including decimal fraction
*/
virtual double getAmountMonthWithDecimals(const int /*productIndex*/) const;
/**
* @brief Get the net monthly base price of the product without tax (in cents, with decimals)
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
* @return Net monthly base price of the product in cents, including decimal fraction, without
* tax
*/
virtual double getMonthlyBasePriceNetWithDecimals(const int /*productIndex*/) const;
/**
* @brief Get a description of the product
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaPricing object is deleted.
*
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
* @return Description of the product
*/
virtual const char* getDescription(int productIndex);
/**
* @brief getIosID Get the iOS ID of the product
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaPricing object is deleted.
*
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
* @return iOS ID of the product, NULL if index is invalid or an empty string
* if pricing plan is a business plan.
*/
virtual const char* getIosID(int productIndex);
/**
* @brief Get the Android ID of the product
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaPricing object is deleted.
*
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
* @return Android ID of the product, NULL if index is invalid or an empty string
* if pricing plan is a business plan.
*/
virtual const char* getAndroidID(int productIndex);
/**
* @brief Returns true if the pricing plan is a Business plan
*
* You can check if the plan is pure buiness or Pro Flexi by calling
* the method MegaApi::getProLevel
*
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
* @return true if the pricing plan is a Business plan, otherwise return false
*/
virtual bool isBusinessType(int productIndex);
/**
* @brief Returns true if the pricing plan is a Feature plan
*
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
*
* @return true if the pricing plan is a Feature plan, otherwise return false
*/
virtual bool isFeaturePlan(int productIndex) const;
/**
* @brief Get the monthly price of the product (in cents)
* If you want the monthly price in cents with decimals call
* MegaPricing::getAmountMonthWithDecimals
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
* @return Monthly price of the product (in cents)
*/
virtual int getAmountMonth(int productIndex);
/**
* @brief Creates a copy of this MegaPricing object.
*
* The resulting object is fully independent of the source MegaPricing,
* it contains a copy of all internal attributes, so it will be valid after
* the original object is deleted.
*
* You are the owner of the returned object
*
* @return Copy of the MegaPricing object
*/
virtual MegaPricing *copy();
/**
* @brief Get the number of GB of storage associated with the product, per user
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
* @return number of GB of storage associated with the product, per user
*/
virtual int getGBStoragePerUser(int productIndex);
/**
* @brief Get the number of GB of transfer associated with the product, per user
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
* @return number of GB of transfer associated with the product, per user
*/
virtual int getGBTransferPerUser(int productIndex);
/**
* @brief Get the minimum number of users to purchase the product
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
* @return minimum number of users to purchase the product
*/
virtual unsigned int getMinUsers(int productIndex);
/**
* @brief Get the monthly price of the product, per user (in cents)
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
* @return monthly price of the product, per user (in cents)
*/
virtual unsigned int getPricePerUser(int productIndex);
/**
* @brief Get the monthly local price of the product, per user (in cents)
*
* Local prices are only available if the account will be charged in a different
* currency than local.
*
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
* @return monthly local price of the product, per user (in cents)
*/
virtual unsigned int getLocalPricePerUser(int productIndex);
/**
* @brief Get the price per storage block
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
* @return price per storage block
*/
virtual unsigned int getPricePerStorage(int productIndex);
/**
* @brief Get the local price per storage block
*
* Local prices are only available if the account will be charged in a different
* currency than local.
*
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
* @return local price per storage block
*/
virtual unsigned int getLocalPricePerStorage(int productIndex);
/**
* @brief Get the number of GB of storage, per block
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
* @return number of GB of storage, per block
*/
virtual int getGBPerStorage(int productIndex);
/**
* @brief Get the price per transfer block
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
* @return price per transfer block
*/
virtual unsigned int getPricePerTransfer(int productIndex);
/**
* @brief Get the local price per transfer block
*
* Local prices are only available if the account will be charged in a different
* currency than local.
*
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
* @return local price per storage block
*/
virtual unsigned int getLocalPricePerTransfer(int productIndex);
/**
* @brief Get the number of GB of transfer, per block
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
* @return number of GB of transfer, per block
*/
virtual int getGBPerTransfer(int productIndex);
/**
* @brief Get the features of this product
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
* @return Features of this product. The value of each feature should be treated as a 32bit unsigned int
*/
virtual MegaStringIntegerMap* getFeatures(int productIndex) const;
/**
* @brief Get test category bitmap of a product
*
* The returned value must always be greater than 0
*
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
* @return test category bitmap
*/
virtual unsigned int getTestCategory(int productIndex) const;
/**
* @brief Check whether the product has a discount
*
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
* @return True if the product has a discount, false otherwise
*/
virtual bool hasDiscount(int productIndex) const;
/**
* @brief Get the discount code for the product
*
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
* @return Discount code for the product, or nullptr if there is no discount
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaPricing object is deleted.
*/
virtual const char* getDiscountCode(int productIndex) const;
/**
* @brief Get the discount name for the product
*
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
* @return Discount name for the product, or nullptr if there is no discount
*
* The SDK retains the ownership of the returned value. It will be valid until
* the MegaPricing object is deleted.
*/
virtual const char* getDiscountName(int productIndex) const;
/**
* @brief Get the discount group for the product
*
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
* @return Discount group for the product, or 0 if there is no discount
*/
virtual int getDiscountGroup(int productIndex) const;
/**
* @brief Get the discount duration in months for the product
*
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
* @return Discount duration in months for the product, or 0 if there is no discount
*/
virtual int getDiscountMonths(int productIndex) const;
/**
* @brief Get the discount percentage for the product
*
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
* @return Discount percentage for the product, or 0 if there is no discount
*/
virtual int getDiscountPercentage(int productIndex) const;
/**
* @brief Get trial duration in days
*
* The returned value will be 0 if the plan is not elegible for trial.
*
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
* @return Trial duration in days
*/
virtual unsigned int getTrialDurationInDays(int productIndex) const = 0;
/**
* @brief Check whether the product has a mobile offer
*
* Determines if the specified product includes an associated mobile offer.
*
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
* @return True if the product has a mobile offer, false otherwise
*/
virtual bool hasMobileOffers(int productIndex) const = 0;
/**
* @brief Get the mobile offer identifier
*
* Returns the identifier of the mobile offer associated with the given
* product.
*
* If the product does not have a mobile offer, this method returns a empty
* string.
*
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
* @return A null-terminated string containing the mobile offer ID
*/
virtual std::string getMobileOfferId(int productIndex) const = 0;
/**
* @brief Check whether the mobile offer title should be used
*
* Possible values are:
* - false: The mobile offer title should not be displayed.
* - true: The mobile offer title should be displayed.
*
* If the product does not have a mobile offer, this method returns false.
*
* @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
* @return True if the mobile offer title should be displayed, false
* otherwise
*/
virtual bool hasMobileOfferUat(int productIndex) const = 0;
};
/**
* @brief The MegaAchievementsDetails class
*
* There are several MEGA Achievements that a user can unlock, resulting in a
* temporary extension of the storage and/or transfer quota during a period of
* time.
*
* Currently there are 4 different classes of MEGA Achievements:
*
* - Welcome: Create your free account and get 35 GB of complimentary storage space,
* valid for 30 days.
*
* - Invite: Invite as many friends or coworkers as you want. For every signup under the
* invited email address, you will receive 10 GB of complimentary storage plus 20 GB
* of transfer quota, both valid for 365 days, provided that the new user installs
* either MEGAsync or a mobile app and starts using MEGA.
*
* - Desktop install: When you install MEGAsync you get 20 GB of complimentary storage
* space plus 40 GB of transfer quota, both valid for 180 days.
*
* - Mobile install: When you install our mobile app you get 15 GB of complimentary
* storage space plus 30 GB transfer quota, both valid for 180 days.
*
* When the user unlocks one of the achievements above, it unlocks an "Award". The award
* includes a timestamps to indicate when it was unlocked, plus an expiration timestamp.
* Afterwards, the award will not be active. Additionally, each award results in a "Reward".
* The reward is linked to the corresponding award and includes the storage and transfer
* quota obtained thanks to the unlocked award.
*
* @note It may take 2-3 days for achievements to show on the account after they have been completed.
*/
class MegaAchievementsDetails
{
public:
enum {
MEGA_ACHIEVEMENT_WELCOME = 1,
MEGA_ACHIEVEMENT_INVITE = 3,
MEGA_ACHIEVEMENT_DESKTOP_INSTALL = 4,
MEGA_ACHIEVEMENT_MOBILE_INSTALL = 5,
MEGA_ACHIEVEMENT_ADD_PHONE = 9,
MEGA_ACHIEVEMENT_PWM_TRIAL = 10,
MEGA_ACHIEVEMENT_VPN_TRIAL = 11
};
virtual ~MegaAchievementsDetails();
/**
* @brief Get the base storage value for this account
* @return The base storage value, in bytes
*/
virtual long long getBaseStorage();
/**
* @brief Checks if the corresponding achievement is valid
*
* Some achievements are valid only for some users.
*
* The following classes are valid:
* - MEGA_ACHIEVEMENT_WELCOME = 1
* - MEGA_ACHIEVEMENT_INVITE = 3
* - MEGA_ACHIEVEMENT_DESKTOP_INSTALL = 4
* - MEGA_ACHIEVEMENT_MOBILE_INSTALL = 5
* - MEGA_ACHIEVEMENT_ADD_PHONE = 9
* - MEGA_ACHIEVEMENT_PWM_TRIAL = 10
* - MEGA_ACHIEVEMENT_VPN_TRIAL = 11
*
* @param class_id Id of the achievement.
* @return True if it is valid, false otherwise
*/
virtual bool isValidClass(int class_id);
/**
* @brief Get the storage granted by a MEGA achievement class
*
* The following classes are valid:
* - MEGA_ACHIEVEMENT_WELCOME = 1
* - MEGA_ACHIEVEMENT_INVITE = 3
* - MEGA_ACHIEVEMENT_DESKTOP_INSTALL = 4
* - MEGA_ACHIEVEMENT_MOBILE_INSTALL = 5
* - MEGA_ACHIEVEMENT_ADD_PHONE = 9
* - MEGA_ACHIEVEMENT_PWM_TRIAL = 10
* - MEGA_ACHIEVEMENT_VPN_TRIAL = 11
*
* @param class_id Id of the MEGA achievement
* @return Storage granted by this MEGA achievement class, in bytes
*/
virtual long long getClassStorage(int class_id);
/**
* @brief Get the transfer quota granted by a MEGA achievement class
*
* The following classes are valid:
* - MEGA_ACHIEVEMENT_WELCOME = 1
* - MEGA_ACHIEVEMENT_INVITE = 3
* - MEGA_ACHIEVEMENT_DESKTOP_INSTALL = 4
* - MEGA_ACHIEVEMENT_MOBILE_INSTALL = 5
* - MEGA_ACHIEVEMENT_ADD_PHONE = 9
* - MEGA_ACHIEVEMENT_PWM_TRIAL = 10
* - MEGA_ACHIEVEMENT_VPN_TRIAL = 11
*
* @param class_id Id of the MEGA achievement
* @return Transfer quota granted by this MEGA achievement class, in bytes
*/
virtual long long getClassTransfer(int class_id);
/**
* @brief Get the duration of storage/transfer quota granted by a MEGA achievement class
*
* The following classes are valid:
* - MEGA_ACHIEVEMENT_WELCOME = 1
* - MEGA_ACHIEVEMENT_INVITE = 3
* - MEGA_ACHIEVEMENT_DESKTOP_INSTALL = 4
* - MEGA_ACHIEVEMENT_MOBILE_INSTALL = 5
* - MEGA_ACHIEVEMENT_ADD_PHONE = 9
* - MEGA_ACHIEVEMENT_PWM_TRIAL = 10
* - MEGA_ACHIEVEMENT_VPN_TRIAL = 11
*
* The storage and transfer quota resulting from a MEGA achievement may expire after
* certain number of days. In example, the "Welcome" reward lasts for 30 days and afterwards
* the granted storage and transfer quota is revoked.
*
* @param class_id Id of the MEGA achievement
* @return Number of days for the storage/transfer quota granted by this MEGA achievement class
*/
virtual int getClassExpire(int class_id);
/**
* @brief Get the number of unlocked awards for this account
* @return Number of unlocked awards
*/
virtual unsigned int getAwardsCount();
/**
* @brief Get the MEGA achievement class of the award
* @param index Position of the award in the list of unlocked awards
* @return The achievement class associated to the award in position \c index
*/
virtual int getAwardClass(unsigned int index);
/**
* @brief Get the id of the award
* @param index Position of the award in the list of unlocked awards
* @return The id of the award in position \c index
*/
virtual int getAwardId(unsigned int index);
/**
* @brief Get the timestamp of the award (when it was unlocked)
* @param index Position of the award in the list of unlocked awards
* @return The timestamp of the award (when it was unlocked) in position \c index
*/
virtual int64_t getAwardTimestamp(unsigned int index);
/**
* @brief Get the expiration timestamp of the award
*
* After this moment, the storage and transfer quota granted as result of the award
* will not be valid anymore.
*
* @note The expiration time may not be the \c getAwardTimestamp plus the number of days
* returned by \c getClassExpire, since the award can be unlocked but not yet granted. It
* typically takes 2 days from unlocking the award until the user is actually rewarded.
*
* If this function returns 0, it means the award is permanent (does not expire).
*
* @param index Position of the award in the list of unlocked awards
* @return The expiration timestamp of the award in position \c index
*/
virtual int64_t getAwardExpirationTs(unsigned int index);
/**
* @brief Get the list of referred emails for the award
*
* This function is specific for the achievements of class MEGA_ACHIEVEMENT_INVITE.
*
* You take ownership of the returned value.
*
* @param index Position of the award in the list of unlocked awards
* @return The list of invited emails for the award in position \c index
*/
virtual MegaStringList* getAwardEmails(unsigned int index);
/**
* @brief Get the number of active rewards for this account
* @return Number of active rewards
*/
virtual int getRewardsCount();
/**
* @brief Get the id of the award associated with the reward
* @param index Position of the reward in the list of active rewards
* @return The id of the award associated with the reward
*/
virtual int getRewardAwardId(unsigned int index);
/**
* @brief Get the storage rewarded by the award
* @param index Position of the reward in the list of active rewards
* @return The storage rewarded by the award
*/
virtual long long getRewardStorage(unsigned int index);
/**
* @brief Get the transfer quota rewarded by the award
* @param index Position of the reward in the list of active rewards
* @return The transfer quota rewarded by the award
*/
virtual long long getRewardTransfer(unsigned int index);
/**
* @brief Get the storage rewarded by the award_id
* @param award_id The id of the award
* @return The storage rewarded by the award_id
*/
virtual long long getRewardStorageByAwardId(int award_id);
/**
* @brief Get the transfer rewarded by the award_id
* @param award_id The id of the award
* @return The transfer rewarded by the award_id
*/
virtual long long getRewardTransferByAwardId(int award_id);
/**
* @brief Get the duration of the reward
* @param index Position of the reward in the list of active rewards
* @return The duration of the reward, in days
*/
virtual int getRewardExpire(unsigned int index);
/**
* @brief Creates a copy of this MegaAchievementsDetails object.
*
* The resulting object is fully independent of the source MegaAchievementsDetails,
* it contains a copy of all internal attributes, so it will be valid after
* the original object is deleted.
*
* You are the owner of the returned object
*
* @return Copy of the MegaAchievementsDetails object
*/
virtual MegaAchievementsDetails *copy();
/**
* @brief Returns the actual storage achieved by this account
*
* This function considers all the storage granted to the logged in
* account as result of the unlocked achievements. It does not consider
* the expired achievements nor the permanent base storage.
*
* @return The achieved storage for this account
*/
virtual long long currentStorage();
/**
* @brief Returns the actual transfer quota achieved by this account
*
* This function considers all the transfer quota granted to the logged
* in account as result of the unlocked achievements. It does not consider
* the expired achievements.
*
* @return The achieved transfer quota for this account
*/
virtual long long currentTransfer();
/**
* @brief Returns the actual achieved storage due to referrals
*
* This function considers all the storage granted to the logged in account
* as result of the successful invitations (referrals). It does not consider
* the expired achievements.
*
* @return The achieved storage by this account as result of referrals
*/
virtual long long currentStorageReferrals();
/**
* @brief Returns the actual achieved transfer quota due to referrals
*
* This function considers all the transfer quota granted to the logged
* in account as result of the successful invitations (referrals). It
* does not consider the expired achievements.
*
* @return The transfer achieved quota by this account as result of referrals
*/
virtual long long currentTransferReferrals();
};
class MegaCancelToken
{
protected:
MegaCancelToken();
public:
/**
* @brief Creates an object which can be passed as parameter for some MegaApi methods in order to
* request the cancellation of the processing associated to the function. @see MegaApi::search
*
* The instance of MegaCancelToken can be reset (@see cancel) for reuse for future calls, but
* it should not be used for more than one operation at the same time.
*
* You take ownership of the returned value.
*
* @return A pointer to an object that allows to cancel the processing of some functions.
*/
static MegaCancelToken* createInstance();
virtual ~MegaCancelToken();
/**
* @brief Allows to set the value of the flag
*/
virtual void cancel() = 0;
/**
* @brief Returns the state of the flag
* @return The state of the flag
*/
virtual bool isCancelled() const = 0;
};
/**
* @brief Container to store information of a VPN Cluster.
*
* - Host
* - DNS: list of IPs
*
* Instances of this class are immutable.
*/
class MegaVpnCluster
{
public:
/**
* @brief Get the host of this VPN Cluster.
*
* The caller does not take ownership of the returned const char*, which is valid as long as
* current instance is valid.
*
* @return the host of this VPN Cluster, always not-null.
*/
virtual const char* getHost() const = 0;
/**
* @brief Get the list of IPs for current VPN Cluster
*
* You take the ownership of the returned value
*
* @return A list containing the IPs for current VPN Cluster, always not-null
*/
virtual MegaStringList* getDns() const = 0;
/**
* @brief Get the list of ad-blocking DNS IPs.
*
* You take the ownership of the returned value
*
* @return A list containing the IPs for ad blocking DNS, always not-null
*/
virtual MegaStringList* getAdBlockingDns() const = 0;
virtual ~MegaVpnCluster() = default;
virtual MegaVpnCluster* copy() const = 0;
protected:
MegaVpnCluster() = default;
};
/**
* @brief Container for MegaVpnCluster-s
*
* Instances of this class are immutable.
*/
class MegaVpnClusterMap
{
public:
/**
* @brief Get the list of keys in current instance
*
* You take the ownership of the returned value
*
* @return A list containing the keys in current intance, always not-null
*/
virtual MegaIntegerList* getKeys() const = 0;
/**
* @brief Get the payload for the provided key
*
* You take the ownership of the returned value
*
* @param key Key of the element that you want to get from the map
*
* @return The payload for the provided key, or null if not found
*/
virtual MegaVpnCluster* get(int64_t key) const = 0;
/**
* @brief Get the entry count for the container
*
* @return Entry count for the container
*/
virtual int64_t size() const = 0;
virtual ~MegaVpnClusterMap() = default;
virtual MegaVpnClusterMap* copy() const = 0;
protected:
MegaVpnClusterMap() = default;
};
/**
* @brief Container to store information of a VPN Region.
*
* - Name (example: hMLKTUojS6o, 1MvzBCx1Uf4)
* - Country Code (example: ES, LU)
* - Country Name (example: Spain, Luxembourg)
* - Region Name (optional) (example: Esch-sur-Alzette)
* - Town Name (Optional) (example: Bettembourg)
* - Clusters (contain information like host, DNS list, possibly others)
*
* Instances of this class are immutable.
*/
class MegaVpnRegion
{
public:
/**
* @brief Get the name of this VPN Region.
*
* The caller does not take ownership of the returned value, which is valid as long as current
* instance is valid.
*
* @return the name of this VPN Region, always not-null.
*/
virtual const char* getName() const = 0;
/**
* @brief Get the country code where the VPN Region is located.
*
* The caller does not take ownership of the returned value, which is valid as long as current
* instance is valid.
*
* @return the country code for this VPN Region, always not-null.
*/
virtual const char* getCountryCode() const = 0;
/**
* @brief Get the name of the country where the VPN Region is located.
*
* The caller does not take ownership of the returned value, which is valid as long as current
* instance is valid.
*
* @return the country name for this VPN Region, always not-null.
*/
virtual const char* getCountryName() const = 0;
/**
* @brief Get the name of the country region where this VPN Region is located.
*
* Optional value. It may be empty for certain VPN Regions
*
* The caller does not take ownership of the returned value, which is valid as long as current
* instance is valid.
*
* @return the country region name for this VPN Region, always not-null.
*/
virtual const char* getRegionName() const = 0;
/**
* @brief Get the name name of the town where this VPN is located.
*
* Optional value. It may be empty for certain VPN Regions
*
* The caller does not take ownership of the returned value, which is valid as long as current
* instance is valid.
*
* @return the name of the Town for this VPN Region, always not-null.
*/
virtual const char* getTownName() const = 0;
/**
* @brief Get a container with all Clusters of this VPN Region.
*
* The caller takes ownership of the returned instance.
*
* @return a container with all Clusters of this VPN Region, always not-null.
*/
virtual MegaVpnClusterMap* getClusters() const = 0;
virtual MegaVpnRegion* copy() const = 0;
virtual ~MegaVpnRegion() = default;
protected:
MegaVpnRegion() = default;
};
/**
* @brief List of MegaVpnRegion objects
*
* Instances of this class are immutable.
*/
class MegaVpnRegionList
{
public:
/**
* @brief Get the instance at position i in the list.
*
* The caller does not take ownership of the returned value, which will be valid until the list
* is deleted. If you want to retain a copy of the instance returned by this function, use
* MegaVpnRegion::copy().
* If the given index was out of range, this function will return null.
*
* @param i Position of the instance that we want to get from the list
*
* @return Instance at position i in the list, or null if given index was out of range
*/
virtual const MegaVpnRegion* get(unsigned i) const = 0;
/**
* @brief Get the instance count for the list
*
* @return Instance count for this list
*/
virtual unsigned size() const = 0;
virtual MegaVpnRegionList* copy() const = 0;
virtual ~MegaVpnRegionList() = default;
protected:
MegaVpnRegionList() = default;
};
/**
* @brief Container class to store and load Mega VPN credentials data.
*
* - SlotIDs occupied by VPN credentials.
* - Full list of VPN regions.
* - IPv4 and IPv6 used on each SlotID.
* - ClusterID used on each SlotID.
* - Cluster Public Key associated to each ClusterID.
*/
class MegaVpnCredentials
{
protected:
MegaVpnCredentials();
public:
virtual ~MegaVpnCredentials();
/**
* @brief Get the SlotIDs occupied by the user.
*
* The caller takes the ownership of the MegaIntegerList object.
*
* @return A pointer to a MegaIntegerList with the SlotIDs.
*/
virtual MegaIntegerList* getSlotIDs() const = 0;
/**
* @brief Get the list of the available VPN regions.
*
* This object is a copy of the one owned by the MegaVpnCredentials object.
* The caller takes the ownership of the MegaStringList object.
*
* @return A pointer to a MegaStringList with the VPN regions.
*/
virtual MegaStringList* getVpnRegions() const = 0;
/**
* @brief Get the list of the available VPN regions, including the clusters for each region.
*
* The caller takes the ownership of the returned object.
*
* @return A pointer to a list of detailed VPN regions.
*/
virtual MegaVpnRegionList* getVpnRegionsDetailed() const = 0;
/**
* @brief Get the IPv4 associated with the VPN credentials of a SlotID.
*
* The caller does not take the ownership of the const char* object.
* The const char* object is valid as long as the current MegaVpnCredentials object is valid too.
*
* @param slotID The SlotID associated with the VPN credentials.
* @return const char* with the IPv4 if the SlotID has a valid VPN credential, nullptr otherwise.
*/
virtual const char* getIPv4(int slotID) const = 0;
/**
* @brief Get the IPv6 associated with the VPN credentials of a SlotID.
*
* The caller does not take the ownership of the const char* object.
* The const char* object is valid as long as the current MegaVpnCredentials object is valid too.
*
* @param slotID The SlotID associated with the VPN credentials.
* @return const char* with the IPv6 if the SlotID has a valid VPN credential, nullptr otherwise.
*/
virtual const char* getIPv6(int slotID) const = 0;
/**
* @brief Get the DeviceID associated with the VPN credentials of a SlotID.
*
* The string value can be empty if there is no associated device ID.
* The current device ID can be retrieved via MegaApi::getDeviceId
*
* The caller does not take the ownership of the const char* object.
* The const char* object is valid as long as the current MegaVpnCredentials object is valid too.
*
* @param slotID The SlotID associated with the VPN credentials.
* @return const char* with the DeviceID if the SlotID has a valid VPN credential, nullptr otherwise.
*/
virtual const char* getDeviceID(int slotID) const = 0;
/**
* @brief Get the ClusterID associated with the VPN credentials of a SlotID.
*
* @param slotID The SlotID associated with the VPN credentials.
* @return int with the ClusterID if the SlotID has a valid VPN credential, -1 otherwise.
*/
virtual int getClusterID(int slotID) const = 0;
/**
* @brief Get the Cluster Public Key associated with a ClusterID.
*
* The caller does not take the ownership of the const char* object.
* The const char* object is valid as long as the current MegaVpnCredentials object is valid too.
*
* @param clusterID The ClusterID used on any of the VPN credentials.
* @return const char* with the Cluster Public Key if the ClusterID exists, nullptr otherwise.
*/
virtual const char* getClusterPublicKey(int clusterID) const = 0;
/**
* @brief Copy the MegaVpnCredentials object.
*
* This copy is meant to be used from another scope which must survive the actual owner of this MegaVpnCredentials object.
* The caller takes the ownership of the new MegaVpnCredentials object.
*
* @return MegaVpnCredentials* with the copied MegaVpnCredentials object.
*/
virtual MegaVpnCredentials* copy() const = 0;
};
class MegaNetworkConnectivityTestResults
{
public:
virtual ~MegaNetworkConnectivityTestResults() = default;
/**
* @brief Possible test results.
*/
enum // 1:1 with enum values from internal implementation
{
NETWORK_CONNECTIVITY_TEST_PASS = 0,
NETWORK_CONNECTIVITY_TEST_FAIL = 1,
NETWORK_CONNECTIVITY_TEST_NET_UNREACHABLE = 2,
};
/**
* @brief Get the result of testing communication over IPv4
*
* @return The type of the flag. Possible values are any of the NETWORK_CONNECTIVITY_TEST_x
* values.
*/
virtual int getIPv4UDP() const = 0;
/**
* @brief Get the result of testing DNS resolution over IPv4
*
* @return The type of the flag. Possible values are any of the NETWORK_CONNECTIVITY_TEST_x
* values.
*/
virtual int getIPv4DNS() const = 0;
/**
* @brief Get the result of testing communication over IPv6
*
* @return The type of the flag. Possible values are any of the NETWORK_CONNECTIVITY_TEST_x
* values.
*/
virtual int getIPv6UDP() const = 0;
/**
* @brief Get the result of testing DNS resolution over IPv6
*
* @return The type of the flag. Possible values are any of the NETWORK_CONNECTIVITY_TEST_x
* values.
*/
virtual int getIPv6DNS() const = 0;
/**
* @brief Copy this object.
*
* This copy is meant to be used from another scope which must survive the actual owner of this
* object. The caller takes the ownership of the new object.
*
* @return Pointer with the copied object.
*/
virtual MegaNetworkConnectivityTestResults* copy() const = 0;
};
/**
* @brief Container class to store all information of a notification.
*
* - ID.
* - Title.
* - Description.
* - Name of the main image for the notification.
* - Name of the icon for the notification.
* - Default static path for the notification image.
* - Timestamp of when the notification became available to the user.
* - Timestamp of when the notification will expire.
* - Whether it should show a banner or only render a notification.
* - Metadata for the first call-to-action ("link" and "text" attributes).
* - Metadata for the second call-to-action ("link" and "text" attributes).
*
* Objects of this class are immutable.
*/
class MegaNotification
{
protected:
MegaNotification() = default;
public:
virtual ~MegaNotification() = default;
/**
* @brief Get the ID associated with this notification.
*
* @return the ID associated with this notification.
*/
virtual int64_t getID() const = 0;
/**
* @brief Get the title of this notification.
*
* The caller does not take the ownership of the const char* object.
* The const char* object is valid as long as the current MegaNotification object is valid too.
*
* @return the title of this notification, always not-null.
*/
virtual const char* getTitle() const = 0;
/**
* @brief Get the description for this notification.
*
* The caller does not take the ownership of the const char* object.
* The const char* object is valid as long as the current MegaNotification object is valid too.
*
* @return the description for this notification, always not-null.
*/
virtual const char* getDescription() const = 0;
/**
* @brief Get the name of the main image for this notification.
*
* The caller does not take the ownership of the const char* object.
* The const char* object is valid as long as the current MegaNotification object is valid too.
*
* @return the name of the main image for this notification, always not-null.
*/
virtual const char* getImageName() const = 0;
/**
* @brief Get the name of the icon for this notification.
*
* The caller does not take the ownership of the const char* object.
* The const char* object is valid as long as the current MegaNotification object is valid too.
*
* @return the name of the icon for this notification, always not-null.
*/
virtual const char* getIconName() const = 0;
/**
* @brief Get the default static path of the image associated with this notification.
*
* The caller does not take the ownership of the const char* object.
* The const char* object is valid as long as the current MegaNotification object is valid too.
*
* @return the default static path of the image associated with this notification, always not-null.
*/
virtual const char* getImagePath() const = 0;
/**
* @brief Get the timestamp of when the notification became available to the user.
*
* @return the timestamp of when the notification became available to the user.
*/
virtual int64_t getStart() const = 0;
/**
* @brief Get the timestamp of when the notification will expire.
*
* @return the timestamp of when the notification will expire.
*/
virtual int64_t getEnd() const = 0;
/**
* @brief Report whether it should show a banner or only render a notification.
*
* @return whether it should show a banner or only render a notification.
*/
virtual bool showBanner() const = 0;
/**
* @brief Get metadata for the first call to action, represented by attributes "link" and "text",
* and their corresponding values.
*
* The caller does not take the ownership of the returned object.
* The returned object is valid as long as the current MegaNotification object is valid too.
*
* @return metadata for the first call to action, always not-null.
*/
virtual const MegaStringMap* getCallToAction1() const = 0;
/**
* @brief Get metadata for the second call-to-action, represented by attributes "link" and "text",
* and their corresponding values.
*
* The caller does not take the ownership of the returned object.
* The returned object is valid as long as the current MegaNotification object is valid too.
*
* @return metadata for the second call-to-action, always not-null.
*/
virtual const MegaStringMap* getCallToAction2() const = 0;
/**
* @brief Get available rendering modes.
*
* The caller takes ownership of the returned object and is in charge of releasing the memory.
*
* @return available rendering modes, null if no rendering mode was supported.
*/
virtual MegaStringList* getRenderModes() const = 0;
/**
* @brief Get the fields of the received rendering mode.
*
* The caller takes ownership of the returned object and is in charge of releasing the memory.
*
* @param mode Rendering mode for which the fields will be returned
*
* @return fields of the received rendering mode, null if the mode was not supported.
*/
virtual MegaStringMap* getRenderModeFields(const char* mode) const = 0;
/**
* @brief Copy the MegaNotification object.
*
* This copy is meant to be used from another scope which must survive the actual owner of this MegaNotification object.
* The caller takes the ownership of the new MegaNotification object.
*
* @return MegaNotification* of the copied object.
*/
virtual MegaNotification* copy() const = 0;
};
/**
* @brief List of MegaNotification objects
*
* A MegaNotificationList has the ownership of the MegaNotification objects that it contains, so they will be
* only valid until the MegaNotificationList is deleted. If you want to retain a MegaNotification returned by
* a MegaNotificationList, use MegaNotification::copy().
*
* Objects of this class are immutable.
*/
class MegaNotificationList
{
public:
/**
* @brief Returns the MegaNotification at position i in the list
*
* The MegaNotificationList retains the ownership of the returned MegaNotification. It will be only valid until
* the MegaNotificationList is deleted. If you want to retain a MegaNotification returned by this function,
* use MegaNotification::copy().
*
* If the index is >= the size of the list, this function returns NULL.
*
* @param i Position of the MegaNotification that we want to get from the list
* @return MegaNotification at position i in the list
*/
virtual const MegaNotification* get(unsigned i) const = 0;
/**
* @brief Returns the number of MegaNotification-s in the list
* @return number of MegaNotification-s in the list
*/
virtual unsigned size() const = 0;
virtual MegaNotificationList* copy() const = 0;
virtual ~MegaNotificationList() = default;
};
class MegaFuseExecutorFlags
{
protected:
MegaFuseExecutorFlags();
public:
virtual ~MegaFuseExecutorFlags();
/**
* @brief
* How many threads is the executor allowed to spawn?
*
* @return
* The maximum number of threads the executor is allowed to spawn.
*/
virtual size_t getMaxThreadCount() const = 0;
/**
* @brief
* How long should idle threads be retained?
*
* @return
* How long, in seconds, idle threads are retained.
*/
virtual size_t getMaxThreadIdleTime() const = 0;
/**
* @brief
* How many idle threads is the executor allowed to retain.
*
* @return
* The number of idle threads that the executor will retain.
*/
virtual size_t getMinThreadCount() const = 0;
/**
* @brief
* Specify how many threads the executor is allowed to spawn.
*
* @param max
* How many threads the executor is allowed to spawn.
*
* @return
* True if max is a non-zero value, false otherwise.
*/
virtual bool setMaxThreadCount(size_t max) = 0;
/**
* @brief
* Specify how long an idle thread is retained.
*
* @param seconds
* How long an idle thread should be retained.
*/
virtual void setMaxThreadIdleTime(size_t seconds) = 0;
/**
* @brief
* Specify how many idle threads the executor can retain.
*
* @param min
* How many idle threads the executor can retain.
*/
virtual void setMinThreadCount(size_t min) = 0;
}; // MegaFuseExecutorFlags
class MegaFuseFlags
{
protected:
MegaFuseFlags();
public:
enum LogLevel
{
// Only emit error messages.
LOG_LEVEL_ERROR,
// Only emit error messages and warnings.
LOG_LEVEL_WARNING,
// Only emit error, warning and info messages.
LOG_LEVEL_INFO,
// Emit all messages.
LOG_LEVEL_DEBUG
}; // LogLevel
enum FileExplorerView
{
// Do nothing
FILE_EXPLORER_VIEW_NONE = 0,
// Set file explorer view to list
FILE_EXPLORER_VIEW_LIST = 1
}; // FileExplorerView
virtual ~MegaFuseFlags();
/**
* @brief
* Create a copy of this instance.
*
* @return
* A copy of this instance.
*/
virtual MegaFuseFlags* copy() const = 0;
/**
* @brief
* Create a new instance.
*
* @return
* A new instance.
*/
static MegaFuseFlags* create();
/**
* @brief
* How long should we wait until we upload a modified file?
*
* @return
* How long, in seconds, before modified files are uploaded.
*/
virtual size_t getFlushDelay() const = 0;
/**
* @brief
* Query the service's log level.
*
* @return
* The service's current log level.
*/
virtual int getLogLevel() const = 0;
/**
* @brief
* Query the service's file explorer view.
*
* @return
* The service's current file explorer view.
*/
virtual int getFileExplorerView() const = 0;
/**
* @brief
* Retrieve a reference to the inode cache's flags.
*
* @return
* A reference to the inode cache's flags.
*/
virtual MegaFuseInodeCacheFlags* getInodeCacheFlags() = 0;
/**
* @brief
* Retrieve a reference to the mount executor flags.
*
* These flags control how many threads an individual mount is allowed
* to create and how long those threads should remain idle before they
* are destroyed.
*
* @return
* A reference to the mount executor flags.
*/
virtual MegaFuseExecutorFlags* getMountExecutorFlags() = 0;
/**
* @brief
* Retrieve a reference to the subsystem's executor flags.
*
* These flags control how many threads the FUSE subsystem is allowed to
* create for its own internal use and how long those threads should
* remain before they are destroyed.
*
* @return
* A reference to the subsystem's executor flags.
*/
virtual MegaFuseExecutorFlags* getSubsystemExecutorFlags() = 0;
/**
* @brief
* Specify how long we should wait before uploading a modified file.
*
* @param seconds
* How many seconds before a modified file is uploaded.
*/
virtual void setFlushDelay(size_t seconds) = 0;
/**
* @brief
* Specify the service's log level.
*
* @param level
* The service's new log level.
*/
virtual void setLogLevel(int level) = 0;
/**
* @brief
* Specify the service's file explorer view.
*
* @param level
* The service's new file explorer view.
*/
virtual void setFileExplorerView(int view) = 0;
}; // MegaFuseFlags
class MegaFuseInodeCacheFlags
{
protected:
MegaFuseInodeCacheFlags();
public:
virtual ~MegaFuseInodeCacheFlags();
virtual size_t getCleanAgeThreshold() const = 0;
virtual size_t getCleanInterval() const = 0;
virtual size_t getCleanSizeThreshold() const = 0;
virtual size_t getMaxSize() const = 0;
virtual void setCleanAgeThreshold(std::size_t seconds) = 0;
virtual void setCleanInterval(std::size_t seconds) = 0;
virtual void setCleanSizeThreshold(std::size_t size) = 0;
virtual void setMaxSize(std::size_t size) = 0;
}; // MegaFuseInodeCacheFlags
class MegaMount
{
protected:
MegaMount();
public:
enum Result
{
// The operation was aborted due to client shutdown.
ABORTED,
// FUSE is supported but the backend is not installed.
BACKEND_UNAVAILABLE,
// The mount's busy and cannot be disabled.
BUSY,
// A mount has encountered an expected failure and has been disabled.
FAILED,
// Mount target already exists.
LOCAL_EXISTS,
// Mount target doesn't denote a directory.
LOCAL_FILE,
// Mount target is being synchronized.
LOCAL_SYNCING,
// A mount's already associated with the target path.
LOCAL_TAKEN,
// Mount target doesn't exist.
LOCAL_UNKNOWN,
// A mount already exists with a specified name.
NAME_TAKEN,
// The specified name is too long.
NAME_TOO_LONG,
// The specified name contains invalid character(s).
NAME_INVALID_CHAR,
// No name has been specified for a mount.
NO_NAME,
// Mount source doesn't describe a directory.
REMOTE_FILE,
// Mount source doesn't exist.
REMOTE_UNKNOWN,
// Mount was successful.
SUCCESS,
// Encountered an unexpected error while mounting.
UNEXPECTED,
// No mount is associated with the specified handle or path.
UNKNOWN,
// FUSE isn't supported on this platform.
UNSUPPORTED
}; // Result
virtual ~MegaMount();
/**
* @brief
* Copies this instance.
*
* @return
* A copy of this instance.
*/
virtual MegaMount* copy() const = 0;
/**
* @brief
* Creates a new instance.
*
* @return
* A new instance.
*/
static MegaMount* create();
/**
* @brief
* Retrieves a reference to this mount's flags.
*
* @return
* A mutable reference to this mount's flags.
*/
virtual MegaMountFlags* getFlags() const = 0;
/**
* @brief
* Retrieves the handle this mount is associated with.
*
* @return
* The handle this mount is associated with.
*/
virtual MegaHandle getHandle() const = 0;
/**
* @brief
* Retrieve this mount's local path.
*
* @return
* This mount's local path.
*/
virtual const char* getPath() const = 0;
/**
* @brief
* Translates a result code into a human readable description.
*
* @param result
* The result you want to translate.
*
* @return
* A description of the result.
*/
static const char* getResultDescription(int result);
/**
* @brief
* Translates a result code into a human readable string.
*
* @param result
* The result you want to translate.
*
* @return
* A human-readable version of the result code.
*/
static const char* getResultString(int result);
/**
* @brief
* Update this mount's flags.
*
* @param flags
* The flags we want the mount to have.
*/
virtual void setFlags(const MegaMountFlags* flags) = 0;
/**
* @brief
* Set the handle this mount should be associated with.
*
* @param handle
* A handle identifying a cloud node.
*/
virtual void setHandle(MegaHandle handle) = 0;
/**
* @brief
* Set this mount's local path.
*
* @param path
* Where the mount should be present on the local filesystem.
*/
virtual void setPath(const char* path) = 0;
}; // MegaMount
class MegaMountFlags
{
protected:
MegaMountFlags();
public:
virtual ~MegaMountFlags();
/**
* @brief
* Copies this instance.
*
* @return
* A copy of this instance.
*/
virtual MegaMountFlags* copy() const = 0;
/**
* @brief
* Creates a new instance.
*
* @return
* A new instance.
*/
static MegaMountFlags* create();
/**
* @brief
* Query whether the mount will be enabled on startup.
*
* @return
* True if the mount will be enabled at startup.
*/
virtual bool getEnableAtStartup() const = 0;
/**
* @brief
* Retrives a mount's name.
*
* @return
* The mount's name.
*/
virtual const char* getName() const = 0;
/**
* @brief
* Query whether a mount is persistent.
*
* @return
* True if the mount is persistent.
*/
virtual bool getPersistent() const = 0;
/**
* @brief
* Query whether a mount is read only.
*
* @return
* True if the mount is read only.
*/
virtual bool getReadOnly() const = 0;
/**
* Specify whether a mount should be enabled at startup.
*
* @param enabled
* True if the mount should be enabled at startup.
*
* @note
* Altering the value of this flag will make a transient mount
* persistent. This makes sense as stating how it should behave
* on startup implies that the mount will exist for more than
* a single session.
*/
virtual void setEnableAtStartup(bool enable) = 0;
/**
* @brief
* Set the mount's name.
*
* @param name
* The name of the mount.
*/
virtual void setName(const char* name) = 0;
/**
* @brief
* Specify whether a mount is persistent.
*
* @param persistent
* True if the mount should be persistent.
*/
virtual void setPersistent(bool persistent) = 0;
/**
* @brief
* Specify whether a mount is read only.
*
* @param readOnly
* True if the mount should be read only.
*/
virtual void setReadOnly(bool readOnly) = 0;
}; // MegaMountFlags
class MegaMountList
{
protected:
MegaMountList();
public:
virtual ~MegaMountList();
/**
* @brief
* Copies this instance.
*
* @return
* A copy of this instance.
*/
virtual MegaMountList* copy() const = 0;
/**
* @brief
* Retrieves an element from the list.
*
* @param index
* The index of the element to retrieve.
*
* @return
* NULL if index is out of range.
*/
virtual const MegaMount* get(size_t index) const = 0;
/**
* @brief
* Query how many elements are in this list.
*
* @return
* The number of elements in this list.
*/
virtual size_t size() const = 0;
}; // MegaMountList
/**
* @brief Reason chosen from a multiple-choice by a user when canceling a subscription
*/
class MegaCancelSubscriptionReason
{
public:
/**
* @brief
* Create a new instance.
*
* @param text
* The actual text of the reason.
* @param position
* The rendered position of the selected reason (for example "1", "1.a", "2" etc.)
*
* @return
* A new instance.
*/
static MegaCancelSubscriptionReason* create(const char* text, const char* position);
/**
* @brief
* Get the text of the reason.
* The returned value is owned by the current instances.
*
* @return
* The text of the reason.
*/
virtual const char* text() const = 0;
/**
* @brief
* Get the rendered position of the selected reason.
* The returned value is owned by the current instances.
*
* @return
* The rendered position of the selected reason.
*/
virtual const char* position() const = 0;
virtual MegaCancelSubscriptionReason* copy() const = 0;
virtual ~MegaCancelSubscriptionReason() = default;
};
/**
* @brief List of MegaCancelSubscriptionReason instances
*
* The list has the ownership of the instances that it contains, so they will be valid until the
* list is deleted. If you want to retain a copy of a particular instance, use
* MegaCancelSubscriptionReason::copy().
*/
class MegaCancelSubscriptionReasonList
{
public:
/**
* @brief
* Create a new instance.
*
* @return
* A new instance.
*/
static MegaCancelSubscriptionReasonList* create();
/**
* @brief
* Add an element to the list.
*
* @param reason
* The reason to be added to the list.
*/
virtual void add(const MegaCancelSubscriptionReason* reason) = 0;
/**
* @brief
* Retrieve an element from the list.
*
* @param index
* The index of the element to retrieve.
*
* @return
* The element at the given index or NULL if index was out of range.
*/
virtual const MegaCancelSubscriptionReason* get(size_t index) const = 0;
/**
* @brief
* Query how many elements are in this list.
*
* @return
* The number of elements in this list.
*/
virtual size_t size() const = 0;
virtual MegaCancelSubscriptionReasonList* copy() const = 0;
virtual ~MegaCancelSubscriptionReasonList() = default;
};
}
#endif //MEGAAPI_H
|