1 /**
2  * @file megaapi.h
3  * @brief Public header file of the intermediate layer for the MEGA C++ SDK.
4  *
5  * (c) 2013-2014 by Mega Limited, Auckland, New Zealand
6  *
7  * This file is part of the MEGA SDK - Client Access Engine.
8  *
9  * Applications using the MEGA API must present a valid application key
10  * and comply with the the rules set forth in the Terms of Service.
11  *
12  * The MEGA SDK is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15  *
16  * @copyright Simplified (2-clause) BSD License.
17  *
18  * You should have received a copy of the license along with this
19  * program.
20  */
21 
22 #ifndef MEGAAPI_H
23 #define MEGAAPI_H
24 
25 #include <string>
26 #include <vector>
27 #include <inttypes.h>
28 
29 #ifdef __APPLE__
30 #include <TargetConditionals.h>
31 #endif
32 
33 namespace mega
34 {
35 typedef uint64_t MegaHandle;
36 
37 #ifdef WIN32
38     const char MEGA_DEBRIS_FOLDER[] = "Rubbish";
39 #else
40     const char MEGA_DEBRIS_FOLDER[] = ".debris";
41 #endif
42 
43     /**
44      * @brief INVALID_HANDLE Invalid value for a handle
45      *
46      * This value is used to represent an invalid handle. Several MEGA objects can have
47      * a handle but it will never be mega::INVALID_HANDLE
48      *
49      */
50     const MegaHandle INVALID_HANDLE = ~(MegaHandle)0;
51 
52 class MegaListener;
53 class MegaRequestListener;
54 class MegaTransferListener;
55 class MegaBackupListener;
56 class MegaGlobalListener;
57 class MegaTreeProcessor;
58 class MegaAccountDetails;
59 class MegaAchievementsDetails;
60 class MegaPricing;
61 class MegaNode;
62 class MegaUser;
63 class MegaUserAlert;
64 class MegaContactRequest;
65 class MegaShare;
66 class MegaError;
67 class MegaRequest;
68 class MegaEvent;
69 class MegaTransfer;
70 class MegaBackup;
71 class MegaSync;
72 class MegaStringList;
73 class MegaNodeList;
74 class MegaUserList;
75 class MegaUserAlertList;
76 class MegaContactRequestList;
77 class MegaShareList;
78 class MegaTransferList;
79 class MegaFolderInfo;
80 class MegaTimeZoneDetails;
81 class MegaPushNotificationSettings;
82 class MegaBackgroundMediaUpload;
83 class MegaCancelToken;
84 class MegaApi;
85 
86 class MegaSemaphore;
87 
88 /**
89  * @brief Interface to provide an external GFX processor
90  *
91  * You can implement this interface to provide a graphics processor to the SDK
92  * in the MegaApi::MegaApi constructor. That way, SDK will use your implementation to generate
93  * thumbnails/previews when needed.
94  *
95  * The implementation will receive callbacks from an internal worker thread.
96  *
97  * Images will be sequentially processed. At first, the SDK will call MegaGfxProcessor::readBitmap
98  * with the path of the file. Then, it will call MegaGfxProcessor::getWidth and MegaGfxProcessor::getHeight
99  * to get the dimensions of the file (in pixels). After that, the SDK will call
100  * MegaGfxProcessor::getBitmapDataSize and MegaGfxProcessor::getBitmapData in a loop
101  * to get thumbnails/previews of different sizes. Finally, the SDK will call
102  * MegaGfxProcessor::freeBitmap to let you free the resources required to process
103  * the current file.
104  *
105  * If the image has EXIF data, it should be rotated/mirrored before doing any
106  * other processing. MegaGfxProcessor::getWidth, MegaGfxProcessor::getHeight and all
107  * other coordinates in this interface are expressed over the image after the required
108  * transformation based on the EXIF data.
109  *
110  * Generated images must be in JPG format.
111  *
112  */
113 class MegaGfxProcessor
114 {
115 public:
116     /**
117      * @brief Read the image file and check if it can be processed
118      *
119      * This is the first function that will be called to process an image. No other
120      * functions of this interface will be called before this one.
121      *
122      * The recommended implementation is to read the file, check if it's an image and
123      * get its dimensions. If everything is OK, the function should return true. If the
124      * file isn't an image or can't be processed, this function should return false.
125      *
126      * The SDK will call this function with all files so it's probably a good idea to
127      * check the extension before trying to open them.
128      *
129      * @param path Path of the file that is going to be processed
130      * @return True if the implementation is able to manage the file, false otherwise.
131      */
132     virtual bool readBitmap(const char* path);
133 
134     /**
135      * @brief Returns the width of the image
136      *
137      * This function must return the width of the image at the path provided in MegaGfxProcessor::readBitmap
138      * If a number <= 0 is returned, the image won't be processed.
139      *
140      * @return The width of the image
141      */
142     virtual int getWidth();
143 
144     /**
145      * @brief Returns the height of the image
146      *
147      * This function must return de width of the image at the path provided in MegaGfxProcessor::readBitmap
148      * If a number <= 0 is returned, the image won't be processed.
149      *
150      * @return The height of the image
151      */
152     virtual int getHeight();
153 
154     /**
155      * @brief Generates a thumbnail/preview image.
156      *
157      * This function provides the parameters of the thumbnail/preview that the SDK wants to generate.
158      * If the implementation can create it, it has to provide the size of the buffer (in bytes) that
159      * it needs to store the generated JPG image. Otherwise, it should return a number <= 0.
160      *
161      * The implementation of this function has to scale the image to the size (width, height) and then
162      * extract the rectangle starting at the point (px, py) with size (rw, rh). (px, py, rw and rh) are
163      * expressed in pixels over the scaled image, being the point (0, 0) the upper-left corner of the
164      * scaled image, with the X-axis growing to the right and the Y-axis growing to the bottom.
165      *
166      * @param width Width of the scaled image from which the thumbnail/preview image will be extracted
167      * @param height Height of the scaled image from which the thumbnail/preview image will be extracted
168      * @param px X coordinate of the starting point of the desired image (in pixels over the scaled image)
169      * @param py Y coordinate of the starting point of the desired image (in pixels over the scaled image)
170      * @param rw Width of the desired image (in pixels over the scaled image)
171      * @param rh Height of the desired image (in pixels over the scaled image)
172      *
173      * @return Size of the buffer required to store the image (in bytes) or a number <= 0 if it's not
174      * possible to generate it.
175      *
176      */
177     virtual int getBitmapDataSize(int width, int height, int px, int py, int rw, int rh);
178 
179     /**
180      * @brief Copy the thumbnail/preview data to a buffer provided by the SDK
181      *
182      * The SDK uses this function immediately after MegaGfxProcessor::getBitmapDataSize when that
183      * fuction succeed. The implementation of this function must copy the data of the image in the
184      * buffer provided by the SDK. The size of this buffer will be the same as the value returned
185      * in the previous call to MegaGfxProcessor::getBitmapDataSize. That size is provided in the
186      * second parameter for compatibility with SWIG and to help the implementation to prevent
187      * buffer overflow errors.
188      *
189      * @param bitmapData Preallocated buffer in which the implementation must write the generated image
190      * @param size Size of the buffer. It will be the same that the previous return value of
191      * MegaGfxProcessor::getBitmapDataSize
192      *
193      * @return True in case of success, false otherwise.
194      */
195     virtual bool getBitmapData(char *bitmapData, size_t size);
196 
197     /**
198      * @brief Free resources associated with the processing of the current image
199      *
200      * With a call of this function, the processing of the image started with a call to
201      * MegaGfxProcessor::readBitmap ends. No other functions will be called to continue processing
202      * the current image, so you can free all related resources.
203      *
204      */
205     virtual void freeBitmap();
206 
207     virtual ~MegaGfxProcessor();
208 };
209 
210 /**
211  * @brief Contains the information related to a proxy server.
212  *
213  * Pass an object of this class to MegaApi::setProxySettings to
214  * start using a proxy server.
215  *
216  * Currently, only HTTP proxies are allowed. The proxy server
217  * should support HTTP request and tunneling for HTTPS.
218  *
219  */
220 class MegaProxy
221 {
222 public:
223     enum {PROXY_NONE = 0, PROXY_AUTO = 1, PROXY_CUSTOM = 2};
224 
225     /**
226      * @brief Creates a MegaProxy object with the default settings (PROXY_AUTO)
227      */
228     MegaProxy();
229     virtual ~MegaProxy();
230 
231     /**
232      * @brief Sets the type of the proxy
233      *
234      * The allowed values in the current version are:
235      * - PROXY_NONE means no proxy
236      * - PROXY_AUTO means automatic detection (default)
237      * - PROXY_CUSTOM means a proxy using user-provided data
238      *
239      * PROXY_AUTO is currently supported on Windows only, for other platforms
240      * PROXY_NONE will be used as the automatic detected value.
241      *
242      * @param proxyType Sets the type of the proxy
243      */
244     void setProxyType(int proxyType);
245 
246     /**
247      * @brief Sets the URL of the proxy
248      *
249      * That URL must follow this format: "<scheme>://<hostname|ip>:<port>"
250      *
251      * This is a valid example: http://127.0.0.1:8080
252      *
253      * @param proxyURL URL of the proxy: "<scheme>://<hostname|ip>:<port>"
254      */
255     void setProxyURL(const char *proxyURL);
256 
257     /**
258      * @brief Set the credentials needed to use the proxy
259      *
260      * If you don't need to use any credentials, do not use this function
261      * or pass NULL in the first parameter.
262      *
263      * @param username Username to access the proxy, or NULL if credentials aren't needed
264      * @param password Password to access the proxy
265      */
266     void setCredentials(const char *username, const char *password);
267 
268     /**
269      * @brief Returns the current proxy type of the object
270      *
271      * The allowed values in the current version are:
272      * - PROXY_NONE means no proxy
273      * - PROXY_AUTO means automatic detection (default)
274      * - PROXY_CUSTOM means a proxy using user-provided data
275      *
276     * @return Current proxy type (PROXY_NONE, PROXY_AUTO or PROXY_CUSTOM)
277      */
278     int getProxyType();
279 
280     /**
281      * @brief Returns the URL of the proxy, previously set with MegaProxy::setProxyURL.
282      *
283      * The MegaProxy object retains the ownership of the returned value.
284      * It will be valid until the MegaProxy::setProxyURL is called (that will delete the previous value)
285      * or until the MegaProxy object is deleted.
286      *
287      * @return URL of the proxy
288      */
289     const char *getProxyURL();
290 
291     /**
292      * @brief Returns true if credentials are needed to access the proxy, false otherwise.
293      *
294      * The default value of this function is false. It will return true after calling
295      * MegaProxy::setCredentials with a non NULL username.
296      *
297      * @return True if credentials are needed to access the proxy, false otherwise.
298      */
299     bool credentialsNeeded();
300 
301     /**
302      * @brief Return the username required to access the proxy
303      *
304      * The MegaProxy object retains the ownership of the returned value.
305      * It will be valid until the MegaProxy::setCredentials is called (that will delete the previous value)
306      * or until the MegaProxy object is deleted.
307      *
308      * @return Username required to access the proxy
309      */
310     const char *getUsername();
311 
312     /**
313      * @brief Return the username required to access the proxy
314      *
315      * The MegaProxy object retains the ownership of the returned value.
316      * It will be valid until the MegaProxy::setCredentials is called (that will delete the previous value)
317      * or until the MegaProxy object is deleted.
318      *
319      * @return Password required to access the proxy
320      */
321     const char *getPassword();
322 
323 private:
324     int proxyType;
325     const char *proxyURL;
326     const char *username;
327     const char *password;
328 };
329 
330 /**
331  * @brief Interface to receive SDK logs
332  *
333  * You can implement this class and pass an object of your subclass to MegaApi::setLoggerClass
334  * to receive SDK logs. You will have to use also MegaApi::setLogLevel to select the level of
335  * the logs that you want to receive.
336  *
337  */
338 class MegaLogger
339 {
340 public:
341     /**
342      * @brief This function will be called with all logs with level <= your selected
343      * level of logging (by default it is MegaApi::LOG_LEVEL_INFO)
344      *
345      * @param time Readable string representing the current time.
346      *
347      * The SDK retains the ownership of this string, it won't be valid after this funtion returns.
348      *
349      * @param loglevel Log level of this message
350      *
351      * Valid values are:
352      * - MegaApi::LOG_LEVEL_FATAL = 0
353      * - MegaApi::LOG_LEVEL_ERROR = 1
354      * - MegaApi::LOG_LEVEL_WARNING = 2
355      * - MegaApi::LOG_LEVEL_INFO = 3
356      * - MegaApi::LOG_LEVEL_DEBUG = 4
357      * - MegaApi::LOG_LEVEL_MAX = 5
358      *
359      * @param source Location where this log was generated
360      *
361      * For logs generated inside the SDK, this will contain the source file and the line of code.
362      * The SDK retains the ownership of this string, it won't be valid after this funtion returns.
363      *
364      * @param message Log message
365      *
366      * The SDK retains the ownership of this string, it won't be valid after this funtion returns.
367      *
368      * @param directMessages: in ENABLE_LOG_PERFORMANCE MODE, this will indicate the logger that an array of const char* should
369      * be written in the logs immediately without buffering the output. message can be discarded in that case.
370      *
371      * @param directMessagesSizes: size of the previous const char *.
372      *
373      */
374     virtual void log(const char *time, int loglevel, const char *source, const char *message
375 #ifdef ENABLE_LOG_PERFORMANCE
376                      , const char **directMessages = nullptr, size_t *directMessagesSizes = nullptr, int numberMessages = 0
377 #endif
378                      );
~MegaLogger()379     virtual ~MegaLogger(){}
380 };
381 
382 /**
383  * @brief Represents a node (file/folder) in the MEGA account
384  *
385  * It allows to get all data related to a file/folder in MEGA. It can be also used
386  * to start SDK requests (MegaApi::renameNode, MegaApi::moveNode, etc.)
387  *
388  * Objects of this class aren't live, they are snapshots of the state of a node
389  * in MEGA when the object is created, they are immutable.
390  *
391  * Do not inherit from this class. You can inspect the MEGA filesystem and get these objects using
392  * MegaApi::getChildren, MegaApi::getChildNode and other MegaApi functions.
393  *
394  */
395 class MegaNode
396 {
397     public:
398 		enum {
399 			TYPE_UNKNOWN = -1,
400 			TYPE_FILE = 0,
401 			TYPE_FOLDER,
402 			TYPE_ROOT,
403 			TYPE_INCOMING,
404             TYPE_RUBBISH
405 		};
406 
407         enum
408         {
409             CHANGE_TYPE_REMOVED         = 0x01,
410             CHANGE_TYPE_ATTRIBUTES      = 0x02,
411             CHANGE_TYPE_OWNER           = 0x04,
412             CHANGE_TYPE_TIMESTAMP       = 0x08,
413             CHANGE_TYPE_FILE_ATTRIBUTES = 0x10,
414             CHANGE_TYPE_INSHARE         = 0x20,
415             CHANGE_TYPE_OUTSHARE        = 0x40,
416             CHANGE_TYPE_PARENT          = 0x80,
417             CHANGE_TYPE_PENDINGSHARE    = 0x100,
418             CHANGE_TYPE_PUBLIC_LINK     = 0x200,
419             CHANGE_TYPE_NEW             = 0x400
420         };
421 
422         static const int INVALID_DURATION = -1;
423         static const double INVALID_COORDINATE;
424 
425         virtual ~MegaNode();
426 
427         /**
428          * @brief Creates a copy of this MegaNode object.
429          *
430          * The resulting object is fully independent of the source MegaNode,
431          * it contains a copy of all internal attributes, so it will be valid after
432          * the original object is deleted.
433          *
434          * You are the owner of the returned object
435          *
436          * @return Copy of the MegaNode object
437          */
438         virtual MegaNode *copy();
439 
440         /**
441          * @brief Returns the type of the node
442          *
443          * Valid values are:
444          * - TYPE_UNKNOWN = -1,
445          * Unknown node type
446          *
447          * - TYPE_FILE = 0,
448          * The MegaNode object represents a file in MEGA
449          *
450          * - TYPE_FOLDER = 1
451          * The MegaNode object represents a folder in MEGA
452          *
453          * - TYPE_ROOT = 2
454          * The MegaNode object represents root of the MEGA Cloud Drive
455          *
456          * - TYPE_INCOMING = 3
457          * The MegaNode object represents root of the MEGA Inbox
458          *
459          * - TYPE_RUBBISH = 4
460          * The MegaNode object represents root of the MEGA Rubbish Bin
461          *
462          * @return Type of the node
463          */
464         virtual int getType();
465 
466         /**
467          * @brief Returns the name of the node
468          *
469          * The name is only valid for nodes of type TYPE_FILE or TYPE_FOLDER.
470          * For other MegaNode types, the name is undefined.
471          *
472          * The MegaNode object retains the ownership of the returned string. It will
473          * be valid until the MegaNode object is deleted.
474          *
475          * @return Name of the node
476          */
477         virtual const char* getName();
478 
479         /**
480          * @brief Returns the fingerprint (Base64-encoded) of the node
481          *
482          * Only files have a fingerprint, and there could be files without it.
483          * If the node doesn't have a fingerprint, this funtion returns NULL
484          *
485          * The MegaNode object retains the ownership of the returned string. It will
486          * be valid until the MegaNode object is deleted.
487          *
488          * @return Base64-encoded fingerprint of the node, or NULL it the node doesn't have a fingerprint.
489          */
490         virtual const char* getFingerprint();
491 
492         /**
493          * @brief Returns the original fingerprint (Base64-encoded) of the node
494          *
495          * In the case where a file was modified before uploaded (eg. resized photo or gps coords removed),
496          * it may have an original fingerprint set (by MegaApi::setOriginalFingerprint or
497          * MegaApi::backgroundMediaUploadComplete), which is the fingerprint of the file before it was modified.
498          * This can be useful on mobile devices to avoid uploading a file multiple times when only
499          * the original file is kept on the device.
500          *
501          * The MegaNode object retains the ownership of the returned string. It will
502          * be valid until the MegaNode object is deleted.
503          *
504          * @return Base64-encoded original fingerprint of the node, or NULL it the node doesn't have an original fingerprint.
505          */
506         virtual const char* getOriginalFingerprint();
507 
508         /**
509          * @brief Returns true if the node has custom attributes
510          *
511          * Custom attributes can be set using MegaApi::setCustomNodeAttribute
512          *
513          * @return True if the node has custom attributes, otherwise false
514          * @see MegaApi::setCustomNodeAttribute
515          */
516         virtual bool hasCustomAttrs();
517 
518         /**
519          * @brief Returns the list with the names of the custom attributes of the node
520          *
521          * Custom attributes can be set using MegaApi::setCustomNodeAttribute
522          *
523          * You take the ownership of the returned value
524          *
525          * @return Names of the custom attributes of the node
526          * @see MegaApi::setCustomNodeAttribute
527          */
528         virtual MegaStringList *getCustomAttrNames();
529 
530         /**
531          * @brief Get a custom attribute of the node
532          *
533          * Custom attributes can be set using MegaApi::setCustomNodeAttribute
534          *
535          * The MegaNode object retains the ownership of the returned string. It will
536          * be valid until the MegaNode object is deleted.
537          *
538          * @param attrName Name of the custom attribute
539          * @return Custom attribute of the node
540          * @see MegaApi::setCustomNodeAttribute
541          */
542         virtual const char *getCustomAttr(const char* attrName);
543 
544         /**
545          * @brief Get the attribute of the node representing its duration.
546          *
547          * The purpose of this attribute is to store the duration of audio/video files.
548          *
549          * @return The number of seconds, or -1 if this attribute is not set.
550          */
551         virtual int getDuration();
552 
553         /**
554          * @brief Get the attribute of the node representing its width.
555          *
556          * @return The number of pixels for width, or -1 if this attribute is not set.
557          */
558         virtual int getWidth();
559 
560         /**
561          * @brief Get the attribute of the node representing its height.
562          *
563          * @return The number of pixels for height, or -1 if this attribute is not set.
564          */
565         virtual int getHeight();
566 
567         /**
568          * @brief Get the attribute of the node representing its shortformat.
569          *
570          * @return The shortformat, or -1 if this attribute is not set.
571          */
572         virtual int getShortformat();
573 
574         /**
575          * @brief Get the attribute of the node representing its videocodecid.
576          *
577          * @return The videocodecid, or -1 if this attribute is not set.
578          */
579         virtual int getVideocodecid();
580 
581         /**
582          * @brief Get the attribute of the node representing the latitude.
583          *
584          * The purpose of this attribute is to store the coordinate where a photo was taken.
585          *
586          * @return The latitude coordinate in its decimal degree notation, or INVALID_COORDINATE
587          * if this attribute is not set.
588          */
589         virtual double getLatitude();
590 
591         /**
592          * @brief Get the attribute of the node representing the longitude.
593          *
594          * The purpose of this attribute is to store the coordinate where a photo was taken.
595          *
596          * @return The longitude coordinate in its decimal degree notation, or INVALID_COORDINATE
597          * if this attribute is not set.
598          */
599         virtual double getLongitude();
600 
601         /**
602          * @brief Returns the handle of this MegaNode in a Base64-encoded string
603          *
604          * You take the ownership of the returned string.
605          * Use delete [] to free it.
606          *
607          * @return Base64-encoded handle of the node
608          */
609         virtual char* getBase64Handle();
610 
611         /**
612          * @brief Returns the size of the node
613          *
614          * The returned value is only valid for nodes of type TYPE_FILE.
615          *
616          * @return Size of the node
617          */
618         virtual int64_t getSize();
619 
620         /**
621          * @brief Returns the creation time of the node in MEGA (in seconds since the epoch)
622          *
623          * The returned value is only valid for nodes of type TYPE_FILE or TYPE_FOLDER.
624          *
625          * @return Creation time of the node (in seconds since the epoch)
626          */
627         virtual int64_t getCreationTime();
628 
629         /**
630          * @brief Returns the modification time of the file that was uploaded to MEGA (in seconds since the epoch)
631          *
632          * The returned value is only valid for nodes of type TYPE_FILE.
633          *
634          * @return Modification time of the file that was uploaded to MEGA (in seconds since the epoch)
635          */
636         virtual int64_t getModificationTime();
637 
638         /**
639          * @brief Returns a handle to identify this MegaNode
640          *
641          * You can use MegaApi::getNodeByHandle to recover the node later.
642          *
643          * @return Handle that identifies this MegaNode
644          */
645         virtual MegaHandle getHandle();
646 
647         /**
648          * @brief Returns the handle of the previous parent of this node.
649          *
650          * This attribute is set when nodes are moved to the Rubbish Bin to
651          * ease their restoration. If the attribute is not set for the node,
652          * this function returns MegaApi::INVALID_HANDLE
653          *
654          * @return Handle of the previous parent of this node or MegaApi::INVALID_HANDLE
655          * if the attribute is not set.
656          */
657         virtual MegaHandle getRestoreHandle();
658 
659         /**
660          * @brief Returns the handle of the parent node
661          *
662          * You can use MegaApi::getNodeByHandle to recover the node later.
663          *
664          * @return Handle of the parent node (or INVALID_HANDLE for root nodes)
665          */
666         virtual MegaHandle getParentHandle();
667 
668         /**
669          * @brief Returns the key of the node in a Base64-encoded string
670          *
671          * You take the ownership of the returned string.
672          * Use delete [] to free it.
673          *
674          * @return Returns the key of the node.
675          */
676         virtual char* getBase64Key();
677 
678         /**
679          * @brief Returns the tag of the operation that created/modified this node in MEGA
680          *
681          * Every request and every transfer has a tag that identifies it.
682          * When a request creates or modifies a node, the tag is associated with the node
683          * at runtime, this association is lost after a reload of the filesystem or when
684          * the SDK is closed.
685          *
686          * This tag is specially useful to know if a node reported in MegaListener::onNodesUpdate or
687          * MegaGlobalListener::onNodesUpdate was modified by a local operation (tag != 0) or by an
688          * external operation, made by another MEGA client (tag == 0).
689          *
690          * If the node hasn't been created/modified during the current execution, this function returns 0
691          *
692          * @return The tag associated with the node.
693          */
694         virtual int getTag();
695 
696         /**
697          * @brief Returns the expiration time of a public link, if any
698          *
699          * @return The expiration time as an Epoch timestamp. Returns 0 for non-expire
700          * links, and -1 if the MegaNode is not exported.
701          */
702         virtual int64_t getExpirationTime();
703 
704         /**
705          * @brief Returns the public handle of a node
706          *
707          * Only exported nodes have a public handle.
708          *
709          * @return The public handle of an exported node. If the MegaNode
710          * has not been exported, it returns UNDEF.
711          */
712         virtual MegaHandle getPublicHandle();
713 
714          /**
715          * @brief Returns a public node corresponding to the exported MegaNode
716          *
717          * @return Public node for the exported node. If the MegaNode has not been
718          * exported or it has expired, then it returns NULL.
719          */
720         virtual MegaNode* getPublicNode();
721 
722         /**
723          * @brief Returns the URL for the public link of the exported node.
724          *
725          * You take the ownership of the returned string.
726          * Use delete [] to free it.
727          *
728          * @param includeKey False if you want the link without the key.
729          * @return The URL for the public link of the exported node. If the MegaNode
730          * has not been exported, it returns NULL.
731          */
732         virtual char * getPublicLink(bool includeKey = true);
733 
734         /**
735          * @brief Returns the creation time for the public link of the exported node (in seconds since the epoch).
736          *
737          * @return Creation time for the public link of the node. Returns 0 if the creation time is not available
738          * and -1 if the MegaNode has not been exported.
739          */
740         virtual int64_t getPublicLinkCreationTime();
741 
742         /**
743          * @brief Returns true if this node represents a file (type == TYPE_FILE)
744          * @return true if this node represents a file, otherwise false
745          */
746         virtual bool isFile();
747 
748         /**
749          * @brief Returns true this node represents a folder or a root node
750          *
751          * @return true this node represents a folder or a root node
752          */
753         virtual bool isFolder();
754 
755         /**
756          * @brief Returns true if this node has been removed from the MEGA account
757          *
758          * This value is only useful for nodes notified by MegaListener::onNodesUpdate or
759          * MegaGlobalListener::onNodesUpdate that can notify about deleted nodes.
760          *
761          * In other cases, the return value of this function will be always false.
762          *
763          * @return true if this node has been removed from the MEGA account
764          */
765         virtual bool isRemoved();
766 
767         /**
768          * @brief Returns true if this node has an specific change
769          *
770          * This value is only useful for nodes notified by MegaListener::onNodesUpdate or
771          * MegaGlobalListener::onNodesUpdate that can notify about node modifications.
772          *
773          * In other cases, the return value of this function will be always false.
774          *
775          * @param changeType The type of change to check. It can be one of the following values:
776          *
777          * - MegaNode::CHANGE_TYPE_REMOVED         = 0x01
778          * Check if the node is being removed
779          *
780          * - MegaNode::CHANGE_TYPE_ATTRIBUTES      = 0x02
781          * Check if an attribute of the node has changed, usually the namespace name
782          *
783          * - MegaNode::CHANGE_TYPE_OWNER           = 0x04
784          * Check if the owner of the node has changed
785          *
786          * - MegaNode::CHANGE_TYPE_TIMESTAMP       = 0x08
787          * Check if the modification time of the node has changed
788          *
789          * - MegaNode::CHANGE_TYPE_FILE_ATTRIBUTES = 0x10
790          * Check if file attributes have changed, usually the thumbnail or the preview for images
791          *
792          * - MegaNode::CHANGE_TYPE_INSHARE         = 0x20
793          * Check if the node is a new or modified inshare
794          *
795          * - MegaNode:: CHANGE_TYPE_OUTSHARE       = 0x40
796          * Check if the node is a new or modified outshare
797          *
798          * - MegaNode::CHANGE_TYPE_PARENT          = 0x80
799          * Check if the parent of the node has changed
800          *
801          * - MegaNode::CHANGE_TYPE_PENDINGSHARE    = 0x100
802          * Check if the pending share of the node has changed
803          *
804          * - MegaNode::CHANGE_TYPE_PUBLIC_LINK     = 0x200
805          * Check if the public link of the node has changed
806          *
807          * - MegaNode::CHANGE_TYPE_NEW             = 0x400
808          * Check if the node is new
809          *
810          * @return true if this node has an specific change
811          */
812         virtual bool hasChanged(int changeType);
813 
814         /**
815          * @brief Returns a bit field with the changes of the node
816          *
817          * This value is only useful for nodes notified by MegaListener::onNodesUpdate or
818          * MegaGlobalListener::onNodesUpdate that can notify about node modifications.
819          *
820          * @return The returned value is an OR combination of these flags:
821          *
822          *- MegaNode::CHANGE_TYPE_REMOVED         = 0x01
823          * The node is being removed
824          *
825          * - MegaNode::CHANGE_TYPE_ATTRIBUTES      = 0x02
826          * An attribute of the node has changed, usually the namespace name
827          *
828          * - MegaNode::CHANGE_TYPE_OWNER           = 0x04
829          * The owner of the node has changed
830          *
831          * - MegaNode::CHANGE_TYPE_TIMESTAMP       = 0x08
832          * The modification time of the node has changed
833          *
834          * - MegaNode::CHANGE_TYPE_FILE_ATTRIBUTES = 0x10
835          * File attributes have changed, usually the thumbnail or the preview for images
836          *
837          * - MegaNode::CHANGE_TYPE_INSHARE         = 0x20
838          * The node is a new or modified inshare
839          *
840          * - MegaNode::CHANGE_TYPE_OUTSHARE       = 0x40
841          * The node is a new or modified outshare
842          *
843          * - MegaNode::CHANGE_TYPE_PARENT          = 0x80
844          * The parent of the node has changed
845          *
846          * - MegaNode::CHANGE_TYPE_PENDINGSHARE    = 0x100
847          * Check if the pending share of the node has changed
848          *
849          * - MegaNode::CHANGE_TYPE_PUBLIC_LINK     = 0x200
850          * Check if the public link of the node has changed
851          *
852          * - MegaNode::CHANGE_TYPE_NEW             = 0x400
853          * Check if the node is new
854          *
855          */
856         virtual int getChanges();
857 
858         /**
859          * @brief Returns true if the node has an associated thumbnail
860          * @return true if the node has an associated thumbnail
861          */
862         virtual bool hasThumbnail();
863 
864         /**
865          * @brief Returns true if the node has an associated preview
866          * @return true if the node has an associated preview
867          */
868         virtual bool hasPreview();
869 
870         /**
871          * @brief Returns true if this is a public node
872          *
873          * Only MegaNode objects generated with MegaApi::getPublicMegaNode
874          * will return true.
875          *
876          * @return true if this is a public node
877          */
878         virtual bool isPublic();
879 
880         /**
881          * @brief Check if the MegaNode is being shared by/with your own user
882          *
883          * For nodes that are being shared, you can get a list of MegaShare
884          * objects using MegaApi::getOutShares, or a list of MegaNode objects
885          * using MegaApi::getInShares
886          *
887          * @return true is the MegaNode is being shared, otherwise false
888          * @note Exported nodes (public link) are not considered to be shared nodes.
889          */
890         virtual bool isShared();
891 
892         /**
893          * @brief Check if the MegaNode is being shared with other users
894          *
895          * For nodes that are being shared, you can get a list of MegaShare
896          * objects using MegaApi::getOutShares
897          *
898          * @return true is the MegaNode is being shared, otherwise false
899          */
900         virtual bool isOutShare();
901 
902         /**
903          * @brief Check if a MegaNode belong to another User, but it is shared with you
904          *
905          * For nodes that are being shared, you can get a list of MegaNode
906          * objects using MegaApi::getInShares
907          *
908          * @return true is the MegaNode is being shared, otherwise false
909          */
910         virtual bool isInShare();
911 
912         /**
913          * @brief Returns true if the node has been exported (has a public link)
914          *
915          * Public links are created by calling MegaApi::exportNode.
916          *
917          * @return true if this is an exported node
918          */
919         virtual bool isExported();
920 
921         /**
922          * @brief Returns true if the node has been exported (has a temporal public link)
923          * and the related public link has expired.
924          *
925          * Public links are created by calling MegaApi::exportNode.
926          *
927          * @return true if the public link has expired.
928          */
929         virtual bool isExpired();
930 
931         /**
932          * @brief Returns true if this the node has been exported
933          * and the related public link has been taken down.
934          *
935          * Public links are created by calling MegaApi::exportNode.
936          *
937          * @return true if the public link has been taken down.
938          */
939         virtual bool isTakenDown();
940 
941         /**
942          * @brief Returns true if this MegaNode is a private node from a foreign account
943          *
944          * Only MegaNodes created with MegaApi::createForeignFileNode and MegaApi::createForeignFolderNode
945          * returns true in this function.
946          *
947          * @return true if this node is a private node from a foreign account
948          */
949         virtual bool isForeign();
950 
951         /**
952          * @brief Returns a string that contains the decryption key of the file (in binary format)
953          *
954          * The MegaNode object retains the ownership of the returned pointer. It will be valid until the deletion
955          * of the MegaNode object.
956          *
957          * @return Decryption key of the file (in binary format)
958          * @deprecated This function is intended for debugging and internal purposes and will be probably removed in future updates.
959          * Use MegaNode::getBase64Key instead
960          */
961         virtual std::string* getNodeKey();
962 
963         /**
964          * @brief Returns a string that contains the encrypted attributes of the file (in binary format)
965          *
966          * The return value is only valid for public nodes or undecrypted nodes. In all other cases this function
967          * will return an empty string.
968          *
969          * The MegaNode object retains the ownership of the returned pointer. It will be valid until the deletion
970          * of the MegaNode object.
971          *
972          * @return Encrypted attributes of the file (in binary format)
973          * @deprecated This function is intended for debugging and internal purposes and will be probably removed in future updates.
974          * Use MegaNode::getName and MegaNode::getModificationTime and MegaApi::getFingerprint. They provide the same information,
975          * decrypted and in a manageable format.
976          */
977         virtual std::string* getAttrString();
978 
979         /**
980          * @brief Returns the file attributes related to the node
981          *
982          * The return value is only valid for nodes attached in a chatroom. In all other cases this function
983          * will return NULL.
984          *
985          * You take the ownership of the returned string.
986          * Use delete [] to free it.
987          *
988          * @return File attributes related to the node
989          */
990         virtual char *getFileAttrString();
991 
992         /**
993          * @brief Return the private auth token to access this node
994          *
995          * The MegaNode object retains the ownership of the returned pointer. It will be valid until the deletion
996          * of the MegaNode object.
997          *
998          * @return Private auth token to access the node
999          * @deprecated This function is intended for internal purposes and will be probably removed in future updates.
1000          */
1001         virtual std::string* getPrivateAuth();
1002 
1003         /**
1004          * @brief Set an auth token to access this node
1005          * @param privateAuth token to access the node
1006          * @deprecated This function is intended for internal purposes and will be probably removed in future updates.
1007          */
1008         virtual void setPrivateAuth(const char *privateAuth);
1009 
1010         /**
1011          * @brief Return the public auth token to access this node
1012          *
1013          * The MegaNode object retains the ownership of the returned pointer. It will be valid until the deletion
1014          * of the MegaNode object.
1015          *
1016          * @return Public auth token to access the node
1017          * @deprecated This function is intended for internal purposes and will be probably removed in future updates.
1018          */
1019         virtual std::string* getPublicAuth();
1020 
1021         /**
1022          * @brief Return the chat auth token to access this node
1023          *
1024          * The MegaNode object retains the ownership of the returned pointer. It will be valid until the deletion
1025          * of the MegaNode object.
1026          *
1027          * @return Chat auth token to access the node
1028          * @deprecated This function is intended for internal purposes and will be probably removed in future updates.
1029          */
1030         virtual const char *getChatAuth();
1031 
1032         /**
1033          * @brief Returns the child nodes of an authorized folder node
1034          *
1035          * This function always returns NULL, except for authorized folder nodes.
1036          * Authorized folder nodes are the ones returned by MegaApi::authorizeNode.
1037          *
1038          * The MegaNode object retains the ownership of the returned pointer. It will be valid until the deletion
1039          * of the MegaNode object.
1040          *
1041          * @return Child nodes of an authorized folder node, otherwise NULL
1042          */
1043         virtual MegaNodeList *getChildren();
1044 
1045 #ifdef ENABLE_SYNC
1046         /**
1047          * @brief Returns true if this node was deleted from the MEGA account by the
1048          * synchronization engine
1049          *
1050          * This value is only useful for nodes notified by MegaListener::onNodesUpdate or
1051          * MegaGlobalListener::onNodesUpdate that can notify about deleted nodes.
1052          *
1053          * In other cases, the return value of this function will be always false.
1054          *
1055          * @return True if this node was deleted from the MEGA account by the synchronization engine
1056          */
1057         virtual bool isSyncDeleted();
1058 
1059         /**
1060          * @brief Returns the local path associated with this node
1061          *
1062          * Only synchronized nodes has an associated local path, for all other nodes
1063          * the return value will be an empty string.
1064          *
1065          * @return The local path associated with this node or an empty string if the node isn't synced-
1066          */
1067         virtual std::string getLocalPath();
1068 #endif
1069 
1070         virtual MegaHandle getOwner() const;
1071 
1072         /**
1073          * @brief Provides a serialization of the MegaNode object
1074          *
1075          * @note This function is intended to use ONLY with MegaNode objects obtained from
1076          * attachment messages received in a chatroom (@see MegaChatMessage::getMegaNodeList()).
1077          * Using MegaNode objects returned by MegaNode::unserialize from a serialized
1078          * non-chat MegaNode object may cause undefined behavior.
1079          *
1080          * You take the ownership of the returned value.
1081          *
1082          * @return Serialization of the MegaNode object, in Base64, or NULL if error.
1083          */
1084         virtual char *serialize();
1085 
1086         /**
1087          * @brief Returns a new MegaNode object from its serialization
1088          *
1089          * @note This function is intended to use ONLY with MegaNode objects obtained from
1090          * attachment messages received in a chatroom (@see MegaChatMessage::getMegaNodeList()).
1091          * Using MegaNode objects obtained by MegaNode::unserialize from a serialized
1092          * non-chat MegaNode object may cause undefined behavior.
1093          *
1094          * You take the ownership of the returned value.
1095          *
1096          * @param d Serialization of a MegaNode object obtained from a chat message (in Base64)
1097          * @return A new MegaNode object, or NULL if error.
1098          */
1099         static MegaNode* unserialize(const char *d);
1100 };
1101 
1102 /**
1103  * @brief Represents an user in MEGA
1104  *
1105  * It allows to get all data related to an user in MEGA. It can be also used
1106  * to start SDK requests (MegaApi::share MegaApi::removeContact, etc.)
1107  *
1108  * Objects of this class aren't live, they are snapshots of the state of an user
1109  * in MEGA when the object is created, they are immutable.
1110  *
1111  * Do not inherit from this class. You can get the contacts of an account using
1112  * MegaApi::getContacts and MegaApi::getContact.
1113  *
1114  */
1115 class MegaUser
1116 {
1117 	public:
1118 		enum {
1119 			VISIBILITY_UNKNOWN = -1,
1120             VISIBILITY_HIDDEN = 0,
1121             VISIBILITY_VISIBLE = 1,
1122             VISIBILITY_INACTIVE = 2,
1123             VISIBILITY_BLOCKED = 3
1124 		};
1125 
1126 		virtual ~MegaUser();
1127 
1128         /**
1129          * @brief Creates a copy of this MegaUser object.
1130          *
1131          * The resulting object is fully independent of the source MegaUser,
1132          * it contains a copy of all internal attributes, so it will be valid after
1133          * the original object is deleted.
1134          *
1135          * You are the owner of the returned object
1136          *
1137          * @return Copy of the MegaUser object
1138          */
1139         virtual MegaUser *copy();
1140 
1141         /**
1142          * @brief Returns the email associated with the contact.
1143          *
1144          * The email can be used to recover the MegaUser object later using MegaApi::getContact
1145          *
1146          * The MegaUser object retains the ownership of the returned string, it will be valid until
1147          * the MegaUser object is deleted.
1148          *
1149          * @return The email associated with the contact.
1150          */
1151         virtual const char* getEmail();
1152 
1153         /**
1154          * @brief Returns the handle associated with the contact.
1155          *
1156          * @return The handle associated with the contact.
1157          */
1158         virtual MegaHandle getHandle();
1159 
1160         /**
1161          * @brief Get the current visibility of the contact
1162          *
1163          * The returned value will be one of these:
1164          *
1165          * - VISIBILITY_UNKNOWN = -1
1166          * The visibility of the contact isn't know
1167          *
1168          * - VISIBILITY_HIDDEN = 0
1169          * The contact is currently hidden
1170          *
1171          * - VISIBILITY_VISIBLE = 1
1172          * The contact is currently visible
1173          *
1174          * - VISIBILITY_INACTIVE = 2
1175          * The contact is currently inactive
1176          *
1177          * - VISIBILITY_BLOCKED = 3
1178          * The contact is currently blocked
1179          *
1180          * @note The visibility of your own user is undefined and shouldn't be used.
1181          * @return Current visibility of the contact
1182          */
1183         virtual int getVisibility();
1184 
1185         /**
1186          * @brief Returns the timestamp when the contact was added to the contact list (in seconds since the epoch)
1187          * @return Timestamp when the contact was added to the contact list (in seconds since the epoch)
1188          */
1189         virtual int64_t getTimestamp();
1190 
1191         enum
1192         {
1193             CHANGE_TYPE_AUTHRING                    = 0x01,
1194             CHANGE_TYPE_LSTINT                      = 0x02,
1195             CHANGE_TYPE_AVATAR                      = 0x04,
1196             CHANGE_TYPE_FIRSTNAME                   = 0x08,
1197             CHANGE_TYPE_LASTNAME                    = 0x10,
1198             CHANGE_TYPE_EMAIL                       = 0x20,
1199             CHANGE_TYPE_KEYRING                     = 0x40,
1200             CHANGE_TYPE_COUNTRY                     = 0x80,
1201             CHANGE_TYPE_BIRTHDAY                    = 0x100,
1202             CHANGE_TYPE_PUBKEY_CU255                = 0x200,
1203             CHANGE_TYPE_PUBKEY_ED255                = 0x400,
1204             CHANGE_TYPE_SIG_PUBKEY_RSA              = 0x800,
1205             CHANGE_TYPE_SIG_PUBKEY_CU255            = 0x1000,
1206             CHANGE_TYPE_LANGUAGE                    = 0x2000,
1207             CHANGE_TYPE_PWD_REMINDER                = 0x4000,
1208             CHANGE_TYPE_DISABLE_VERSIONS            = 0x8000,
1209             CHANGE_TYPE_CONTACT_LINK_VERIFICATION   = 0x10000,
1210             CHANGE_TYPE_RICH_PREVIEWS               = 0x20000,
1211             CHANGE_TYPE_RUBBISH_TIME                = 0x40000,
1212             CHANGE_TYPE_STORAGE_STATE               = 0x80000,
1213             CHANGE_TYPE_GEOLOCATION                 = 0x100000,
1214             CHANGE_TYPE_CAMERA_UPLOADS_FOLDER       = 0x200000,
1215             CHANGE_TYPE_MY_CHAT_FILES_FOLDER        = 0x400000,
1216             CHANGE_TYPE_PUSH_SETTINGS               = 0x800000,
1217             CHANGE_TYPE_ALIAS                       = 0x1000000,
1218             CHANGE_TYPE_UNSHAREABLE_KEY             = 0x2000000,
1219             CHANGE_TYPE_DEVICE_NAMES                = 0x4000000,
1220         };
1221 
1222         /**
1223          * @brief Returns true if this user has an specific change
1224          *
1225          * This value is only useful for users notified by MegaListener::onUsersUpdate or
1226          * MegaGlobalListener::onUsersUpdate that can notify about user modifications.
1227          *
1228          * In other cases, the return value of this function will be always false.
1229          *
1230          * @param changeType The type of change to check. It can be one of the following values:
1231          *
1232          * - MegaUser::CHANGE_TYPE_AUTH            = 0x01
1233          * Check if the user has new or modified authentication information
1234          *
1235          * - MegaUser::CHANGE_TYPE_LSTINT          = 0x02
1236          * Check if the last interaction timestamp is modified
1237          *
1238          * - MegaUser::CHANGE_TYPE_AVATAR          = 0x04
1239          * Check if the user has a new or modified avatar image, or if the avatar was removed
1240          *
1241          * - MegaUser::CHANGE_TYPE_FIRSTNAME       = 0x08
1242          * Check if the user has new or modified firstname
1243          *
1244          * - MegaUser::CHANGE_TYPE_LASTNAME        = 0x10
1245          * Check if the user has new or modified lastname
1246          *
1247          * - MegaUser::CHANGE_TYPE_EMAIL           = 0x20
1248          * Check if the user has modified email
1249          *
1250          * - MegaUser::CHANGE_TYPE_KEYRING        = 0x40
1251          * Check if the user has new or modified keyring
1252          *
1253          * - MegaUser::CHANGE_TYPE_COUNTRY        = 0x80
1254          * Check if the user has new or modified country
1255          *
1256          * - MegaUser::CHANGE_TYPE_BIRTHDAY        = 0x100
1257          * Check if the user has new or modified birthday, birthmonth or birthyear
1258          *
1259          * - MegaUser::CHANGE_TYPE_PUBKEY_CU255    = 0x200
1260          * Check if the user has new or modified public key for chat
1261          *
1262          * - MegaUser::CHANGE_TYPE_PUBKEY_ED255    = 0x400
1263          * Check if the user has new or modified public key for signing
1264          *
1265          * - MegaUser::CHANGE_TYPE_SIG_PUBKEY_RSA  = 0x800
1266          * Check if the user has new or modified signature for RSA public key
1267          *
1268          * - MegaUser::CHANGE_TYPE_SIG_PUBKEY_CU255 = 0x1000
1269          * Check if the user has new or modified signature for Cu25519 public key
1270          *
1271          * - MegaUser::CHANGE_TYPE_LANGUAGE         = 0x2000
1272          * Check if the user has modified the preferred language
1273          *
1274          * - MegaUser::CHANGE_TYPE_PWD_REMINDER     = 0x4000
1275          * Check if the data related to the password reminder dialog has changed
1276          *
1277          * - MegaUser::CHANGE_TYPE_DISABLE_VERSIONS     = 0x8000
1278          * Check if option for file versioning has changed
1279          *
1280          * - MegaUser::CHANGE_TYPE_CONTACT_LINK_VERIFICATION = 0x10000
1281          * Check if option for automatic contact-link verification has changed
1282          *
1283          * - MegaUser::CHANGE_TYPE_RICH_PREVIEWS    = 0x20000
1284          * Check if option for rich links has changed
1285          *
1286          * - MegaUser::CHANGE_TYPE_RUBBISH_TIME    = 0x40000
1287          * Check if rubbish time for autopurge has changed
1288          *
1289          * - MegaUser::CHANGE_TYPE_STORAGE_STATE   = 0x80000
1290          * Check if the state of the storage has changed
1291          *
1292          * - MegaUser::CHANGE_TYPE_GEOLOCATION    = 0x100000
1293          * Check if option for geolocation messages has changed
1294          *
1295          * - MegaUser::CHANGE_TYPE_PUSH_SETTINGS = 0x800000
1296          * Check if settings for push notifications have changed
1297          *
1298          * - MegaUser::CHANGE_TYPE_ALIAS    = 0x1000000
1299          * Check if aliases have changed
1300          *
1301          * - MegaUser::CHANGE_TYPE_UNSHAREABLE_KEY = 0x2000000
1302          * (internal) The unshareable key has been created
1303          *
1304          * - MegaUser::CHANGE_TYPE_DEVICE_NAMES = 0x4000000
1305          * Check if device names have changed
1306          *
1307          * @return true if this user has an specific change
1308          */
1309         virtual bool hasChanged(int changeType);
1310 
1311         /**
1312          * @brief Returns a bit field with the changes of the user
1313          *
1314          * This value is only useful for users notified by MegaListener::onUsersUpdate or
1315          * MegaGlobalListener::onUsersUpdate that can notify about user modifications.
1316          *
1317          * @return The returned value is an OR combination of these flags:
1318          *
1319          * - MegaUser::CHANGE_TYPE_AUTH            = 0x01
1320          * Check if the user has new or modified authentication information
1321          *
1322          * - MegaUser::CHANGE_TYPE_LSTINT          = 0x02
1323          * Check if the last interaction timestamp is modified
1324          *
1325          * - MegaUser::CHANGE_TYPE_AVATAR          = 0x04
1326          * Check if the user has a new or modified avatar image
1327          *
1328          * - MegaUser::CHANGE_TYPE_FIRSTNAME       = 0x08
1329          * Check if the user has new or modified firstname
1330          *
1331          * - MegaUser::CHANGE_TYPE_LASTNAME        = 0x10
1332          * Check if the user has new or modified lastname
1333          *
1334          * - MegaUser::CHANGE_TYPE_EMAIL           = 0x20
1335          * Check if the user has modified email
1336          *
1337          * - MegaUser::CHANGE_TYPE_KEYRING        = 0x40
1338          * Check if the user has new or modified keyring
1339          *
1340          * - MegaUser::CHANGE_TYPE_COUNTRY        = 0x80
1341          * Check if the user has new or modified country
1342          *
1343          * - MegaUser::CHANGE_TYPE_BIRTHDAY        = 0x100
1344          * Check if the user has new or modified birthday, birthmonth or birthyear
1345          *
1346          * - MegaUser::CHANGE_TYPE_PUBKEY_CU255    = 0x200
1347          * Check if the user has new or modified public key for chat
1348          *
1349          * - MegaUser::CHANGE_TYPE_PUBKEY_ED255    = 0x400
1350          * Check if the user has new or modified public key for signing
1351          *
1352          * - MegaUser::CHANGE_TYPE_SIG_PUBKEY_RSA  = 0x800
1353          * Check if the user has new or modified signature for RSA public key
1354          *
1355          * - MegaUser::CHANGE_TYPE_SIG_PUBKEY_CU255 = 0x1000
1356          * Check if the user has new or modified signature for Cu25519 public key
1357          *
1358          * - MegaUser::CHANGE_TYPE_LANGUAGE         = 0x2000
1359          * Check if the user has modified the preferred language
1360          *
1361          * - MegaUser::CHANGE_TYPE_PWD_REMINDER     = 0x4000
1362          * Check if the data related to the password reminder dialog has changed
1363          *
1364          * - MegaUser::CHANGE_TYPE_DISABLE_VERSIONS     = 0x8000
1365          * Check if option for file versioning has changed
1366          *
1367          * - MegaUser::CHANGE_TYPE_CONTACT_LINK_VERIFICATION = 0x10000
1368          * Check if option for automatic contact-link verification has changed
1369          *
1370          * - MegaUser::CHANGE_TYPE_RICH_PREVIEWS    = 0x20000
1371          * Check if option for rich links has changed
1372          *
1373          * - MegaUser::CHANGE_TYPE_RUBBISH_TIME    = 0x40000
1374          * Check if rubbish time for autopurge has changed
1375          *
1376          * - MegaUser::CHANGE_TYPE_STORAGE_STATE   = 0x80000
1377          * Check if the state of the storage has changed
1378          *
1379          * - MegaUser::CHANGE_TYPE_GEOLOCATION    = 0x100000
1380          * Check if option for geolocation messages has changed
1381          *
1382          * - MegaUser::CHANGE_TYPE_PUSH_SETTINGS = 0x800000
1383          * Check if settings for push notifications have changed
1384          *
1385          * - MegaUser::CHANGE_TYPE_ALIAS    = 0x1000000
1386          * Check if aliases have changed
1387          *
1388          * - MegaUser::CHANGE_TYPE_UNSHAREABLE_KEY = 0x2000000
1389          * (internal) The unshareable key has been created
1390          *
1391          * - MegaUser::CHANGE_TYPE_DEVICE_NAMES = 0x4000000
1392          * Check if device names have changed
1393          *
1394          */
1395         virtual int getChanges();
1396 
1397         /**
1398          * @brief Indicates if the user is changed by yourself or by another client.
1399          *
1400          * This value is only useful for users notified by MegaListener::onUsersUpdate or
1401          * MegaGlobalListener::onUsersUpdate that can notify about user modifications.
1402          *
1403          * @return 0 if the change is external. >0 if the change is the result of an
1404          * explicit request, -1 if the change is the result of an implicit request
1405          * made by the SDK internally.
1406          */
1407         virtual int isOwnChange();
1408 };
1409 
1410 
1411 /**
1412 * @brief Represents a user alert in MEGA.
1413 * Alerts are the notifictions appearing under the bell in the webclient
1414 *
1415 * Objects of this class aren't live, they are snapshots of the state
1416 * in MEGA when the object is created, they are immutable.
1417 *
1418 * MegaUserAlerts can be retrieved with MegaApi::getUserAlerts
1419 *
1420 */
1421 class MegaUserAlert
1422 {
1423 public:
1424 
1425     enum {
1426         TYPE_INCOMINGPENDINGCONTACT_REQUEST,
1427         TYPE_INCOMINGPENDINGCONTACT_CANCELLED,
1428         TYPE_INCOMINGPENDINGCONTACT_REMINDER,
1429         TYPE_CONTACTCHANGE_DELETEDYOU,
1430         TYPE_CONTACTCHANGE_CONTACTESTABLISHED,
1431         TYPE_CONTACTCHANGE_ACCOUNTDELETED,
1432         TYPE_CONTACTCHANGE_BLOCKEDYOU,
1433         TYPE_UPDATEDPENDINGCONTACTINCOMING_IGNORED,
1434         TYPE_UPDATEDPENDINGCONTACTINCOMING_ACCEPTED,
1435         TYPE_UPDATEDPENDINGCONTACTINCOMING_DENIED,
1436         TYPE_UPDATEDPENDINGCONTACTOUTGOING_ACCEPTED,
1437         TYPE_UPDATEDPENDINGCONTACTOUTGOING_DENIED,
1438         TYPE_NEWSHARE,
1439         TYPE_DELETEDSHARE,
1440         TYPE_NEWSHAREDNODES,
1441         TYPE_REMOVEDSHAREDNODES,
1442         TYPE_PAYMENT_SUCCEEDED,
1443         TYPE_PAYMENT_FAILED,
1444         TYPE_PAYMENTREMINDER,
1445         TYPE_TAKEDOWN,
1446         TYPE_TAKEDOWN_REINSTATED,
1447 
1448         TOTAL_OF_ALERT_TYPES
1449     };
1450 
1451     virtual ~MegaUserAlert();
1452 
1453     /**
1454     * @brief Creates a copy of this MegaUserAlert object.
1455     *
1456     * The resulting object is fully independent of the source MegaUserAlert,
1457     * it contains a copy of all internal attributes, so it will be valid after
1458     * the original object is deleted.
1459     *
1460     * You are the owner of the returned object
1461     *
1462     * @return Copy of the MegaUserAlert object
1463     */
1464     virtual MegaUserAlert *copy() const;
1465 
1466     /**
1467     * @brief Returns the id of the alert
1468     *
1469     * The ids are assigned to alerts sequentially from program start,
1470     * however there may be gaps. The id can be used to create an
1471     * association with a UI element in order to process updates in callbacks.
1472     *
1473     * @return Type of alert associated with the object
1474     */
1475     virtual unsigned getId() const;
1476 
1477     /**
1478     * @brief Returns whether the alert has been acknowledged by this client or another
1479     *
1480     * @return Flag indicating whether the alert has been seen
1481     */
1482     virtual bool getSeen() const;
1483 
1484     /**
1485     * @brief Returns whether the alert is still relevant to the logged in user.
1486     *
1487     * An alert may be relevant initially but become non-relevant, eg. payment reminder.
1488     * Alerts which are no longer relevant are usually removed from the visible list.
1489     *
1490     * @return Flag indicting whether the alert is still relevant
1491     */
1492     virtual bool getRelevant() const;
1493 
1494     /**
1495     * @brief Returns the type of alert associated with the object
1496     * @return Type of alert associated with the object
1497     */
1498     virtual int getType() const;
1499 
1500     /**
1501     * @brief Returns a readable string that shows the type of alert
1502     *
1503     * This function returns a pointer to a statically allocated buffer.
1504     * You don't have to free the returned pointer
1505     *
1506     * @return Readable string showing the type of alert
1507     */
1508     virtual const char *getTypeString() const;
1509 
1510     /**
1511     * @brief Returns the handle of a user related to the alert
1512     *
1513     * This value is valid for user related alerts.
1514     *
1515     * @return the associated user's handle, otherwise UNDEF
1516     */
1517     virtual MegaHandle getUserHandle() const;
1518 
1519     /**
1520     * @brief Returns the handle of a node related to the alert
1521     *
1522     * This value is valid for alerts that relate to a single node.
1523     *
1524     * @return the relevant node handle, or UNDEF if this alert does not have one.
1525     */
1526     virtual MegaHandle getNodeHandle() const;
1527 
1528     /**
1529     * @brief Returns an email related to the alert
1530     *
1531     * This value is valid for alerts that relate to another user, provided the
1532     * user could be looked up at the time the alert arrived. If it was not available,
1533     * this function will return false and the client can request it via the userHandle.
1534     *
1535     * The SDK retains the ownership of the returned value. It will be valid until
1536     * the MegaUserAlert object is deleted.
1537     *
1538     * @return email string of the relevant user, or NULL if not available
1539     */
1540     virtual const char* getEmail() const;
1541 
1542     /**
1543     * @brief Returns the path of a file, folder, or node related to the alert
1544     *
1545     * The SDK retains the ownership of the returned value. It will be valid until
1546     * the MegaUserAlert object is deleted.
1547     *
1548     * This value is valid for those alerts that relate to a single path, provided
1549     * it could be looked up from the cached nodes at the time the alert arrived.
1550     * Otherwise, it may be obtainable via the nodeHandle.
1551     *
1552     * @return the path string if relevant and available, otherwise NULL
1553     */
1554     virtual const char* getPath() const;
1555 
1556     /**
1557      * @brief Returns the name of a file, folder, or node related to the alert
1558      *
1559      * The SDK retains the ownership of the returned value. It will be valid until
1560      * the MegaUserAlert object is deleted.
1561      *
1562      * This value is valid for those alerts that relate to a single name, provided
1563      * it could be looked up from the cached nodes at the time the alert arrived.
1564      * Otherwise, it may be obtainable via the nodeHandle.
1565      *
1566      * @return the name string if relevant and available, otherwise NULL
1567      */
1568     virtual const char* getName() const;
1569 
1570     /**
1571     * @brief Returns the heading related to this alert
1572     *
1573     * The SDK retains the ownership of the returned value. They will be valid until
1574     * the MegaUserAlert object is deleted.
1575     *
1576     * This value is valid for all alerts, and similar to the strings displayed in the
1577     * webclient alerts.
1578     *
1579     * @return heading related to this alert.
1580     */
1581     virtual const char* getHeading() const;
1582 
1583     /**
1584     * @brief Returns the title related to this alert
1585     *
1586     * The SDK retains the ownership of the returned value. They will be valid until
1587     * the MegaUserAlert object is deleted.
1588     *
1589     * This value is valid for all alerts, and similar to the strings displayed in the
1590     * webclient alerts.
1591     *
1592     * @return title related to this alert.
1593     */
1594     virtual const char* getTitle() const;
1595 
1596     /**
1597     * @brief Returns a number related to this alert
1598     *
1599     * This value is valid for these alerts:
1600     * TYPE_NEWSHAREDNODES (0: folder count 1: file count )
1601     * TYPE_REMOVEDSHAREDNODES (0: item count )
1602     * TYPE_DELETEDSHARE (0: value 1 if access for this user was removed by the share owner, otherwise
1603     *                       value 0 if someone left the folder)
1604     *
1605     * @return Number related to this request, or -1 if the index is invalid
1606     */
1607     virtual int64_t getNumber(unsigned index) const;
1608 
1609     /**
1610     * @brief Returns a timestamp related to this alert
1611     *
1612     * This value is valid for index 0 for all requests, indicating when the alert occurred.
1613     * Additionally TYPE_PAYMENTREMINDER index 1 is the timestamp of the expiry of the period.
1614     *
1615     * @return Timestamp related to this request, or -1 if the index is invalid
1616     */
1617     virtual int64_t getTimestamp(unsigned index) const;
1618 
1619     /**
1620     * @brief Returns an additional string, related to the alert
1621     *
1622     * The SDK retains the ownership of the returned value. It will be valid until
1623     * the MegaUserAlert object is deleted.
1624     *
1625     * This value is currently only valid for
1626     *   TYPE_PAYMENT_SUCCEEDED   index 0: the plan name
1627     *   TYPE_PAYMENT_FAILED      index 0: the plan name
1628     *
1629     * @return a pointer to the string if index is valid; otherwise NULL
1630     */
1631     virtual const char* getString(unsigned index) const;
1632 
1633     /**
1634      * @brief Indicates if the user alert is changed by yourself or by another client.
1635      *
1636      * This value is only useful for user alerts notified by MegaListener::onUserAlertsUpdate or
1637      * MegaGlobalListener::onUserAlertsUpdate that can notify about user alerts modifications.
1638      *
1639      * @return false if the change is external. true if the change is the result of a
1640      * request sent by this instance of the SDK.
1641      */
1642     virtual bool isOwnChange() const;
1643 };
1644 
1645 /**
1646  * @brief List of MegaHandle objects
1647  *
1648  */
1649 class MegaHandleList
1650 {
1651 protected:
1652     MegaHandleList();
1653 
1654 public:
1655     /**
1656      * @brief Creates a new instance of MegaHandleList
1657      * @return A pointer the new object
1658      */
1659     static MegaHandleList *createInstance();
1660 
1661     virtual ~MegaHandleList();
1662 
1663     /**
1664      * @brief Creates a copy of this MegaHandleList object
1665      *
1666      * The resulting object is fully independent of the source MegaHandleList,
1667      * it contains a copy of all internal attributes, so it will be valid after
1668      * the original object is deleted.
1669      *
1670      * You are the owner of the returned object
1671      *
1672      * @return Copy of the MegaHandleList object
1673      */
1674     virtual MegaHandleList *copy() const;
1675 
1676     /**
1677      * @brief Returns the MegaHandle at the position i in the MegaHandleList
1678      *
1679      *
1680      * If the index is >= the size of the list, this function returns MEGACHAT_INVALID_HANDLE.
1681      *
1682      * @param i Position of the MegaHandle that we want to get for the list
1683      * @return MegaHandle at the position i in the list
1684      */
1685     virtual MegaHandle get(unsigned int i) const;
1686 
1687     /**
1688      * @brief Returns the number of MegaHandles in the list
1689      * @return Number of MegaHandles in the list
1690      */
1691     virtual unsigned int size() const;
1692 
1693     /**
1694      * @brief Add new MegaHandle to list
1695      * @param megaHandle to be added
1696      */
1697     virtual void addMegaHandle(MegaHandle megaHandle);
1698 };
1699 
1700 class MegaIntegerList
1701 {
1702 public:
1703     virtual ~MegaIntegerList();
1704     virtual MegaIntegerList *copy() const;
1705 
1706     /**
1707      * @brief Returns the integer at the position i in the MegaIntegerList
1708      *
1709      * If the index is >= the size of the list, this function returns -1.
1710      *
1711      * @param i Position of the integer that we want to get for the list
1712      * @return Integer at the position i in the list
1713      */
1714     virtual int64_t get(int i) const;
1715 
1716     /**
1717      * @brief Returns the number of integer values in the list
1718      * @return Number of integer values in the list
1719      */
1720     virtual int size() const;
1721 };
1722 
1723 /**
1724  * @brief Represents the outbound sharing of a folder with a user in MEGA
1725  *
1726  * It allows to get all data related to the sharing. You can start sharing a folder with
1727  * a contact or cancel an existing sharing using MegaApi::share. A public link of a folder
1728  * is also considered a sharing and can be cancelled.
1729  *
1730  * Objects of this class aren't live, they are snapshots of the state of the sharing
1731  * in MEGA when the object is created, they are immutable.
1732  *
1733  * Do not inherit from this class. You can get current active sharings using MegaApi::getOutShares
1734  *
1735  */
1736 class MegaShare
1737 {
1738 	public:
1739 		enum {
1740 			ACCESS_UNKNOWN = -1,
1741 			ACCESS_READ = 0,
1742 			ACCESS_READWRITE,
1743 			ACCESS_FULL,
1744 			ACCESS_OWNER
1745 		};
1746 
1747 		virtual ~MegaShare();
1748 
1749         /**
1750          * @brief Creates a copy of this MegaShare object
1751          *
1752          * The resulting object is fully independent of the source MegaShare,
1753          * it contains a copy of all internal attributes, so it will be valid after
1754          * the original object is deleted.
1755          *
1756          * You are the owner of the returned object
1757          *
1758          * @return Copy of the MegaShare object
1759          */
1760         virtual MegaShare *copy();
1761 
1762         /**
1763          * @brief Returns the email of the user with whom we are sharing the folder
1764          *
1765          * For public shared folders, this function returns NULL
1766          *
1767          * The MegaShare object retains the ownership of the returned string, it will be valid until
1768          * the MegaShare object is deleted.
1769          *
1770          * @return The email of the user with whom we share the folder, or NULL if it's a public folder
1771          */
1772         virtual const char *getUser();
1773 
1774         /**
1775          * @brief Returns the handle of the folder that is being shared
1776          * @return The handle of the folder that is being shared
1777          */
1778         virtual MegaHandle getNodeHandle();
1779 
1780         /**
1781          * @brief Returns the access level of the sharing
1782          *
1783          * Possible return values are:
1784          * - ACCESS_UNKNOWN = -1
1785          * It means that the access level is unknown
1786          *
1787          * - ACCESS_READ = 0
1788          * The user can read the folder only
1789          *
1790          * - ACCESS_READWRITE = 1
1791          * The user can read and write the folder
1792          *
1793          * - ACCESS_FULL = 2
1794          * The user has full permissions over the folder
1795          *
1796          * - ACCESS_OWNER = 3
1797          * The user is the owner of the folder
1798          *
1799          * @return The access level of the sharing
1800          */
1801         virtual int getAccess();
1802 
1803         /**
1804          * @brief Returns the timestamp when the sharing was created (in seconds since the epoch)
1805          * @return The timestamp when the sharing was created (in seconds since the epoch)
1806          */
1807         virtual int64_t getTimestamp();
1808 
1809         /**
1810          * @brief Returns true if the sharing is pending
1811          *
1812          * A sharing is pending when the folder has been shared with a user (or email) that
1813          * is not still a contact of this account.
1814          *
1815          * @return True if the sharing is pending, otherwise false.
1816          */
1817         virtual bool isPending();
1818 };
1819 
1820 #ifdef ENABLE_CHAT
1821 class MegaTextChatPeerList
1822 {
1823 protected:
1824     MegaTextChatPeerList();
1825 
1826 public:
1827     enum {
1828         PRIV_UNKNOWN = -2,
1829         PRIV_RM = -1,
1830         PRIV_RO = 0,
1831         PRIV_STANDARD = 2,
1832         PRIV_MODERATOR = 3
1833     };
1834 
1835     /**
1836      * @brief Creates a new instance of MegaTextChatPeerList
1837      * @return A pointer to the superclass of the private object
1838      */
1839     static MegaTextChatPeerList * createInstance();
1840 
1841     virtual ~MegaTextChatPeerList();
1842 
1843     /**
1844      * @brief Creates a copy of this MegaTextChatPeerList object
1845      *
1846      * The resulting object is fully independent of the source MegaTextChatPeerList,
1847      * it contains a copy of all internal attributes, so it will be valid after
1848      * the original object is deleted.
1849      *
1850      * You are the owner of the returned object
1851      *
1852      * @return Copy of the MegaTextChatPeerList object
1853      */
1854     virtual MegaTextChatPeerList *copy() const;
1855 
1856     /**
1857      * @brief addPeer Adds a new chat peer to the list
1858      *
1859      * @param h MegaHandle of the user to be added
1860      * @param priv Privilege level of the user to be added
1861      * Valid values are:
1862      * - MegaTextChatPeerList::PRIV_UNKNOWN = -2
1863      * - MegaTextChatPeerList::PRIV_RM = -1
1864      * - MegaTextChatPeerList::PRIV_RO = 0
1865      * - MegaTextChatPeerList::PRIV_STANDARD = 2
1866      * - MegaTextChatPeerList::PRIV_MODERATOR = 3
1867      */
1868     virtual void addPeer(MegaHandle h, int priv);
1869 
1870     /**
1871      * @brief Returns the MegaHandle of the chat peer at the position i in the list
1872      *
1873      * If the index is >= the size of the list, this function returns INVALID_HANDLE.
1874      *
1875      * @param i Position of the chat peer that we want to get from the list
1876      * @return MegaHandle of the chat peer at the position i in the list
1877      */
1878     virtual MegaHandle getPeerHandle(int i) const;
1879 
1880     /**
1881      * @brief Returns the privilege of the chat peer at the position i in the list
1882      *
1883      * If the index is >= the size of the list, this function returns PRIV_UNKNOWN.
1884      *
1885      * @param i Position of the chat peer that we want to get from the list
1886      * @return Privilege level of the chat peer at the position i in the list.
1887      * Valid values are:
1888      * - MegaTextChatPeerList::PRIV_UNKNOWN = -2
1889      * - MegaTextChatPeerList::PRIV_RM = -1
1890      * - MegaTextChatPeerList::PRIV_RO = 0
1891      * - MegaTextChatPeerList::PRIV_STANDARD = 2
1892      * - MegaTextChatPeerList::PRIV_MODERATOR = 3
1893      */
1894     virtual int getPeerPrivilege(int i) const;
1895 
1896     /**
1897      * @brief Returns the number of chat peer in the list
1898      * @return Number of chat peers in the list
1899      */
1900     virtual int size() const;
1901 };
1902 
1903 class MegaTextChat
1904 {
1905 public:
1906 
1907     enum
1908     {
1909         CHANGE_TYPE_ATTACHMENT      = 0x01,
1910         CHANGE_TYPE_FLAGS           = 0x02,
1911         CHANGE_TYPE_MODE            = 0x04
1912     };
1913 
1914     virtual ~MegaTextChat();
1915 
1916     /**
1917      * @brief Creates a copy of this MegaTextChat object
1918      *
1919      * The resulting object is fully independent of the source MegaTextChat,
1920      * it contains a copy of all internal attributes, so it will be valid after
1921      * the original object is deleted.
1922      *
1923      * You are the owner of the returned object
1924      *
1925      * @return Copy of the MegaTextChat object
1926      */
1927     virtual MegaTextChat *copy() const;
1928 
1929     /**
1930      * @brief getHandle Returns the MegaHandle of the chat.
1931      * @return MegaHandle of the chat.
1932      */
1933     virtual MegaHandle getHandle() const;
1934 
1935     /**
1936      * @brief getOwnPrivilege Returns your privilege level in this chat
1937      * @return
1938      */
1939     virtual int getOwnPrivilege() const;
1940 
1941     /**
1942      * @brief Returns the chat shard
1943      * @return The chat shard
1944      */
1945     virtual int getShard() const;
1946 
1947     /**
1948      * @brief getPeerList Returns the full user list and privileges (including yourself).
1949      *
1950      * The MegaTextChat retains the ownership of the returned MetaTextChatPeerList. It will
1951      * be only valid until the MegaTextChat is deleted.
1952      *
1953      * @return The list of peers in the chat.
1954      */
1955     virtual const MegaTextChatPeerList *getPeerList() const;
1956 
1957     /**
1958      * @brief Establish the list of peers participating on this chatroom
1959      *
1960      * If a peers list already exist, this function will delete it.
1961      *
1962      * The MegaTextChat does not take ownership of the list passed as parameter, it makes
1963      * a local copy.
1964      *
1965      * @param peers List of peers
1966      */
1967     virtual void setPeerList(const MegaTextChatPeerList *peers);
1968 
1969     /**
1970      * @brief isGroup Returns whether this chat is a group chat or not
1971      * @return True if this chat is a group chat. Only chats with more than 2 peers are groupal chats.
1972      */
1973     virtual bool isGroup() const;
1974 
1975     /**
1976      * @brief getOriginatingUser Returns the user that originated the chat notification
1977      *
1978      * @note This value is only relevant for new or updated chats notified by MegaGlobalListener::onChatsUpdate or
1979      * MegaListener::onChatsUpdate.
1980      *
1981      * @return The handle of the user who originated the chat notification.
1982      */
1983     virtual MegaHandle getOriginatingUser() const;
1984 
1985     /**
1986      * @brief Returns the title of the chat, if any.
1987      *
1988      * The MegaTextChat retains the ownership of the returned string. It will
1989      * be only valid until the MegaTextChat is deleted.
1990      *
1991      * @return The title of the chat as a byte array encoded in Base64URL, or NULL if not available.
1992      */
1993     virtual const char *getTitle() const;
1994 
1995     /**
1996      * @brief Returns the Unified key of the chat, if it's a public chat.
1997      *
1998      * The MegaTextChat retains the ownership of the returned string. It will
1999      * be only valid until the MegaTextChat is deleted.
2000      *
2001      * @return The Unified key [<senderid><uk>] of the chat as a byte array encoded in Base64URL, or NULL if not available.
2002      */
2003     virtual const char *getUnifiedKey() const;
2004 
2005     /**
2006      * @brief Returns true if this chat has an specific change
2007      *
2008      * This value is only useful for chats notified by MegaListener::onChatsUpdate or
2009      * MegaGlobalListener::onChatsUpdate that can notify about chat modifications.
2010      *
2011      * In other cases, the return value of this function will be always false.
2012      *
2013      * @param changeType The type of change to check. It can be one of the following values:
2014      *
2015      * - MegaUser::CHANGE_TYPE_ATTACHMENT       = 0x01
2016      * Check if the access to nodes have been granted/revoked
2017      *
2018      * - MegaUser::CHANGE_TYPE_FLAGS            = 0x02
2019      * Check if flags have changed (like archive flag)
2020      *
2021      * - MegaUser::CHANGE_TYPE_MODE             = 0x04
2022      * Check if operation mode has changed to private mode (from public mode)
2023      *
2024      * @return true if this chat has an specific change
2025      */
2026     virtual bool hasChanged(int changeType) const;
2027 
2028     /**
2029      * @brief Returns a bit field with the changes of the chatroom
2030      *
2031      * This value is only useful for chats notified by MegaListener::onChatsUpdate or
2032      * MegaGlobalListener::onChatsUpdate that can notify about chat modifications.
2033      *
2034      * @return The returned value is an OR combination of these flags:
2035      *
2036      * - MegaUser::CHANGE_TYPE_ATTACHMENT       = 0x01
2037      * Check if the access to nodes have been granted/revoked
2038      *
2039      * - MegaUser::CHANGE_TYPE_FLAGS            = 0x02
2040      * Check if flags have changed (like archive flag)
2041      *
2042      * - MegaUser::CHANGE_TYPE_MODE             = 0x04
2043      * Check if operation mode has changed to private mode (from public mode)
2044      */
2045     virtual int getChanges() const;
2046 
2047     /**
2048      * @brief Indicates if the chat is changed by yourself or by another client.
2049      *
2050      * This value is only useful for chats notified by MegaListener::onChatsUpdate or
2051      * MegaGlobalListener::onChatsUpdate that can notify about chat modifications.
2052      *
2053      * @return 0 if the change is external. >0 if the change is the result of an
2054      * explicit request, -1 if the change is the result of an implicit request
2055      * made by the SDK internally.
2056      */
2057     virtual int isOwnChange() const;
2058 
2059     /**
2060      * @brief Returns the creation timestamp of the chat
2061      *
2062      * In seconds since the Epoch
2063      *
2064      * @return Creation date of the chat
2065      */
2066     virtual int64_t getCreationTime() const;
2067 
2068     /**
2069      * @brief Returns whether this chat has been archived by the user or not
2070      * @return True if this chat is archived.
2071      */
2072     virtual bool isArchived() const;
2073 
2074     /**
2075      * @brief Returns whether this chat is public or private
2076      * @return True if this chat is public
2077      */
2078     virtual bool isPublicChat() const;
2079 };
2080 
2081 /**
2082  * @brief List of MegaTextChat objects
2083  *
2084  * A MegaTextChatList has the ownership of the MegaTextChat objects that it contains, so they will be
2085  * only valid until the MegaTextChatList is deleted. If you want to retain a MegaTextChat returned by
2086  * a MegaTextChatList, use MegaTextChat::copy.
2087  *
2088  * Objects of this class are immutable.
2089  */
2090 class MegaTextChatList
2091 {
2092 public:
2093 
2094     virtual ~MegaTextChatList();
2095 
2096     virtual MegaTextChatList *copy() const;
2097 
2098     /**
2099      * @brief Returns the MegaTextChat at the position i in the MegaTextChatList
2100      *
2101      * The MegaTextChatList retains the ownership of the returned MegaTextChat. It will be only valid until
2102      * the MegaTextChatList is deleted. If you want to retain a MegaTextChat returned by this function,
2103      * use MegaTextChat::copy.
2104      *
2105      * If the index is >= the size of the list, this function returns NULL.
2106      *
2107      * @param i Position of the MegaTextChat that we want to get for the list
2108      * @return MegaTextChat at the position i in the list
2109      */
2110     virtual const MegaTextChat *get(unsigned int i) const;
2111 
2112     /**
2113      * @brief Returns the number of MegaTextChats in the list
2114      * @return Number of MegaTextChats in the list
2115      */
2116     virtual int size() const;
2117 };
2118 
2119 #endif
2120 
2121 /**
2122  * @brief Map of string values with string keys (map<string,string>)
2123  *
2124  * A MegaStringMap has the ownership of the strings that it contains, so they will be
2125  * only valid until the MegaStringMap is deleted. If you want to retain a string returned by
2126  * a MegaStringMap, copy it.
2127  *
2128  * Objects of this class are immutable.
2129  */
2130 
2131 class MegaStringMap
2132 {
2133 protected:
2134     MegaStringMap();
2135 
2136 public:
2137     /**
2138      * @brief Creates a new instance of MegaStringMap
2139      * @return A pointer to the superclass of the private object
2140      */
2141     static MegaStringMap *createInstance();
2142 
2143     virtual ~MegaStringMap();
2144 
2145     virtual MegaStringMap *copy() const;
2146 
2147     /**
2148      * @brief Returns the string at the position key in the MegaStringMap
2149      *
2150      * The returned value is a null-terminated char array. If the value in the map is an array of
2151      * bytes, then it will be a Base64-encoded string.
2152      *
2153      * The MegaStringMap retains the ownership of the returned string. It will be only valid until
2154      * the MegaStringMap is deleted.
2155      *
2156      * If the key is not found in the map, this function returns NULL.
2157      *
2158      * @param key Key of the string that you want to get from the map
2159      * @return String at the position key in the map
2160      */
2161     virtual const char* get(const char* key) const;
2162 
2163     /**
2164      * @brief Returns the list of keys in the MegaStringMap
2165      *
2166      * You take the ownership of the returned value
2167      *
2168      * @return A MegaStringList containing the keys present in the MegaStringMap
2169      */
2170     virtual MegaStringList *getKeys() const;
2171 
2172     /**
2173      * @brief Sets a value in the MegaStringMap for the given key.
2174      *
2175      * If the key already exists in the MegaStringMap, the value will be overwritten by the
2176      * new value.
2177      *
2178      * The MegaStringMap does not take ownership of the strings passed as parameter, it makes
2179      * a local copy.
2180      *
2181      * @param key Key for the new value in the map. It must be a NULL-terminated string.
2182      * @param value The new value for the key in the map. It must be a NULL-terminated string.
2183      */
2184     virtual void set(const char* key, const char *value);
2185 
2186     /**
2187      * @brief Returns the number of strings in the map
2188      * @return Number of strings in the map
2189      */
2190     virtual int size() const;
2191 };
2192 
2193 /**
2194  * @brief List of strings
2195  *
2196  * A MegaStringList has the ownership of the strings that it contains, so they will be
2197  * only valid until the MegaStringList is deleted. If you want to retain a string returned by
2198  * a MegaStringList, copy it.
2199  *
2200  * Objects of this class are immutable.
2201  */
2202 class MegaStringList
2203 {
2204 public:
2205     virtual ~MegaStringList();
2206 
2207     virtual MegaStringList *copy() const;
2208 
2209     /**
2210      * @brief Returns the string at the position i in the MegaStringList
2211      *
2212      * The MegaStringList retains the ownership of the returned string. It will be only valid until
2213      * the MegaStringList is deleted.
2214      *
2215      * If the index is >= the size of the list, this function returns NULL.
2216      *
2217      * @param i Position of the string that we want to get for the list
2218      * @return string at the position i in the list
2219      */
2220     virtual const char* get(int i) const;
2221 
2222     /**
2223      * @brief Returns the number of strings in the list
2224      * @return Number of strings in the list
2225      */
2226     virtual int size() const;
2227 };
2228 
2229 /**
2230 * @brief A map of strings to string lists
2231 *
2232 * A MegaStringListMap takes owership of the MegaStringList objects passed to it. It does
2233 * NOT take ownership of the keys passed to it but makes a local copy.
2234 */
2235 class MegaStringListMap
2236 {
2237 protected:
2238     MegaStringListMap();
2239 
2240 public:
2241     virtual ~MegaStringListMap();
2242 
2243     static MegaStringListMap* createInstance();
2244 
2245     virtual MegaStringListMap* copy() const;
2246 
2247     /**
2248      * @brief Returns the string list at the given key in the map
2249      *
2250      * The MegaStringMap retains the ownership of the returned string list. It will be only
2251      * valid until the MegaStringMap is deleted.
2252      *
2253      * If the key is not found in the map, this function returns NULL.
2254      *
2255      * @param key Key to lookup in the map. Must be null-terminated
2256      * @return String list at the given key in the map
2257      */
2258     virtual const MegaStringList* get(const char* key) const;
2259 
2260     /**
2261      * @brief Returns the list of keys in the MegaStringListMap
2262      *
2263      * You take the ownership of the returned value
2264      *
2265      * @return A MegaStringList containing the keys present in the MegaStringListMap
2266      */
2267     virtual MegaStringList *getKeys() const;
2268 
2269     /**
2270      * @brief Sets a value in the map for the given key.
2271      *
2272      * If the key already exists, the value will be overwritten by the
2273      * new value.
2274      *
2275      * The map does not take ownership of the passed key, it makes
2276      * a local copy. However, it does take ownership of the passed value.
2277      *
2278      * @param key The key in the map. It must be a null-terminated string.
2279      * @param value The new value for the key in the map.
2280      */
2281     virtual void set(const char* key, const MegaStringList* value);
2282 
2283     /**
2284      * @brief Returns the number of (string, string list) pairs in the map
2285      * @return Number of pairs in the map
2286      */
2287     virtual int size() const;
2288 };
2289 
2290 /**
2291 * @brief A list of string lists forming a table of strings.
2292 *
2293 * Each row can have a different number of columns.
2294 * However, ideally this class should be used as a table only.
2295 *
2296 * A MegaStringTable takes owership of the MegaStringList objects passed to it.
2297 */
2298 class MegaStringTable
2299 {
2300 protected:
2301     MegaStringTable();
2302 
2303 public:
2304     virtual ~MegaStringTable();
2305 
2306     static MegaStringTable *createInstance();
2307 
2308     virtual MegaStringTable* copy() const;
2309 
2310     /**
2311      * @brief Appends a new string list to the end of the table
2312      *
2313      * The table takes ownership of the passed value.
2314      *
2315      * @param value The string list to append
2316      */
2317     virtual void append(const MegaStringList* value);
2318 
2319     /**
2320      * @brief Returns the string list at position i
2321      *
2322      * The table retains the ownership of the returned string list. It will be only valid until
2323      * the table is deleted.
2324      *
2325      * The returned pointer is null if i is out of range.
2326      *
2327      * @return The string list at position i
2328      */
2329     virtual const MegaStringList* get(int i) const;
2330 
2331     /**
2332      * @brief Returns the number of string lists in the table
2333      * @return Number of string lists in the table
2334      */
2335     virtual int size() const;
2336 };
2337 
2338 /**
2339  * @brief List of MegaNode objects
2340  *
2341  * A MegaNodeList has the ownership of the MegaNode objects that it contains, so they will be
2342  * only valid until the NodeList is deleted. If you want to retain a MegaMode returned by
2343  * a MegaNodeList, use MegaNode::copy.
2344  *
2345  * Objects of this class are immutable.
2346  *
2347  * @see MegaApi::getChildren, MegaApi::search, MegaApi::getInShares
2348  */
2349 class MegaNodeList
2350 {
2351     protected:
2352         MegaNodeList();
2353 
2354     public:
2355         /**
2356          * @brief Creates a new instance of MegaNodeList
2357          * @return A pointer to the superclass of the private object
2358          */
2359         static MegaNodeList * createInstance();
2360 
2361 		virtual ~MegaNodeList();
2362 
2363         virtual MegaNodeList *copy() const;
2364 
2365         /**
2366          * @brief Returns the MegaNode at the position i in the MegaNodeList
2367          *
2368          * The MegaNodeList retains the ownership of the returned MegaNode. It will be only valid until
2369          * the MegaNodeList is deleted.
2370          *
2371          * If the index is >= the size of the list, this function returns NULL.
2372          *
2373          * @param i Position of the MegaNode that we want to get for the list
2374          * @return MegaNode at the position i in the list
2375          */
2376         virtual MegaNode* get(int i) const;
2377 
2378         /**
2379          * @brief Returns the number of MegaNode objects in the list
2380          * @return Number of MegaNode objects in the list
2381          */
2382         virtual int size() const;
2383 
2384         /**
2385          * @brief Add new node to list
2386          * @param node MegaNode to be added. The node inserted is a copy from 'node'
2387          */
2388         virtual void addNode(MegaNode* node);
2389 };
2390 
2391 /**
2392  * @brief Lists of file and folder children MegaNode objects
2393  *
2394  * A MegaChildrenLists object has the ownership of the MegaNodeList objects that it contains,
2395  * so they will be only valid until the MegaChildrenLists is deleted. If you want to retain
2396  * a MegaNodeList returned by a MegaChildrenLists, use MegaNodeList::copy.
2397  *
2398  * Objects of this class are immutable.
2399  */
2400 class MegaChildrenLists
2401 {
2402 public:
2403     virtual ~MegaChildrenLists();
2404     virtual MegaChildrenLists *copy();
2405 
2406     /**
2407      * @brief Get the list of folder MegaNode objects
2408      * @return List of MegaNode folders
2409      */
2410     virtual MegaNodeList* getFolderList();
2411 
2412     /**
2413      * @brief Get the list of file MegaNode objects
2414      * @return List of MegaNode files
2415      */
2416     virtual MegaNodeList* getFileList();
2417 };
2418 
2419 /**
2420  * @brief List of MegaUser objects
2421  *
2422  * A MegaUserList has the ownership of the MegaUser objects that it contains, so they will be
2423  * only valid until the MegaUserList is deleted. If you want to retain a MegaUser returned by
2424  * a MegaUserList, use MegaUser::copy.
2425  *
2426  * Objects of this class are immutable.
2427  *
2428  * @see MegaApi::getContacts
2429  *
2430  */
2431 class MegaUserList
2432 {
2433 	public:
2434 		virtual ~MegaUserList();
2435 
2436 		virtual MegaUserList *copy();
2437 
2438         /**
2439          * @brief Returns the MegaUser at the position i in the MegaUserList
2440          *
2441          * The MegaUserList retains the ownership of the returned MegaUser. It will be only valid until
2442          * the MegaUserList is deleted.
2443          *
2444          * If the index is >= the size of the list, this function returns NULL.
2445          *
2446          * @param i Position of the MegaUser that we want to get for the list
2447          * @return MegaUser at the position i in the list
2448          */
2449         virtual MegaUser* get(int i);
2450 
2451         /**
2452          * @brief Returns the number of MegaUser objects in the list
2453          * @return Number of MegaUser objects in the list
2454          */
2455         virtual int size();
2456 };
2457 
2458 /**
2459  * @brief List of MegaShare objects
2460  *
2461  * A MegaShareList has the ownership of the MegaShare objects that it contains, so they will be
2462  * only valid until the MegaShareList is deleted. If you want to retain a MegaShare returned by
2463  * a MegaShareList, use MegaShare::copy.
2464  *
2465  * Objects of this class are immutable.
2466  *
2467  * @see MegaApi::getOutShares
2468  */
2469 class MegaShareList
2470 {
2471 	public:
2472 		virtual ~MegaShareList();
2473 
2474         /**
2475          * @brief Returns the MegaShare at the position i in the MegaShareList
2476          *
2477          * The MegaShareList retains the ownership of the returned MegaShare. It will be only valid until
2478          * the MegaShareList is deleted.
2479          *
2480          * If the index is >= the size of the list, this function returns NULL.
2481          *
2482          * @param i Position of the MegaShare that we want to get for the list
2483          * @return MegaShare at the position i in the list
2484          */
2485         virtual MegaShare* get(int i);
2486 
2487         /**
2488          * @brief Returns the number of MegaShare objects in the list
2489          * @return Number of MegaShare objects in the list
2490          */
2491         virtual int size();
2492 };
2493 
2494 /**
2495  * @brief List of MegaTransfer objects
2496  *
2497  * A MegaTransferList has the ownership of the MegaTransfer objects that it contains, so they will be
2498  * only valid until the MegaTransferList is deleted. If you want to retain a MegaTransfer returned by
2499  * a MegaTransferList, use MegaTransfer::copy.
2500  *
2501  * Objects of this class are immutable.
2502  *
2503  * @see MegaApi::getTransfers
2504  */
2505 class MegaTransferList
2506 {
2507 	public:
2508 		virtual ~MegaTransferList();
2509 
2510         /**
2511          * @brief Returns the MegaTransfer at the position i in the MegaTransferList
2512          *
2513          * The MegaTransferList retains the ownership of the returned MegaTransfer. It will be only valid until
2514          * the MegaTransferList is deleted.
2515          *
2516          * If the index is >= the size of the list, this function returns NULL.
2517          *
2518          * @param i Position of the MegaTransfer that we want to get for the list
2519          * @return MegaTransfer at the position i in the list
2520          */
2521         virtual MegaTransfer* get(int i);
2522 
2523         /**
2524          * @brief Returns the number of MegaTransfer objects in the list
2525          * @return Number of MegaTransfer objects in the list
2526          */
2527         virtual int size();
2528 };
2529 
2530 /**
2531  * @brief List of MegaContactRequest objects
2532  *
2533  * A MegaContactRequestList has the ownership of the MegaContactRequest objects that it contains, so they will be
2534  * only valid until the MegaContactRequestList is deleted. If you want to retain a MegaContactRequest returned by
2535  * a MegaContactRequestList, use MegaContactRequest::copy.
2536  *
2537  * Objects of this class are immutable.
2538  *
2539  * @see MegaApi::getContactRequests
2540  */
2541 class MegaContactRequestList
2542 {
2543     public:
2544         virtual ~MegaContactRequestList();
2545 
2546         virtual MegaContactRequestList *copy();
2547 
2548 
2549         /**
2550          * @brief Returns the MegaContactRequest at the position i in the MegaContactRequestList
2551          *
2552          * The MegaContactRequestList retains the ownership of the returned MegaContactRequest. It will be only valid until
2553          * the MegaContactRequestList is deleted.
2554          *
2555          * If the index is >= the size of the list, this function returns NULL.
2556          *
2557          * @param i Position of the MegaContactRequest that we want to get for the list
2558          * @return MegaContactRequest at the position i in the list
2559          */
2560         virtual MegaContactRequest* get(int i);
2561 
2562         /**
2563          * @brief Returns the number of MegaContactRequest objects in the list
2564          * @return Number of MegaContactRequest objects in the list
2565          */
2566         virtual int size();
2567 };
2568 
2569 /**
2570 * @brief List of MegaUserAlert objects
2571 *
2572 * A MegaUserAlertList has the ownership of the MegaUserAlert objects that it contains, so they will be
2573 * only valid until the MegaUserAlertList is deleted. If you want to retain a MegaUserAlert returned by
2574 * a MegaUserAlertList, use MegaUserAlert::copy.
2575 *
2576 * Objects of this class are immutable.
2577 *
2578 * @see MegaApi::getUserAlerts
2579 *
2580 */
2581 class MegaUserAlertList
2582 {
2583 public:
2584     virtual ~MegaUserAlertList();
2585 
2586     virtual MegaUserAlertList *copy() const;
2587 
2588     /**
2589     * @brief Returns the MegaUserAlert at the position i in the MegaUserAlertList
2590     *
2591     * The MegaUserAlertList retains the ownership of the returned MegaUserAlert. It will be only valid until
2592     * the MegaUserAlertList is deleted.
2593     *
2594     * If the index is >= the size of the list, this function returns NULL.
2595     *
2596     * @param i Position of the MegaUserAlert that we want to get for the list
2597     * @return MegaUserAlert at the position i in the list
2598     */
2599     virtual MegaUserAlert* get(int i) const;
2600 
2601     /**
2602     * @brief Returns the number of MegaUserAlert objects in the list
2603     * @return Number of MegaUserAlert objects in the list
2604     */
2605     virtual int size() const;
2606 
2607     /**
2608      * @brief Removes all MegaUserAlert objects from the list (does not delete them)
2609      */
2610     virtual void clear();
2611 };
2612 
2613 
2614 /**
2615 * @brief Represents a set of files uploaded or updated in MEGA.
2616 * These are used to display the recent changes to an account.
2617 *
2618 * Objects of this class aren't live, they are snapshots of the state
2619 * in MEGA when the object is created, they are immutable.
2620 *
2621 * MegaRecentActionBuckets can be retrieved with MegaApi::getRecentActions
2622 *
2623 */
2624 class MegaRecentActionBucket
2625 {
2626 public:
2627 
2628     virtual ~MegaRecentActionBucket();
2629 
2630     /**
2631     * @brief Creates a copy of this MegaRecentActionBucket object.
2632     *
2633     * The resulting object is fully independent of the source MegaRecentActionBucket,
2634     * it contains a copy of all internal attributes, so it will be valid after
2635     * the original object is deleted.
2636     *
2637     * You are the owner of the returned object
2638     *
2639     * @return Copy of the MegaRecentActionBucket object
2640     */
2641     virtual MegaRecentActionBucket *copy() const;
2642 
2643     /**
2644     * @brief Returns a timestamp reflecting when these changes occurred
2645     *
2646     * @return Timestamp indicating when the changes occurred (in seconds since the Epoch)
2647     */
2648     virtual int64_t getTimestamp() const;
2649 
2650     /**
2651     * @brief Returns the email of the user who made the changes
2652     *
2653      * The SDK retains the ownership of the returned value. It will be valid until
2654      * the MegaRecentActionBucket object is deleted.
2655     *
2656     * @return The associated user's email
2657     */
2658     virtual const char* getUserEmail() const;
2659 
2660     /**
2661     * @brief Returns the handle of the parent folder these changes occurred in
2662     *
2663     * @return The handle of the parent folder for these changes.
2664     */
2665     virtual MegaHandle getParentHandle() const;
2666 
2667     /**
2668     * @brief Returns whether the changes are updated files, or new files
2669     *
2670     * @return True if the changes are updates rather than newly uploaded files.
2671     */
2672     virtual bool isUpdate() const;
2673 
2674     /**
2675     * @brief Returns whether the files are photos or videos
2676     *
2677     * @return True if the files in this change are media files.
2678     */
2679     virtual bool isMedia() const;
2680 
2681     /**
2682     * @brief Returns nodes representing the files changed in this bucket
2683     *
2684      * The SDK retains the ownership of the returned value. It will be valid until
2685      * the MegaRecentActionBucket object is deleted.
2686      *
2687     * @return A MegaNodeList containing the files in the bucket
2688     */
2689     virtual const MegaNodeList* getNodes() const;
2690 };
2691 
2692 /**
2693 * @brief List of MegaRecentActionBucket objects
2694 *
2695 * A MegaRecentActionBucketList has the ownership of the MegaRecentActionBucket objects that it contains, so they will be
2696 * only valid until the MegaRecentActionBucketList is deleted. If you want to retain a MegaRecentActionBucket returned by
2697 * a MegaRecentActionBucketList, use MegaRecentActionBucket::copy.
2698 *
2699 * Objects of this class are immutable.
2700 *
2701 * @see MegaApi::getRecentActions
2702 *
2703 */
2704 class MegaRecentActionBucketList
2705 {
2706 public:
2707     virtual ~MegaRecentActionBucketList();
2708 
2709     /**
2710     * @brief Creates a copy of this MegaRecentActionBucketList object.
2711     *
2712     * The resulting object is fully independent of the source MegaRecentActionBucketList,
2713     * it contains a copy of all internal attributes, so it will be valid after
2714     * the original object is deleted.
2715     *
2716     * You are the owner of the returned object
2717     *
2718     * @return Copy of the MegaRecentActionBucketList object
2719     */
2720     virtual MegaRecentActionBucketList *copy() const;
2721 
2722     /**
2723     * @brief Returns the MegaRecentActionBucket at the position i in the MegaRecentActionBucketList
2724     *
2725     * The MegaRecentActionBucketList retains the ownership of the returned MegaRecentActionBucket. It will be only valid until
2726     * the MegaRecentActionBucketList is deleted.
2727     *
2728     * If the index is >= the size of the list, this function returns NULL.
2729     *
2730     * @param i Position of the MegaRecentActionBucket that we want to get for the list
2731     * @return MegaRecentActionBucket at the position i in the list
2732     */
2733     virtual MegaRecentActionBucket* get(int i) const;
2734 
2735     /**
2736     * @brief Returns the number of MegaRecentActionBucket objects in the list
2737     * @return Number of MegaRecentActionBucket objects in the list
2738     */
2739     virtual int size() const;
2740 };
2741 
2742 /**
2743  * @brief Provides information about an asynchronous request
2744  *
2745  * Most functions in this API are asynchronous, except the ones that never require to
2746  * contact MEGA servers. Developers can use listeners (MegaListener, MegaRequestListener)
2747  * to track the progress of each request. MegaRequest objects are provided in callbacks sent
2748  * to these listeners and allow developers to know the state of the request, their parameters
2749  * and their results.
2750  *
2751  * Objects of this class aren't live, they are snapshots of the state of the request
2752  * when the object is created, they are immutable.
2753  *
2754  * These objects have a high number of 'getters', but only some of them return valid values
2755  * for each type of request. Documentation of each request specify which fields are valid.
2756  *
2757  */
2758 class MegaRequest
2759 {
2760     public:
2761         enum {
2762             TYPE_LOGIN, TYPE_CREATE_FOLDER, TYPE_MOVE, TYPE_COPY,
2763             TYPE_RENAME, TYPE_REMOVE, TYPE_SHARE,
2764             TYPE_IMPORT_LINK, TYPE_EXPORT, TYPE_FETCH_NODES, TYPE_ACCOUNT_DETAILS,
2765             TYPE_CHANGE_PW, TYPE_UPLOAD, TYPE_LOGOUT,
2766             TYPE_GET_PUBLIC_NODE, TYPE_GET_ATTR_FILE,
2767             TYPE_SET_ATTR_FILE, TYPE_GET_ATTR_USER,
2768             TYPE_SET_ATTR_USER, TYPE_RETRY_PENDING_CONNECTIONS,
2769             TYPE_REMOVE_CONTACT, TYPE_CREATE_ACCOUNT,
2770             TYPE_CONFIRM_ACCOUNT,
2771             TYPE_QUERY_SIGNUP_LINK, TYPE_ADD_SYNC, TYPE_REMOVE_SYNC,
2772             TYPE_REMOVE_SYNCS, TYPE_PAUSE_TRANSFERS,
2773             TYPE_CANCEL_TRANSFER, TYPE_CANCEL_TRANSFERS,
2774             TYPE_DELETE, TYPE_REPORT_EVENT, TYPE_CANCEL_ATTR_FILE,
2775             TYPE_GET_PRICING, TYPE_GET_PAYMENT_ID, TYPE_GET_USER_DATA,
2776             TYPE_LOAD_BALANCING, TYPE_KILL_SESSION, TYPE_SUBMIT_PURCHASE_RECEIPT,
2777             TYPE_CREDIT_CARD_STORE, TYPE_UPGRADE_ACCOUNT, TYPE_CREDIT_CARD_QUERY_SUBSCRIPTIONS,
2778             TYPE_CREDIT_CARD_CANCEL_SUBSCRIPTIONS, TYPE_GET_SESSION_TRANSFER_URL,
2779             TYPE_GET_PAYMENT_METHODS, TYPE_INVITE_CONTACT, TYPE_REPLY_CONTACT_REQUEST,
2780             TYPE_SUBMIT_FEEDBACK, TYPE_SEND_EVENT, TYPE_CLEAN_RUBBISH_BIN,
2781             TYPE_SET_ATTR_NODE, TYPE_CHAT_CREATE, TYPE_CHAT_FETCH, TYPE_CHAT_INVITE,
2782             TYPE_CHAT_REMOVE, TYPE_CHAT_URL, TYPE_CHAT_GRANT_ACCESS, TYPE_CHAT_REMOVE_ACCESS,
2783             TYPE_USE_HTTPS_ONLY, TYPE_SET_PROXY,
2784             TYPE_GET_RECOVERY_LINK, TYPE_QUERY_RECOVERY_LINK, TYPE_CONFIRM_RECOVERY_LINK,
2785             TYPE_GET_CANCEL_LINK, TYPE_CONFIRM_CANCEL_LINK,
2786             TYPE_GET_CHANGE_EMAIL_LINK, TYPE_CONFIRM_CHANGE_EMAIL_LINK,
2787             TYPE_CHAT_UPDATE_PERMISSIONS, TYPE_CHAT_TRUNCATE, TYPE_CHAT_SET_TITLE, TYPE_SET_MAX_CONNECTIONS,
2788             TYPE_PAUSE_TRANSFER, TYPE_MOVE_TRANSFER, TYPE_CHAT_PRESENCE_URL, TYPE_REGISTER_PUSH_NOTIFICATION,
2789             TYPE_GET_USER_EMAIL, TYPE_APP_VERSION, TYPE_GET_LOCAL_SSL_CERT, TYPE_SEND_SIGNUP_LINK,
2790             TYPE_QUERY_DNS, TYPE_QUERY_GELB, TYPE_CHAT_STATS, TYPE_DOWNLOAD_FILE,
2791             TYPE_QUERY_TRANSFER_QUOTA, TYPE_PASSWORD_LINK, TYPE_GET_ACHIEVEMENTS,
2792             TYPE_RESTORE, TYPE_REMOVE_VERSIONS, TYPE_CHAT_ARCHIVE, TYPE_WHY_AM_I_BLOCKED,
2793             TYPE_CONTACT_LINK_CREATE, TYPE_CONTACT_LINK_QUERY, TYPE_CONTACT_LINK_DELETE,
2794             TYPE_FOLDER_INFO, TYPE_RICH_LINK, TYPE_KEEP_ME_ALIVE, TYPE_MULTI_FACTOR_AUTH_CHECK,
2795             TYPE_MULTI_FACTOR_AUTH_GET, TYPE_MULTI_FACTOR_AUTH_SET,
2796             TYPE_ADD_BACKUP, TYPE_REMOVE_BACKUP, TYPE_TIMER, TYPE_ABORT_CURRENT_BACKUP,
2797             TYPE_GET_PSA, TYPE_FETCH_TIMEZONE, TYPE_USERALERT_ACKNOWLEDGE,
2798             TYPE_CHAT_LINK_HANDLE, TYPE_CHAT_LINK_URL, TYPE_SET_PRIVATE_MODE, TYPE_AUTOJOIN_PUBLIC_CHAT,
2799             TYPE_CATCHUP, TYPE_PUBLIC_LINK_INFORMATION,
2800             TYPE_GET_BACKGROUND_UPLOAD_URL, TYPE_COMPLETE_BACKGROUND_UPLOAD,
2801             TYPE_GET_CLOUD_STORAGE_USED,
2802             TYPE_SEND_SMS_VERIFICATIONCODE, TYPE_CHECK_SMS_VERIFICATIONCODE,
2803             TYPE_GET_REGISTERED_CONTACTS, TYPE_GET_COUNTRY_CALLING_CODES,
2804             TYPE_VERIFY_CREDENTIALS, TYPE_GET_MISC_FLAGS, TYPE_RESEND_VERIFICATION_EMAIL,
2805             TYPE_SUPPORT_TICKET, TYPE_SET_RETENTION_TIME, TYPE_RESET_SMS_VERIFIED_NUMBER,
2806             TYPE_SEND_DEV_COMMAND,
2807             TOTAL_OF_REQUEST_TYPES
2808         };
2809 
2810         virtual ~MegaRequest();
2811 
2812         /**
2813          * @brief Creates a copy of this MegaRequest object
2814          *
2815          * The resulting object is fully independent of the source MegaRequest,
2816          * it contains a copy of all internal attributes, so it will be valid after
2817          * the original object is deleted.
2818          *
2819          * You are the owner of the returned object
2820          *
2821          * @return Copy of the MegaRequest object
2822          */
2823         virtual MegaRequest *copy();
2824 
2825         /**
2826          * @brief Returns the type of request associated with the object
2827          * @return Type of request associated with the object
2828          */
2829         virtual int getType() const;
2830 
2831         /**
2832          * @brief Returns a readable string that shows the type of request
2833          *
2834          * This function returns a pointer to a statically allocated buffer.
2835          * You don't have to free the returned pointer
2836          *
2837          * @return Readable string showing the type of request
2838          */
2839         virtual const char *getRequestString() const;
2840 
2841         /**
2842          * @brief Returns a readable string that shows the type of request
2843          *
2844          * This function provides exactly the same result as MegaRequest::getRequestString.
2845          * It's provided for a better Java compatibility
2846          *
2847          * @return Readable string showing the type of request
2848          */
2849         virtual const char* toString() const;
2850 
2851         /**
2852          * @brief Returns a readable string that shows the type of request
2853          *
2854          * This function provides exactly the same result as MegaRequest::getRequestString.
2855          * It's provided for a better Python compatibility
2856          *
2857          * @return Readable string showing the type of request
2858          */
2859         virtual const char* __str__() const;
2860 
2861         /**
2862          * @brief Returns a readable string that shows the type of request
2863          *
2864          * This function provides exactly the same result as MegaRequest::getRequestString.
2865          * It's provided for a better PHP compatibility
2866          *
2867          * @return Readable string showing the type of request
2868          */
2869         virtual const char* __toString() const;
2870 
2871         /**
2872          * @brief Returns the handle of a node related to the request
2873          *
2874          * This value is valid for these requests:
2875          * - MegaApi::moveNode - Returns the handle of the node to move
2876          * - MegaApi::copyNode - Returns the handle of the node to copy
2877          * - MegaApi::renameNode - Returns the handle of the node to rename
2878          * - MegaApi::remove - Returns the handle of the node to remove
2879          * - MegaApi::sendFileToUser - Returns the handle of the node to send
2880          * - MegaApi::share - Returns the handle of the folder to share
2881          * - MegaApi::getThumbnail - Returns the handle of the node to get the thumbnail
2882          * - MegaApi::getPreview - Return the handle of the node to get the preview
2883          * - MegaApi::cancelGetThumbnail - Return the handle of the node
2884          * - MegaApi::cancelGetPreview - Returns the handle of the node
2885          * - MegaApi::setThumbnail - Returns the handle of the node
2886          * - MegaApi::setPreview - Returns the handle of the node
2887          * - MegaApi::exportNode - Returns the handle of the node
2888          * - MegaApi::disableExport - Returns the handle of the node
2889          * - MegaApi::getPaymentId - Returns the handle of the product
2890          * - MegaApi::syncFolder - Returns the handle of the folder in MEGA
2891          * - MegaApi::resumeSync - Returns the handle of the folder in MEGA
2892          * - MegaApi::removeSync - Returns the handle of the folder in MEGA
2893          * - MegaApi::upgradeAccount - Returns that handle of the product
2894          * - MegaApi::replyContactRequest - Returns the handle of the contact request
2895          * - MegaApi::inviteToChat - Returns the handle of the chat
2896          * - MegaApi::removeFromChat - Returns the handle of the chat
2897          * - MegaApi::getUrlChat - Returns the handle of the chat
2898          * - MegaApi::grantAccessInChat - Returns the handle of the node
2899          * - MegaApi::removeAccessInChat - Returns the handle of the node
2900          *
2901          * This value is valid for these requests in onRequestFinish when the
2902          * error code is MegaError::API_OK:
2903          * - MegaApi::createFolder - Returns the handle of the new folder
2904          * - MegaApi::copyNode - Returns the handle of the new node
2905          * - MegaApi::importFileLink - Returns the handle of the new node
2906          *
2907          * @return Handle of a node related to the request
2908          */
2909         virtual MegaHandle getNodeHandle() const;
2910 
2911         /**
2912          * @brief Returns a link related to the request
2913          *
2914          * This value is valid for these requests:
2915          * - MegaApi::querySignupLink - Returns the confirmation link
2916          * - MegaApi::confirmAccount - Returns the confirmation link
2917          * - MegaApi::fastConfirmAccount - Returns the confirmation link
2918          * - MegaApi::loginToFolder - Returns the link to the folder
2919          * - MegaApi::importFileLink - Returns the link to the file to import
2920          * - MegaApi::getPublicNode - Returns the link to the file
2921          *
2922          * This value is valid for these requests in onRequestFinish when the
2923          * error code is MegaError::API_OK:
2924          * - MegaApi::exportNode - Returns the public link
2925          * - MegaApi::getPaymentId - Returns the payment identifier
2926          * - MegaApi::getUrlChat - Returns the user-specific URL for the chat
2927          * - MegaApi::getChatPresenceURL - Returns the user-specific URL for the chat presence server
2928          *
2929          * The SDK retains the ownership of the returned value. It will be valid until
2930          * the MegaRequest object is deleted.
2931          *
2932          * @return Link related to the request
2933          */
2934         virtual const char* getLink() const;
2935 
2936         /**
2937          * @brief Returns the handle of a parent node related to the request
2938          *
2939          * This value is valid for these requests:
2940          * - MegaApi::createFolder - Returns the handle of the parent folder
2941          * - MegaApi::moveNode - Returns the handle of the new parent for the node
2942          * - MegaApi::copyNode - Returns the handle of the parent for the new node
2943          * - MegaApi::importFileLink - Returns the handle of the node that receives the imported file
2944          * - MegaApi::inviteToChat - Returns the handle of the user to be invited
2945          * - MegaApi::removeFromChat - Returns the handle of the user to be removed
2946          * - MegaApi::grantAccessInchat - Returns the chat identifier
2947          * - MegaApi::removeAccessInchat - Returns the chat identifier
2948          *
2949          * This value is valid for these requests in onRequestFinish when the
2950          * error code is MegaError::API_OK:
2951          * - MegaApi::syncFolder - Returns a fingerprint of the local folder, to resume the sync with (MegaApi::resumeSync)
2952          *
2953          * @return Handle of a parent node related to the request
2954          */
2955         virtual MegaHandle getParentHandle() const;
2956 
2957         /**
2958          * @brief Returns a session key related to the request
2959          *
2960          * This value is valid for these requests:
2961          * - MegaApi::fastLogin - Returns session key used to access the account
2962          *
2963          * The SDK retains the ownership of the returned value. It will be valid until
2964          * the MegaRequest object is deleted.
2965          *
2966          * @return Session key related to the request
2967          */
2968         virtual const char* getSessionKey() const;
2969 
2970         /**
2971          * @brief Returns a name related to the request
2972          *
2973          * This value is valid for these requests:
2974          * - MegaApi::createAccount - Returns the name or the firstname of the user
2975          * - MegaApi::createFolder - Returns the name of the new folder
2976          * - MegaApi::renameNode - Returns the new name for the node
2977          *
2978          * This value is valid for these request in onRequestFinish when the
2979          * error code is MegaError::API_OK:
2980          * - MegaApi::querySignupLink - Returns the name of the user
2981          * - MegaApi::confirmAccount - Returns the name of the user
2982          * - MegaApi::fastConfirmAccount - Returns the name of the user
2983          * - MegaApi::getUserData - Returns the name of the user
2984          *
2985          * The SDK retains the ownership of the returned value. It will be valid until
2986          * the MegaRequest object is deleted.
2987          *
2988          * @return Name related to the request
2989          */
2990         virtual const char* getName() const;
2991 
2992         /**
2993          * @brief Returns an email related to the request
2994          *
2995          * This value is valid for these requests:
2996          * - MegaApi::login - Returns the email of the account
2997          * - MegaApi::fastLogin - Returns the email of the account
2998          * - MegaApi::loginToFolder - Returns the string "FOLDER"
2999          * - MegaApi::createAccount - Returns the email for the account
3000          * - MegaApi::sendFileToUser - Returns the email of the user that receives the node
3001          * - MegaApi::share - Returns the email that receives the shared folder
3002          * - MegaApi::getUserAvatar - Returns the email of the user to get the avatar
3003          * - MegaApi::removeContact - Returns the email of the contact
3004          * - MegaApi::getUserData - Returns the email of the contact
3005          * - MegaApi::inviteContact - Returns the email of the contact
3006          * - MegaApi::grantAccessInChat -Returns the MegaHandle of the user in Base64 enconding
3007          * - MegaApi::removeAccessInChat -Returns the MegaHandle of the user in Base64 enconding
3008          *
3009          * This value is valid for these request in onRequestFinish when the
3010          * error code is MegaError::API_OK:
3011          * - MegaApi::querySignupLink - Returns the email of the account
3012          * - MegaApi::confirmAccount - Returns the email of the account
3013          * - MegaApi::fastConfirmAccount - Returns the email of the account
3014          *
3015          * The SDK retains the ownership of the returned value. It will be valid until
3016          * the MegaRequest object is deleted.
3017          *
3018          * @return Email related to the request
3019          */
3020         virtual const char* getEmail() const;
3021 
3022         /**
3023          * @brief Returns a password related to the request
3024          *
3025          * This value is valid for these requests:
3026          * - MegaApi::login - Returns the password of the account
3027          * - MegaApi::fastLogin - Returns the hash of the email
3028          * - MegaApi::createAccount - Returns the password for the account
3029          * - MegaApi::confirmAccount - Returns the password for the account
3030          * - MegaApi::changePassword - Returns the old password of the account (first parameter)
3031          *
3032          * This value is valid for these request in onRequestFinish when the
3033          * error code is MegaError::API_OK:
3034          * - MegaApi::getUserData - Returns the public RSA key of the contact, Base64-encoded
3035          *
3036          * The SDK retains the ownership of the returned value. It will be valid until
3037          * the MegaRequest object is deleted.
3038          *
3039          * @return Password related to the request
3040          */
3041         virtual const char* getPassword() const;
3042 
3043         /**
3044          * @brief Returns a new password related to the request
3045          *
3046          * This value is valid for these requests:
3047          * - MegaApi::changePassword - Returns the new password for the account
3048          *
3049          * The SDK retains the ownership of the returned value. It will be valid until
3050          * the MegaRequest object is deleted.
3051          *
3052          * @return New password related to the request
3053          */
3054         virtual const char* getNewPassword() const;
3055 
3056         /**
3057          * @brief Returns a private key related to the request
3058          *
3059          * The SDK retains the ownership of the returned value. It will be valid until
3060          * the MegaRequest object is deleted.
3061          *
3062          * This value is valid for these requests:
3063          * - MegaApi::fastLogin - Returns the base64pwKey parameter
3064          * - MegaApi::fastConfirmAccount - Returns the base64pwKey parameter
3065          *
3066          * This value is valid for these request in onRequestFinish when the
3067          * error code is MegaError::API_OK:
3068          * - MegaApi::getUserData - Returns the private RSA key of the account, Base64-encoded
3069          *
3070          * @return Private key related to the request
3071          */
3072         virtual const char* getPrivateKey() const;
3073 
3074         /**
3075          * @brief Returns an access level related to the request
3076          *
3077          * This value is valid for these requests:
3078          * - MegaApi::share - Returns the access level for the shared folder
3079          * - MegaApi::exportNode - Returns true
3080          * - MegaApi::disableExport - Returns false
3081          * - MegaApi::inviteToChat - Returns the privilege level wanted for the user
3082          *
3083          * @return Access level related to the request
3084          */
3085         virtual int getAccess() const;
3086 
3087         /**
3088          * @brief Returns the path of a file related to the request
3089          *
3090          * The SDK retains the ownership of the returned value. It will be valid until
3091          * the MegaRequest object is deleted.
3092          *
3093          * This value is valid for these requests:
3094          * - MegaApi::getThumbnail - Returns the destination path for the thumbnail
3095          * - MegaApi::getPreview - Returns the destination path for the preview
3096          * - MegaApi::getUserAvatar - Returns the destination path for the avatar
3097          * - MegaApi::setThumbnail - Returns the source path for the thumbnail
3098          * - MegaApi::setPreview - Returns the source path for the preview
3099          * - MegaApi::setAvatar - Returns the source path for the avatar
3100          * - MegaApi::syncFolder - Returns the path of the local folder
3101          * - MegaApi::resumeSync - Returns the path of the local folder
3102          * - MegaApi::setBackup - Returns the path of the local folder
3103          *
3104          * @return Path of a file related to the request
3105          */
3106         virtual const char* getFile() const;
3107 
3108         /**
3109          * @brief Return the number of times that a request has temporarily failed
3110          * @return Number of times that a request has temporarily failed
3111          * This value is valid for these requests:
3112          * - MegaApi::setBackup - Returns the maximun number of backups to keep
3113          */
3114         virtual int getNumRetry() const;
3115 
3116         /**
3117          * @brief Returns a public node related to the request
3118          *
3119          * The MegaRequest object retains the ownership of the returned value. It will be valid
3120          * until the MegaRequest object is deleted.
3121          *
3122          * If you want to use the returned node beyond the deletion of the MegaRequest object,
3123          * you must call MegaNode::copy or use MegaRequest::getPublicMegaNode instead
3124          *
3125          * @return Public node related to the request
3126          *
3127          * @deprecated This function will be removed in future updates. You should use
3128          * MegaRequest::getPublicMegaNode instead.
3129          *
3130          */
3131         virtual MegaNode *getPublicNode() const;
3132 
3133         /**
3134          * @brief Returns a public node related to the request
3135          *
3136          * You take the ownership of the returned value.
3137          *
3138          * This value is valid for these requests:
3139          * - MegaApi::copyNode - Returns the node to copy (if it is a public node)
3140          *
3141          * This value is valid for these request in onRequestFinish when the
3142          * error code is MegaError::API_OK:
3143          * - MegaApi::getPublicNode - Returns the public node
3144          *
3145          * You take the ownership of the returned value.
3146          *
3147          * @return Public node related to the request
3148          */
3149         virtual MegaNode *getPublicMegaNode() const;
3150 
3151         /**
3152          * @brief Returns the type of parameter related to the request
3153          *
3154          * This value is valid for these requests:
3155          * - MegaApi::getThumbnail - Returns MegaApi::ATTR_TYPE_THUMBNAIL
3156          * - MegaApi::getPreview - Returns MegaApi::ATTR_TYPE_PREVIEW
3157          * - MegaApi::cancelGetThumbnail - Returns MegaApi::ATTR_TYPE_THUMBNAIL
3158          * - MegaApi::cancelGetPreview - Returns MegaApi::ATTR_TYPE_PREVIEW
3159          * - MegaApi::setThumbnail - Returns MegaApi::ATTR_TYPE_THUMBNAIL
3160          * - MegaApi::setPreview - Returns MegaApi::ATTR_TYPE_PREVIEW
3161          * - MegaApi::reportDebugEvent - Returns MegaApi::EVENT_DEBUG
3162          * - MegaApi::cancelTransfers - Returns MegaTransfer::TYPE_DOWNLOAD if downloads are cancelled or MegaTransfer::TYPE_UPLOAD if uploads are cancelled
3163          * - MegaApi::setUserAttribute - Returns the attribute type
3164          * - MegaApi::getUserAttribute - Returns the attribute type
3165          * - MegaApi::setMaxConnections - Returns the direction of transfers
3166          *
3167          * @return Type of parameter related to the request
3168          */
3169         virtual int getParamType() const;
3170 
3171         /**
3172          * @brief Returns a text relative to this request
3173          *
3174          * The SDK retains the ownership of the returned value. It will be valid until
3175          * the MegaRequest object is deleted.
3176          *
3177          * This value is valid for these requests:
3178          * - MegaApi::submitFeedback - Returns the comment about the app
3179          * - MegaApi::reportDebugEvent - Returns the debug message
3180          * - MegaApi::setUserAttribute - Returns the new value for the attribute
3181          * - MegaApi::inviteContact - Returns the message appended to the contact invitation
3182          * - MegaApi::sendEvent - Returns the event message
3183          * - MegaApi::createAccount - Returns the lastname for the new account
3184          * - MegaApi::setBackup - Returns the cron like time string to define period
3185          *
3186          * This value is valid for these request in onRequestFinish when the
3187          * error code is MegaError::API_OK:
3188          * - MegaApi::getUserAttribute - Returns the value of the attribute
3189          *
3190          * @return Text relative to this request
3191          */
3192         virtual const char *getText() const;
3193 
3194         /**
3195          * @brief Returns a number related to this request
3196          *
3197          * This value is valid for these requests:
3198          * - MegaApi::retryPendingConnections - Returns if transfers are retried
3199          * - MegaApi::submitFeedback - Returns the rating for the app
3200          * - MegaApi::pauseTransfers - Returns the direction of the transfers to pause/resume
3201          * - MegaApi::upgradeAccount - Returns the payment method
3202          * - MegaApi::replyContactRequest - Returns the action to do with the contact request
3203          * - MegaApi::inviteContact - Returns the action to do with the contact request
3204          * - MegaApi::sendEvent - Returns the event type
3205          * - MegaApi::moveTransferUp - Returns MegaTransfer::MOVE_TYPE_UP
3206          * - MegaApi::moveTransferUpByTag - Returns MegaTransfer::MOVE_TYPE_UP
3207          * - MegaApi::moveTransferDown - Returns MegaTransfer::MOVE_TYPE_DOWN
3208          * - MegaApi::moveTransferDownByTag - Returns MegaTransfer::MOVE_TYPE_DOWN
3209          * - MegaApi::moveTransferToFirst - Returns MegaTransfer::MOVE_TYPE_TOP
3210          * - MegaApi::moveTransferToFirstByTag - Returns MegaTransfer::MOVE_TYPE_TOP
3211          * - MegaApi::moveTransferToLast - Returns MegaTransfer::MOVE_TYPE_BOTTOM
3212          * - MegaApi::moveTransferToLastByTag - Returns MegaTransfer::MOVE_TYPE_BOTTOM
3213          * - MegaApi::moveTransferBefore - Returns the tag of the transfer with the target position
3214          * - MegaApi::moveTransferBeforeByTag - Returns the tag of the transfer with the target position
3215          * - MegaApi::setBackup - Returns the period between backups in deciseconds (-1 if cron time used)
3216          * - MegaApi::abortCurrentBackup - Returns the tag of the aborted backup
3217          * - MegaApi::removeBackup - Returns the tag of the deleted backup
3218          * - MegaApi::startTimer - Returns the selected period
3219          * - MegaApi::sendChatStats - Returns the connection port
3220          *
3221          * This value is valid for these request in onRequestFinish when the
3222          * error code is MegaError::API_OK:
3223          * - MegaApi::resumeSync - Returns the fingerprint of the local file
3224          * - MegaApi::creditCardQuerySubscriptions - Returns the number of credit card subscriptions
3225          * - MegaApi::getPaymentMethods - Returns a bitfield with the available payment methods
3226          * - MegaApi::getCloudStorageUsed - Returns the sum of the sizes of file cloud nodes.
3227          *
3228          * @return Number related to this request
3229          */
3230         virtual long long getNumber() const;
3231 
3232         /**
3233          * @brief Returns a flag related to the request
3234          *
3235          * This value is valid for these requests:
3236          * - MegaApi::retryPendingConnections - Returns if request are disconnected
3237          * - MegaApi::pauseTransfers - Returns true if transfers were paused, false if they were resumed
3238          * - MegaApi::createChat - Creates a chat for one or more participants
3239          * - MegaApi::fetchnodes - Return true if logged in into a folder and the provided key is invalid.
3240          * - MegaApi::getPublicNode - Return true if the provided key along the link is invalid.
3241          * - MegaApi::pauseTransfer - Returns true if the transfer has to be pause or false if it has to be resumed
3242          * - MegaApi::pauseTransferByTag - Returns true if the transfer has to be pause or false if it has to be resumed
3243          * - MegaApi::moveTransferUp - Returns true (it means that it's an automatic move)
3244          * - MegaApi::moveTransferUpByTag - Returns true (it means that it's an automatic move)
3245          * - MegaApi::moveTransferDown - Returns true (it means that it's an automatic move)
3246          * - MegaApi::moveTransferDownByTag - Returns true (it means that it's an automatic move)
3247          * - MegaApi::moveTransferToFirst - Returns true (it means that it's an automatic move)
3248          * - MegaApi::moveTransferToFirstByTag - Returns true (it means that it's an automatic move)
3249          * - MegaApi::moveTransferToLast - Returns true (it means that it's an automatic move)
3250          * - MegaApi::moveTransferToLastByTag - Returns true (it means that it's an automatic move)
3251          * - MegaApi::moveTransferBefore - Returns false (it means that it's a manual move)
3252          * - MegaApi::moveTransferBeforeByTag - Returns false (it means that it's a manual move)
3253          * - MegaApi::setBackup - Returns if backups that should have happen in the past should be taken care of
3254          *
3255          * This value is valid for these request in onRequestFinish when the
3256          * error code is MegaError::API_OK:
3257          * - MegaApi::queryTransferQuota - True if it is expected to get an overquota error, otherwise false
3258          *
3259          * @return Flag related to the request
3260          */
3261         virtual bool getFlag() const;
3262 
3263         /**
3264          * @brief Returns the number of transferred bytes during the request
3265          * @return Number of transferred bytes during the request
3266          */
3267         virtual long long getTransferredBytes() const;
3268 
3269         /**
3270          * @brief Returns the number of bytes that the SDK will have to transfer to finish the request
3271          * @return Number of bytes that the SDK will have to transfer to finish the request
3272          */
3273         virtual long long getTotalBytes() const;
3274 
3275         /**
3276          * @brief Return the MegaRequestListener associated with this request
3277          *
3278          * This function will return NULL if there isn't an associated request listener.
3279          *
3280          * @return MegaRequestListener associated with this request
3281          */
3282         virtual MegaRequestListener *getListener() const;
3283 
3284         /**
3285          * @brief Returns details related to the MEGA account
3286          *
3287          * This value is valid for these request in onRequestFinish when the
3288          * error code is MegaError::API_OK:
3289          * - MegaApi::getAccountDetails - Details of the MEGA account
3290          *
3291          * You take the ownership of the returned value.
3292          *
3293          * @return Details related to the MEGA account
3294          */
3295         virtual MegaAccountDetails *getMegaAccountDetails() const;
3296 
3297         /**
3298          * @brief Returns available pricing plans to upgrade a MEGA account
3299          *
3300          * This value is valid for these request in onRequestFinish when the
3301          * error code is MegaError::API_OK:
3302          * - MegaApi::getPricing - Returns the available pricing plans
3303          *
3304          * You take the ownership of the returned value.
3305          *
3306          * @return Available pricing plans to upgrade a MEGA account
3307          */
3308         virtual MegaPricing *getPricing() const;
3309 
3310         /**
3311          * @brief Returns details related to the MEGA Achievements of this account
3312          *
3313          * This value is valid for these request in onRequestFinish when the
3314          * error code is MegaError::API_OK:
3315          * - MegaApi::getMegaAchievements - Details of the MEGA Achievements of this account
3316          *
3317          * You take the ownership of the returned value.
3318          *
3319          * @return Details related to the MEGA Achievements of this account
3320          */
3321         virtual MegaAchievementsDetails *getMegaAchievementsDetails() const;
3322 
3323         /**
3324          * @brief Get details about timezones and the current default
3325          *
3326          * This value is valid for these request in onRequestFinish when the
3327          * error code is MegaError::API_OK:
3328          * - MegaApi::fetchTimeZone - Details about timezones and the current default
3329          *
3330          * In any other case, this function returns NULL.
3331          *
3332          * The SDK retains the ownership of the returned value. It will be valid until
3333          * the MegaRequest object is deleted.
3334          *
3335          * @return Details about timezones and the current default
3336          */
3337         virtual MegaTimeZoneDetails *getMegaTimeZoneDetails() const;
3338 
3339         /**
3340          * @brief Returns the tag of a transfer related to the request
3341          *
3342          * This value is valid for these requests:
3343          * - MegaApi::cancelTransfer - Returns the tag of the cancelled transfer (MegaTransfer::getTag)
3344          * - MegaApi::pauseTransfer - Returns the tag of the request to pause or resume
3345          * - MegaApi::pauseTransferByTag - Returns the tag of the request to pause or resume
3346          * - MegaApi::moveTransferUp - Returns the tag of the transfer to move
3347          * - MegaApi::moveTransferUpByTag - Returns the tag of the transfer to move
3348          * - MegaApi::moveTransferDown - Returns the tag of the transfer to move
3349          * - MegaApi::moveTransferDownByTag - Returns the tag of the transfer to move
3350          * - MegaApi::moveTransferToFirst - Returns the tag of the transfer to move
3351          * - MegaApi::moveTransferToFirstByTag - Returns the tag of the transfer to move
3352          * - MegaApi::moveTransferToLast - Returns the tag of the transfer to move
3353          * - MegaApi::moveTransferToLastByTag - Returns the tag of the transfer to move
3354          * - MegaApi::moveTransferBefore - Returns the tag of the transfer to move
3355          * - MegaApi::moveTransferBeforeByTag - Returns the tag of the transfer to move
3356          * - MegaApi::setBackup - Returns the tag asociated with the backup
3357          *
3358          * @return Tag of a transfer related to the request
3359          */
3360         virtual int getTransferTag() const;
3361 
3362         /**
3363          * @brief Returns the number of details related to this request
3364          *
3365          * This value is valid for these requests:
3366          *  - MegaApi::getAccountDetails
3367          *  - MegaApi::getSpecificAccountDetails
3368          *  - MegaApi::getExtendedAccountDetails
3369          *
3370          * @return Number of details related to this request
3371          */
3372         virtual int getNumDetails() const;
3373 
3374         /**
3375          * @brief Returns the tag that identifies this request
3376          *
3377          * The tag is unique for the MegaApi object that has generated it only
3378          *
3379          * @return Unique tag that identifies this request
3380          */
3381         virtual int getTag() const;
3382 
3383 #ifdef ENABLE_CHAT
3384         /**
3385          * @brief Returns the list of peers in a chat.
3386          *
3387          * The SDK retains the ownership of the returned value. It will be valid until
3388          * the MegaRequest object is deleted.
3389          *
3390          * This value is valid for these requests:
3391          * - MegaApi::createChat - Returns the list of peers and their privilege level
3392          *
3393          * @return List of peers of a chat
3394          */
3395         virtual MegaTextChatPeerList *getMegaTextChatPeerList() const;
3396 
3397         /**
3398          * @brief Returns the list of chats.
3399          *
3400          * The SDK retains the ownership of the returned value. It will be valid until
3401          * the MegaRequest object is deleted.
3402          *
3403          * This value is valid for these requests in onRequestFinish when the
3404          * error code is MegaError::API_OK:
3405          * - MegaApi::createChat - Returns the new chat's information
3406          *
3407          * @return List of chats
3408          */
3409         virtual MegaTextChatList *getMegaTextChatList() const;
3410 #endif
3411 
3412         /**
3413          * @brief Returns the string map
3414          *
3415          * The SDK retains the ownership of the returned value. It will be valid until
3416          * the MegaRequest object is deleted.
3417          *
3418          * This value is valid for these requests in onRequestFinish when the
3419          * error code is MegaError::API_OK:
3420          * - MegaApi::getUserAttribute - Returns the attribute value
3421          *
3422          * @return String map including the key-value pairs of the attribute
3423          */
3424         virtual MegaStringMap* getMegaStringMap() const;
3425 
3426         /**
3427          * @brief Returns the string list map
3428          *
3429          * The SDK retains the ownership of the returned value. It will be valid until
3430          * the MegaRequest object is deleted.
3431          *
3432          * @return String list map
3433          */
3434         virtual MegaStringListMap* getMegaStringListMap() const;
3435 
3436         /**
3437          * @brief Returns the string table
3438          *
3439          * The SDK retains the ownership of the returned value. It will be valid until
3440          * the MegaRequest object is deleted.
3441          *
3442          * @return String table
3443          */
3444         virtual MegaStringTable* getMegaStringTable() const;
3445 
3446         /**
3447          * @brief Returns information about the contents of a folder
3448          *
3449          * The SDK retains the ownership of the returned value. It will be valid until
3450          * the MegaRequest object is deleted.
3451          *
3452          * This value is valid for these requests in onRequestFinish when the
3453          * error code is MegaError::API_OK:
3454          * - MegaApi::getFolderInfo - Returns the information related to the folder
3455          *
3456          * @return Object with information about the contents of a folder
3457          */
3458         virtual MegaFolderInfo *getMegaFolderInfo() const;
3459 
3460         /**
3461          * @brief Returns settings for push notifications
3462          *
3463          * The SDK retains the ownership of the returned value. It will be valid until
3464          * the MegaRequest object is deleted.
3465          *
3466          * This value is valid for these requests in onRequestFinish when the
3467          * error code is MegaError::API_OK:
3468          * - MegaApi::getPushNotificationSettings - Returns settings for push notifications
3469          *
3470          * @return Object with settings for push notifications
3471          */
3472         virtual const MegaPushNotificationSettings *getMegaPushNotificationSettings() const;
3473 
3474         /**
3475          * @brief Returns information about background uploads (used in iOS)
3476          *
3477          * The SDK retains the ownership of the returned value. It will be valid until
3478          * the MegaRequest object is deleted.
3479          *
3480          * This value is valid for requests relating to background uploads. The returned
3481          * pointer is to the relevant background upload object.
3482          *
3483          * @return Object with information about the contents of a folder
3484          */
3485         virtual MegaBackgroundMediaUpload* getMegaBackgroundMediaUploadPtr() const;
3486 };
3487 
3488 /**
3489  * @brief Provides information about an event
3490  *
3491  * Objects of this class aren't live, they are snapshots of the state of the event
3492  * when the object is created, they are immutable.
3493  */
3494 class MegaEvent
3495 {
3496 public:
3497 
3498     enum {
3499         EVENT_COMMIT_DB                 = 0,
3500         EVENT_ACCOUNT_CONFIRMATION      = 1,
3501         EVENT_CHANGE_TO_HTTPS           = 2,
3502         EVENT_DISCONNECT                = 3,
3503         EVENT_ACCOUNT_BLOCKED           = 4,
3504         EVENT_STORAGE                   = 5,
3505         EVENT_NODES_CURRENT             = 6,
3506         EVENT_MEDIA_INFO_READY          = 7,
3507         EVENT_STORAGE_SUM_CHANGED       = 8,
3508         EVENT_BUSINESS_STATUS           = 9,
3509         EVENT_KEY_MODIFIED              = 10,
3510         EVENT_MISC_FLAGS_READY          = 11,
3511     };
3512 
3513     virtual ~MegaEvent();
3514 
3515     /**
3516      * @brief Creates a copy of this MegaEvent object
3517      *
3518      * The resulting object is fully independent of the source MegaEvent,
3519      * it contains a copy of all internal attributes, so it will be valid after
3520      * the original object is deleted.
3521      *
3522      * You are the owner of the returned object
3523      *
3524      * @return Copy of the MegaEvent object
3525      */
3526     virtual MegaEvent *copy();
3527 
3528     /**
3529      * @brief Returns the type of the event associated with the object
3530      * @return Type of the event associated with the object
3531      */
3532     virtual int getType() const;
3533 
3534     /**
3535      * @brief Returns a text relative to this event
3536      *
3537      * The SDK retains the ownership of the returned value. It will be valid until
3538      * the MegaEvent object is deleted.
3539      *
3540      * @return Text relative to this event
3541      */
3542     virtual const char *getText() const;
3543 
3544     /**
3545      * @brief Returns a number relative to this event
3546      *
3547      * For event EVENT_STORAGE_SUM_CHANGED, this number is the new storage sum.
3548      *
3549      * @return Number relative to this event
3550      */
3551     virtual int64_t getNumber() const;
3552 
3553     /**
3554      * @brief Returns the handle relative to this event
3555      * @return Handle relative to this event
3556      */
3557     virtual MegaHandle getHandle() const;
3558 
3559     /**
3560      * @brief Returns a readable description of the event
3561      *
3562      * This function returns a pointer to a statically allocated buffer.
3563      * You don't have to free the returned pointer
3564      *
3565      * @return Readable description of the event
3566      */
3567     virtual const char* getEventString() const;
3568 };
3569 
3570 /**
3571  * @brief Provides information about a transfer
3572  *
3573  * Developers can use listeners (MegaListener, MegaTransferListener)
3574  * to track the progress of each transfer. MegaTransfer objects are provided in callbacks sent
3575  * to these listeners and allow developers to know the state of the transfers, their parameters
3576  * and their results.
3577  *
3578  * Objects of this class aren't live, they are snapshots of the state of the transfer
3579  * when the object is created, they are immutable.
3580  *
3581  */
3582 class MegaTransfer
3583 {
3584 	public:
3585         enum {
3586             TYPE_DOWNLOAD = 0,
3587             TYPE_UPLOAD = 1,
3588             TYPE_LOCAL_TCP_DOWNLOAD = 2,
3589             TYPE_LOCAL_HTTP_DOWNLOAD = 2 //kept for backwards compatibility
3590         };
3591 
3592         enum {
3593             STATE_NONE = 0,
3594             STATE_QUEUED,
3595             STATE_ACTIVE,
3596             STATE_PAUSED,
3597             STATE_RETRYING,
3598             STATE_COMPLETING,
3599             STATE_COMPLETED,
3600             STATE_CANCELLED,
3601             STATE_FAILED
3602         };
3603 
3604         enum {
3605             MOVE_TYPE_UP = 1,
3606             MOVE_TYPE_DOWN,
3607             MOVE_TYPE_TOP,
3608             MOVE_TYPE_BOTTOM
3609         };
3610 
3611         virtual ~MegaTransfer();
3612 
3613         /**
3614          * @brief Creates a copy of this MegaTransfer object
3615          *
3616          * The resulting object is fully independent of the source MegaTransfer,
3617          * it contains a copy of all internal attributes, so it will be valid after
3618          * the original object is deleted.
3619          *
3620          * You are the owner of the returned object
3621          *
3622          * @return Copy of the MegaTransfer object
3623          */
3624         virtual MegaTransfer *copy();
3625 
3626         /**
3627          * @brief Returns the type of the transfer (TYPE_DOWNLOAD, TYPE_UPLOAD)
3628          * @return The type of the transfer (TYPE_DOWNLOAD, TYPE_UPLOAD)
3629          */
3630         virtual int getType() const;
3631 
3632         /**
3633          * @brief Returns a readable string showing the type of transfer (UPLOAD, DOWNLOAD)
3634          *
3635          * This function returns a pointer to a statically allocated buffer.
3636          * You don't have to free the returned pointer
3637          *
3638          * @return Readable string showing the type of transfer (UPLOAD, DOWNLOAD)
3639          */
3640         virtual const char *getTransferString() const;
3641 
3642         /**
3643          * @brief Returns a readable string that shows the type of the transfer
3644          *
3645          * This function provides exactly the same result as MegaTransfer::getTransferString (UPLOAD, DOWNLOAD)
3646          * It's provided for a better Java compatibility
3647          *
3648          * @return Readable string showing the type of transfer (UPLOAD, DOWNLOAD)
3649          */
3650         virtual const char* toString() const;
3651 
3652         /**
3653          * @brief Returns a readable string that shows the type of the transfer
3654          *
3655          * This function provides exactly the same result as MegaTransfer::getTransferString (UPLOAD, DOWNLOAD)
3656          * It's provided for a better Python compatibility
3657          *
3658          * @return Readable string showing the type of transfer (UPLOAD, DOWNLOAD)
3659          */
3660         virtual const char* __str__() const;
3661 
3662         /**
3663          * @brief Returns a readable string that shows the type of the transfer
3664          *
3665          * This function provides exactly the same result as MegaTransfer::getTransferString (UPLOAD, DOWNLOAD)
3666          * It's provided for a better PHP compatibility
3667          *
3668          * @return Readable string showing the type of transfer (UPLOAD, DOWNLOAD)
3669          */
3670         virtual const char *__toString() const;
3671 
3672         /**
3673          * @brief Returns the starting time of the request (in deciseconds)
3674          *
3675          * The returned value is a monotonic time since some unspecified starting point expressed in
3676          * deciseconds.
3677          *
3678          * @return Starting time of the transfer (in deciseconds)
3679          */
3680         virtual int64_t getStartTime() const;
3681 
3682         /**
3683          * @brief Returns the number of transferred bytes during this request
3684          * @return Transferred bytes during this transfer
3685          */
3686         virtual long long getTransferredBytes() const;
3687 
3688         /**
3689          * @brief Returns the total bytes to be transferred to complete the transfer
3690          * @return Total bytes to be transferred to complete the transfer
3691          */
3692         virtual long long getTotalBytes() const;
3693 
3694         /**
3695          * @brief Returns the local path related to this request
3696          *
3697          * For uploads, this function returns the path to the source file. For downloads, it
3698          * returns the path of the destination file.
3699          *
3700          * The SDK retains the ownership of the returned value. It will be valid until
3701          * the MegaTransfer object is deleted.
3702          *
3703          * @return Local path related to this transfer
3704          */
3705         virtual const char* getPath() const;
3706 
3707         /**
3708          * @brief Returns the parent path related to this request
3709          *
3710          * For uploads, this function returns the path to the folder containing the source file.
3711          *  except when uploading files for support: it will return the support account then.
3712          * For downloads, it returns that path to the folder containing the destination file.
3713          *
3714          * The SDK retains the ownership of the returned value. It will be valid until
3715          * the MegaTransfer object is deleted.
3716          *
3717          * @return Parent path related to this transfer
3718          */
3719         virtual const char* getParentPath() const;
3720 
3721         /**
3722          * @brief Returns the handle related to this transfer
3723          *
3724          * For downloads, this function returns the handle of the source node.
3725          *
3726          * For uploads, it returns the handle of the new node in MegaTransferListener::onTransferFinish
3727          * and MegaListener::onTransferFinish when the error code is API_OK. Otherwise, it returns
3728          * mega::INVALID_HANDLE.
3729          *
3730          * @return The handle related to the transfer.
3731          */
3732         virtual MegaHandle getNodeHandle() const;
3733 
3734         /**
3735          * @brief Returns the handle of the parent node related to this transfer
3736          *
3737          * For downloads, this function returns always mega::INVALID_HANDLE. For uploads,
3738          * it returns the handle of the destination node (folder) for the uploaded file.
3739          *
3740          * @return The handle of the destination folder for uploads, or mega::INVALID_HANDLE for downloads.
3741          */
3742         virtual MegaHandle getParentHandle() const;
3743 
3744         /**
3745          * @brief Returns the starting position of the transfer for streaming downloads
3746          *
3747          * The return value of this fuction will be 0 if the transfer isn't a streaming
3748          * download (MegaApi::startStreaming)
3749          *
3750          * @return Starting position of the transfer for streaming downloads, otherwise 0
3751          */
3752         virtual long long getStartPos() const;
3753 
3754         /**
3755          * @brief Returns the end position of the transfer for streaming downloads
3756          *
3757          * The return value of this fuction will be 0 if the transfer isn't a streaming
3758          * download (MegaApi::startStreaming)
3759          *
3760          * @return End position of the transfer for streaming downloads, otherwise 0
3761          */
3762         virtual long long getEndPos() const;
3763 
3764 		/**
3765 		 * @brief Returns the name of the file that is being transferred
3766 		 *
3767 		 * It's possible to upload a file with a different name (MegaApi::startUpload). In that case,
3768 		 * this function returns the destination name.
3769 		 *
3770          * The SDK retains the ownership of the returned value. It will be valid until
3771          * the MegaTransfer object is deleted.
3772          *
3773 		 * @return Name of the file that is being transferred
3774 		 */
3775 		virtual const char* getFileName() const;
3776 
3777 		/**
3778 		 * @brief Returns the MegaTransferListener object associated with this transfer
3779 		 *
3780 		 * MegaTransferListener objects can be associated with transfers at startup, if a listener
3781 		 * isn't associated, this function will return NULL
3782 		 *
3783 		 * @return Listener associated with this transfer
3784 		 */
3785 		virtual MegaTransferListener* getListener() const;
3786 
3787 		/**
3788 		 * @brief Return the number of times that a transfer has temporarily failed
3789 		 * @return Number of times that a transfer has temporarily failed
3790 		 */
3791 		virtual int getNumRetry() const;
3792 
3793 		/**
3794 		 * @brief Returns the maximum number of times that the transfer will be retried
3795 		 * @return Mmximum number of times that the transfer will be retried
3796 		 */
3797 		virtual int getMaxRetries() const;
3798 
3799 		/**
3800 		 * @brief Returns an integer that identifies this transfer
3801 		 * @return Integer that identifies this transfer
3802 		 */
3803 		virtual int getTag() const;
3804 
3805 		/**
3806          * @brief Returns the current speed of this transfer
3807          * @return Current speed of this transfer
3808 		 */
3809 		virtual long long getSpeed() const;
3810 
3811         /**
3812          * @brief Returns the average speed of this transfer
3813          * @return Average speed of this transfer
3814          */
3815         virtual long long getMeanSpeed() const;
3816 
3817         /**
3818 		 * @brief Returns the number of bytes transferred since the previous callback
3819 		 * @return Number of bytes transferred since the previous callback
3820 		 * @see MegaListener::onTransferUpdate, MegaTransferListener::onTransferUpdate
3821 		 */
3822 		virtual long long getDeltaSize() const;
3823 
3824 		/**
3825 		 * @brief Returns the timestamp when the last data was received (in deciseconds)
3826 		 *
3827 		 * This timestamp doesn't have a defined starting point. Use the difference between
3828 		 * the return value of this function and MegaTransfer::getStartTime to know how
3829 		 * much time the transfer has been running.
3830 		 *
3831 		 * @return Timestamp when the last data was received (in deciseconds)
3832 		 */
3833 		virtual int64_t getUpdateTime() const;
3834 
3835         /**
3836          * @brief Returns a public node related to the transfer
3837          *
3838          * The return value is only valid for downloads of public nodes.
3839          *
3840          * You take the ownership of the returned value.
3841          *
3842          * @return Public node related to the transfer
3843          */
3844         virtual MegaNode *getPublicMegaNode() const;
3845 
3846         /**
3847          * @brief Returns true if this transfer belongs to the synchronization engine
3848          *
3849          * A single transfer can upload/download several files with exactly the same contents. If
3850          * some of these files are being transferred by the synchonization engine, but there is at
3851          * least one file started by the application, this function returns false.
3852          *
3853          * This data is important to know if the transfer is cancellable. Regular transfers are cancellable
3854          * but synchronization transfers aren't.
3855          *
3856          * @return true if this transfer belongs to the synchronization engine, otherwise false
3857          */
3858         virtual bool isSyncTransfer() const;
3859 
3860         /**
3861          * @brief Returns true if this transfer belongs to the backups engine
3862          *
3863          * This data is important to know if the transfer will resume when enableTransferResumption is called.
3864          * Regular transfers are resumed, but backup transfers aren't.
3865          *
3866          * @return true if this transfer belongs to the backups engine, otherwise false
3867          */
3868         virtual bool isBackupTransfer() const;
3869 
3870         /**
3871          * @brief Returns true if the transfer has failed with API_EOVERQUOTA
3872          * and the target is foreign.
3873          *
3874          * @return true if the transfer has failed with API_EOVERQUOTA and the target is foreign.
3875          */
3876         virtual bool isForeignOverquota() const;
3877 
3878         /**
3879          * @brief Returns true is this is a streaming transfer
3880          * @return true if this is a streaming transfer, false otherwise
3881          * @see MegaApi::startStreaming
3882          */
3883         virtual bool isStreamingTransfer() const;
3884 
3885         /**
3886          * @brief Returns true is the transfer is at finished state (COMPLETED, CANCELLED OR FAILED)
3887          * @return true if this transfer is finished, false otherwise
3888          */
3889         virtual bool isFinished() const;
3890 
3891         /**
3892          * @brief Returns the received bytes since the last callback
3893          *
3894          * The returned value is only valid for streaming transfers (MegaApi::startStreaming).
3895          *
3896          * @return Received bytes since the last callback
3897          */
3898         virtual char *getLastBytes() const;
3899 
3900         /**
3901          * @brief Returns the last error related to the transfer
3902          *
3903          * @note This method returns a MegaError with the error code, but
3904          * the extra info is not valid. If you need to use MegaError::getUserStatus, in
3905          * example, you need to use MegaTransfer::getLastErrorExtended.
3906          *
3907          * @deprecated User use MegaTransfer::getLastErrorExtended.
3908          *
3909          * @return Last error related to the transfer
3910          */
3911         virtual MegaError getLastError() const;
3912 
3913         /**
3914          * @brief Returns the last error related to the transfer with extra info
3915          *
3916          * The MegaTransfer object retains the ownership of the returned pointer. It will
3917          * be valid until the deletion of the MegaTransfer object.
3918          *
3919          * @return Last error related to the transfer, with extended info
3920          */
3921         virtual const MegaError* getLastErrorExtended() const;
3922 
3923         /**
3924          * @brief Returns true if the transfer is a folder transfer
3925          * @return true if it's a folder transfer, otherwise (file transfer) it returns false
3926          */
3927         virtual bool isFolderTransfer() const;
3928 
3929         /**
3930          * @brief Returns the identifier of the folder transfer associated to this transfer
3931          *
3932          * This function is only useful for transfers automatically started in the context of a folder transfer.
3933          * For folder transfers (the ones directly started with startUpload), it returns -1
3934          * Otherwise, it returns 0
3935          *
3936          * @return Tag of the associated folder transfer.
3937          */
3938         virtual int getFolderTransferTag() const;
3939 
3940         /**
3941          * @brief Returns the application data associated with this transfer
3942          *
3943          * You can set the data returned by this function in MegaApi::startDownload
3944          *
3945          * The SDK retains the ownership of the returned value. It will be valid until
3946          * the MegaTransfer object is deleted.
3947          *
3948          * @return Application data associated with this transfer
3949          */
3950         virtual const char* getAppData() const;
3951 
3952         /**
3953          * @brief Returns the state of the transfer
3954          *
3955          * It can be one of these values:
3956          * - STATE_NONE = 0
3957          * Unknown state. This state should be never returned.
3958          *
3959          * - STATE_QUEUED = 1
3960          * The transfer is queued. No data related to it is being transferred.
3961          *
3962          * - STATE_ACTIVE = 2
3963          * The transfer is active. Its data is being transferred.
3964          *
3965          * - STATE_PAUSED = 3
3966          * The transfer is paused. It won't be activated until it's resumed.
3967          *
3968          * - STATE_RETRYING = 4
3969          * The transfer is waiting to be retried due to a temporary error.
3970          *
3971          * - STATE_COMPLETING = 5
3972          * The transfer is being completed. All data has been transferred
3973          * but it's still needed to attach the resulting node to the
3974          * account (uploads), to attach thumbnails/previews to the
3975          * node (uploads of images) or to create the resulting local
3976          * file (downloads). The transfer should be completed in a short time.
3977          *
3978          * - STATE_COMPLETED = 6
3979          * The transfer has beeing finished.
3980          *
3981          * - STATE_CANCELLED = 7
3982          * The transfer was cancelled by the user.
3983          *
3984          * - STATE_FAILED = 8
3985          * The transfer was cancelled by the SDK due to a fatal error or
3986          * after a high number of retries.
3987          *
3988          * @return State of the transfer
3989          */
3990         virtual int getState() const;
3991 
3992         /**
3993          * @brief Returns the priority of the transfer
3994          *
3995          * This value is intended to keep the order of the transfer queue on apps.
3996          *
3997          * @return Priority of the transfer
3998          */
3999         virtual unsigned long long getPriority() const;
4000 
4001         /**
4002          * @brief Returns the notification number of the SDK when this MegaTransfer was generated
4003          *
4004          * The notification number of the SDK is increased every time the SDK sends a callback
4005          * to the app.
4006          *
4007          * @return Notification number
4008          */
4009         virtual long long getNotificationNumber() const;
4010 };
4011 
4012 /**
4013  * @brief Provides information about the contents of a folder
4014  *
4015  * This object is related to provide the results of the function MegaApi::getFolderInfo
4016  *
4017  * Objects of this class aren't live, they are snapshots of the state of the contents of the
4018  * folder when the object is created, they are immutable.
4019  *
4020  */
4021 class MegaFolderInfo
4022 {
4023 public:
4024     virtual ~MegaFolderInfo();
4025 
4026     /**
4027      * @brief Creates a copy of this MegaFolderInfo object
4028      *
4029      * The resulting object is fully independent of the source MegaFolderInfo,
4030      * it contains a copy of all internal attributes, so it will be valid after
4031      * the original object is deleted.
4032      *
4033      * You are the owner of the returned object
4034      *
4035      * @return Copy of the MegaFolderInfo object
4036      */
4037     virtual MegaFolderInfo *copy() const;
4038 
4039     /**
4040      * @brief Return the number of file versions inside the folder
4041      *
4042      * The current version of files is not taken into account for the return value of this function
4043      *
4044      * @return Number of file versions inside the folder
4045      */
4046     virtual int getNumVersions() const;
4047 
4048     /**
4049      * @brief Returns the number of files inside the folder
4050      *
4051      * File versions are not counted for the return value of this function
4052      *
4053      * @return Number of files inside the folder
4054      */
4055     virtual int getNumFiles() const;
4056 
4057     /**
4058      * @brief Returns the number of folders inside the folder
4059      * @return Number of folders inside the folder
4060      */
4061     virtual int getNumFolders() const;
4062 
4063     /**
4064      * @brief Returns the total size of files inside the folder
4065      *
4066      * File versions are not taken into account for the return value of this function
4067      *
4068      * @return Total size of files inside the folder
4069      */
4070     virtual long long getCurrentSize() const;
4071 
4072     /**
4073      * @brief Returns the total size of file versions inside the folder
4074      *
4075      * The current version of files is not taken into account for the return value of this function
4076      *
4077      * @return Total size of file versions inside the folder
4078      */
4079     virtual long long getVersionsSize() const;
4080 };
4081 
4082 /**
4083  * @brief Provides information about timezones and the current default
4084  *
4085  * This object is related to results of the function MegaApi::fetchTimeZone
4086  *
4087  * Objects of this class aren't live, they contain details about timezones and the
4088  * default when the object is created, they are immutable.
4089  *
4090  */
4091 class MegaTimeZoneDetails
4092 {
4093 public:
4094     virtual ~MegaTimeZoneDetails();
4095 
4096     /**
4097      * @brief Creates a copy of this MegaTimeZoneDetails object
4098      *
4099      * The resulting object is fully independent of the source MegaTimeZoneDetails,
4100      * it contains a copy of all internal attributes, so it will be valid after
4101      * the original object is deleted.
4102      *
4103      * You are the owner of the returned object
4104      *
4105      * @return Copy of the MegaTimeZoneDetails object
4106      */
4107     virtual MegaTimeZoneDetails *copy() const;
4108 
4109     /**
4110      * @brief Returns the number of timezones in this object
4111      *
4112      * @return Number of timezones in this object
4113      */
4114     virtual int getNumTimeZones() const;
4115 
4116     /**
4117      * @brief Returns the timezone at an index
4118      *
4119      * The MegaTimeZoneDetails object retains the ownership of the returned string.
4120      * It will be only valid until the MegaTimeZoneDetails object is deleted.
4121      *
4122      * @param index Index in the list (it must be lower than MegaTimeZoneDetails::getNumTimeZones)
4123      * @return Timezone at an index
4124      */
4125     virtual const char *getTimeZone(int index) const;
4126 
4127     /**
4128      * @brief Returns the current time offset of the time zone at an index, respect to UTC (in seconds, it can be negative)
4129      *
4130      * @param index Index in the list (it must be lower than MegaTimeZoneDetails::getNumTimeZones)
4131      * @return Current time offset of the time zone at an index, respect to UTC (in seconds, it can be negative)
4132      * @see MegaTimeZoneDetails::getTimeZone
4133      */
4134     virtual int getTimeOffset(int index) const;
4135 
4136     /**
4137      * @brief Get the default time zone index
4138      *
4139      * If there isn't any good default known, this function will return -1
4140      *
4141      * @return Default time zone index, or -1 if there isn't a good default known
4142      */
4143     virtual int getDefault() const;
4144 };
4145 
4146 /**
4147  * @brief Provides information about the notification settings
4148  *
4149  * The notifications can be configured:
4150  *
4151  * 1. Globally
4152  *  1.1. Mute all notifications
4153  *  1.2. Notify only during a schedule: from one time to another time of the day, specifying the timezone of reference
4154  *  1.3. Do Not Disturb for a period of time: it overrides the schedule, if any (no notification will be generated)
4155  *
4156  * 2. Chats: Mute for all chats notifications
4157  *
4158  * 3. Per chat:
4159  *  2.1. Mute all notifications from the specified chat
4160  *  2.2. Always notify for the specified chat
4161  *  2.3. Do Not Disturb for a period of time for the specified chat
4162  *
4163  * @note Notification settings per chat override any global notification setting.
4164  * @note The DND mode per chat is not compatible with the option to always notify and viceversa.
4165  *
4166  * 4. Contacts: new incoming contact request, outgoing contact request accepted...
4167  * 5. Shared folders: new shared folder, access removed...
4168  *
4169  */
4170 class MegaPushNotificationSettings
4171 {
4172 protected:
4173     MegaPushNotificationSettings();
4174 
4175 public:
4176 
4177     /**
4178      * @brief Creates a new instance of MegaPushNotificationSettings
4179      * @return A pointer to the superclass of the private object
4180      */
4181     static MegaPushNotificationSettings *createInstance();
4182 
4183     virtual ~MegaPushNotificationSettings();
4184 
4185     /**
4186      * @brief Creates a copy of this MegaPushNotificationSettings object
4187      *
4188      * The resulting object is fully independent of the source MegaPushNotificationSettings,
4189      * it contains a copy of all internal attributes, so it will be valid after
4190      * the original object is deleted.
4191      *
4192      * You are the owner of the returned object
4193      *
4194      * @return Copy of the MegaPushNotificationSettings object
4195      */
4196     virtual MegaPushNotificationSettings *copy() const;
4197 
4198     /**
4199      * @brief Returns whether notifications are globaly enabled or not
4200      *
4201      * The purpose of this method is to control the UI in order to enable
4202      * the modification of the global parameters (dnd & schedule) or not.
4203      *
4204      * @return True if notifications are enabled, false if disabled
4205      *
4206      * @deprecated This method is deprecated, use isGlobalDndEnabled instead of this.
4207      * Note that isGlobalDndEnabled returns the opposite value to isGlobalEnabled
4208      */
4209     virtual bool isGlobalEnabled() const;
4210 
4211     /**
4212      * @brief Returns whether Do-Not-Disturb mode is enabled or not
4213      * @return True if enabled, false otherwise
4214      */
4215     virtual bool isGlobalDndEnabled() const;
4216 
4217     /**
4218      * @brief Returns whether Do-Not-Disturb mode for chats is enabled or not
4219 
4220      * @return True if enabled, false otherwise
4221      */
4222     virtual bool isGlobalChatsDndEnabled() const;
4223 
4224     /**
4225      * @brief Returns the timestamp until the DND mode is enabled
4226      *
4227      * This method returns a valid value only if MegaPushNotificationSettings::isGlobalDndEnabled
4228      * returns true.
4229      *
4230      * If there's no DND mode established, this function returns -1.
4231      * @note a DND value of 0 means the DND does not expire.
4232      *
4233      * @return Timestamp until DND mode is enabled (in seconds since the Epoch)
4234      */
4235     virtual int64_t getGlobalDnd() const;
4236 
4237     /**
4238      * @brief Returns whether there is a schedule for notifications or not
4239      * @return True if enabled, false otherwise
4240      */
4241     virtual bool isGlobalScheduleEnabled() const;
4242 
4243     /**
4244      * @brief Returns the time of the day when notifications start
4245      *
4246      * This method returns a valid value only if MegaPushNotificationSettings::isGlobalScheduleEnabled
4247      * returns true.
4248      *
4249      * @return Minutes counting from 00:00 (based on the configured timezone)
4250      */
4251     virtual int getGlobalScheduleStart() const;
4252 
4253     /**
4254      * @brief Returns the time of the day when notifications stop
4255      *
4256      * This method returns a valid value only if MegaPushNotificationSettings::isGlobalScheduleEnabled
4257      * returns true.
4258      *
4259      * @return Minutes counting from 00:00 (based on the configured timezone)
4260      */
4261     virtual int getGlobalScheduleEnd() const;
4262 
4263     /**
4264      * @brief Returns the timezone of reference for the notification schedule
4265      *
4266      * This method returns a valid value only if MegaPushNotificationSettings::isGlobalScheduleEnabled
4267      * returns true.
4268      *
4269      * You take the ownership of the returned value
4270      *
4271      * @return Minutes counting from 00:00 (based on the configured timezone)
4272      */
4273     virtual const char *getGlobalScheduleTimezone() const;
4274 
4275     /**
4276      * @brief Returns whether notifications for a chat are enabled or not
4277      *
4278      * The purpose of this method is to control the UI in order to enable
4279      * the modification of the chat parameters (dnd & always notify) or not.
4280      *
4281      * @param chatid MegaHandle that identifies the chat room
4282      * @return True if enabled, false otherwise
4283      *
4284      * @deprecated This method is deprecated, use isChatDndEnabled instead of this.
4285      * Note that isChatDndEnabled returns the opposite value to isChatEnabled
4286      */
4287     virtual bool isChatEnabled(MegaHandle chatid) const;
4288 
4289     /**
4290      * @brief Returns whether Do-Not-Disturb mode for a chat is enabled or not
4291      *
4292      * @param chatid MegaHandle that identifies the chat room
4293      * @return True if enabled, false otherwise
4294      */
4295     virtual bool isChatDndEnabled(MegaHandle chatid) const;
4296 
4297     /**
4298      * @brief Returns the timestamp until the Do-Not-Disturb mode for a chat
4299      *
4300      * This method returns a valid value only if MegaPushNotificationSettings::isChatDndEnabled
4301      * returns true.
4302      *
4303      * If there's no DND mode established for the specified chat, this function returns -1.
4304      * @note a DND value of 0 means the DND does not expire.
4305      *
4306      * @param chatid MegaHandle that identifies the chat room
4307      * @return Timestamp until DND mode is enabled (in seconds since the Epoch)
4308      */
4309     virtual int64_t getChatDnd(MegaHandle chatid) const;
4310 
4311     /**
4312      * @brief Returns whether always notify for a chat or not
4313      *
4314      * This option overrides the global notification settings.
4315      *
4316      * @param chatid MegaHandle that identifies the chat room
4317      * @return True if enabled, false otherwise
4318      */
4319     virtual bool isChatAlwaysNotifyEnabled(MegaHandle chatid) const;
4320 
4321     /**
4322      * @brief Returns whether notifications about Contacts are enabled or not
4323      * @return True if enabled, false otherwise
4324      */
4325     virtual bool isContactsEnabled() const;
4326 
4327     /**
4328      * @brief Returns whether notifications about shared-folders are enabled or not
4329      * @return True if enabled, false otherwise
4330      */
4331     virtual bool isSharesEnabled() const;
4332 
4333     /**
4334      * @brief Returns whether notifications about chats are enabled or not
4335      * @return True if enabled, false otherwise
4336      *
4337      * @deprecated This method is deprecated, use isGlobalChatsDndEnabled instead of this.
4338      * Note that isGlobalChatsDndEnabled returns the opposite result to isChatsEnabled;
4339      */
4340     virtual bool isChatsEnabled() const;
4341 
4342     /**
4343      * @brief Returns the timestamp until the chats DND mode is enabled
4344      *
4345      * This method returns a valid value only if MegaPushNotificationSettings::isGlobalChatsDndEnabled
4346      * returns true.
4347      *
4348      * If there's no DND mode established, this function returns -1.
4349      * @note a DND value of 0 means the DND does not expire.
4350      *
4351      * @return Timestamp until chats DND mode is enabled (in seconds since the Epoch)
4352      */
4353     virtual int64_t getGlobalChatsDnd() const;
4354 
4355     /**
4356      * @brief Enable or disable notifications globally
4357      *
4358      * If notifications are globally disabled, the DND global setting will be
4359      * cleared and the specified schedule, if any, will have no effect.
4360      *
4361      * @note When notifications are globally disabled, settings per chat still apply.
4362      *
4363      * @param enable True to enable, false to disable
4364      */
4365     virtual void enableGlobal(bool enable);
4366 
4367     /**
4368      * @brief Set the global DND mode for a period of time
4369      *
4370      * No notifications will be generated until the specified timestamp.
4371      *
4372      * If notifications were globally disabled, this function will enable them
4373      * back (but will not generate notification until the specified timestamp).
4374      *
4375      * @param timestamp Timestamp until DND mode is enabled (in seconds since the Epoch)
4376      */
4377     virtual void setGlobalDnd(int64_t timestamp);
4378 
4379     /**
4380      * @brief Disable the globally specified DND mode
4381      */
4382     virtual void disableGlobalDnd();
4383 
4384     /**
4385      * @brief Set the schedule for notifications globally
4386      *
4387      * Notifications, if globally enabled, will be generated only from \c start
4388      * to \c end time, using the \c timezone as reference.
4389      *
4390      * The timezone should be one of the values returned by MegaTimeZoneDetails::getTimeZone.
4391      * @see MegaApi::fetchTimeZone for more details.
4392      *
4393      * @param start Minutes counting from 00:00 (based on the configured timezone)
4394      * @param end Minutes counting from 00:00 (based on the configured timezone)
4395      * @param timezone C-String representing the timezone
4396      */
4397     virtual void setGlobalSchedule(int start, int end, const char *timezone);
4398 
4399     /**
4400      * @brief Disable the schedule for notifications globally
4401      */
4402     virtual void disableGlobalSchedule();
4403 
4404     /**
4405      * @brief Enable or disable notifications for a chat
4406      *
4407      * If notifications for this chat are disabled, the DND settings for this chat,
4408      * if any, will be cleared.
4409      *
4410      * @note Settings per chat override any global notification setting.
4411      *
4412      * @param chatid MegaHandle that identifies the chat room
4413      * @param enable True to enable, false to disable
4414      */
4415     virtual void enableChat(MegaHandle chatid, bool enable);
4416 
4417     /**
4418      * @brief Set the DND mode for a chat for a period of time
4419      *
4420      * No notifications will be generated until the specified timestamp.
4421      *
4422      * This setting is not compatible with the "Always notify". If DND mode is
4423      * configured, the "Always notify" will be disabled.
4424      *
4425      * If chat notifications were totally disabled for the specified chat, this
4426      * function will enable them back (but will not generate notification until
4427      * the specified timestamp).
4428      *
4429      * @param timestamp Timestamp until DND mode is enabled (in seconds since the Epoch)
4430      */
4431     virtual void setChatDnd(MegaHandle chatid, int64_t timestamp);
4432 
4433     /**
4434      * @brief Set the Global DND for chats for a period of time
4435      *
4436      * No chat notifications will be generated until the specified timestamp.
4437      *
4438      * @param timestamp Timestamp until DND mode is enabled (in seconds since the Epoch)
4439      */
4440     virtual void setGlobalChatsDnd(int64_t timestamp);
4441 
4442     /**
4443      * @brief Enable or disable "Always notify" setting
4444      *
4445      * Notifications for this chat will always be generated, even if they are globally
4446      * disabled, out of the global schedule or a global DND mode is set.
4447      *
4448      * This setting is not compatible with the DND mode for the specified chat. In consequence,
4449      * if "Always notify" is enabled and the DND mode was configured, it will be disabled.
4450      * Also, if notifications were disabled for the specified chat, they will be enabled.
4451      *
4452      * @note Settings per chat override any global notification setting.
4453      *
4454      * @param chatid MegaHandle that identifies the chat room
4455      * @param enable True to enable, false to disable
4456      */
4457     virtual void enableChatAlwaysNotify(MegaHandle chatid, bool enable);
4458 
4459     /**
4460      * @brief Enable or disable notifications related to contacts
4461      * @param enable True to enable, false to disable
4462      */
4463     virtual void enableContacts(bool enable);
4464 
4465     /**
4466      * @brief Enable or disable notifications related to shared-folders
4467      * @param enable True to enable, false to disable
4468      */
4469     virtual void enableShares(bool enable);
4470 
4471     /**
4472      * @brief Enable or disable notifications related to all chats
4473      * @param enable True to enable, false to disable
4474      */
4475     virtual void enableChats(bool enable);
4476 };
4477 
4478 /**
4479  * @brief Provides information about transfer queues
4480  *
4481  * This object is used as the return value of the function MegaApi::getTransferData
4482  *
4483  * Objects of this class aren't live, they are snapshots of the state of the transfer
4484  * queues when the object is created, they are immutable.
4485  *
4486  */
4487 class MegaTransferData
4488 {
4489 public:
4490     virtual ~MegaTransferData();
4491 
4492     /**
4493      * @brief Creates a copy of this MegaTransferData object
4494      *
4495      * The resulting object is fully independent of the source MegaTransferData,
4496      * it contains a copy of all internal attributes, so it will be valid after
4497      * the original object is deleted.
4498      *
4499      * You are the owner of the returned object
4500      *
4501      * @return Copy of the MegaTransferData object
4502      */
4503     virtual MegaTransferData *copy() const;
4504 
4505     /**
4506      * @brief Returns the number of downloads in the transfer queue
4507      * @return Number of downloads in the transfer queue
4508      */
4509     virtual int getNumDownloads() const;
4510 
4511     /**
4512      * @brief Returns the number of uploads in the transfer queue
4513      * @return Number of uploads in the transfer queue
4514      */
4515     virtual int getNumUploads() const;
4516 
4517     /**
4518      * @brief Returns the tag of the download at index i
4519      * @param i index of the selected download. It must be between 0 and MegaTransferData::getNumDownloads (not included)
4520      * @return Tag of the download at index i
4521      */
4522     virtual int getDownloadTag(int i) const;
4523 
4524     /**
4525      * @brief Returns the tag of the upload at index i
4526      * @param i index of the selected upload. It must be between 0 and MegaTransferData::getNumUploads (not included)
4527      * @return Tag of the upload at index i
4528      */
4529     virtual int getUploadTag(int i) const;
4530 
4531     /**
4532      * @brief Returns the priority of the download at index i
4533      * @param i index of the selected download. It must be between 0 and MegaTransferData::getNumDownloads (not included)
4534      * @return Priority of the download at index i
4535      */
4536     virtual unsigned long long getDownloadPriority(int i) const;
4537 
4538     /**
4539      * @brief Returns the priority of the upload at index i
4540      * @param i index of the selected upload. It must be between 0 and MegaTransferData::getNumUploads (not included)
4541      * @return Priority of the upload at index i
4542      */
4543     virtual unsigned long long getUploadPriority(int i) const;
4544 
4545     /**
4546      * @brief Returns the notification number of the SDK when this MegaTransferData was generated
4547      *
4548      * The notification number of the SDK is increased every time the SDK sends a callback
4549      * to the app.
4550      *
4551      * @return Notification number
4552      */
4553     virtual long long getNotificationNumber() const;
4554 };
4555 
4556 
4557 /**
4558  * @brief Provides information about a contact request
4559  *
4560  * Developers can use listeners (MegaListener, MegaGlobalListener)
4561  * to track the progress of each contact. MegaContactRequest objects are provided in callbacks sent
4562  * to these listeners and allow developers to know the state of the contact requests, their parameters
4563  * and their results.
4564  *
4565  * Objects of this class aren't live, they are snapshots of the state of the contact request
4566  * when the object is created, they are immutable.
4567  *
4568  */
4569 class MegaContactRequest
4570 {
4571 public:
4572     enum {
4573         STATUS_UNRESOLVED = 0,
4574         STATUS_ACCEPTED,
4575         STATUS_DENIED,
4576         STATUS_IGNORED,
4577         STATUS_DELETED,
4578         STATUS_REMINDED
4579     };
4580 
4581     enum {
4582         REPLY_ACTION_ACCEPT = 0,
4583         REPLY_ACTION_DENY,
4584         REPLY_ACTION_IGNORE
4585     };
4586 
4587     enum {
4588         INVITE_ACTION_ADD = 0,
4589         INVITE_ACTION_DELETE,
4590         INVITE_ACTION_REMIND
4591     };
4592 
4593     virtual ~MegaContactRequest();
4594 
4595     /**
4596      * @brief Creates a copy of this MegaContactRequest object
4597      *
4598      * The resulting object is fully independent of the source MegaContactRequest,
4599      * it contains a copy of all internal attributes, so it will be valid after
4600      * the original object is deleted.
4601      *
4602      * You are the owner of the returned object
4603      *
4604      * @return Copy of the MegaContactRequest object
4605      */
4606     virtual MegaContactRequest *copy() const;
4607 
4608     /**
4609      * @brief Returns the handle of this MegaContactRequest object
4610      * @return Handle of the object
4611      */
4612     virtual MegaHandle getHandle() const;
4613 
4614     /**
4615      * @brief Returns the email of the request creator
4616      * @return Email of the request creator
4617      */
4618     virtual char* getSourceEmail() const;
4619 
4620     /**
4621      * @brief Return the message that the creator of the contact request has added
4622      * @return Message sent by the request creator
4623      */
4624     virtual char* getSourceMessage() const;
4625 
4626     /**
4627      * @brief Returns the email of the recipient or NULL if the current account is the recipient
4628      * @return Email of the recipient or NULL if the request is for us
4629      */
4630     virtual char* getTargetEmail() const;
4631 
4632     /**
4633      * @brief Returns the creation time of the contact request
4634      * @return Creation time of the contact request (in seconds since the Epoch)
4635      */
4636     virtual int64_t getCreationTime() const;
4637 
4638     /**
4639      * @brief Returns the last update time of the contact request
4640      * @return Last update time of the contact request (in seconds since the Epoch)
4641      */
4642     virtual int64_t getModificationTime() const;
4643 
4644     /**
4645      * @brief Returns the status of the contact request
4646      *
4647      * It can be one of the following values:
4648      * - STATUS_UNRESOLVED = 0
4649      * The request is pending
4650      *
4651      * - STATUS_ACCEPTED = 1
4652      * The request has been accepted
4653      *
4654      * - STATUS_DENIED = 2
4655      * The request has been denied
4656      *
4657      * - STATUS_IGNORED = 3
4658      * The request has been ignored
4659      *
4660      * - STATUS_DELETED = 4
4661      * The request has been deleted
4662      *
4663      * - STATUS_REMINDED = 5
4664      * The request has been reminded
4665      *
4666      * @return Status of the contact request
4667      */
4668     virtual int getStatus() const;
4669 
4670     /**
4671      * @brief Direction of the request
4672      * @return True if the request is outgoing and false if it's incoming
4673      */
4674     virtual bool isOutgoing() const;
4675 
4676     /**
4677      * @brief Returns true is the incoming contact request is being automatically accepted
4678      * @return True if the incoming contact request is being automatically accepted
4679      */
4680     virtual bool isAutoAccepted() const;
4681 };
4682 
4683 
4684 #ifdef ENABLE_SYNC
4685 
4686 /**
4687  * @brief Provides information about a synchronization event
4688  *
4689  * This object is provided in callbacks related to the synchronization engine
4690  * (MegaListener::onSyncEvent MegaSyncListener::onSyncEvent)
4691  */
4692 class MegaSyncEvent
4693 {
4694 public:
4695 
4696     /**
4697      * Event types.
4698      */
4699     enum {
4700         TYPE_LOCAL_FOLDER_ADITION, TYPE_LOCAL_FOLDER_DELETION,
4701         TYPE_LOCAL_FILE_ADDITION, TYPE_LOCAL_FILE_DELETION,
4702         TYPE_LOCAL_FILE_CHANGED, TYPE_LOCAL_MOVE,
4703         TYPE_REMOTE_FOLDER_ADDITION, TYPE_REMOTE_FOLDER_DELETION,
4704         TYPE_REMOTE_FILE_ADDITION, TYPE_REMOTE_FILE_DELETION,
4705         TYPE_REMOTE_MOVE, TYPE_REMOTE_RENAME,
4706         TYPE_FILE_GET, TYPE_FILE_PUT
4707     };
4708 
4709     virtual ~MegaSyncEvent();
4710 
4711     virtual MegaSyncEvent *copy();
4712 
4713     /**
4714      * @brief Returns the type of event
4715      * @return Type of event
4716      */
4717     virtual int getType() const;
4718 
4719     /**
4720      * @brief Returns the local path related to the event.
4721      *
4722      * If there isn't any local path related to the event (remote events)
4723      * this function returns NULL
4724      *
4725      * The SDK retains the ownership of the returned value. It will be valid until
4726      * the MegaSyncEvent object is deleted.
4727      *
4728      * @return Local path related to the event
4729      */
4730     virtual const char* getPath() const;
4731 
4732     /**
4733      * @brief getNodeHandle Returns the node handle related to the event
4734      *
4735      * If there isn't any local path related to the event (remote events)
4736      * this function returns mega::INVALID_HANDLE
4737      *
4738      * @return Node handle related to the event
4739      */
4740     virtual MegaHandle getNodeHandle() const;
4741 
4742     /**
4743      * @brief Returns the previous path of the local file.
4744      *
4745      * This data is only valid when the event type is TYPE_LOCAL_MOVE
4746      *
4747      * The SDK retains the ownership of the returned value. It will be valid until
4748      * the MegaSyncEvent object is deleted.
4749      *
4750      * @return Previous path of the local file.
4751      */
4752     virtual const char* getNewPath() const;
4753 
4754     /**
4755      * @brief Returns the previous name of the remote node
4756      *
4757      * This data is only valid when the event type is TYPE_REMOTE_RENAME
4758      *
4759      * The SDK retains the ownership of the returned value. It will be valid until
4760      * the MegaSyncEvent object is deleted.
4761      *
4762      * @return Previous name of the remote node
4763      */
4764     virtual const char* getPrevName() const;
4765 
4766     /**
4767      * @brief Returns the handle of the previous parent of the remote node
4768      *
4769      * This data is only valid when the event type is TYPE_REMOTE_MOVE
4770      *
4771      * The SDK retains the ownership of the returned value. It will be valid until
4772      * the MegaSyncEvent object is deleted.
4773      *
4774      * @return Handle of the previous parent of the remote node
4775      */
4776     virtual MegaHandle getPrevParent() const;
4777 };
4778 
4779 class MegaRegExpPrivate;
4780 
4781 /**
4782  * @brief Provides a mechanism to handle Regular Expressions
4783  */
4784 class MegaRegExp
4785 {
4786 public:
4787     MegaRegExp();
4788     ~MegaRegExp();
4789 
4790     /**
4791      * @brief Creates a copy of this MegaRegExp object
4792      *
4793      * The resulting object is fully independent of the source MegaRegExp,
4794      * it contains a copy of all internal attributes, so it will be valid after
4795      * the original object is deleted.
4796      *
4797      * You are the owner of the returned object
4798      *
4799      * @return Copy of the MegaRegExp object
4800      */
4801     MegaRegExp *copy();
4802 
4803     bool addRegExp(const char *regExp);
4804     int getNumRegExp();
4805     const char *getRegExp(int index);
4806     bool match(const char *s);
4807 
4808     const char *getFullPattern();
4809 
4810 private:
4811     MegaRegExpPrivate *pImpl;
4812     MegaRegExp(MegaRegExpPrivate *pImpl);
4813 };
4814 
4815 /**
4816  * @brief Provides information about a synchronization
4817  *
4818  * Developers can use listeners (MegaListener, MegaSyncListener)
4819  * to track the progress of each synchronization. MegaSync objects are provided in callbacks sent
4820  * to these listeners and allow developers to know the state of the synchronizations and their parameters
4821  * and their results.
4822  *
4823  * The implementation will receive callbacks from an internal worker thread.
4824  *
4825  **/
4826 class MegaSyncListener
4827 {
4828 public:
4829     /**
4830      * @brief This function is called when the state of a synced file or folder changes
4831      *
4832      * Possible values for the state are:
4833      * - MegaApi::STATE_SYNCED = 1
4834      * The file is synced with the MEGA account
4835      *
4836      * - MegaApi::STATE_PENDING = 2
4837      * The file isn't synced with the MEGA account. It's waiting to be synced.
4838      *
4839      * - MegaApi::STATE_SYNCING = 3
4840      * The file is being synced with the MEGA account
4841      *
4842      * @param api MegaApi object that is synchronizing files
4843      * @param sync MegaSync object related that manages the file
4844      * @param localPath Local path of the file or folder
4845      * @param newState New state of the file
4846      */
4847     virtual void onSyncFileStateChanged(MegaApi *api, MegaSync *sync, std::string *localPath, int newState);
4848 
4849     /**
4850      * @brief This function is called when the state of the synchronization changes
4851      *
4852      * The SDK calls this function when the state of the synchronization changes, for example
4853      * from 'scanning' to 'syncing' or 'failed'.
4854      *
4855      * You can use MegaSync::getState to get the new state.
4856      *
4857      * @param api MegaApi object that is synchronizing files
4858      * @param sync MegaSync object that has changed the state
4859      */
4860     virtual void onSyncStateChanged(MegaApi *api, MegaSync *sync);
4861 
4862     /**
4863      * @brief This function is called when there is a synchronization event
4864      *
4865      * Synchronization events can be local deletions, local additions, remote deletions,
4866      * remote additions, etc. See MegaSyncEvent to know the full list of event types
4867      *
4868      * @param api MegaApi object that is synchronizing files
4869      * @param sync MegaSync object that detects the event
4870      * @param event Information about the event
4871      *
4872      * This parameter will be deleted just after the callback. If you want to save it use
4873      * MegaSyncEvent::copy
4874      */
4875     virtual void onSyncEvent(MegaApi *api, MegaSync *sync, MegaSyncEvent *event);
4876 };
4877 
4878 /**
4879  * @brief Provides information about a synchronization
4880  */
4881 class MegaSync
4882 {
4883 public:
4884     enum
4885     {
4886         SYNC_FAILED = -2,
4887         SYNC_CANCELED = -1,
4888         SYNC_INITIALSCAN = 0,
4889         SYNC_ACTIVE
4890     };
4891 
4892     virtual ~MegaSync();
4893 
4894     /**
4895      * @brief Creates a copy of this MegaSync object
4896      *
4897      * The resulting object is fully independent of the source MegaSync,
4898      * it contains a copy of all internal attributes, so it will be valid after
4899      * the original object is deleted.
4900      *
4901      * You are the owner of the returned object
4902      *
4903      * @return Copy of the MegaError object
4904      */
4905     virtual MegaSync *copy();
4906 
4907     /**
4908      * @brief Get the handle of the folder that is being synced
4909      * @return Handle of the folder that is being synced in MEGA
4910      */
4911     virtual MegaHandle getMegaHandle() const;
4912 
4913     /**
4914      * @brief Get the path of the local folder that is being synced
4915      *
4916      * The SDK retains the ownership of the returned value. It will be valid until
4917      * the MegaSync object is deleted.
4918      *
4919      * @return Local folder that is being synced
4920      */
4921     virtual const char* getLocalFolder() const;
4922 
4923     /**
4924      * @brief Gets an unique identifier of the local folder that is being synced
4925      * @return Unique identifier of the local folder that is being synced
4926      */
4927     virtual long long getLocalFingerprint() const;
4928 
4929     /**
4930      * @brief Returns the identifier of this synchronization
4931      *
4932      * Identifiers of synchronizations are always negative numbers.
4933      *
4934      * @return Identifier of the synchronization
4935      */
4936     virtual int getTag() const;
4937 
4938     /**
4939      * @brief Get the state of the synchronization
4940      *
4941      * Possible values are:
4942      * - SYNC_FAILED = -2
4943      * The synchronization has failed and has been disabled
4944      *
4945      * - SYNC_CANCELED = -1,
4946      * The synchronization has failed and has been disabled
4947      *
4948      * - SYNC_INITIALSCAN = 0,
4949      * The synchronization is doing the initial scan
4950      *
4951      * - SYNC_ACTIVE
4952      * The synchronization is active
4953      *
4954      * @return State of the synchronization
4955      */
4956     virtual int getState() const;
4957 };
4958 
4959 #endif
4960 
4961 
4962 /**
4963  * @brief Provides information about a backup
4964  *
4965  * Developers can use listeners (MegaListener, MegaBackupListener)
4966  * to track the progress of each backup. MegaBackup objects are provided in callbacks sent
4967  * to these listeners and allow developers to know the state of the backups and their parameters
4968  * and their results.
4969  *
4970  * The implementation will receive callbacks from an internal worker thread.
4971  *
4972  **/
4973 class MegaBackupListener
4974 {
4975 public:
4976 
4977     virtual ~MegaBackupListener();
4978 
4979     /**
4980      * @brief This function is called when the state of the backup changes
4981      *
4982      * The SDK calls this function when the state of the backup changes, for example
4983      * from 'active' to 'ongoing' or 'removing exceeding'.
4984      *
4985      * You can use MegaBackup::getState to get the new state.
4986      *
4987      * @param api MegaApi object that is backing up files
4988      * @param backup MegaBackup object that has changed the state
4989      */
4990     virtual void onBackupStateChanged(MegaApi *api, MegaBackup *backup);
4991 
4992     /**
4993      * @brief This function is called when a backup is about to start being processed
4994      *
4995      * The SDK retains the ownership of the backup parameter.
4996      * Don't use it after this functions returns.
4997      *
4998      * The api object is the one created by the application, it will be valid until
4999      * the application deletes it.
5000      *
5001      * @param api MegaApi object that started the backup
5002      * @param backup Information about the backup
5003      */
5004     virtual void onBackupStart(MegaApi *api, MegaBackup *backup);
5005 
5006     /**
5007      * @brief This function is called when a backup has finished
5008      *
5009      * The SDK retains the ownership of the backup and error parameters.
5010      * Don't use them after this functions returns.
5011      *
5012      * The api object is the one created by the application, it will be valid until
5013      * the application deletes it.
5014      *
5015      * There won't be more callbacks about this backup.
5016      * The last parameter provides the result of the backup:
5017      * If the backup finished without problems,
5018      * the error code will be API_OK.
5019      * If some transfer failed, the error code will be API_EINCOMPLETE.
5020      * If the backup has been skipped the error code will be API_EEXPIRED.
5021      * If the backup folder cannot be found, the error will be API_ENOENT.
5022      *
5023      *
5024      * @param api MegaApi object that started the backup
5025      * @param backup Information about the backup
5026      * @param error Error information
5027      */
5028     virtual void onBackupFinish(MegaApi* api, MegaBackup *backup, MegaError* error);
5029 
5030     /**
5031      * @brief This function is called to inform about the progress of a backup
5032      *
5033      * The SDK retains the ownership of the backup parameter.
5034      * Don't use it after this functions returns.
5035      *
5036      * The api object is the one created by the application, it will be valid until
5037      * the application deletes it.
5038      *
5039      * @param api MegaApi object that started the backup
5040      * @param backup Information about the backup
5041      *
5042      * @see MegaBackup::getTransferredBytes, MegaBackup::getSpeed
5043      */
5044     virtual void onBackupUpdate(MegaApi *api, MegaBackup *backup);
5045 
5046     /**
5047      * @brief This function is called when there is a temporary error processing a backup
5048      *
5049      * The backup continues after this callback, so expect more MegaBackupListener::onBackupTemporaryError or
5050      * a MegaBackupListener::onBackupFinish callback
5051      *
5052      * The SDK retains the ownership of the backup and error parameters.
5053      * Don't use them after this functions returns.
5054      *
5055      * @param api MegaApi object that started the backup
5056      * @param backup Information about the backup
5057      * @param error Error information
5058      */
5059     virtual void onBackupTemporaryError(MegaApi *api, MegaBackup *backup, MegaError* error);
5060 
5061 };
5062 
5063 
5064 /**
5065  * @brief Provides information about a backup
5066  */
5067 class MegaBackup
5068 {
5069 public:
5070     enum
5071     {
5072         BACKUP_FAILED = -2,
5073         BACKUP_CANCELED = -1,
5074         BACKUP_INITIALSCAN = 0,
5075         BACKUP_ACTIVE,
5076         BACKUP_ONGOING,
5077         BACKUP_SKIPPING,
5078         BACKUP_REMOVING_EXCEEDING
5079     };
5080 
5081     virtual ~MegaBackup();
5082 
5083     /**
5084      * @brief Creates a copy of this MegaBackup object
5085      *
5086      * The resulting object is fully independent of the source MegaBackup,
5087      * it contains a copy of all internal attributes, so it will be valid after
5088      * the original object is deleted.
5089      *
5090      * You are the owner of the returned object
5091      *
5092      * @return Copy of the MegaBackup object
5093      */
5094     virtual MegaBackup *copy();
5095 
5096     /**
5097      * @brief Get the handle of the folder that is being backed up
5098      * @return Handle of the folder that is being backed up in MEGA
5099      */
5100     virtual MegaHandle getMegaHandle() const;
5101 
5102     /**
5103      * @brief Get the path of the local folder that is being backed up
5104      *
5105      * The SDK retains the ownership of the returned value. It will be valid until
5106      * the MegaBackup object is deleted.
5107      *
5108      * @return Local folder that is being backed up
5109      */
5110     virtual const char* getLocalFolder() const;
5111 
5112     /**
5113      * @brief Returns the identifier of this backup
5114      *
5115      * @return Identifier of the backup
5116      */
5117     virtual int getTag() const;
5118 
5119     /**
5120      * @brief Returns if backups that should have happen in the past should be taken care of
5121      *
5122      * @return Whether past backups should be taken care of
5123      */
5124     virtual bool getAttendPastBackups() const;
5125 
5126     /**
5127      * @brief Returns the period of the backup
5128      *
5129      * @return The period of the backup in deciseconds
5130      */
5131     virtual int64_t getPeriod() const;
5132 
5133     /**
5134      * @brief Returns the period string of the backup
5135      * 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.
5136      *
5137      * Period is formatted as follows
5138      *  - - - - - -
5139      *  | | | | | |
5140      *  | | | | | |
5141      *  | | | | | +---- Day of the Week   (range: 1-7, 1 standing for Monday)
5142      *  | | | | +------ Month of the Year (range: 1-12)
5143      *  | | | +-------- Day of the Month  (range: 1-31)
5144      *  | | +---------- Hour              (range: 0-23)
5145      *  | +------------ Minute            (range: 0-59)
5146      *  +-------------- Second            (range: 0-59)
5147      *
5148      * E.g:
5149      * - daily at 04:00:00 (UTC): "0 0 4 * * *"
5150      * - every 15th day at 00:00:00 (UTC) "0 0 0 15 * *"
5151      * - mondays at 04.30.00 (UTC): "0 30 4 * * 1"
5152      *
5153      * @return The period string of the backup
5154      */
5155     virtual const char *getPeriodString() const;
5156 
5157     /**
5158      * @brief Returns the next absolute timestamp of the next backup.
5159      * @param oldStartTimeAbsolute Reference timestamp of the previous backup. If none provided it'll use current one.
5160      *
5161      * Successive nested calls to this functions will give you a full schedule of the next backups.
5162      *
5163      * Timestamp measures are given in number of seconds that elapsed since January 1, 1970 (midnight UTC/GMT),
5164      * not counting leap seconds (in ISO 8601: 1970-01-01T00:00:00Z).
5165      *
5166      * @return timestamp of the next backup.
5167      */
5168     virtual long long getNextStartTime(long long oldStartTimeAbsolute = -1) const;
5169 
5170 
5171     /**
5172      * @brief Returns the number of backups to keep
5173      *
5174      * @return Maximun number of Backups to store
5175      */
5176     virtual int getMaxBackups() const;
5177 
5178     /**
5179      * @brief Get the state of the backup
5180      *
5181      * Possible values are:
5182      * - BACKUP_FAILED = -2
5183      * The backup has failed and has been disabled
5184      *
5185      * - BACKUP_CANCELED = -1,
5186      * The backup has failed and has been disabled
5187      *
5188      * - BACKUP_INITIALSCAN = 0,
5189      * The backup is doing the initial scan
5190      *
5191      * - BACKUP_ACTIVE
5192      * The backup is active
5193      *
5194      * - BACKUP_ONGOING
5195      * A backup is being performed
5196      *
5197      * - BACKUP_SKIPPING
5198      * A backup is being skipped
5199      *
5200      * - BACKUP_REMOVING_EXCEEDING
5201      * The backup is active and an exceeding backup is being removed
5202      * @return State of the backup
5203      */
5204     virtual int getState() const;
5205 
5206 
5207     // Current backup data:
5208     /**
5209      * @brief Returns the number of folders created in the backup
5210      * @return number of folders created in the backup
5211      */
5212     virtual long long getNumberFolders() const;
5213 
5214     /**
5215      * @brief Returns the number of files created in the backup
5216      * @return number of files created in the backup
5217      */
5218     virtual long long getNumberFiles() const;
5219 
5220     /**
5221      * @brief Returns the number of files to be created in the backup
5222      * @return number of files to be created in the backup
5223      */
5224     virtual long long getTotalFiles() const;
5225 
5226     /**
5227      * @brief Returns the starting time of the current backup being processed (in deciseconds)
5228      *
5229      * The returned value is a monotonic time since some unspecified starting point expressed in
5230      * deciseconds.
5231      *
5232      * @return Starting time of the backup (in deciseconds)
5233      */
5234     virtual int64_t getCurrentBKStartTime() const;
5235 
5236     /**
5237      * @brief Returns the number of transferred bytes during last backup
5238      * @return Transferred bytes during this backup
5239      */
5240     virtual long long getTransferredBytes() const;
5241 
5242     /**
5243      * @brief Returns the total bytes to be transferred to complete last backup
5244      * @return Total bytes to be transferred to complete the backup
5245      */
5246     virtual long long getTotalBytes() const;
5247 
5248     /**
5249      * @brief Returns the current speed of last backup
5250      * @return Current speed of this backup
5251      */
5252     virtual long long getSpeed() const;
5253 
5254     /**
5255      * @brief Returns the average speed of last backup
5256      * @return Average speed of this backup
5257      */
5258     virtual long long getMeanSpeed() const;
5259 
5260     /**
5261      * @brief Returns the timestamp when the last data was received (in deciseconds)
5262      *
5263      * This timestamp doesn't have a defined starting point. Use the difference between
5264      * the return value of this function and MegaBackup::getCurrentBKStartTime to know how
5265      * much time the backup has been running.
5266      *
5267      * @return Timestamp when the last data was received (in deciseconds)
5268      */
5269     virtual int64_t getUpdateTime() const;
5270 
5271     /**
5272      * @brief Returns the list with the transfers that have failed for during last backup
5273      *
5274      * You take the ownership of the returned value
5275      *
5276      * @return Names of the custom attributes of the node
5277      * @see MegaApi::setCustomNodeAttribute
5278      */
5279     virtual MegaTransferList *getFailedTransfers();
5280 };
5281 
5282 
5283 /**
5284  * @brief Provides information about an error
5285  */
5286 class MegaError
5287 {
5288 public:
5289     /**
5290      * @brief Declaration of API error codes.
5291      */
5292     enum
5293     {
5294         API_OK = 0,                     ///< Everything OK
5295         API_EINTERNAL = -1,             ///< Internal error.
5296         API_EARGS = -2,                 ///< Bad arguments.
5297         API_EAGAIN = -3,                ///< Request failed, retry with exponential back-off.
5298         API_ERATELIMIT = -4,            ///< Too many requests, slow down.
5299         API_EFAILED = -5,               ///< Request failed permanently.
5300         API_ETOOMANY = -6,              ///< Too many requests for this resource.
5301         API_ERANGE = -7,                ///< Resource access out of range.
5302         API_EEXPIRED = -8,              ///< Resource expired.
5303         API_ENOENT = -9,                ///< Resource does not exist.
5304         API_ECIRCULAR = -10,            ///< Circular linkage.
5305         API_EACCESS = -11,              ///< Access denied.
5306         API_EEXIST = -12,               ///< Resource already exists.
5307         API_EINCOMPLETE = -13,          ///< Request incomplete.
5308         API_EKEY = -14,                 ///< Cryptographic error.
5309         API_ESID = -15,                 ///< Bad session ID.
5310         API_EBLOCKED = -16,             ///< Resource administratively blocked.
5311         API_EOVERQUOTA = -17,           ///< Quota exceeded.
5312         API_ETEMPUNAVAIL = -18,         ///< Resource temporarily not available.
5313         API_ETOOMANYCONNECTIONS = -19,  ///< Too many connections on this resource.
5314         API_EWRITE = -20,               ///< File could not be written to (or failed post-write integrity check).
5315         API_EREAD = -21,                ///< File could not be read from (or changed unexpectedly during reading).
5316         API_EAPPKEY = -22,              ///< Invalid or missing application key.
5317         API_ESSL = -23,                 ///< SSL verification failed
5318         API_EGOINGOVERQUOTA = -24,      ///< Not enough quota
5319         API_EMFAREQUIRED = -26,         ///< Multi-factor authentication required
5320         API_EMASTERONLY = -27,          ///< Access denied for sub-users (only for business accounts)
5321         API_EBUSINESSPASTDUE = -28,     ///< Business account expired
5322         API_EPAYWALL = -29,             ///< Over Disk Quota Paywall
5323 
5324         PAYMENT_ECARD = -101,
5325         PAYMENT_EBILLING = -102,
5326         PAYMENT_EFRAUD = -103,
5327         PAYMENT_ETOOMANY = -104,
5328         PAYMENT_EBALANCE = -105,
5329         PAYMENT_EGENERIC = -106
5330     };
5331 
5332 
5333     /**
5334      * @brief Api error code context.
5335      */
5336     enum ErrorContexts
5337     {
5338         API_EC_DEFAULT = 0,         ///< Default error code context
5339         API_EC_DOWNLOAD = 1,        ///< Download transfer context.
5340         API_EC_IMPORT = 2,          ///< Import context.
5341         API_EC_UPLOAD = 3,          ///< Upload transfer context.
5342     };
5343 
5344     /**
5345      * @brief User custom error details
5346      */
5347     enum UserErrorCode
5348     {
5349         USER_ETD_UNKNOWN = -1,      ///< Unknown state
5350         USER_ETD_SUSPENSION = 7,    ///< Account suspend by an ETD/ToS 'severe'
5351     };
5352 
5353     /**
5354      * @brief Link custom error details
5355      */
5356     enum LinkErrorCode
5357     {
5358         LINK_UNKNOWN = -1,      ///< Unknown state
5359         LINK_UNDELETED = 0,     ///< Link is undeleted
5360         LINK_DELETED_DOWN = 1,  ///< Link is deleted or down
5361         LINK_DOWN_ETD = 2,      ///< Link is down due to an ETD specifically
5362     };
5363 
5364         virtual ~MegaError();
5365 
5366         /**
5367          * @brief Creates a copy of this MegaError object
5368          *
5369          * The resulting object is fully independent of the source MegaError,
5370          * it contains a copy of all internal attributes, so it will be valid after
5371          * the original object is deleted.
5372          *
5373          * You are the owner of the returned object
5374          *
5375          * @return Copy of the MegaError object
5376          */
5377         virtual MegaError* copy() const;
5378 
5379 
5380 		/**
5381 		 * @brief Returns the error code associated with this MegaError
5382          *
5383 		 * @return Error code associated with this MegaError
5384 		 */
5385         virtual int getErrorCode() const;
5386 
5387         /**
5388          * @brief Returns a value associated with the error
5389          *
5390          * Currently, this value is only useful when it is related to an API_EOVERQUOTA
5391          * error related to a transfer. In that case, it's the number of seconds until
5392          * the more bandwidth will be available for the account.
5393          *
5394          * In any other case, this value will be 0
5395          *
5396          * @return Value associated with the error
5397          */
5398         virtual long long getValue() const;
5399 
5400         /**
5401          * @brief Returns true if error has extra info
5402          *
5403          * @note This method can return true for:
5404          *   - MegaRequest::TYPE_FETCH_NODES with error ENOENT
5405          *   - MegaRequest::TYPE_GET_PUBLIC_NODE with error ETOOMANY
5406          *   - MegaRequest::TYPE_IMPORT_LINK with error ETOOMANY
5407          *   - MegaTransferListener::onTransferFinish with error ETOOMANY
5408          *
5409          * @return True if error has extra info
5410          */
5411         virtual bool hasExtraInfo() const;
5412 
5413         /**
5414          * @brief Returns the user status
5415          *
5416          * This method only returns a valid value when hasExtraInfo is true
5417          * Possible values:
5418          *  MegaError::UserErrorCode::USER_ETD_SUSPENSION
5419          *
5420          * Otherwise, it returns MegaError::UserErrorCode::USER_ETD_UNKNOWN
5421          *
5422          * @return user status
5423          */
5424         virtual long long getUserStatus() const;
5425 
5426         /**
5427          * @brief Returns the link status
5428          *
5429          * This method only returns a valid value when hasExtraInfo is true
5430          * Possible values:
5431          *  MegaError::LinkErrorCode::LINK_UNDELETED
5432          *  MegaError::LinkErrorCode::LINK_DELETED_DOWN
5433          *  MegaError::LinkErrorCode::LINK_DOWN_ETD
5434          *
5435          * Otherwise, it returns MegaError::LinkErrorCode::LINK_UNKNOWN
5436          *
5437          * @return link status
5438          */
5439         virtual long long getLinkStatus() const;
5440 
5441 		/**
5442 		 * @brief Returns a readable description of the error
5443 		 *
5444 		 * This function returns a pointer to a statically allocated buffer.
5445 		 * You don't have to free the returned pointer
5446 		 *
5447 		 * @return Readable description of the error
5448 		 */
5449         virtual const char* getErrorString() const;
5450 
5451 		/**
5452 		 * @brief Returns a readable description of the error
5453 		 *
5454 		 * This function returns a pointer to a statically allocated buffer.
5455 		 * You don't have to free the returned pointer
5456 		 *
5457 		 * This function provides exactly the same result as MegaError::getErrorString.
5458 		 * It's provided for a better Java compatibility
5459 		 *
5460 		 * @return Readable description of the error
5461 		 */
5462         virtual const char* toString() const;
5463 
5464 		/**
5465 		 * @brief Returns a readable description of the error
5466 		 *
5467 		 * This function returns a pointer to a statically allocated buffer.
5468 		 * You don't have to free the returned pointer
5469 		 *
5470 		 * This function provides exactly the same result as MegaError::getErrorString.
5471 		 * It's provided for a better Python compatibility
5472 		 *
5473 		 * @return Readable description of the error
5474 		 */
5475         virtual const char* __str__() const;
5476 
5477 		/**
5478 		 * @brief Returns a readable description of the error
5479 		 *
5480 		 * This function returns a pointer to a statically allocated buffer.
5481 		 * You don't have to free the returned pointer
5482 		 *
5483 		 * This function provides exactly the same result as MegaError::getErrorString.
5484 		 * It's provided for a better PHP compatibility
5485 		 *
5486 		 * @return Readable description of the error
5487 		 */
5488         virtual const char* __toString() const;
5489 
5490 		/**
5491 		 * @brief Provides the error description associated with an error code
5492 		 *
5493 		 * This function returns a pointer to a statically allocated buffer.
5494 		 * You don't have to free the returned pointer
5495 		 *
5496 		 * @param errorCode Error code for which the description will be returned
5497 		 * @return Description associated with the error code
5498 		 */
5499         static const char *getErrorString(int errorCode);
5500 
5501         /**
5502          * @brief Provides the error description associated with an error code
5503          * given a certain context.
5504          *
5505          * This function returns a pointer to a statically allocated buffer.
5506          * You don't have to free the returned pointer
5507          *
5508          * @param errorCode Error code for which the description will be returned
5509          * @param context Context to provide a more accurate description (MegaError::ErrorContexts)
5510          * @return Description associated with the error code
5511          */
5512         static const char *getErrorString(int errorCode, ErrorContexts context);
5513 
5514 
5515 protected:
5516         MegaError(int e);
5517 
5518         //< 0 = API error code, > 0 = http error, 0 = No error
5519         int errorCode;
5520 
5521         friend class MegaTransfer;
5522         friend class MegaApiImpl;
5523 };
5524 
5525 /**
5526  * @brief Interface to process node trees
5527  *
5528  * An implementation of this class can be used to process a node tree passing a pointer to
5529  * MegaApi::processMegaTree
5530  *
5531  * The implementation will receive callbacks from an internal worker thread.
5532  *
5533  */
5534 class MegaTreeProcessor
5535 {
5536     public:
5537         /**
5538          * @brief Function that will be called for all nodes in a node tree
5539          * @param node Node to be processed
5540          * @return true to continue processing nodes, false to stop
5541          */
5542         virtual bool processMegaNode(MegaNode* node);
5543         virtual ~MegaTreeProcessor();
5544 };
5545 
5546 /**
5547  * @brief Interface to receive information about requests
5548  *
5549  * All requests allows to pass a pointer to an implementation of this interface in the last parameter.
5550  * You can also get information about all requests using MegaApi::addRequestListener
5551  *
5552  * MegaListener objects can also receive information about requests
5553  *
5554  * This interface uses MegaRequest objects to provide information of requests. Take into account that not all
5555  * fields of MegaRequest objects are valid for all requests. See the documentation about each request to know
5556  * which fields contain useful information for each one.
5557  *
5558  * The implementation will receive callbacks from an internal worker thread.
5559  *
5560  */
5561 class MegaRequestListener
5562 {
5563     public:
5564         /**
5565          * @brief This function is called when a request is about to start being processed
5566          *
5567          * The SDK retains the ownership of the request parameter.
5568          * Don't use it after this functions returns.
5569          *
5570          * The api object is the one created by the application, it will be valid until
5571          * the application deletes it.
5572          *
5573          * @param api MegaApi object that started the request
5574          * @param request Information about the request
5575          */
5576         virtual void onRequestStart(MegaApi* api, MegaRequest *request);
5577 
5578         /**
5579          * @brief This function is called when a request has finished
5580          *
5581          * There won't be more callbacks about this request.
5582          * The last parameter provides the result of the request. If the request finished without problems,
5583          * the error code will be API_OK
5584          *
5585          * The SDK retains the ownership of the request and error parameters.
5586          * Don't use them after this functions returns.
5587          *
5588          * The api object is the one created by the application, it will be valid until
5589          * the application deletes it.
5590          *
5591          * @param api MegaApi object that started the request
5592          * @param request Information about the request
5593          * @param e Error information
5594          */
5595         virtual void onRequestFinish(MegaApi* api, MegaRequest *request, MegaError* e);
5596 
5597         /**
5598          * @brief This function is called to inform about the progres of a request
5599          *
5600          * Currently, this callback is only used for fetchNodes (MegaRequest::TYPE_FETCH_NODES) requests
5601          *
5602          * The SDK retains the ownership of the request parameter.
5603          * Don't use it after this functions returns.
5604          *
5605          * The api object is the one created by the application, it will be valid until
5606          * the application deletes it.
5607          *
5608          *
5609          * @param api MegaApi object that started the request
5610          * @param request Information about the request
5611          * @see MegaRequest::getTotalBytes MegaRequest::getTransferredBytes
5612          */
5613         virtual void onRequestUpdate(MegaApi*api, MegaRequest *request);
5614 
5615         /**
5616          * @brief This function is called when there is a temporary error processing a request
5617          *
5618          * The request continues after this callback, so expect more MegaRequestListener::onRequestTemporaryError or
5619          * a MegaRequestListener::onRequestFinish callback
5620          *
5621          * The SDK retains the ownership of the request and error parameters.
5622          * Don't use them after this functions returns.
5623          *
5624          * The api object is the one created by the application, it will be valid until
5625          * the application deletes it.
5626          *
5627          * @param api MegaApi object that started the request
5628          * @param request Information about the request
5629          * @param error Error information
5630          */
5631         virtual void onRequestTemporaryError(MegaApi *api, MegaRequest *request, MegaError* error);
5632         virtual ~MegaRequestListener();
5633 };
5634 
5635 /**
5636  * @brief This class extendes the functionality of MegaRequestListener
5637  * allowing a synchronous behaviour
5638  * It can be used the same way as a MegaRequestListener by overriding doOnRequestFinish
5639  * instead of onRequestFinish. This function will be called
5640  * when onRequestFinish is called by the SDK.
5641  *
5642  * For a synchronous usage, a client for this listener may wait() until the request is finished and doOnRequestFinish is completed.
5643  * Alternatively a trywait function is included which waits for an amount of time or until the request is finished.
5644  * Then it can gather the MegaError and MegaRequest objects to process the outcome of the request.
5645  *
5646  * @see MegaRequestListener
5647  */
5648 class SynchronousRequestListener : public MegaRequestListener
5649 {
5650 private:
5651     MegaSemaphore* semaphore;
5652     void onRequestFinish(MegaApi *api, MegaRequest *request, MegaError *error);
5653 
5654 protected:
5655     MegaRequestListener *listener;
5656     MegaApi *megaApi;
5657     MegaRequest *megaRequest;
5658     MegaError *megaError;
5659 
5660 public:
5661     SynchronousRequestListener();
5662 
5663     /**
5664      * @brief This function is called when a request has finished
5665      *
5666      * There won't be more callbacks about this request.
5667      * The last parameter provides the result of the request. If the request finished without problems,
5668      * the error code will be API_OK
5669      *
5670      * The SDK retains the ownership of the request and error parameters.
5671      * Don't use them after this functions returns.
5672      *
5673      * The api object is the one created by the application, it will be valid until
5674      * the application deletes it.
5675      *
5676      * @param api MegaApi object that started the request
5677      * @param request Information about the request
5678      * @param error Error information
5679      */
5680     virtual void doOnRequestFinish(MegaApi *api, MegaRequest *request, MegaError *error);
5681 
5682     /**
5683      * @brief Wait untill the request is finished. This means that the request has been processed and
5684      * doOnRequestFinish is completed.
5685      * After successfully waiting for the request to be finished, the caller can use getError() and getRequest()
5686      * to gather the output and errors produced by the request. Thus, implementing the callback doOnRequestFinish
5687      * is not required and the processing can be coded more linearly.
5688      *
5689      */
5690     void wait();
5691 
5692     /**
5693      * @brief Waits untill either the request is finished or the provided time is passed.
5694      *
5695      * After successfully waiting for the request to be finished, the caller can use getError() and getRequest()
5696      * to gather the output and errors produced by the request. Thus, implementing the callback doOnRequestFinish
5697      * is not required and the processing can be coded more linearly.
5698      * @param milliseconds Max number of milliseconds to wait.
5699      * @return returns 0 if the request had finished and a value different to 0 if timeout passed.
5700      */
5701     int trywait(int milliseconds);
5702 
5703     /**
5704      * @brief Get the MegaError object produced by the request.
5705      * The RequestListener retains the ownership of the object and will delete upon its destruction
5706      * @return the error
5707      */
5708     MegaError *getError() const;
5709 
5710     /**
5711      * @brief Get the MegaRequest object produced by the request.
5712      * The RequestListener retains the ownership of the object and will delete upon its destruction
5713      * @return the request
5714      */
5715     MegaRequest *getRequest() const;
5716 
5717     /**
5718      * @brief Getter for the MegaApi object that started the request.
5719      * @return the MegaApi object that started the request.
5720      */
5721     MegaApi *getApi() const;
5722 
5723     virtual ~SynchronousRequestListener();
5724 };
5725 
5726 /**
5727  * @brief Interface to receive information about transfers
5728  *
5729  * All transfers allows to pass a pointer to an implementation of this interface in the last parameter.
5730  * You can also get information about all transfers using MegaApi::addTransferListener
5731  *
5732  * MegaListener objects can also receive information about transfers
5733  *
5734  * The implementation will receive callbacks from an internal worker thread.
5735  *
5736  */
5737 class MegaTransferListener
5738 {
5739     public:
5740         /**
5741          * @brief This function is called when a transfer is about to start being processed
5742          *
5743          * The SDK retains the ownership of the transfer parameter.
5744          * Don't use it after this functions returns.
5745          *
5746          * The api object is the one created by the application, it will be valid until
5747          * the application deletes it.
5748          *
5749          * @param api MegaApi object that started the transfer
5750          * @param transfer Information about the transfer
5751          */
5752         virtual void onTransferStart(MegaApi *api, MegaTransfer *transfer);
5753 
5754         /**
5755          * @brief This function is called when a transfer has finished
5756          *
5757          * The SDK retains the ownership of the transfer and error parameters.
5758          * Don't use them after this functions returns.
5759          *
5760          * The api object is the one created by the application, it will be valid until
5761          * the application deletes it.
5762          *
5763          * There won't be more callbacks about this transfer.
5764          * The last parameter provides the result of the transfer. If the transfer finished without problems,
5765          * the error code will be API_OK
5766          *
5767          * @param api MegaApi object that started the transfer
5768          * @param transfer Information about the transfer
5769          * @param error Error information
5770          */
5771         virtual void onTransferFinish(MegaApi* api, MegaTransfer *transfer, MegaError* error);
5772 
5773         /**
5774          * @brief This function is called to inform about the progress of a transfer
5775          *
5776          * The SDK retains the ownership of the transfer parameter.
5777          * Don't use it after this functions returns.
5778          *
5779          * The api object is the one created by the application, it will be valid until
5780          * the application deletes it.
5781          *
5782          * @param api MegaApi object that started the transfer
5783          * @param transfer Information about the transfer
5784          *
5785          * @see MegaTransfer::getTransferredBytes, MegaTransfer::getSpeed
5786          */
5787         virtual void onTransferUpdate(MegaApi *api, MegaTransfer *transfer);
5788 
5789         /**
5790          * @brief This function is called when there is a temporary error processing a transfer
5791          *
5792          * The transfer continues after this callback, so expect more MegaTransferListener::onTransferTemporaryError or
5793          * a MegaTransferListener::onTransferFinish callback
5794          *
5795          * The SDK retains the ownership of the transfer and error parameters.
5796          * Don't use them after this functions returns.
5797          *
5798          * If the error code is API_EOVERQUOTA we need to call to MegaTransfer::isForeignOverquota to determine if
5799          * our own storage, or a foreign storage is in overquota. If MegaTransfer::isForeignOverquota returns true
5800          * a foreign storage is in overquota, otherwise our own storage is in overquota.
5801          *
5802          * @param api MegaApi object that started the transfer
5803          * @param transfer Information about the transfer
5804          * @param error Error information
5805          */
5806         virtual void onTransferTemporaryError(MegaApi *api, MegaTransfer *transfer, MegaError* error);
5807 
5808         virtual ~MegaTransferListener();
5809 
5810         /**
5811          * @brief This function is called to provide the last read bytes of streaming downloads
5812          *
5813          * This function won't be called for non streaming downloads. You can get the same buffer
5814          * provided by this function in MegaTransferListener::onTransferUpdate, using
5815          * MegaTransfer::getLastBytes MegaTransfer::getDeltaSize.
5816          *
5817          * The SDK retains the ownership of the transfer and buffer parameters.
5818          * Don't use them after this functions returns.
5819          *
5820          * This callback is mainly provided for compatibility with other programming languages.
5821          *
5822          * @param api MegaApi object that started the transfer
5823          * @param transfer Information about the transfer
5824          * @param buffer Buffer with the last read bytes
5825          * @param size Size of the buffer
5826          * @return true to continue the transfer, false to cancel it
5827          *
5828          * @see MegaApi::startStreaming
5829          */
5830         virtual bool onTransferData(MegaApi *api, MegaTransfer *transfer, char *buffer, size_t size);
5831 };
5832 
5833 
5834 /**
5835  * @brief This class extendes the functionality of MegaTransferListener
5836  * allowing a synchronous behaviour
5837  * It can be used the same way as a MegaTransferListener by overriding doOnTransferFinish
5838  * instead of onTransferFinish. This function will be called
5839  * when onTransferFinish is called by the SDK.
5840  *
5841  * For a synchronous usage, a client for this listener may wait() until the transfer is finished and doOnTransferFinish is completed.
5842  * Alternatively a trywait function is included which waits for an amount of time or until the transfer is finished.
5843  * Then it can gather the MegaError and MegaTransfer objects to process the outcome of the transfer.
5844  *
5845  * @see MegaTransferListener
5846  */
5847 class SynchronousTransferListener : public MegaTransferListener
5848 {
5849 private:
5850     MegaSemaphore* semaphore;
5851     void onTransferFinish(MegaApi *api, MegaTransfer *transfer, MegaError *error);
5852 
5853 protected:
5854     MegaTransferListener *listener;
5855     MegaApi *megaApi;
5856     MegaTransfer *megaTransfer;
5857     MegaError *megaError;
5858 
5859 public:
5860     SynchronousTransferListener();
5861 
5862     /**
5863      * @brief This function is called when a transfer has finished
5864      *
5865      * There won't be more callbacks about this transfer.
5866      * The last parameter provides the result of the transfer. If the transfer finished without problems,
5867      * the error code will be API_OK
5868      *
5869      * The SDK retains the ownership of the transfer and error parameters.
5870      * Don't use them after this functions returns.
5871      *
5872      * The api object is the one created by the application, it will be valid until
5873      * the application deletes it.
5874      *
5875      * @param api MegaApi object that started the transfer
5876      * @param transfer Information about the transfer
5877      * @param error Error information
5878      */
5879     virtual void doOnTransferFinish(MegaApi *api, MegaTransfer *transfer, MegaError *error);
5880 
5881     /**
5882      * @brief Wait untill the transfer is finished. This means that the transfer has been processed and
5883      * doOnTransferFinish is completed.
5884      * After successfully waiting for the transfer to be finished, the caller can use getError() and getTransfer()
5885      * to gather the output and errors produced by the transfer. Thus, implementing the callback doOnTransferFinish
5886      * is not required and the processing can be coded more linearly.
5887      *
5888      */
5889     void wait();
5890 
5891     /**
5892      * @brief Waits untill either the transfer is finished or the provided time is passed.
5893      *
5894      * After successfully waiting for the transfer to be finished, the caller can use getError() and getTransfer()
5895      * to gather the output and errors produced by the transfer. Thus, implementing the callback doOnTransferFinish
5896      * is not required and the processing can be coded more linearly.
5897      * @param milliseconds Max number of milliseconds to wait.
5898      * @return returns 0 if the transfer had finished and a value different to 0 if timeout passed.
5899      */
5900     int trywait(int milliseconds);
5901 
5902     /**
5903      * @brief Get the MegaError object produced by the transfer.
5904      * The TransferListener retains the ownership of the object and will delete upon its destruction
5905      * @return the error
5906      */
5907     MegaError *getError() const;
5908 
5909     /**
5910      * @brief Get the MegaTransfer object produced by the transfer.
5911      * The TransferListener retains the ownership of the object and will delete upon its destruction
5912      * @return the transfer
5913      */
5914     MegaTransfer *getTransfer() const;
5915 
5916     /**
5917      * @brief Getter for the MegaApi object that started the transfer.
5918      * @return the MegaApi object that started the transfer.
5919      */
5920     MegaApi *getApi() const;
5921 
5922     virtual ~SynchronousTransferListener();
5923 };
5924 
5925 
5926 
5927 /**
5928  * @brief Interface to get information about global events
5929  *
5930  * You can implement this interface and start receiving events calling MegaApi::addGlobalListener
5931  *
5932  * MegaListener objects can also receive global events
5933  *
5934  * The implementation will receive callbacks from an internal worker thread.
5935  */
5936 class MegaGlobalListener
5937 {
5938     public:
5939         /**
5940          * @brief This function is called when there are new or updated contacts in the account
5941          *
5942          * The SDK retains the ownership of the MegaUserList in the second parameter. The list and all the
5943          * MegaUser objects that it contains will be valid until this function returns. If you want to save the
5944          * list, use MegaUserList::copy. If you want to save only some of the MegaUser objects, use MegaUser::copy
5945          * for those objects.
5946          *
5947          * @param api MegaApi object connected to the account
5948          * @param users List that contains the new or updated contacts
5949          */
5950         virtual void onUsersUpdate(MegaApi* api, MegaUserList *users);
5951 
5952         /**
5953         * @brief This function is called when there are new or updated user alerts in the account
5954         *
5955         * The SDK retains the ownership of the MegaUserAlertList in the second parameter. The list and all the
5956         * MegaUserAlert objects that it contains will be valid until this function returns. If you want to save the
5957         * list, use MegaUserAlertList::copy. If you want to save only some of the MegaUserAlert objects, use MegaUserAlert::copy
5958         * for those objects.
5959         *
5960         * @param api MegaApi object connected to the account
5961         * @param alerts List that contains the new or updated alerts
5962         */
5963         virtual void onUserAlertsUpdate(MegaApi* api, MegaUserAlertList *alerts);
5964 
5965         /**
5966          * @brief This function is called when there are new or updated nodes in the account
5967          *
5968          * When the full account is reloaded or a large number of server notifications arrives at once, the
5969          * second parameter will be NULL.
5970          *
5971          * The SDK retains the ownership of the MegaNodeList in the second parameter. The list and all the
5972          * MegaNode objects that it contains will be valid until this function returns. If you want to save the
5973          * list, use MegaNodeList::copy. If you want to save only some of the MegaNode objects, use MegaNode::copy
5974          * for those nodes.
5975          *
5976          * @param api MegaApi object connected to the account
5977          * @param nodes List that contains the new or updated nodes
5978          */
5979         virtual void onNodesUpdate(MegaApi* api, MegaNodeList *nodes);
5980 
5981         /**
5982          * @brief This function is called when the account has been updated (confirmed/upgraded/downgraded)
5983          *
5984          * The usage of this callback to handle the external account confirmation is deprecated.
5985          * Instead, you should use MegaGlobalListener::onEvent.
5986          *
5987          * @param api MegaApi object connected to the account
5988          */
5989         virtual void onAccountUpdate(MegaApi *api);
5990 
5991         /**
5992          * @brief This function is called when there are new or updated contact requests in the account
5993          *
5994          * When the full account is reloaded or a large number of server notifications arrives at once, the
5995          * second parameter will be NULL.
5996          *
5997          * The SDK retains the ownership of the MegaContactRequestList in the second parameter. The list and all the
5998          * MegaContactRequest objects that it contains will be valid until this function returns. If you want to save the
5999          * list, use MegaContactRequestList::copy. If you want to save only some of the MegaContactRequest objects, use MegaContactRequest::copy
6000          * for them.
6001          *
6002          * @param api MegaApi object connected to the account
6003          * @param requests List that contains the new or updated contact requests
6004          */
6005         virtual void onContactRequestsUpdate(MegaApi* api, MegaContactRequestList* requests);
6006 
6007         /**
6008          * @brief This function is called when an inconsistency is detected in the local cache
6009          *
6010          * You should call MegaApi::fetchNodes when this callback is received
6011          *
6012          * @param api MegaApi object connected to the account
6013          */
6014         virtual void onReloadNeeded(MegaApi* api);
6015 
6016 #ifdef ENABLE_SYNC
6017         /**
6018          * @brief This function is called with the state of the synchronization engine has changed
6019          *
6020          * You can call MegaApi::isScanning and MegaApi::isWaiting to know the global state
6021          * of the synchronization engine.
6022          *
6023          * @param api MegaApi object related to the event
6024          */
6025         virtual void onGlobalSyncStateChanged(MegaApi* api);
6026 #endif
6027 
6028 #ifdef ENABLE_CHAT
6029         /**
6030          * @brief This function is called when there are new or updated chats
6031          *
6032          * This callback is also used to initialize the list of chats available during the fetchnodes request.
6033          *
6034          * The SDK retains the ownership of the MegaTextChatList in the second parameter. The list and all the
6035          * MegaTextChat objects that it contains will be valid until this function returns. If you want to save the
6036          * list, use MegaTextChatList::copy. If you want to save only some of the MegaTextChat objects, use
6037          * MegaTextChat::copy for those objects.
6038          *
6039          * @param api MegaApi object connected to the account
6040          * @param chats List that contains the new or updated chats
6041          */
6042         virtual void onChatsUpdate(MegaApi* api, MegaTextChatList *chats);
6043 #endif
6044         /**
6045          * The details about the event, like the type of event and optionally any
6046          * additional parameter, is received in the \c params parameter.
6047          *
6048          * You can check the type of event by calling MegaEvent::getType
6049          *
6050          * The SDK retains the ownership of the details of the event (\c event).
6051          * Don't use them after this functions returns.
6052          *
6053          * Currently, the following type of events are notified:
6054          *
6055          *  - MegaEvent::EVENT_COMMIT_DB: when the SDK commits the ongoing DB transaction.
6056          *  This event can be used to keep synchronization between the SDK cache and the
6057          *  cache managed by the app thanks to the sequence number.
6058          *
6059          *  Valid data in the MegaEvent object received in the callback:
6060          *      - MegaEvent::getText: sequence number recorded by the SDK when this event happened
6061          *
6062          *  - MegaEvent::EVENT_ACCOUNT_CONFIRMATION: when a new account is finally confirmed
6063          * by the user by confirming the signup link.
6064          *
6065          *   Valid data in the MegaEvent object received in the callback:
6066          *      - MegaEvent::getText: email address used to confirm the account
6067          *
6068          *  - MegaEvent::EVENT_CHANGE_TO_HTTPS: when the SDK automatically starts using HTTPS for all
6069          * its communications. This happens when the SDK is able to detect that MEGA servers can't be
6070          * reached using HTTP or that HTTP communications are being tampered. Transfers of files and
6071          * file attributes (thumbnails and previews) use HTTP by default to save CPU usage. Since all data
6072          * is already end-to-end encrypted, it's only needed to use HTTPS if HTTP doesn't work. Anyway,
6073          * applications can force the SDK to always use HTTPS using MegaApi::useHttpsOnly. It's recommended
6074          * that applications that receive one of these events save that information on its settings and
6075          * automatically enable HTTPS on next executions of the app to not force the SDK to detect the problem
6076          * and automatically switch to HTTPS every time that the application starts.
6077          *
6078          *  - MegaEvent::EVENT_DISCONNECT: when the SDK performs a disconnect to reset all the
6079          * existing open-connections, since they have become unusable. It's recommended that the app
6080          * receiving this event reset its connections with other servers, since the disconnect
6081          * performed by the SDK is due to a network change or IP addresses becoming invalid.
6082          *
6083          *  - MegaEvent::EVENT_ACCOUNT_BLOCKED: when the account get blocked, typically because of
6084          * infringement of the Mega's terms of service repeatedly. This event is followed by an automatic
6085          * logout, except for the temporary blockings (ACCOUNT_BLOCKED_VERIFICATION_SMS and
6086          * ACCOUNT_BLOCKED_VERIFICATION_EMAIL)
6087          *
6088          *  Valid data in the MegaEvent object received in the callback:
6089          *      - MegaEvent::getText: message to show to the user.
6090          *      - MegaEvent::getNumber: code representing the reason for being blocked.
6091          *
6092          *          - MegaApi::ACCOUNT_BLOCKED_TOS_NON_COPYRIGHT = 200
6093          *              Suspension message for any type of suspension, but copyright suspension.
6094          *
6095          *          - MegaApi::ACCOUNT_BLOCKED_TOS_COPYRIGHT = 300
6096          *              Suspension only for multiple copyright violations.
6097          *
6098          *          - MegaApi::ACCOUNT_BLOCKED_SUBUSER_DISABLED = 400
6099          *              Subuser of the business account has been disabled.
6100          *
6101          *          - MegaApi::ACCOUNT_BLOCKED_SUBUSER_REMOVED = 401
6102          *              Subuser of business account has been removed.
6103          *
6104          *          - MegaApi::ACCOUNT_BLOCKED_VERIFICATION_SMS = 500
6105          *              The account is temporary blocked and needs to be verified by an SMS code.
6106          *
6107          *          - MegaApi::ACCOUNT_BLOCKED_VERIFICATION_EMAIL = 700
6108          *              The account is temporary blocked and needs to be verified by email (Weak Account Protection).
6109          *
6110          * - MegaEvent::EVENT_STORAGE: when the status of the storage changes.
6111          *
6112          * For this event type, MegaEvent::getNumber provides the current status of the storage
6113          *
6114          * There are three possible storage states:
6115          *     - MegaApi::STORAGE_STATE_GREEN = 0
6116          *     There are no storage problems
6117          *
6118          *     - MegaApi::STORAGE_STATE_ORANGE = 1
6119          *     The account is almost full
6120          *
6121          *     - MegaApi::STORAGE_STATE_RED = 2
6122          *     The account is full. Uploads have been stopped
6123          *
6124          *     - MegaApi::STORAGE_STATE_CHANGE = 3
6125          *     There is a possible significant change in the storage state.
6126          *     It's needed to call MegaApi::getAccountDetails to check the storage status.
6127          *     After calling it, this callback will be called again with the corresponding
6128          *     state if there is really a change.
6129          *
6130          *     - MegaApi::STORAGE_STATE_PAYWALL = 4
6131          *     The account has been full for a long time. Now most of actions are disallowed.
6132          *     It's needed to call MegaApi::getUserData in order to retrieve the deadline/warnings
6133          *     timestamps. @see MegaApi::getOverquotaDeadlineTs and MegaApi::getOverquotaWarningsTs.
6134          *
6135          * - MegaEvent::EVENT_NODES_CURRENT: when all external changes have been received
6136          *
6137          * - MegaEvent::EVENT_MEDIA_INFO_READY: when codec-mappings have been received
6138          *
6139          * - MegaEvent::EVENT_STORAGE_SUM_CHANGED: when the storage sum has changed.
6140          *
6141          * For this event type, MegaEvent::getNumber provides the new storage sum.
6142          *
6143          * - MegaEvent::EVENT_BUSINESS_STATUS: when the status of a business account has changed.
6144          *
6145          * For this event type, MegaEvent::getNumber provides the new business status.
6146          *
6147          * The posible values are:
6148          *  - BUSINESS_STATUS_EXPIRED = -1
6149          *  - BUSINESS_STATUS_INACTIVE = 0
6150          *  - BUSINESS_STATUS_ACTIVE = 1
6151          *  - BUSINESS_STATUS_GRACE_PERIOD = 2
6152          *
6153          * - MegaEvent::EVENT_KEY_MODIFIED: when the key of a user has changed.
6154          *
6155          * For this event type, MegaEvent::getHandle provides the handle of the user whose key has been modified.
6156          * For this event type, MegaEvent::getNumber provides type of key that has been modified.
6157          *
6158          * The posible values are:
6159          *  - Public chat key (Cu25519)     = 0
6160          *  - Public signing key (Ed25519)  = 1
6161          *  - Public RSA key                = 2
6162          *  - Signature of chat key         = 3
6163          *  - Signature of RSA key          = 4
6164          *
6165          * - MegaEvent::EVENT_MISC_FLAGS_READY: when the miscellaneous flags are available/updated.
6166          *
6167          * @param api MegaApi object connected to the account
6168          * @param event Details about the event
6169          */
6170         virtual void onEvent(MegaApi* api, MegaEvent *event);
6171 
6172         virtual ~MegaGlobalListener();
6173 };
6174 
6175 /**
6176  * @brief Interface to get all information related to a MEGA account
6177  *
6178  * Implementations of this interface can receive all events (request, transfer, global) and two
6179  * additional events related to the synchronization engine. The SDK will provide a new interface
6180  * to get synchronization events separately in future updates-
6181  *
6182  * Multiple inheritance isn't used for compatibility with other programming languages
6183  *
6184  * The implementation will receive callbacks from an internal worker thread.
6185  *
6186  */
6187 class MegaListener
6188 {
6189     public:
6190         /**
6191          * @brief This function is called when a request is about to start being processed
6192          *
6193          * The SDK retains the ownership of the request parameter.
6194          * Don't use it after this functions returns.
6195          *
6196          * The api object is the one created by the application, it will be valid until
6197          * the application deletes it.
6198          *
6199          * @param api MegaApi object that started the request
6200          * @param request Information about the request
6201          */
6202         virtual void onRequestStart(MegaApi* api, MegaRequest *request);
6203 
6204         /**
6205          * @brief This function is called when a request has finished
6206          *
6207          * There won't be more callbacks about this request.
6208          * The last parameter provides the result of the request. If the request finished without problems,
6209          * the error code will be API_OK
6210          *
6211          * The SDK retains the ownership of the request and error parameters.
6212          * Don't use them after this functions returns.
6213          *
6214          * The api object is the one created by the application, it will be valid until
6215          * the application deletes it.
6216          *
6217          * @param api MegaApi object that started the request
6218          * @param request Information about the request
6219          * @param e Error information
6220          */
6221         virtual void onRequestFinish(MegaApi* api, MegaRequest *request, MegaError* e);
6222 
6223         /**
6224          * @brief This function is called to inform about the progres of a request
6225          *
6226          * Currently, this callback is only used for fetchNodes (MegaRequest::TYPE_FETCH_NODES) requests
6227          *
6228          * The SDK retains the ownership of the request parameter.
6229          * Don't use it after this functions returns.
6230          *
6231          * The api object is the one created by the application, it will be valid until
6232          * the application deletes it.
6233          *
6234          *
6235          * @param api MegaApi object that started the request
6236          * @param request Information about the request
6237          * @see MegaRequest::getTotalBytes MegaRequest::getTransferredBytes
6238          */
6239         virtual void onRequestUpdate(MegaApi*api, MegaRequest *request);
6240 
6241         /**
6242          * @brief This function is called when there is a temporary error processing a request
6243          *
6244          * The request continues after this callback, so expect more MegaRequestListener::onRequestTemporaryError or
6245          * a MegaRequestListener::onRequestFinish callback
6246          *
6247          * The SDK retains the ownership of the request and error parameters.
6248          * Don't use them after this functions returns.
6249          *
6250          * The api object is the one created by the application, it will be valid until
6251          * the application deletes it.
6252          *
6253          * @param api MegaApi object that started the request
6254          * @param request Information about the request
6255          * @param error Error information
6256          */
6257         virtual void onRequestTemporaryError(MegaApi *api, MegaRequest *request, MegaError* error);
6258 
6259         /**
6260          * @brief This function is called when a transfer is about to start being processed
6261          *
6262          * The SDK retains the ownership of the transfer parameter.
6263          * Don't use it after this functions returns.
6264          *
6265          * The api object is the one created by the application, it will be valid until
6266          * the application deletes it.
6267          *
6268          * @param api MegaApi object that started the request
6269          * @param transfer Information about the transfer
6270          */
6271         virtual void onTransferStart(MegaApi *api, MegaTransfer *transfer);
6272 
6273         /**
6274          * @brief This function is called when a transfer has finished
6275          *
6276          * The SDK retains the ownership of the transfer and error parameters.
6277          * Don't use them after this functions returns.
6278          *
6279          * The api object is the one created by the application, it will be valid until
6280          * the application deletes it.
6281          *
6282          * There won't be more callbacks about this transfer.
6283          * The last parameter provides the result of the transfer. If the transfer finished without problems,
6284          * the error code will be API_OK
6285          *
6286          * @param api MegaApi object that started the transfer
6287          * @param transfer Information about the transfer
6288          * @param error Error information
6289          */
6290         virtual void onTransferFinish(MegaApi* api, MegaTransfer *transfer, MegaError* error);
6291 
6292         /**
6293          * @brief This function is called to inform about the progress of a transfer
6294          *
6295          * The SDK retains the ownership of the transfer parameter.
6296          * Don't use it after this functions returns.
6297          *
6298          * The api object is the one created by the application, it will be valid until
6299          * the application deletes it.
6300          *
6301          * @param api MegaApi object that started the transfer
6302          * @param transfer Information about the transfer
6303          *
6304          * @see MegaTransfer::getTransferredBytes, MegaTransfer::getSpeed
6305          */
6306         virtual void onTransferUpdate(MegaApi *api, MegaTransfer *transfer);
6307 
6308         /**
6309          * @brief This function is called when there is a temporary error processing a transfer
6310          *
6311          * The transfer continues after this callback, so expect more MegaTransferListener::onTransferTemporaryError or
6312          * a MegaTransferListener::onTransferFinish callback
6313          *
6314          * The SDK retains the ownership of the transfer and error parameters.
6315          * Don't use them after this functions returns.
6316          *
6317          * If the error code is API_EOVERQUOTA we need to call to MegaTransfer::isForeignOverquota to determine if
6318          * our own storage, or a foreign storage is in overquota. If MegaTransfer::isForeignOverquota returns true
6319          * a foreign storage is in overquota, otherwise our own storage is in overquota.
6320          *
6321          * @param api MegaApi object that started the transfer
6322          * @param transfer Information about the transfer
6323          * @param error Error information
6324          */
6325         virtual void onTransferTemporaryError(MegaApi *api, MegaTransfer *transfer, MegaError* error);
6326 
6327         /**
6328         * @brief This function is called when there are new or updated contacts in the account
6329         *
6330         * The SDK retains the ownership of the MegaUserList in the second parameter. The list and all the
6331         * MegaUser objects that it contains will be valid until this function returns. If you want to save the
6332         * list, use MegaUserList::copy. If you want to save only some of the MegaUser objects, use MegaUser::copy
6333         * for those objects.
6334         *
6335         * @param api MegaApi object connected to the account
6336         * @param users List that contains the new or updated contacts
6337         */
6338         virtual void onUsersUpdate(MegaApi* api, MegaUserList *users);
6339 
6340         /**
6341         * @brief This function is called when there are new or updated user alerts in the account
6342         *
6343         * The SDK retains the ownership of the MegaUserAlertList in the second parameter. The list and all the
6344         * MegaUserAlert objects that it contains will be valid until this function returns. If you want to save the
6345         * list, use MegaUserAlertList::copy. If you want to save only some of the MegaUserAlert objects, use MegaUserAlert::copy
6346         * for those objects.
6347         *
6348         * @param api MegaApi object connected to the account
6349         * @param alerts List that contains the new or updated alerts
6350         */
6351         virtual void onUserAlertsUpdate(MegaApi* api, MegaUserAlertList *alerts);
6352 
6353         /**
6354          * @brief This function is called when there are new or updated nodes in the account
6355          *
6356          * When the full account is reloaded or a large number of server notifications arrives at once, the
6357          * second parameter will be NULL.
6358          *
6359          * The SDK retains the ownership of the MegaNodeList in the second parameter. The list and all the
6360          * MegaNode objects that it contains will be valid until this function returns. If you want to save the
6361          * list, use MegaNodeList::copy. If you want to save only some of the MegaNode objects, use MegaNode::copy
6362          * for those nodes.
6363          *
6364          * @param api MegaApi object connected to the account
6365          * @param nodes List that contains the new or updated nodes
6366          */
6367         virtual void onNodesUpdate(MegaApi* api, MegaNodeList *nodes);
6368 
6369         /**
6370          * @brief This function is called when the account has been updated (confirmed/upgraded/downgraded)
6371          *
6372          * The usage of this callback to handle the external account confirmation is deprecated.
6373          * Instead, you should use MegaListener::onEvent.
6374          *
6375          * @param api MegaApi object connected to the account
6376          */
6377         virtual void onAccountUpdate(MegaApi *api);
6378 
6379         /**
6380          * @brief This function is called when there are new or updated contact requests in the account
6381          *
6382          * When the full account is reloaded or a large number of server notifications arrives at once, the
6383          * second parameter will be NULL.
6384          *
6385          * The SDK retains the ownership of the MegaContactRequestList in the second parameter. The list and all the
6386          * MegaContactRequest objects that it contains will be valid until this function returns. If you want to save the
6387          * list, use MegaContactRequestList::copy. If you want to save only some of the MegaContactRequest objects, use MegaContactRequest::copy
6388          * for them.
6389          *
6390          * @param api MegaApi object connected to the account
6391          * @param requests List that contains the new or updated contact requests
6392          */
6393         virtual void onContactRequestsUpdate(MegaApi* api, MegaContactRequestList* requests);
6394 
6395         /**
6396          * @brief This function is called when an inconsistency is detected in the local cache
6397          *
6398          * You should call MegaApi::fetchNodes when this callback is received
6399          *
6400          * @param api MegaApi object connected to the account
6401          */
6402         virtual void onReloadNeeded(MegaApi* api);
6403 
6404 #ifdef ENABLE_SYNC
6405     /**
6406      * @brief This function is called when the state of a synced file or folder changes
6407      *
6408      * Possible values for the state are:
6409      * - MegaApi::STATE_SYNCED = 1
6410      * The file is synced with the MEGA account
6411      *
6412      * - MegaApi::STATE_PENDING = 2
6413      * The file isn't synced with the MEGA account. It's waiting to be synced.
6414      *
6415      * - MegaApi::STATE_SYNCING = 3
6416      * The file is being synced with the MEGA account
6417      *
6418      * @param api MegaApi object that is synchronizing files
6419      * @param sync MegaSync object manages the file
6420      * @param localPath Local path of the file or folder
6421      * @param newState New state of the file
6422      */
6423     virtual void onSyncFileStateChanged(MegaApi *api, MegaSync *sync, std::string *localPath, int newState);
6424 
6425     /**
6426      * @brief This function is called when there is a synchronization event
6427      *
6428      * Synchronization events can be local deletions, local additions, remote deletions,
6429      * remote additions, etc. See MegaSyncEvent to know the full list of event types
6430      *
6431      * @param api MegaApi object that is synchronizing files
6432      * @param sync MegaSync object that detects the event
6433      * @param event Information about the event
6434      *
6435      * This parameter will be deleted just after the callback. If you want to save it use
6436      * MegaSyncEvent::copy
6437      */
6438     virtual void onSyncEvent(MegaApi *api, MegaSync *sync, MegaSyncEvent *event);
6439 
6440     /**
6441      * @brief This function is called when the state of the synchronization changes
6442      *
6443      * The SDK calls this function when the state of the synchronization changes. you can use
6444      * MegaSync::getState to get the new state of the synchronization
6445      *
6446      * @param api MegaApi object that is synchronizing files
6447      * @param sync MegaSync object that has changed its state
6448      */
6449     virtual void onSyncStateChanged(MegaApi *api, MegaSync *sync);
6450 
6451     /**
6452      * @brief This function is called with the state of the synchronization engine has changed
6453      *
6454      * You can call MegaApi::isScanning and MegaApi::isWaiting to know the global state
6455      * of the synchronization engine.
6456      *
6457      * @param api MegaApi object related to the event
6458      */
6459     virtual void onGlobalSyncStateChanged(MegaApi* api);
6460 #endif
6461 
6462     /**
6463      * @brief This function is called when the state of the backup changes
6464      *
6465      * The SDK calls this function when the state of the backup changes, for example
6466      * from 'active' to 'ongoing' or 'removing exceeding'.
6467      *
6468      * You can use MegaBackup::getState to get the new state.
6469      *
6470      * @param api MegaApi object that is backing up files
6471      * @param backup MegaBackup object that has changed the state
6472      */
6473     virtual void onBackupStateChanged(MegaApi *api, MegaBackup *backup);
6474 
6475     /**
6476      * @brief This function is called when a backup is about to start being processed
6477      *
6478      * The SDK retains the ownership of the backup parameter.
6479      * Don't use it after this functions returns.
6480      *
6481      * The api object is the one created by the application, it will be valid until
6482      * the application deletes it.
6483      *
6484      * @param api MegaApi object that started the backup
6485      * @param backup Information about the backup
6486      */
6487     virtual void onBackupStart(MegaApi *api, MegaBackup *backup);
6488 
6489     /**
6490      * @brief This function is called when a backup has finished
6491      *
6492      * The SDK retains the ownership of the backup and error parameters.
6493      * Don't use them after this functions returns.
6494      *
6495      * The api object is the one created by the application, it will be valid until
6496      * the application deletes it.
6497      *
6498      * There won't be more callbacks about this backup.
6499      * The last parameter provides the result of the backup. If the backup finished without problems,
6500      * the error code will be API_OK
6501      *
6502      * @param api MegaApi object that started the backup
6503      * @param backup Information about the backup
6504      * @param error Error information
6505      */
6506     virtual void onBackupFinish(MegaApi* api, MegaBackup *backup, MegaError* error);
6507 
6508     /**
6509      * @brief This function is called to inform about the progress of a backup
6510      *
6511      * The SDK retains the ownership of the backup parameter.
6512      * Don't use it after this functions returns.
6513      *
6514      * The api object is the one created by the application, it will be valid until
6515      * the application deletes it.
6516      *
6517      * @param api MegaApi object that started the backup
6518      * @param backup Information about the backup
6519      *
6520      * @see MegaBackup::getTransferredBytes, MegaBackup::getSpeed
6521      */
6522     virtual void onBackupUpdate(MegaApi *api, MegaBackup *backup);
6523 
6524     /**
6525      * @brief This function is called when there is a temporary error processing a backup
6526      *
6527      * The backup continues after this callback, so expect more MegaBackupListener::onBackupTemporaryError or
6528      * a MegaBackupListener::onBackupFinish callback
6529      *
6530      * The SDK retains the ownership of the backup and error parameters.
6531      * Don't use them after this functions returns.
6532      *
6533      * @param api MegaApi object that started the backup
6534      * @param backup Information about the backup
6535      * @param error Error information
6536      */
6537     virtual void onBackupTemporaryError(MegaApi *api, MegaBackup *backup, MegaError* error);
6538 
6539 #ifdef ENABLE_CHAT
6540     /**
6541      * @brief This function is called when there are new or updated chats
6542      *
6543      * The SDK retains the ownership of the MegaTextChatList in the second parameter. The list and all the
6544      * MegaTextChat objects that it contains will be valid until this function returns. If you want to save the
6545      * list, use MegaTextChatList::copy. If you want to save only some of the MegaTextChat objects, use
6546      * MegaTextChat::copy for those objects.
6547      *
6548      * @param api MegaApi object connected to the account
6549      * @param chats List that contains the new or updated chats
6550      */
6551     virtual void onChatsUpdate(MegaApi* api, MegaTextChatList *chats);
6552 #endif
6553 
6554         /**
6555          * The details about the event, like the type of event and optionally any
6556          * additional parameter, is received in the \c params parameter.
6557          *
6558          * You can check the type of event by calling MegaEvent::getType
6559          *
6560          * The SDK retains the ownership of the details of the event (\c event).
6561          * Don't use them after this functions returns.
6562          *
6563          * Currently, the following type of events are notified:
6564          *
6565          *  - MegaEvent::EVENT_COMMIT_DB: when the SDK commits the ongoing DB transaction.
6566          *  This event can be used to keep synchronization between the SDK cache and the
6567          *  cache managed by the app thanks to the sequence number.
6568          *
6569          *  Valid data in the MegaEvent object received in the callback:
6570          *      - MegaEvent::getText: sequence number recorded by the SDK when this event happened
6571          *
6572          *  - MegaEvent::EVENT_ACCOUNT_CONFIRMATION: when a new account is finally confirmed
6573          * by the user by confirming the signup link.
6574          *
6575          *   Valid data in the MegaEvent object received in the callback:
6576          *      - MegaEvent::getText: email address used to confirm the account
6577          *
6578          *  - MegaEvent::EVENT_CHANGE_TO_HTTPS: when the SDK automatically starts using HTTPS for all
6579          * its communications. This happens when the SDK is able to detect that MEGA servers can't be
6580          * reached using HTTP or that HTTP communications are being tampered. Transfers of files and
6581          * file attributes (thumbnails and previews) use HTTP by default to save CPU usage. Since all data
6582          * is already end-to-end encrypted, it's only needed to use HTTPS if HTTP doesn't work. Anyway,
6583          * applications can force the SDK to always use HTTPS using MegaApi::useHttpsOnly. It's recommended
6584          * that applications that receive one of these events save that information on its settings and
6585          * automatically enable HTTPS on next executions of the app to not force the SDK to detect the problem
6586          * and automatically switch to HTTPS every time that the application starts.
6587          *
6588          *  - MegaEvent::EVENT_DISCONNECT: when the SDK performs a disconnect to reset all the
6589          * existing open-connections, since they have become unusable. It's recommended that the app
6590          * receiving this event reset its connections with other servers, since the disconnect
6591          * performed by the SDK is due to a network change or IP addresses becoming invalid.
6592          *
6593          *  - MegaEvent::EVENT_ACCOUNT_BLOCKED: when the account get blocked, typically because of
6594          * infringement of the Mega's terms of service repeatedly. This event is followed by an automatic
6595          * logout.
6596          *
6597          *  Valid data in the MegaEvent object received in the callback:
6598          *      - MegaEvent::getText: message to show to the user.
6599          *      - MegaEvent::getNumber: code representing the reason for being blocked.
6600          *
6601          *          - MegaApi::ACCOUNT_BLOCKED_TOS_NON_COPYRIGHT = 200
6602          *              Suspension message for any type of suspension, but copyright suspension.
6603          *
6604          *          - MegaApi::ACCOUNT_BLOCKED_TOS_COPYRIGHT = 300
6605          *              Suspension only for multiple copyright violations.
6606          *
6607          *          - MegaApi::ACCOUNT_BLOCKED_SUBUSER_DISABLED = 400
6608          *              Subuser of the business account has been disabled.
6609          *
6610          *          - MegaApi::ACCOUNT_BLOCKED_SUBUSER_REMOVED = 401
6611          *              Subuser of business account has been removed.
6612          *
6613          *          - MegaApi::ACCOUNT_BLOCKED_VERIFICATION_SMS = 500
6614          *              The account is temporary blocked and needs to be verified by an SMS code.
6615          *
6616          *          - MegaApi::ACCOUNT_BLOCKED_VERIFICATION_EMAIL = 700
6617          *              The account is temporary blocked and needs to be verified by email (Weak Account Protection).
6618          *
6619          * - MegaEvent::EVENT_STORAGE: when the status of the storage changes.
6620          *
6621          * For this event type, MegaEvent::getNumber provides the current status of the storage
6622          *
6623          * There are three possible storage states:
6624          *     - MegaApi::STORAGE_STATE_GREEN = 0
6625          *     There are no storage problems
6626          *
6627          *     - MegaApi::STORAGE_STATE_ORANGE = 1
6628          *     The account is almost full
6629          *
6630          *     - MegaApi::STORAGE_STATE_RED = 2
6631          *     The account is full. Uploads have been stopped
6632          *
6633          *     - MegaApi::STORAGE_STATE_CHANGE = 3
6634          *     There is a possible significant change in the storage state.
6635          *     It's needed to call MegaApi::getAccountDetails to check the storage status.
6636          *     After calling it, this callback will be called again with the corresponding
6637          *     state if there is really a change.
6638          *
6639          *     - MegaApi::STORAGE_STATE_PAYWALL = 4
6640          *     The account has been full for a long time. Now most of actions are disallowed.
6641          *     It's needed to call MegaApi::getUserData in order to retrieve the deadline/warnings
6642          *     timestamps. @see MegaApi::getOverquotaDeadlineTs and MegaApi::getOverquotaWarningsTs.
6643          *
6644          * - MegaEvent::EVENT_NODES_CURRENT: when all external changes have been received
6645          *
6646          * - MegaEvent::EVENT_MEDIA_INFO_READY: when codec-mappings have been received
6647          *
6648          * - MegaEvent::EVENT_STORAGE_SUM_CHANGED: when the storage sum has changed.
6649          *
6650          * For this event type, MegaEvent::getNumber provides the new storage sum.
6651          *
6652          * - MegaEvent::EVENT_BUSINESS_STATUS: when the status of a business account has changed.
6653          *
6654          * For this event type, MegaEvent::getNumber provides the new business status.
6655          *
6656          * The posible values are:
6657          *  - BUSINESS_STATUS_EXPIRED = -1
6658          *  - BUSINESS_STATUS_INACTIVE = 0
6659          *  - BUSINESS_STATUS_ACTIVE = 1
6660          *  - BUSINESS_STATUS_GRACE_PERIOD = 2
6661          *
6662          * - MegaEvent::EVENT_KEY_MODIFIED: when the key of a user has changed.
6663          *
6664          * For this event type, MegaEvent::getHandle provides the handle of the user whose key has been modified.
6665          * For this event type, MegaEvent::getNumber provides type of key that has been modified.
6666          *
6667          * The posible values are:
6668          *  - Public chat key (Cu25519)     = 0
6669          *  - Public signing key (Ed25519)  = 1
6670          *  - Public RSA key                = 2
6671          *  - Signature of chat key         = 3
6672          *  - Signature of RSA key          = 4
6673          *
6674          * - MegaEvent::EVENT_MISC_FLAGS_READY: when the miscellaneous flags are available/updated.
6675          *
6676          * @param api MegaApi object connected to the account
6677          * @param event Details about the event
6678          */
6679         virtual void onEvent(MegaApi* api, MegaEvent *event);
6680 
6681         virtual ~MegaListener();
6682 };
6683 
6684 /**
6685  * @brief Stores information about a background photo/video upload, used in iOS to take advantage of power saving features
6686  *
6687  * This object can be serialised so it can be stored in case your app is unloaded by its OS, and the background operation
6688  * completed afterward.
6689  *
6690  */
6691 class MegaBackgroundMediaUpload
6692 {
6693 protected:
6694     MegaBackgroundMediaUpload();
6695 
6696 public:
6697 
6698     /**
6699      * @brief Initial step to upload a photo/video via iOS low-power background upload feature
6700      *
6701      * Creates an object which can be used to encrypt a media file, and upload it outside of the SDK,
6702      * eg. in order to take advantage of a particular platform's low power background upload functionality.
6703      *
6704      * You take ownership of the returned value.
6705      *
6706      * @param api The MegaApi the new object will be used with. It must live longer than the new object.
6707      * @return A pointer to an object that keeps some needed state through the process of
6708      *         uploading a media file via iOS low power background uploads (or similar).
6709      */
6710     static MegaBackgroundMediaUpload* createInstance(MegaApi *api);
6711 
6712     /**
6713      * @brief Extract mediainfo information about the photo or video.
6714      *
6715      * Call this function once with the file to be uploaded. It uses mediainfo to extract information that will
6716      * help other clients to show or to play the files. The information is stored in this object until the whole
6717      * operation completes.
6718      *
6719      * Call MegaApi::ensureMediaInfo first in order prepare the library to attach file attributes
6720      * that enable videos to be identified and played in the web browser.
6721      *
6722      * @param inputFilepath The file to analyse with MediaInfo.
6723      * @return true if analysis was performed (and any relevant attributes stored ready for upload), false if mediainfo was not ready yet.
6724      */
6725     virtual bool analyseMediaInfo(const char* inputFilepath);
6726 
6727     /**
6728      * @brief Encrypt the file or a portion of it
6729      *
6730      * Call this function once with the file to be uploaded. It uses mediainfo to extract information that will
6731      * help the webclient show or play the file in various browsers. The information is stored in this object
6732      * until the whole operation completes. The encrypted data is stored in a new file.
6733      *
6734      * In order to save space on mobile devices, this function can be called in such a way that the last portion
6735      * of the file is encrypted (to a new file), and then that last portion of the file is removed by file truncation.
6736      * That operation can be repeated until the file is completely encrypted, and only the encrypted version remains,
6737      * and takes up the same amount of space on the device. The size of the portions must first be calculated by using
6738      * the 'adjustsizeonly' parameter, and iterating from the start of the file, specifying the approximate sizes of the portions.
6739      *
6740      * Encryption is done by reading small pieces of the file, encrypting them, and outputting to the new file,
6741      * so that RAM usage is not excessive.
6742      *
6743      * You take ownership of the returned value.
6744      *
6745      * @param inputFilepath The file to encrypt a portion of (and the one that is ultimately being uploaded).
6746      * @param startPos The index of the first byte of the file to encrypt
6747      * @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
6748      *        MEGA internal chunking algorithm. The number of bytes actually encrypted and stored in the new file is the updated number.
6749      *        You can supply -1 as input to request the remainder file (from startPos) be encrypted.
6750      * @param outputFilepath The name of the new file to create, and store the encrypted data in.
6751      * @param adjustsizeonly If this is set true, then encryption is not performed, and only the length parameter is adjusted.
6752      *        This feature is to enable precalculating the exact sizes of the file portions for upload.
6753      * @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.
6754      *         If adjustsizeonly was set, and the function succeeds, the return value will be non-NULL (and will need deallocation as usual).
6755      *         If the function fails, the return value is NULL, and an error will have been logged.
6756      */
6757     virtual char *encryptFile(const char* inputFilepath, int64_t startPos, int64_t* length, const char* outputFilepath, bool adjustsizeonly);
6758 
6759     /**
6760      * @brief Retrieves the value of the uploadURL once it has been successfully requested via MegaApi::backgroundMediaUploadRequestUploadURL
6761      *
6762      * You take ownership of the returned value.
6763      *
6764      * @return The URL to upload to (after appending the suffix), if one has been received. Otherwise NULL.
6765      */
6766     virtual char *getUploadURL();
6767 
6768     /**
6769      * @brief Attach a thumbnail by its file attribute handle.
6770      *
6771      * The thumbnail will implictly be attached to the node created as part of MegaApi::backgroundMediaUploadComplete.
6772      * The thumbnail file attibrute must have been obtained by MegaApi::putThumbnail.
6773      * If the result of MegaApi::putThumbnail is not available by the time MegaApi::backgroundMediaUploadComplete
6774      * is called, it can be attached to the node later using MegaApi::setThumbnailByHandle.
6775      *
6776      * @param h The handle obtained via MegaApi::putThumbnail
6777      */
6778     virtual void setThumbnail(MegaHandle h);
6779 
6780     /**
6781      * @brief Attach a preview by its file attribute handle.
6782      *
6783      * The preview will implictly be attached to the node created as part of MegaApi::backgroundMediaUploadComplete.
6784      * The preview file attibrute must have been obtained by MegaApi::putPreview.
6785      * If the result of MegaApi::putPreview is not available by the time MegaApi::backgroundMediaUploadComplete
6786      * is called, it can be attached to the node later using MegaApi::setPreviewByHandle.
6787      *
6788      * @param h The handle obtained via MegaApi::putPreview
6789      */
6790     virtual void setPreview(MegaHandle h);
6791 
6792     /**
6793      * @brief Sets the GPS coordinates for the node
6794      *
6795      * The node created via MegaApi::backgroundMediaUploadComplete will gain these coordinates as part of the
6796      * node creation. If the unshareable flag is set, the coodinates are encrypted in a way that even if the
6797      * node is later shared, the GPS coordinates cannot be decrypted by a different account.
6798      *
6799      * @param latitude The GPS latitude
6800      * @param longitude The GPS longitude
6801      * @param unshareable Set this true to prevent the coordinates being readable by other accounts.
6802      */
6803     virtual void setCoordinates(double latitude, double longitude, bool unshareable);
6804 
6805     /**
6806      * @brief Turns the data stored in this object into a base 64 encoded string.
6807      *
6808      * The object can then be recreated via MegaBackgroundMediaUpload::unserialize and supplying the returned string.
6809      *
6810      * You take ownership of the returned value.
6811      *
6812      * @return serialized version of this object (including URL, mediainfo attributes, and internal data suitable to resume uploading with in future)
6813      */
6814     virtual char *serialize();
6815 
6816     /**
6817      * @brief Get back the needed MegaBackgroundMediaUpload after the iOS app exited and restarted
6818      *
6819      * In case the iOS app exits while a background upload is going on, and the app is started again
6820      * to complete the operation, call this function to recreate the MegaBackgroundMediaUpload object
6821      * needed for a call to MegaApi::backgroundMediaUploadComplete. The object must have been serialised
6822      * before the app was unloaded by using MegaBackgroundMediaUpload::serialize.
6823      *
6824      * You take ownership of the returned value.
6825      *
6826      * @param data The string the object was serialized to previously.
6827      * @param api The MegaApi this object will be used with. It must live longer than this object.
6828      * @return A pointer to a new MegaBackgroundMediaUpload with all fields set to the data that was
6829      *         stored in the serialized string.
6830      */
6831     static MegaBackgroundMediaUpload* unserialize(const char* data, MegaApi* api);
6832 
6833     /**
6834      * @brief Destructor
6835      */
6836     virtual ~MegaBackgroundMediaUpload();
6837 };
6838 
6839 class MegaInputStream
6840 {
6841 public:
6842     virtual int64_t getSize();
6843     virtual bool read(char *buffer, size_t size);
6844     virtual ~MegaInputStream();
6845 };
6846 
6847 class MegaApiImpl;
6848 
6849 /**
6850  * @brief Allows calling many synchronous operations on MegaApi without being blocked by SDK activity.
6851  *
6852  * Call MegaApi::getMegaApiLock() to get an instance of this class to use.
6853  */
6854 class MegaApiLock
6855 {
6856 public:
6857     /**
6858      * @brief Lock the MegaApi if this instance does not currently have a lock on it yet.
6859      *
6860      * There is no harm in calling this more than once, the MegaApi will only be locked
6861      * once, and the first unlock() call will release it.    Sometimes it is useful eg.
6862      * in a loop which may or may not need to use a locking function, or may need to use
6863      * many, to call lockOnce() before any such usage, and know that the MegaApi will
6864      * be locked once from that point, until the end of the loop (when unlockOnce() can
6865      * be called, or the MegaApiLock destroyed.
6866      */
6867     void lockOnce();
6868 
6869     /**
6870      * @brief Tries to lock the MegaApi if this instance does not currently have a lock on it yet.
6871      *
6872      * If the lock is succeeded in the expected time, the behaviour is the same as lockOnce().
6873      *
6874      * @param time Milliseconds to wait for locking
6875      *
6876      * @return if the locking succeded
6877      */
6878     bool tryLockFor(long long time);
6879 
6880 
6881     /**
6882      * @brief Release the lock on the MegaApi if one is still held by this instance
6883      *
6884      * The MegaApi will be unable to continue work until all MegaApiLock objects release
6885      * their locks.  Only use multiple of these if you need nested locking.  The destructor
6886      * of the object will release the lock, so it is sufficient to delete it when finished.
6887      * However, when using it from a garbage collected language it may be prudent to call unlock() directly.
6888      *
6889      * This function must be called from the same thread that called MegaApiLock::lockOnce().
6890      */
6891     void unlockOnce();
6892 
6893     /**
6894      * @brief Destructor.  This will call unlock() if the MegaApi is still locked by this instance.
6895      */
6896     ~MegaApiLock();
6897 
6898 private:
6899     MegaApiImpl* api;
6900     bool locked = false;
6901     MegaApiLock(MegaApiImpl*, bool lock);
6902     MegaApiLock(const MegaApiLock&) = delete;
6903     void operator=(const MegaApiLock&) = delete;
6904     friend class MegaApi;
6905 };
6906 
6907 /**
6908  * @brief Allows to control a MEGA account or a shared folder
6909  *
6910  * You must provide an appKey to use this SDK. You can generate an appKey for your app for free here:
6911  * - https://mega.nz/#sdk
6912  *
6913  * You can enable local node caching by passing a local path in the constructor of this class. That saves many data usage
6914  * and many time starting your app because the entire filesystem won't have to be downloaded each time. The persistent
6915  * node cache will only be loaded by logging in with a session key. To take advantage of this feature, apart of passing the
6916  * local path to the constructor, your application have to save the session key after login (MegaApi::dumpSession) and use
6917  * it to log in the next time. This is highly recommended also to enhance the security, because in this was the access password
6918  * doesn't have to be stored by the application.
6919  *
6920  * 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
6921  * to a MEGA account or a public folder). If the login request succeed, you must call MegaApi::fetchNodes to get the filesystem in MEGA.
6922  * After successfully completing that request, you can use all other functions, manage the files and start transfers.
6923  *
6924  * After using MegaApi::logout you can reuse the same MegaApi object to log in to another MEGA account or a public folder.
6925  *
6926  * Some functions in this class return a pointer and give you the ownership. In all of them, memory allocations
6927  * are made using new (for single objects) and new[] (for arrays) so you should use delete and delete[] to free them.
6928  */
6929 class MegaApi
6930 {
6931     public:
6932     	enum
6933 		{
6934 			STATE_NONE = 0,
6935 			STATE_SYNCED,
6936 			STATE_PENDING,
6937 			STATE_SYNCING,
6938 			STATE_IGNORED
6939 		};
6940 
6941         enum {
6942             LOG_LEVEL_FATAL = 0,   // Very severe error event that will presumably lead the application to abort.
6943             LOG_LEVEL_ERROR,   // Error information but will continue application to keep running.
6944             LOG_LEVEL_WARNING, // Information representing errors in application but application will keep running
6945             LOG_LEVEL_INFO,    // Mainly useful to represent current progress of application.
6946             LOG_LEVEL_DEBUG,   // Informational logs, that are useful for developers. Only applicable if DEBUG is defined.
6947             LOG_LEVEL_MAX
6948         };
6949 
6950         enum {
6951             ATTR_TYPE_THUMBNAIL = 0,
6952             ATTR_TYPE_PREVIEW = 1
6953         };
6954 
6955         enum {
6956             USER_ATTR_UNKNOWN = -1,
6957             USER_ATTR_AVATAR = 0,               // public - char array
6958             USER_ATTR_FIRSTNAME = 1,            // public - char array
6959             USER_ATTR_LASTNAME = 2,             // public - char array
6960             USER_ATTR_AUTHRING = 3,             // private - byte array
6961             USER_ATTR_LAST_INTERACTION = 4,     // private - byte array
6962             USER_ATTR_ED25519_PUBLIC_KEY = 5,   // public - byte array
6963             USER_ATTR_CU25519_PUBLIC_KEY = 6,   // public - byte array
6964             USER_ATTR_KEYRING = 7,              // private - byte array
6965             USER_ATTR_SIG_RSA_PUBLIC_KEY = 8,   // public - byte array
6966             USER_ATTR_SIG_CU255_PUBLIC_KEY = 9, // public - byte array
6967             USER_ATTR_LANGUAGE = 14,            // private - char array
6968             USER_ATTR_PWD_REMINDER = 15,        // private - char array
6969             USER_ATTR_DISABLE_VERSIONS = 16,    // private - byte array
6970             USER_ATTR_CONTACT_LINK_VERIFICATION = 17,     // private - byte array
6971             USER_ATTR_RICH_PREVIEWS = 18,        // private - byte array
6972             USER_ATTR_RUBBISH_TIME = 19,         // private - byte array
6973             USER_ATTR_LAST_PSA = 20,             // private - char array
6974             USER_ATTR_STORAGE_STATE = 21,        // private - char array
6975             USER_ATTR_GEOLOCATION = 22,          // private - byte array
6976             USER_ATTR_CAMERA_UPLOADS_FOLDER = 23,// private - byte array
6977             USER_ATTR_MY_CHAT_FILES_FOLDER = 24, // private - byte array
6978             USER_ATTR_PUSH_SETTINGS = 25,        // private - char array
6979             // ATTR_UNSHAREABLE_KEY = 26         // it's internal for SDK, not exposed to apps
6980             USER_ATTR_ALIAS = 27,                // private - byte array
6981             USER_ATTR_DEVICE_NAMES = 30,          // private - byte array
6982         };
6983 
6984         enum {
6985             NODE_ATTR_DURATION = 0,
6986             NODE_ATTR_COORDINATES = 1,
6987             NODE_ATTR_ORIGINALFINGERPRINT = 2
6988         };
6989 
6990         enum {
6991             PAYMENT_METHOD_BALANCE = 0,
6992             PAYMENT_METHOD_PAYPAL = 1,
6993             PAYMENT_METHOD_ITUNES = 2,
6994             PAYMENT_METHOD_GOOGLE_WALLET = 3,
6995             PAYMENT_METHOD_BITCOIN = 4,
6996             PAYMENT_METHOD_UNIONPAY = 5,
6997             PAYMENT_METHOD_FORTUMO = 6,
6998             PAYMENT_METHOD_CREDIT_CARD = 8,
6999             PAYMENT_METHOD_CENTILI = 9,
7000             PAYMENT_METHOD_WINDOWS_STORE = 13
7001         };
7002 
7003         enum {
7004             TRANSFER_METHOD_NORMAL = 0,
7005             TRANSFER_METHOD_ALTERNATIVE_PORT = 1,
7006             TRANSFER_METHOD_AUTO = 2,
7007             TRANSFER_METHOD_AUTO_NORMAL = 3,
7008             TRANSFER_METHOD_AUTO_ALTERNATIVE = 4
7009         };
7010 
7011         enum {
7012             PUSH_NOTIFICATION_ANDROID = 1,
7013             PUSH_NOTIFICATION_IOS_VOIP = 2,
7014             PUSH_NOTIFICATION_IOS_STD = 3,
7015             PUSH_NOTIFICATION_ANDROID_HUAWEI = 4
7016         };
7017 
7018         enum {
7019             PASSWORD_STRENGTH_VERYWEAK = 0,
7020             PASSWORD_STRENGTH_WEAK = 1,
7021             PASSWORD_STRENGTH_MEDIUM = 2,
7022             PASSWORD_STRENGTH_GOOD = 3,
7023             PASSWORD_STRENGTH_STRONG = 4
7024         };
7025 
7026         enum {
7027             RETRY_NONE = 0,
7028             RETRY_CONNECTIVITY = 1,
7029             RETRY_SERVERS_BUSY = 2,
7030             RETRY_API_LOCK = 3,
7031             RETRY_RATE_LIMIT = 4,
7032             RETRY_LOCAL_LOCK = 5,
7033             RETRY_UNKNOWN = 6
7034         };
7035 
7036         enum {
7037             KEEP_ALIVE_CAMERA_UPLOADS = 0
7038         };
7039 
7040         enum {
7041             STORAGE_STATE_UNKNOWN = -9,
7042             STORAGE_STATE_GREEN = 0,
7043             STORAGE_STATE_ORANGE = 1,
7044             STORAGE_STATE_RED = 2,
7045             STORAGE_STATE_CHANGE = 3,
7046             STORAGE_STATE_PAYWALL = 4,
7047         };
7048 
7049         enum {
7050             BUSINESS_STATUS_EXPIRED = -1,
7051             BUSINESS_STATUS_INACTIVE = 0,   // no business subscription
7052             BUSINESS_STATUS_ACTIVE = 1,
7053             BUSINESS_STATUS_GRACE_PERIOD = 2
7054         };
7055 
7056         enum {
7057             AFFILIATE_TYPE_INVALID = 0, // legacy mode
7058             AFFILIATE_TYPE_ID = 1,
7059             AFFILIATE_TYPE_FILE_FOLDER = 2,
7060             AFFILIATE_TYPE_CHAT = 3,
7061             AFFILIATE_TYPE_CONTACT = 4,
7062         };
7063 
7064         enum {
7065             ACCOUNT_NOT_BLOCKED = 0,
7066             ACCOUNT_BLOCKED_EXCESS_DATA_USAGE = 100,        // (deprecated)
7067             ACCOUNT_BLOCKED_TOS_NON_COPYRIGHT = 200,        // suspended due to multiple breaches of MEGA ToS
7068             ACCOUNT_BLOCKED_TOS_COPYRIGHT = 300,            // suspended due to copyright violations
7069             ACCOUNT_BLOCKED_SUBUSER_DISABLED = 400,         // subuser disabled by business administrator
7070             ACCOUNT_BLOCKED_SUBUSER_REMOVED = 401,          // subuser removed by business administrator
7071             ACCOUNT_BLOCKED_VERIFICATION_SMS = 500,         // temporary blocked, require SMS verification
7072             ACCOUNT_BLOCKED_VERIFICATION_EMAIL = 700,       // temporary blocked, require email verification
7073         };
7074 
7075         /**
7076          * @brief Constructor suitable for most applications
7077          * @param appKey AppKey of your application
7078          * You can generate your AppKey for free here:
7079          * - https://mega.nz/#sdk
7080          *
7081          * @param basePath Base path to store the local cache
7082          * If you pass NULL to this parameter, the SDK won't use any local cache.
7083          *
7084          * @param userAgent User agent to use in network requests
7085          * If you pass NULL to this parameter, a default user agent will be used
7086          *
7087          * @param workerThreadCount The number of worker threads for encryption or other operations
7088          * Using worker threads means that synchronous function calls on MegaApi will be blocked less,
7089          * and uploads and downloads can proceed more quickly on very fast connections.
7090          *
7091          */
7092         MegaApi(const char *appKey, const char *basePath = NULL, const char *userAgent = NULL, unsigned workerThreadCount = 1);
7093 
7094         /**
7095          * @brief MegaApi Constructor that allows to use a custom GFX processor
7096          *
7097          * The SDK attach thumbnails and previews to all uploaded images. To generate them, it needs a graphics processor.
7098          * You can build the SDK with one of the provided built-in graphics processors. If none of them is available
7099          * in your app, you can implement the MegaGfxProcessor interface to provide your custom processor. Please
7100          * read the documentation of MegaGfxProcessor carefully to ensure that your implementation is valid.
7101          *
7102          * @param appKey AppKey of your application
7103          * You can generate your AppKey for free here:
7104          * - https://mega.nz/#sdk
7105          *
7106          * @param processor Image processor. The SDK will use it to generate previews and thumbnails
7107          * If you pass NULL to this parameter, the SDK will try to use the built-in image processors.
7108          *
7109          * @param basePath Base path to store the local cache
7110          * If you pass NULL to this parameter, the SDK won't use any local cache.
7111          *
7112          * @param userAgent User agent to use in network requests
7113          * If you pass NULL to this parameter, a default user agent will be used
7114          *
7115          * @param workerThreadCount The number of worker threads for encryption or other operations
7116          * Using worker threads means that synchronous function calls on MegaApi will be blocked less,
7117          * and uploads and downloads can proceed more quickly on very fast connections.
7118          *
7119          */
7120         MegaApi(const char *appKey, MegaGfxProcessor* processor, const char *basePath = NULL, const char *userAgent = NULL, unsigned workerThreadCount = 1);
7121 
7122 #ifdef ENABLE_SYNC
7123         /**
7124          * @brief Special constructor to allow non root synchronization on OSX
7125          *
7126          * The synchronization engine needs to read filesystem notifications from /dev/fsevents to work efficiently.
7127          * Only root can open this file, so if you want to use the synchronization engine on OSX you will have to
7128          * run the application as root, or to use this constructor to provide an open file descriptor to /dev/fsevents
7129          *
7130          * You could open /dev/fsevents in a minimal loader with root permissions and provide the file descriptor
7131          * to a new executable that uses this constructor. Here you have an example implementation of the loader:
7132          *
7133          * int main(int argc, char *argv[])
7134          * {
7135          *     char buf[16];
7136          *     int fd = open("/dev/fsevents", O_RDONLY);
7137          *     seteuid(getuid());
7138          *     snprintf(buf, sizeof(buf), "%d", fd);
7139          *     execl("executablePath", buf, NULL);
7140          *     return 0;
7141          * }
7142          *
7143          * If you use another constructor. The synchronization engine will still work on OSX, but it will scan all files
7144          * regularly so it will be much less efficient.
7145          *
7146          * @param appKey AppKey of your application
7147          * You can generate your AppKey for free here:
7148          * - https://mega.nz/#sdk
7149          *
7150          * @param basePath Base path to store the local cache
7151          * If you pass NULL to this parameter, the SDK won't use any local cache.
7152          *
7153          * @param userAgent User agent to use in network requests
7154          * If you pass NULL to this parameter, a default user agent will be used
7155          *
7156          * @param fseventsfd Open file descriptor of /dev/fsevents
7157          *
7158          * @param workerThreadCount The number of worker threads for encryption or other operations
7159          * Using worker threads means that synchronous function calls on MegaApi will be blocked less,
7160          * and uploads and downloads can proceed more quickly on very fast connections.
7161          *
7162          */
7163         MegaApi(const char *appKey, const char *basePath, const char *userAgent, int fseventsfd, unsigned workerThreadCount = 1);
7164 #endif
7165 
7166         virtual ~MegaApi();
7167 
7168 
7169         /**
7170          * @brief Register a listener to receive all events (requests, transfers, global, synchronization)
7171          *
7172          * You can use MegaApi::removeListener to stop receiving events.
7173          *
7174          * @param listener Listener that will receive all events (requests, transfers, global, synchronization)
7175          */
7176         void addListener(MegaListener* listener);
7177 
7178         /**
7179          * @brief Register a listener to receive all events about requests
7180          *
7181          * You can use MegaApi::removeRequestListener to stop receiving events.
7182          *
7183          * @param listener Listener that will receive all events about requests
7184          */
7185         void addRequestListener(MegaRequestListener* listener);
7186 
7187         /**
7188          * @brief Register a listener to receive all events about transfers
7189          *
7190          * You can use MegaApi::removeTransferListener to stop receiving events.
7191          *
7192          * @param listener Listener that will receive all events about transfers
7193          */
7194         void addTransferListener(MegaTransferListener* listener);
7195 
7196         /**
7197          * @brief Register a listener to receive global events
7198          *
7199          * You can use MegaApi::removeGlobalListener to stop receiving events.
7200          *
7201          * @param listener Listener that will receive global events
7202          */
7203         void addGlobalListener(MegaGlobalListener* listener);
7204 
7205 #ifdef ENABLE_SYNC
7206         /**
7207          * @brief Add a listener for all events related to synchronizations
7208          * @param listener Listener that will receive synchronization events
7209          */
7210         void addSyncListener(MegaSyncListener *listener);
7211 
7212         /**
7213          * @brief Unregister a synchronization listener
7214          * @param listener Objet that will be unregistered
7215          */
7216         void removeSyncListener(MegaSyncListener *listener);
7217 #endif
7218 
7219         /**
7220          * @brief Add a listener for all events related to backups
7221          * @param listener Listener that will receive backup events
7222          */
7223         void addBackupListener(MegaBackupListener *listener);
7224 
7225         /**
7226          * @brief Unregister a backup listener
7227          * @param listener Objet that will be unregistered
7228          */
7229         void removeBackupListener(MegaBackupListener *listener);
7230 
7231         /**
7232          * @brief Unregister a listener
7233          *
7234          * This listener won't receive more events.
7235          *
7236          * @param listener Object that is unregistered
7237          */
7238         void removeListener(MegaListener* listener);
7239 
7240         /**
7241          * @brief Unregister a MegaRequestListener
7242          *
7243          * This listener won't receive more events.
7244          *
7245          * @param listener Object that is unregistered
7246          */
7247         void removeRequestListener(MegaRequestListener* listener);
7248 
7249         /**
7250          * @brief Unregister a MegaTransferListener
7251          *
7252          * This listener won't receive more events.
7253          *
7254          * @param listener Object that is unregistered
7255          */
7256         void removeTransferListener(MegaTransferListener* listener);
7257 
7258         /**
7259          * @brief Unregister a MegaGlobalListener
7260          *
7261          * This listener won't receive more events.
7262          *
7263          * @param listener Object that is unregistered
7264          */
7265         void removeGlobalListener(MegaGlobalListener* listener);
7266 
7267         /**
7268          * @brief Get the current request
7269          *
7270          * The return value is only valid when this function is synchronously
7271          * called inside a callback related to a request. The return value is
7272          * the same as the received in the parameter of the callback.
7273          * This function is provided to support the creation of bindings for
7274          * some programming languaguages like PHP.
7275          *
7276          * @return Current request
7277          */
7278         MegaRequest *getCurrentRequest();
7279 
7280         /**
7281          * @brief Get the current transfer
7282          *
7283          * The return value is only valid when this function is synchronously
7284          * called inside a callback related to a transfer. The return value is
7285          * the same as the received in the parameter of the callback.
7286          * This function is provided to support the creation of bindings for
7287          * some programming languaguages like PHP.
7288          *
7289          * @return Current transfer
7290          */
7291         MegaTransfer *getCurrentTransfer();
7292 
7293         /**
7294          * @brief Get the current error
7295          *
7296          * The return value is only valid when this function is synchronously
7297          * called inside a callback. The return value is
7298          * the same as the received in the parameter of the callback.
7299          * This function is provided to support the creation of bindings for
7300          * some programming languaguages like PHP.
7301          *
7302          * @return Current error
7303          */
7304         MegaError *getCurrentError();
7305 
7306         /**
7307          * @brief Get the current nodes
7308          *
7309          * The return value is only valid when this function is synchronously
7310          * called inside a onNodesUpdate callback. The return value is
7311          * the same as the received in the parameter of the callback.
7312          * This function is provided to support the creation of bindings for
7313          * some programming languaguages like PHP.
7314          *
7315          * @return Current nodes
7316          */
7317         MegaNodeList *getCurrentNodes();
7318 
7319         /**
7320          * @brief Get the current users
7321          *
7322          * The return value is only valid when this function is synchronously
7323          * called inside a onUsersUpdate callback. The return value is
7324          * the same as the received in the parameter of the callback.
7325          * This function is provided to support the creation of bindings for
7326          * some programming languaguages like PHP.
7327          *
7328          * @return Current users
7329          */
7330         MegaUserList *getCurrentUsers();
7331 
7332         /**
7333          * @brief Generates a hash based in the provided private key and email
7334          *
7335          * This is a time consuming operation (specially for low-end mobile devices). Since the resulting key is
7336          * required to log in, this function allows to do this step in a separate function. You should run this function
7337          * in a background thread, to prevent UI hangs. The resulting key can be used in MegaApi::fastLogin
7338          *
7339          * You take the ownership of the returned value.
7340          *
7341          * @param base64pwkey Private key returned by MegaRequest::getPrivateKey in the onRequestFinish callback of createAccount
7342          * @param email Email to create the hash
7343          * @return Base64-encoded hash
7344          *
7345          * @deprecated This function is only useful for old accounts. Once enabled the new registration logic,
7346          * this function will return an empty string for new accounts and will be removed few time after.
7347          */
7348         char* getStringHash(const char* base64pwkey, const char* email);
7349 
7350         /**
7351          * @brief Get internal timestamp used by the SDK
7352          *
7353          * This is a time used in certain internal operations.
7354          *
7355          * @return actual SDK time in deciseconds
7356          */
7357         long long getSDKtime();
7358 
7359         /**
7360          * @brief Get an URL to transfer the current session to the webclient
7361          *
7362          * This function creates a new session for the link so logging out in the web client won't log out
7363          * the current session.
7364          *
7365          * The associated request type with this request is MegaRequest::TYPE_GET_SESSION_TRANSFER_URL
7366          * Valid data in the MegaRequest object received in onRequestFinish when the error code
7367          * is MegaError::API_OK:
7368          * - MegaRequest::getLink - URL to open the desired page with the same account
7369          *
7370          * You take the ownership of the returned value.
7371          *
7372          * @param path Path inside https://mega.nz/# that we want to open with the current session
7373          *
7374          * For example, if you want to open https://mega.nz/#pro, the parameter of this function should be "pro".
7375          *
7376          * @param listener MegaRequestListener to track this request
7377          */
7378         void getSessionTransferURL(const char *path, MegaRequestListener *listener = NULL);
7379 
7380         /**
7381          * @brief Converts a Base32-encoded user handle (JID) to a MegaHandle
7382          *
7383          * @param base32Handle Base32-encoded handle (JID)
7384          * @return User handle
7385          */
7386         static MegaHandle base32ToHandle(const char* base32Handle);
7387 
7388         /**
7389          * @brief Converts a Base64-encoded node handle to a MegaHandle
7390          *
7391          * The returned value can be used to recover a MegaNode using MegaApi::getNodeByHandle
7392          * You can revert this operation using MegaApi::handleToBase64
7393          *
7394          * @param base64Handle Base64-encoded node handle
7395          * @return Node handle
7396          */
7397         static MegaHandle base64ToHandle(const char* base64Handle);
7398 
7399         /**
7400          * @brief Converts a Base64-encoded user handle to a MegaHandle
7401          *
7402          * You can revert this operation using MegaApi::userHandleToBase64
7403          *
7404          * @param base64Handle Base64-encoded user handle
7405          * @return User handle
7406          */
7407         static MegaHandle base64ToUserHandle(const char* base64Handle);
7408 
7409         /**
7410          * @brief Converts the handle of a node to a Base64-encoded string
7411          *
7412          * You take the ownership of the returned value
7413          * You can revert this operation using MegaApi::base64ToHandle
7414          *
7415          * @param handle Node handle to be converted
7416          * @return Base64-encoded node handle
7417          */
7418         static char* handleToBase64(MegaHandle handle);
7419 
7420         /**
7421          * @brief Converts a MegaHandle to a Base64-encoded string
7422          *
7423          * You take the ownership of the returned value
7424          * You can revert this operation using MegaApi::base64ToUserHandle
7425          *
7426          * @param handle User handle to be converted
7427          * @return Base64-encoded user handle
7428          */
7429         static char* userHandleToBase64(MegaHandle handle);
7430 
7431         /**
7432          * @brief Convert binary data to a base 64 encoded string
7433          *
7434          * For some operations such as background uploads, binary data must be converted to a format
7435          * suitable to be passed to the MegaApi interface. Use this function to do so.
7436          *
7437          * You take the ownership of the returned value
7438          *
7439          * @param binaryData A pointer to the start of the binary data
7440          * @param length The number of bytes in the binary data
7441          * @return A newly allocated NULL-terminated string consisting of base64 characters.
7442          */
7443         static char *binaryToBase64(const char* binaryData, size_t length);
7444 
7445         /**
7446          * @brief Convert data encoded in a base 64 string back to binary.
7447          *
7448          * This operation is the inverse of binaryToString64.
7449          *
7450          * You take ownership of the pointer assigned to *binary.
7451          *
7452          * @param base64string The base 64 encoded string to decode.
7453          * @param binary A pointer to a pointer to assign with a `new unsigned char[]`
7454          *        allocated buffer containing the decoded binary data.
7455          * @param size A pointer to a variable that will be assigned the size of the buffer allocated.
7456          */
7457         static void base64ToBinary(const char *base64string, unsigned char **binary, size_t* binarysize);
7458 
7459         /**
7460          * @brief Add entropy to internal random number generators
7461          *
7462          * It's recommended to call this function with random data specially to
7463          * enhance security,
7464          *
7465          * @param data Byte array with random data
7466          * @param size Size of the byte array (in bytes)
7467          */
7468         void addEntropy(char* data, unsigned int size);
7469 
7470 #ifdef WINDOWS_PHONE
7471         /**
7472          * @brief Set the ID for statistics
7473          *
7474          * This function is not thread-safe so it must be used before
7475          * the creation of instances of MegaApi to not interfere with
7476          * the internal thread. Otherwise, the behavior of this
7477          * function is undefined and it could even crash.
7478          *
7479          * Only the first call to this function will correctly set the ID.
7480          * If you call this function more times, it won't have any effect.
7481          *
7482          * The id parameter is hashed before being used
7483          *
7484          * @param id ID for statistics
7485          */
7486         static void setStatsID(const char *id);
7487 #endif
7488 
7489         /**
7490          * @brief Retry all pending requests
7491          *
7492          * When requests fails they wait some time before being retried. That delay grows exponentially if the request
7493          * fails again. For this reason, and since this request is very lightweight, it's recommended to call it with
7494          * the default parameters on every user interaction with the application. This will prevent very big delays
7495          * completing requests.
7496          *
7497          * The associated request type with this request is MegaRequest::TYPE_RETRY_PENDING_CONNECTIONS.
7498          * Valid data in the MegaRequest object received on callbacks:
7499          * - MegaRequest::getFlag - Returns the first parameter
7500          * - MegaRequest::getNumber - Returns the second parameter
7501          *
7502          * If not possible to retrieve the DNS servers from the system, in iOS, this request will fail with
7503          * the error code MegaError::API_EACCESS in onRequestFinish().
7504          *
7505          * @param disconnect true if you want to disconnect already connected requests
7506          * It's not recommended to set this flag to true if you are not fully sure about what are you doing. If you
7507          * send a request that needs some time to complete and you disconnect it in a loop without giving it enough time,
7508          * it could be retrying forever.
7509          * Using true in this parameter will trigger the callback MegaGlobalListener::onEvent and the callback
7510          * MegaListener::onEvent with the event type MegaEvent::EVENT_DISCONNECT.
7511          *
7512          * @param includexfers true to retry also transfers
7513          * It's not recommended to set this flag. Transfer has a retry counter and are aborted after a number of retries
7514          * MegaTransfer::getMaxRetries. Setting this flag to true, you will force more immediate retries and your transfers
7515          * could fail faster.
7516          *
7517          * @param listener MegaRequestListener to track this request
7518          */
7519         void retryPendingConnections(bool disconnect = false, bool includexfers = false, MegaRequestListener* listener = NULL);
7520 
7521         /**
7522          * @brief Use custom DNS servers
7523          *
7524          * The SDK tries to automatically get and use DNS servers configured in the system at startup. This function can be used
7525          * to override that automatic detection and use a custom list of DNS servers. It is also useful to provide working
7526          * DNS servers to the SDK in platforms in which it can't get them from the system (Windows Phone and Universal Windows Platform).
7527          *
7528          * Since the usage of this function implies a change in DNS servers used by the SDK, all connections are
7529          * closed and restarted using the new list of new DNS servers, so calling this function too often can cause
7530          * many retries and problems to complete requests. Please use it only at startup or when DNS servers need to be changed.
7531          *
7532          * The associated request type with this request is MegaRequest::TYPE_RETRY_PENDING_CONNECTIONS.
7533          * Valid data in the MegaRequest object received on callbacks:
7534          * - MegaRequest::getText - Returns the new list of DNS servers
7535          *
7536          * @param dnsServers New list of DNS servers. It must be a list of IPs separated by a comma character ",".
7537          * IPv6 servers are allowed (without brackets).
7538          *
7539          * The usage of this function will trigger the callback MegaGlobalListener::onEvent and the callback
7540          * MegaListener::onEvent with the event type MegaEvent::EVENT_DISCONNECT.
7541          *
7542          * @param listener MegaRequestListener to track this request
7543          */
7544         void setDnsServers(const char *dnsServers, MegaRequestListener* listener = NULL);
7545 
7546         /**
7547          * @brief Check if server-side Rubbish Bin autopurging is enabled for the current account
7548          *
7549          * This function will NOT return a valid value until the callback onEvent with
7550          * type MegaApi::EVENT_MISC_FLAGS_READY is received. You can also rely on the completion of
7551          * a fetchnodes to check this value, but only when it follows a login with user and password,
7552          * not when an existing session is resumed.
7553          *
7554          * @return True if this feature is enabled. Otherwise false.
7555          */
7556         bool serverSideRubbishBinAutopurgeEnabled();
7557 
7558         /**
7559          * @brief Check if the account has VOIP push enabled
7560          *
7561          * This function will NOT return a valid value until the callback onEvent with
7562          * type MegaApi::EVENT_MISC_FLAGS_READY is received. You can also rely on the completion of
7563          * a fetchnodes to check this value, but only when it follows a login with user and password,
7564          * not when an existing session is resumed.
7565          *
7566          * @return True if this feature is enabled. Otherwise false.
7567          */
7568         bool appleVoipPushEnabled();
7569 
7570         /**
7571          * @brief Check if the new format for public links is enabled
7572          *
7573          * This function will NOT return a valid value until the callback onEvent with
7574          * type MegaApi::EVENT_MISC_FLAGS_READY is received. You can also rely on the completion of
7575          * a fetchnodes to check this value, but only when it follows a login with user and password,
7576          * not when an existing session is resumed.
7577          *
7578          * For not logged-in mode, you need to call MegaApi::getMiscFlags first.
7579          *
7580          * @return True if this feature is enabled. Otherwise, false.
7581          */
7582         bool newLinkFormatEnabled();
7583 
7584         /**
7585          * @brief Check if the opt-in or account unblocking SMS is allowed
7586          *
7587          * The result indicated whether the MegaApi::sendSMSVerificationCode function can be used.
7588          *
7589          * This function will NOT return a valid value until the callback onEvent with
7590          * type MegaApi::EVENT_MISC_FLAGS_READY is received. You can also rely on the completion of
7591          * a fetchnodes to check this value, but only when it follows a login with user and password,
7592          * not when an existing session is resumed.
7593          *
7594          * For not logged-in mode, you need to call MegaApi::getMiscFlags first.
7595          *
7596          * @return 2 = Opt-in and unblock SMS allowed.  1 = Only unblock SMS allowed.  0 = No SMS allowed
7597          */
7598         int smsAllowedState();
7599 
7600         /**
7601          * @brief Get the verified phone number for the account logged in
7602          *
7603          * Returns the phone number previously confirmed with MegaApi::sendSMSVerificationCode
7604          * and MegaApi::checkSMSVerificationCode.
7605          *
7606          * You take the ownership of the returned value.
7607          *
7608          * @return NULL if there is no verified number, otherwise a string containing that phone number.
7609          */
7610         char* smsVerifiedPhoneNumber();
7611 
7612         /**
7613          * @brief Check if multi-factor authentication can be enabled for the current account.
7614          *
7615          * This function will NOT return a valid value until the callback onEvent with
7616          * type MegaApi::EVENT_MISC_FLAGS_READY is received. You can also rely on the completion of
7617          * a fetchnodes to check this value, but only when it follows a login with user and password,
7618          * not when an existing session is resumed.
7619          *
7620          * For not logged-in mode, you need to call MegaApi::getMiscFlags first.
7621          *
7622          * @return True if multi-factor authentication can be enabled for the current account, otherwise false.
7623          */
7624         bool multiFactorAuthAvailable();
7625 
7626         /**
7627          * @brief Reset the verified phone number for the account logged in.
7628          *
7629          * The associated request type with this request is MegaRequest::TYPE_RESET_SMS_VERIFIED_NUMBER
7630          * If there's no verified phone number associated for the account logged in, the error code
7631          * provided in onRequestFinish is MegaError::API_ENOENT.
7632          *
7633          * @param listener MegaRequestListener to track this request
7634          */
7635         void resetSmsVerifiedPhoneNumber(MegaRequestListener *listener = NULL);
7636 
7637         /**
7638          * @brief Check if multi-factor authentication is enabled for an account
7639          *
7640          * The associated request type with this request is MegaRequest::TYPE_MULTI_FACTOR_AUTH_CHECK
7641          * Valid data in the MegaRequest object received on callbacks:
7642          * - MegaRequest::getEmail - Returns the email sent in the first parameter
7643          *
7644          * Valid data in the MegaRequest object received in onRequestFinish when the error code
7645          * is MegaError::API_OK:
7646          * - MegaRequest::getFlag - Returns true if multi-factor authentication is enabled or false if it's disabled.
7647          *
7648          * @param email Email to check
7649          * @param listener MegaRequestListener to track this request
7650          */
7651         void multiFactorAuthCheck(const char *email, MegaRequestListener *listener = NULL);
7652 
7653         /**
7654          * @brief Get the secret code of the account to enable multi-factor authentication
7655          * The MegaApi object must be logged into an account to successfully use this function.
7656          *
7657          * The associated request type with this request is MegaRequest::TYPE_MULTI_FACTOR_AUTH_GET
7658          *
7659          * Valid data in the MegaRequest object received in onRequestFinish when the error code
7660          * is MegaError::API_OK:
7661          * - MegaRequest::getText - Returns the Base32 secret code needed to configure multi-factor authentication.
7662          *
7663          * @param listener MegaRequestListener to track this request
7664          */
7665         void multiFactorAuthGetCode(MegaRequestListener *listener = NULL);
7666 
7667         /**
7668          * @brief Enable multi-factor authentication for the account
7669          * The MegaApi object must be logged into an account to successfully use this function.
7670          *
7671          * The associated request type with this request is MegaRequest::TYPE_MULTI_FACTOR_AUTH_SET
7672          * Valid data in the MegaRequest object received on callbacks:
7673          * - MegaRequest::getFlag - Returns true
7674          * - MegaRequest::getPassword - Returns the pin sent in the first parameter
7675          *
7676          * @param pin Valid pin code for multi-factor authentication
7677          * @param listener MegaRequestListener to track this request
7678          */
7679         void multiFactorAuthEnable(const char *pin, MegaRequestListener *listener = NULL);
7680 
7681         /**
7682          * @brief Disable multi-factor authentication for the account
7683          * The MegaApi object must be logged into an account to successfully use this function.
7684          *
7685          * The associated request type with this request is MegaRequest::TYPE_MULTI_FACTOR_AUTH_SET
7686          * Valid data in the MegaRequest object received on callbacks:
7687          * - MegaRequest::getFlag - Returns false
7688          * - MegaRequest::getPassword - Returns the pin sent in the first parameter
7689          *
7690          * @param pin Valid pin code for multi-factor authentication
7691          * @param listener MegaRequestListener to track this request
7692          */
7693         void multiFactorAuthDisable(const char *pin, MegaRequestListener *listener = NULL);
7694 
7695         /**
7696          * @brief Log in to a MEGA account with multi-factor authentication enabled
7697          *
7698          * The associated request type with this request is MegaRequest::TYPE_LOGIN.
7699          * Valid data in the MegaRequest object received on callbacks:
7700          * - MegaRequest::getEmail - Returns the first parameter
7701          * - MegaRequest::getPassword - Returns the second parameter
7702          * - MegaRequest::getText - Returns the third parameter
7703          *
7704          * If the email/password aren't valid the error code provided in onRequestFinish is
7705          * MegaError::API_ENOENT.
7706          *
7707          * @param email Email of the user
7708          * @param password Password
7709          * @param pin Pin code for multi-factor authentication
7710          * @param listener MegaRequestListener to track this request
7711          */
7712         void multiFactorAuthLogin(const char* email, const char* password, const char* pin, MegaRequestListener *listener = NULL);
7713 
7714         /**
7715          * @brief Change the password of a MEGA account with multi-factor authentication enabled
7716          *
7717          * The associated request type with this request is MegaRequest::TYPE_CHANGE_PW
7718          * Valid data in the MegaRequest object received on callbacks:
7719          * - MegaRequest::getPassword - Returns the old password (if it was passed as parameter)
7720          * - MegaRequest::getNewPassword - Returns the new password
7721          * - MegaRequest::getText - Returns the pin code for multi-factor authentication
7722          *
7723          * @param oldPassword Old password (optional, it can be NULL to not check the old password)
7724          * @param newPassword New password
7725          * @param pin Pin code for multi-factor authentication
7726          * @param listener MegaRequestListener to track this request
7727          */
7728         void multiFactorAuthChangePassword(const char *oldPassword, const char *newPassword, const char* pin, MegaRequestListener *listener = NULL);
7729 
7730         /**
7731          * @brief Initialize the change of the email address associated to an account with multi-factor authentication enabled.
7732          *
7733          * The associated request type with this request is MegaRequest::TYPE_GET_CHANGE_EMAIL_LINK.
7734          * Valid data in the MegaRequest object received on all callbacks:
7735          * - MegaRequest::getEmail - Returns the email for the account
7736          * - MegaRequest::getText - Returns the pin code for multi-factor authentication
7737          *
7738          * If this request succeeds, a change-email link will be sent to the specified email address.
7739          * If no user is logged in, you will get the error code MegaError::API_EACCESS in onRequestFinish().
7740          *
7741          * If the MEGA account is a sub-user business account, onRequestFinish will
7742          * be called with the error code MegaError::API_EMASTERONLY.
7743          *
7744          * @param email The new email to be associated to the account.
7745          * @param pin Pin code for multi-factor authentication
7746          * @param listener MegaRequestListener to track this request
7747          */
7748         void multiFactorAuthChangeEmail(const char *email, const char* pin, MegaRequestListener *listener = NULL);
7749 
7750 
7751         /**
7752          * @brief Initialize the cancellation of an account.
7753          *
7754          * The associated request type with this request is MegaRequest::TYPE_GET_CANCEL_LINK.
7755          *
7756          * If this request succeeds, a cancellation link will be sent to the email address of the user.
7757          * If no user is logged in, you will get the error code MegaError::API_EACCESS in onRequestFinish().
7758          *
7759          * Valid data in the MegaRequest object received on all callbacks:
7760          * - MegaRequest::getText - Returns the pin code for multi-factor authentication
7761          *
7762          * If the MEGA account is a sub-user business account, onRequestFinish will
7763          * be called with the error code MegaError::API_EMASTERONLY.
7764          *
7765          * @see MegaApi::confirmCancelAccount
7766          *
7767          * @param pin Pin code for multi-factor authentication
7768          * @param listener MegaRequestListener to track this request
7769          */
7770         void multiFactorAuthCancelAccount(const char* pin, MegaRequestListener *listener = NULL);
7771 
7772         /**
7773          * @brief Fetch details related to time zones and the current default
7774          *
7775          * The associated request type with this request is MegaRequest::TYPE_FETCH_TIMEZONE.
7776          *
7777          * Valid data in the MegaRequest object received in onRequestFinish when the error code
7778          * is MegaError::API_OK:
7779          * - MegaRequest::getMegaTimeZoneDetails - Returns details about timezones and the current default
7780          *
7781          * @param listener MegaRequestListener to track this request
7782          */
7783         void fetchTimeZone(MegaRequestListener *listener = NULL);
7784 
7785         /**
7786          * @brief Log in to a MEGA account
7787          *
7788          * The associated request type with this request is MegaRequest::TYPE_LOGIN.
7789          * Valid data in the MegaRequest object received on callbacks:
7790          * - MegaRequest::getEmail - Returns the first parameter
7791          * - MegaRequest::getPassword - Returns the second parameter
7792          *
7793          * If the email/password aren't valid the error code provided in onRequestFinish is
7794          * MegaError::API_ENOENT.
7795          *
7796          * @param email Email of the user
7797          * @param password Password
7798          * @param listener MegaRequestListener to track this request
7799          */
7800         void login(const char* email, const char* password, MegaRequestListener *listener = NULL);
7801 
7802         /**
7803          * @brief Log in to a public folder using a folder link
7804          *
7805          * After a successful login, you should call MegaApi::fetchNodes to get filesystem and
7806          * start working with the folder.
7807          *
7808          * The associated request type with this request is MegaRequest::TYPE_LOGIN.
7809          * Valid data in the MegaRequest object received on callbacks:
7810          * - MegaRequest::getEmail - Retuns the string "FOLDER"
7811          * - MegaRequest::getLink - Returns the public link to the folder
7812          *
7813          * @param megaFolderLink Public link to a folder in MEGA
7814          * @param listener MegaRequestListener to track this request
7815          */
7816         void loginToFolder(const char* megaFolderLink, MegaRequestListener *listener = NULL);
7817 
7818         /**
7819          * @brief Log in to a MEGA account using precomputed keys
7820          *
7821          * The associated request type with this request is MegaRequest::TYPE_LOGIN.
7822          * Valid data in the MegaRequest object received on callbacks:
7823          * - MegaRequest::getEmail - Returns the first parameter
7824          * - MegaRequest::getPassword - Returns the second parameter
7825          * - MegaRequest::getPrivateKey - Returns the third parameter
7826          *
7827          * If the email/stringHash/base64pwKey aren't valid the error code provided in onRequestFinish is
7828          * MegaError::API_ENOENT.
7829          *
7830          * @param email Email of the user
7831          * @param stringHash Hash of the email returned by MegaApi::getStringHash
7832          * @param base64pwkey Private key returned by MegaRequest::getPrivateKey in the onRequestFinish callback of createAccount
7833          * @param listener MegaRequestListener to track this request
7834          *
7835          * @deprecated The parameter stringHash is no longer for new accounts so this function will be replaced by another
7836          * one soon. Please use MegaApi::login (with email and password) or MegaApi::fastLogin (with session) instead when possible.
7837          */
7838         void fastLogin(const char* email, const char *stringHash, const char *base64pwkey, MegaRequestListener *listener = NULL);
7839 
7840         /**
7841          * @brief Log in to a MEGA account using a session key
7842          *
7843          * The associated request type with this request is MegaRequest::TYPE_LOGIN.
7844          * Valid data in the MegaRequest object received on callbacks:
7845          * - MegaRequest::getSessionKey - Returns the session key
7846          *
7847          * @param session Session key previously dumped with MegaApi::dumpSession
7848          * @param listener MegaRequestListener to track this request
7849          */
7850         void fastLogin(const char* session, MegaRequestListener *listener = NULL);
7851 
7852         /**
7853          * @brief Close a MEGA session
7854          *
7855          * All clients using this session will be automatically logged out.
7856          *
7857          * You can get session information using MegaApi::getExtendedAccountDetails.
7858          * Then use MegaAccountDetails::getNumSessions and MegaAccountDetails::getSession
7859          * to get session info.
7860          * MegaAccountSession::getHandle provides the handle that this function needs.
7861          *
7862          * If you use mega::INVALID_HANDLE, all sessions except the current one will be closed
7863          *
7864          * @param sessionHandle Handle of the session. Use mega::INVALID_HANDLE to cancel all sessions except the current one
7865          * @param listener MegaRequestListener to track this request
7866          */
7867         void killSession(MegaHandle sessionHandle, MegaRequestListener *listener = NULL);
7868 
7869         /**
7870          * @brief Get data about the logged account
7871          *
7872          * The associated request type with this request is MegaRequest::TYPE_GET_USER_DATA.
7873          *
7874          * Valid data in the MegaRequest object received in onRequestFinish when the error code
7875          * is MegaError::API_OK:
7876          * - MegaRequest::getName - Returns the name of the logged user
7877          * - MegaRequest::getPassword - Returns the the public RSA key of the account, Base64-encoded
7878          * - MegaRequest::getPrivateKey - Returns the private RSA key of the account, Base64-encoded
7879          *
7880          * @param listener MegaRequestListener to track this request
7881          */
7882         void getUserData(MegaRequestListener *listener = NULL);
7883 
7884         /**
7885          * @brief Get data about a contact
7886          *
7887          * The associated request type with this request is MegaRequest::TYPE_GET_USER_DATA.
7888          * Valid data in the MegaRequest object received on callbacks:
7889          * - MegaRequest::getEmail - Returns the email of the contact
7890          *
7891          * Valid data in the MegaRequest object received in onRequestFinish when the error code
7892          * is MegaError::API_OK:
7893          * - MegaRequest::getPassword - Returns the public RSA key of the contact, Base64-encoded
7894          *
7895          * @param user Contact to get the data
7896          * @param listener MegaRequestListener to track this request
7897          */
7898         void getUserData(MegaUser *user, MegaRequestListener *listener = NULL);
7899 
7900         /**
7901          * @brief Get information about a MEGA user
7902          *
7903          * The associated request type with this request is MegaRequest::TYPE_GET_USER_DATA.
7904          * Valid data in the MegaRequest object received on callbacks:
7905          * - MegaRequest::getEmail - Returns the email or the Base64 handle of the user,
7906          * depending on the value provided as user parameter
7907          *
7908          * Valid data in the MegaRequest object received in onRequestFinish when the error code
7909          * is MegaError::API_OK:
7910          * - MegaRequest::getPassword - Returns the public RSA key of the user, Base64-encoded
7911          *
7912          * @param user Email or Base64 handle of the user
7913          * @param listener MegaRequestListener to track this request
7914          */
7915         void getUserData(const char *user, MegaRequestListener *listener = NULL);
7916 
7917         /**
7918          * @brief Fetch miscellaneous flags when not logged in
7919          *
7920          * The associated request type with this request is MegaRequest::TYPE_GET_MISC_FLAGS.
7921          *
7922          * When onRequestFinish is called with MegaError::API_OK, the miscellaneous flags are available.
7923          * If you are logged in into an account, the error code provided in onRequestFinish is
7924          * MegaError::API_EACCESS.
7925          *
7926          * @see MegaApi::multiFactorAuthAvailable
7927          * @see MegaApi::newLinkFormatEnabled
7928          * @see MegaApi::smsAllowedState
7929          *
7930          * @param listener MegaRequestListener to track this request
7931          */
7932         void getMiscFlags(MegaRequestListener *listener = NULL);
7933 
7934         /**
7935          * @brief Trigger special account state changes for own accounts, for testing
7936          *
7937          * Because the dev API command allows a wide variety of state changes including suspension and unsuspension,
7938          * it has restrictions on which accounts you can target, and where it can be called from.
7939          *
7940          * Your client must be on a company VPN IP address.
7941          *
7942          * The target account must be an @mega email address. The target account must either be the calling account,
7943          * OR a related account via a prefix and + character. For example if the calling account is name1+test@mega.co.nz
7944          * then it can perform a dev command on itself or on name1@mega.co.nz, name1+bob@mega.co.nz etc, but NOT on
7945          * name2@mega.co.nz or name2+test@meg.co.nz.
7946          *
7947          * The associated request type with this request is MegaRequest::TYPE_SEND_DEV_COMMAND.
7948          * Valid data in the MegaRequest object received on callbacks:
7949          * - MegaRequest::getName - Returns the first parameter
7950          * - MegaRequest::getEmail - Returns the second parameter
7951          *
7952          * Possible errors are:
7953          *  - EACCESS if the calling account is not allowed to perform this method (not a mega email account, not the right IP, etc).
7954          *  - EARGS if the subcommand is not present or is invalid
7955          *  - EBLOCKED if the target account is not allowed (this could also happen if the target account does not exist)
7956          *
7957          * Possible commands:
7958          *  - "aodq" - Advance ODQ Warning State
7959          *      If called, this will advance your ODQ warning state until the final warning state,
7960          *      at which point it will turn on the ODQ paywall for your account. It requires an account lock on the target account.
7961          *      This subcommand will return the 'step' of the warning flow you have advanced to - 1, 2, 3 or 4
7962          *      (the paywall is turned on at step 4)
7963          *
7964          *      Valid data in the MegaRequest object received in onRequestFinish when the error code is MegaError::API_OK:
7965          *       + MegaRequest::getNumber - Returns the number of warnings (1, 2, 3 or 4).
7966          *
7967          *      Possible errors in addition to the standard dev ones are:
7968          *       + EFAILED - your account is not in the RED stoplight state
7969          *
7970          * @param command The subcommand for the specific operation
7971          * @param email Optional email of the target email's account. If null, it will use the logged-in account
7972          * @param listener MegaRequestListener to track this request
7973          */
7974         void sendDevCommand(const char *command, const char *email = nullptr, MegaRequestListener *listener = nullptr);
7975 
7976         /**
7977          * @brief Returns the current session key
7978          *
7979          * You have to be logged in to get a valid session key. Otherwise,
7980          * this function returns NULL.
7981          *
7982          * You take the ownership of the returned value.
7983          *
7984          * @return Current session key
7985          */
7986         char *dumpSession();
7987 
7988         /**
7989          * @brief Returns the current sequence number
7990          *
7991          * The sequence number indicates the state of a MEGA account known by the SDK.
7992          * When external changes are received via actionpackets, the sequence number is
7993          * updated and changes are commited to the local cache.
7994          *
7995          * You take the ownership of the returned value.
7996          *
7997          * @return The current sequence number
7998          */
7999         char *getSequenceNumber();
8000 
8001         /**
8002          * @brief Get an authentication token that can be used to identify the user account
8003          *
8004          * If this MegaApi object is not logged into an account, this function will return NULL
8005          *
8006          * The value returned by this function can be used in other instances of MegaApi
8007          * thanks to the function MegaApi::setAccountAuth.
8008          *
8009          * You take the ownership of the returned value
8010          *
8011          * @return Authentication token
8012          */
8013         char *getAccountAuth();
8014 
8015         /**
8016          * @brief Use an authentication token to identify an account while accessing public folders
8017          *
8018          * This function is useful to preserve the PRO status when a public folder is being
8019          * used. The identifier will be sent in all API requests made after the call to this function.
8020          *
8021          * To stop using the current authentication token, it's needed to explicitly call
8022          * this function with NULL as parameter. Otherwise, the value set would continue
8023          * being used despite this MegaApi object is logged in or logged out.
8024          *
8025          * It's recommended to call this function before the usage of MegaApi::loginToFolder
8026          *
8027          * @param auth Authentication token used to identify the account of the user.
8028          * You can get it using MegaApi::getAccountAuth with an instance of MegaApi logged into
8029          * an account.
8030          */
8031         void setAccountAuth(const char* auth);
8032 
8033         /**
8034          * @brief Initialize the creation of a new MEGA account, with firstname and lastname
8035          *
8036          * The associated request type with this request is MegaRequest::TYPE_CREATE_ACCOUNT.
8037          * Valid data in the MegaRequest object received on callbacks:
8038          * - MegaRequest::getEmail - Returns the email for the account
8039          * - MegaRequest::getPassword - Returns the password for the account
8040          * - MegaRequest::getName - Returns the firstname of the user
8041          * - MegaRequest::getText - Returns the lastname of the user
8042          *
8043          * Valid data in the MegaRequest object received in onRequestFinish when the error code
8044          * is MegaError::API_OK:
8045          * - MegaRequest::getSessionKey - Returns the session id to resume the process
8046          *
8047          * If this request succeeds, a new ephemeral account will be created for the new user
8048          * and a confirmation email will be sent to the specified email address. The app may
8049          * resume the create-account process by using MegaApi::resumeCreateAccount.
8050          *
8051          * If an account with the same email already exists, you will get the error code
8052          * MegaError::API_EEXIST in onRequestFinish
8053          *
8054          * @param email Email for the account
8055          * @param password Password for the account
8056          * @param firstname Firstname of the user
8057          * @param lastname Lastname of the user
8058          * @param listener MegaRequestListener to track this request
8059          */
8060         void createAccount(const char* email, const char* password, const char* firstname, const char* lastname, MegaRequestListener *listener = NULL);
8061 
8062 
8063         /**
8064          * @brief Initialize the creation of a new MEGA account, with firstname and lastname
8065          *
8066          * The associated request type with this request is MegaRequest::TYPE_CREATE_ACCOUNT.
8067          * Valid data in the MegaRequest object received on callbacks:
8068          * - MegaRequest::getEmail - Returns the email for the account
8069          * - MegaRequest::getPassword - Returns the password for the account
8070          * - MegaRequest::getName - Returns the firstname of the user
8071          * - MegaRequest::getText - Returns the lastname of the user
8072          * - MegaRequest::getNodeHandle - Returns the last public node handle accessed
8073          * - MegaRequest::getAccess - Returns the type of lastPublicHandle
8074          * - MegaRequest::getTransferredBytes - Returns the timestamp of the last access
8075          *
8076          * Valid data in the MegaRequest object received in onRequestFinish when the error code
8077          * is MegaError::API_OK:
8078          * - MegaRequest::getSessionKey - Returns the session id to resume the process
8079          *
8080          * If this request succeeds, a new ephemeral session will be created for the new user
8081          * and a confirmation email will be sent to the specified email address. The app may
8082          * resume the create-account process by using MegaApi::resumeCreateAccount.
8083          *
8084          * If an account with the same email already exists, you will get the error code
8085          * MegaError::API_EEXIST in onRequestFinish
8086          *
8087          * @param email Email for the account
8088          * @param password Password for the account
8089          * @param firstname Firstname of the user
8090          * @param lastname Lastname of the user
8091          * @param lastPublicHandle Last public node handle accessed by the user in the last 24h
8092          * @param lastPublicHandleType Indicates the type of lastPublicHandle, valid values are:
8093          *      - MegaApi::AFFILIATE_TYPE_ID = 1
8094          *      - MegaApi::AFFILIATE_TYPE_FILE_FOLDER = 2
8095          *      - MegaApi::AFFILIATE_TYPE_CHAT = 3
8096          *      - MegaApi::AFFILIATE_TYPE_CONTACT = 4
8097          *
8098          * @param lastAccessTimestamp Timestamp of the last access
8099          * @param listener MegaRequestListener to track this request
8100          */
8101         void createAccount(const char* email, const char* password, const char* firstname, const char* lastname, MegaHandle lastPublicHandle, int lastPublicHandleType, int64_t lastAccessTimestamp, MegaRequestListener *listener = NULL);
8102 
8103         /**
8104          * @brief Resume a registration process
8105          *
8106          * When a user begins the account registration process by calling MegaApi::createAccount,
8107          * an ephemeral account is created.
8108          *
8109          * Until the user successfully confirms the signup link sent to the provided email address,
8110          * you can resume the ephemeral session in order to change the email address, resend the
8111          * signup link (@see MegaApi::sendSignupLink) and also to receive notifications in case the
8112          * user confirms the account using another client (MegaGlobalListener::onAccountUpdate or
8113          * MegaListener::onAccountUpdate). It is also possible to cancel the registration process by
8114          * MegaApi::cancelCreateAccount, which invalidates the signup link associated to the ephemeral
8115          * session (the session will be still valid).
8116          *
8117          * The associated request type with this request is MegaRequest::TYPE_CREATE_ACCOUNT.
8118          * Valid data in the MegaRequest object received on callbacks:
8119          * - MegaRequest::getSessionKey - Returns the session id to resume the process
8120          * - MegaRequest::getParamType - Returns the value 1
8121          *
8122          * In case the account is already confirmed, the associated request will fail with
8123          * error MegaError::API_EARGS.
8124          *
8125          * @param sid Session id valid for the ephemeral account (@see MegaApi::createAccount)
8126          * @param listener MegaRequestListener to track this request
8127          */
8128         void resumeCreateAccount(const char* sid, MegaRequestListener *listener = NULL);
8129 
8130         /**
8131          * @brief Cancel a registration process
8132          *
8133          * If a signup link has been generated during registration process, call this function
8134          * to invalidate it. The ephemeral session will not be invalidated, only the signup link.
8135          *
8136          * The associated request type with this request is MegaRequest::TYPE_CREATE_ACCOUNT.
8137          * Valid data in the MegaRequest object received on callbacks:
8138          * - MegaRequest::getParamType - Returns the value 2
8139          *
8140          * @param listener MegaRequestListener to track this request
8141          */
8142         void cancelCreateAccount(MegaRequestListener *listener = NULL);
8143 
8144         /**
8145          * @brief Sends the confirmation email for a new account
8146          *
8147          * This function is useful to send the confirmation link again or to send it to a different
8148          * email address, in case the user mistyped the email at the registration form. It can only
8149          * be used after a successful call to MegaApi::createAccount or MegaApi::resumeCreateAccount.
8150          *
8151          * The associated request type with this request is MegaRequest::TYPE_SEND_SIGNUP_LINK.
8152          *
8153          * @param email Email for the account
8154          * @param name Fullname of the user (firstname + lastname)
8155          * @param password Password for the account
8156          * @param listener MegaRequestListener to track this request
8157          */
8158         void sendSignupLink(const char* email, const char *name, const char *password, MegaRequestListener *listener = NULL);
8159 
8160         /**
8161          * @brief Sends the confirmation email for a new account
8162          *
8163          * This function is useful to send the confirmation link again or to send it to a different
8164          * email address, in case the user mistyped the email at the registration form.
8165          *
8166          * @param email Email for the account
8167          * @param name Fullname of the user (firstname + lastname)
8168          * @param base64pwkey Private key returned by MegaRequest::getPrivateKey in the onRequestFinish callback of createAccount
8169          * @param listener MegaRequestListener to track this request
8170          *
8171          * @deprecated This function only works using the old registration method and will be removed soon.
8172          * Please use MegaApi::sendSignupLink (with email and password) instead.
8173          */
8174         void fastSendSignupLink(const char* email, const char *base64pwkey, const char *name, MegaRequestListener *listener = NULL);
8175 
8176         /**
8177          * @brief Get information about a confirmation link or a new signup link
8178          *
8179          * The associated request type with this request is MegaRequest::TYPE_QUERY_SIGNUP_LINK.
8180          * Valid data in the MegaRequest object received on all callbacks:
8181          * - MegaRequest::getLink - Returns the confirmation link
8182          *
8183          * Valid data in the MegaRequest object received in onRequestFinish when the error code
8184          * is MegaError::API_OK:
8185          * - MegaRequest::getEmail - Return the email associated with the link
8186          * - MegaRequest::getName - Returns the name associated with the link (available only for confirmation links)
8187          * - MegaRequest::getFlag - Returns true if the account was automatically confirmed, otherwise false
8188          *
8189          * If MegaRequest::getFlag returns true, the account was automatically confirmed and it's not needed
8190          * to call MegaApi::confirmAccount. If it returns false, it's needed to call MegaApi::confirmAccount
8191          * as usual. New accounts (V2, starting from April 2018) do not require a confirmation with the password,
8192          * but old confirmation links (V1) require it, so it's needed to check that parameter in onRequestFinish
8193          * to know how to proceed.
8194          *
8195          * If already logged-in into a different account, you will get the error code MegaError::API_EACCESS
8196          * in onRequestFinish.
8197          * If logged-in into the account that is attempted to confirm and the account is already confirmed, you
8198          * will get the error code MegaError::API_EEXPIRED in onRequestFinish.
8199          * In both cases, the MegaRequest::getEmail will return the email of the account that was attempted
8200          * to confirm, and the MegaRequest::getName will return the name.
8201          *
8202          * @param link Confirmation link (#confirm) or new signup link (#newsignup)
8203          * @param listener MegaRequestListener to track this request
8204          */
8205         void querySignupLink(const char* link, MegaRequestListener *listener = NULL);
8206 
8207         /**
8208          * @brief Confirm a MEGA account using a confirmation link and the user password
8209          *
8210          * The associated request type with this request is MegaRequest::TYPE_CONFIRM_ACCOUNT
8211          * Valid data in the MegaRequest object received on callbacks:
8212          * - MegaRequest::getLink - Returns the confirmation link
8213          * - MegaRequest::getPassword - Returns the password
8214          *
8215          * Valid data in the MegaRequest object received in onRequestFinish when the error code
8216          * is MegaError::API_OK:
8217          * - MegaRequest::getEmail - Email of the account
8218          * - MegaRequest::getName - Name of the user
8219          *
8220          * As a result of a successfull confirmation, the app will receive the callback
8221          * MegaListener::onEvent and MegaGlobalListener::onEvent with an event of type
8222          * MegaEvent::EVENT_ACCOUNT_CONFIRMATION. You can check the email used to confirm
8223          * the account by checking MegaEvent::getText. @see MegaListener::onEvent.
8224          *
8225          * If already logged-in into a different account, you will get the error code MegaError::API_EACCESS
8226          * in onRequestFinish.
8227          * If logged-in into the account that is attempted to confirm and the account is already confirmed, you
8228          * will get the error code MegaError::API_EEXPIRED in onRequestFinish.
8229          * In both cases, the MegaRequest::getEmail will return the email of the account that was attempted
8230          * to confirm, and the MegaRequest::getName will return the name.
8231          *
8232          * @param link Confirmation link
8233          * @param password Password of the account
8234          * @param listener MegaRequestListener to track this request
8235          */
8236         void confirmAccount(const char* link, const char *password, MegaRequestListener *listener = NULL);
8237 
8238         /**
8239          * @brief Confirm a MEGA account using a confirmation link and a precomputed key
8240          *
8241          * The associated request type with this request is MegaRequest::TYPE_CONFIRM_ACCOUNT
8242          * Valid data in the MegaRequest object received on callbacks:
8243          * - MegaRequest::getLink - Returns the confirmation link
8244          * - MegaRequest::getPrivateKey - Returns the base64pwkey parameter
8245          *
8246          * Valid data in the MegaRequest object received in onRequestFinish when the error code
8247          * is MegaError::API_OK:
8248          * - MegaRequest::getEmail - Email of the account
8249          * - MegaRequest::getName - Name of the user
8250          *
8251          * As a result of a successfull confirmation, the app will receive the callback
8252          * MegaListener::onEvent and MegaGlobalListener::onEvent with an event of type
8253          * MegaEvent::EVENT_ACCOUNT_CONFIRMATION. You can check the email used to confirm
8254          * the account by checking MegaEvent::getText. @see MegaListener::onEvent.
8255          *
8256          * @param link Confirmation link
8257          * @param base64pwkey Private key precomputed with MegaApi::getBase64PwKey
8258          * @param listener MegaRequestListener to track this request
8259          *
8260          * @deprecated This function only works using the old registration method and will be removed soon.
8261          * Please use MegaApi::confirmAccount instead.
8262          */
8263         void fastConfirmAccount(const char* link, const char *base64pwkey, MegaRequestListener *listener = NULL);
8264 
8265         /**
8266          * @brief Initialize the reset of the existing password, with and without the Master Key.
8267          *
8268          * The associated request type with this request is MegaRequest::TYPE_GET_RECOVERY_LINK.
8269          * Valid data in the MegaRequest object received on callbacks:
8270          * - MegaRequest::getEmail - Returns the email for the account
8271          * - MegaRequest::getFlag - Returns whether the user has a backup of the master key or not.
8272          *
8273          * If this request succeeds, a recovery link will be sent to the user.
8274          * If no account is registered under the provided email, you will get the error code
8275          * MegaError::API_ENOENT in onRequestFinish
8276          *
8277          * @param email Email used to register the account whose password wants to be reset.
8278          * @param hasMasterKey True if the user has a backup of the master key. Otherwise, false.
8279          * @param listener MegaRequestListener to track this request
8280          */
8281         void resetPassword(const char *email, bool hasMasterKey, MegaRequestListener *listener = NULL);
8282 
8283         /**
8284          * @brief Get information about a recovery link created by MegaApi::resetPassword.
8285          *
8286          * The associated request type with this request is MegaRequest::TYPE_QUERY_RECOVERY_LINK
8287          * Valid data in the MegaRequest object received on all callbacks:
8288          * - MegaRequest::getLink - Returns the recovery link
8289          *
8290          * Valid data in the MegaRequest object received in onRequestFinish when the error code
8291          * is MegaError::API_OK:
8292          * - MegaRequest::getEmail - Return the email associated with the link
8293          * - MegaRequest::getFlag - Return whether the link requires masterkey to reset password.
8294          *
8295          * @param link Recovery link (#recover)
8296          * @param listener MegaRequestListener to track this request
8297          */
8298         void queryResetPasswordLink(const char *link, MegaRequestListener *listener = NULL);
8299 
8300         /**
8301          * @brief Set a new password for the account pointed by the recovery link.
8302          *
8303          * Recovery links are created by calling MegaApi::resetPassword and may or may not
8304          * require to provide the Master Key.
8305          *
8306          * @see The flag of the MegaRequest::TYPE_QUERY_RECOVERY_LINK in MegaApi::queryResetPasswordLink.
8307          *
8308          * The associated request type with this request is MegaRequest::TYPE_CONFIRM_RECOVERY_LINK
8309          * Valid data in the MegaRequest object received on all callbacks:
8310          * - MegaRequest::getLink - Returns the recovery link
8311          * - MegaRequest::getPassword - Returns the new password
8312          * - MegaRequest::getPrivateKey - Returns the Master Key, when provided
8313          *
8314          * Valid data in the MegaRequest object received in onRequestFinish when the error code
8315          * is MegaError::API_OK:
8316          * - MegaRequest::getEmail - Return the email associated with the link
8317          * - MegaRequest::getFlag - Return whether the link requires masterkey to reset password.
8318          *
8319          * If the account is logged-in into a different account than the account for which the link
8320          * was generated, onRequestFinish will be called with the error code MegaError::API_EACCESS.
8321          *
8322          * @param link The recovery link sent to the user's email address.
8323          * @param newPwd The new password to be set.
8324          * @param masterKey Base64-encoded string containing the master key (optional).
8325          * @param listener MegaRequestListener to track this request
8326          */
8327         void confirmResetPassword(const char *link, const char *newPwd, const char *masterKey = NULL, MegaRequestListener *listener = NULL);
8328 
8329         /**
8330          * @brief Initialize the cancellation of an account.
8331          *
8332          * The associated request type with this request is MegaRequest::TYPE_GET_CANCEL_LINK.
8333          *
8334          * If this request succeeds, a cancellation link will be sent to the email address of the user.
8335          * If no user is logged in, you will get the error code MegaError::API_EACCESS in onRequestFinish().
8336          *
8337          * If the MEGA account is a sub-user business account, onRequestFinish will
8338          * be called with the error code MegaError::API_EMASTERONLY.
8339          *
8340          * @see MegaApi::confirmCancelAccount
8341          *
8342          * @param listener MegaRequestListener to track this request
8343          */
8344         void cancelAccount(MegaRequestListener *listener = NULL);
8345 
8346         /**
8347          * @brief Get information about a cancel link created by MegaApi::cancelAccount.
8348          *
8349          * The associated request type with this request is MegaRequest::TYPE_QUERY_RECOVERY_LINK
8350          * Valid data in the MegaRequest object received on all callbacks:
8351          * - MegaRequest::getLink - Returns the cancel link
8352          *
8353          * Valid data in the MegaRequest object received in onRequestFinish when the error code
8354          * is MegaError::API_OK:
8355          * - MegaRequest::getEmail - Return the email associated with the link
8356          *
8357          * @param link Cancel link (#cancel)
8358          * @param listener MegaRequestListener to track this request
8359          */
8360         void queryCancelLink(const char *link, MegaRequestListener *listener = NULL);
8361 
8362         /**
8363          * @brief Effectively parks the user's account without creating a new fresh account.
8364          *
8365          * If no user is logged in, you will get the error code MegaError::API_EACCESS in onRequestFinish().
8366          *
8367          * The contents of the account will then be purged after 60 days. Once the account is
8368          * parked, the user needs to contact MEGA support to restore the account.
8369          *
8370          * The associated request type with this request is MegaRequest::TYPE_CONFIRM_CANCEL_LINK.
8371          * Valid data in the MegaRequest object received on all callbacks:
8372          * - MegaRequest::getLink - Returns the recovery link
8373          * - MegaRequest::getPassword - Returns the new password
8374          *
8375          * Valid data in the MegaRequest object received in onRequestFinish when the error code
8376          * is MegaError::API_OK:
8377          * - MegaRequest::getEmail - Return the email associated with the link
8378          *
8379          * @param link Cancellation link sent to the user's email address;
8380          * @param pwd Password for the account.
8381          * @param listener MegaRequestListener to track this request
8382          */
8383         void confirmCancelAccount(const char *link, const char *pwd, MegaRequestListener *listener = NULL);
8384 
8385         /**
8386          * @brief Allow to resend the verification email for Weak Account Protection
8387          *
8388          * The verification email will be resent to the same address as it was previously sent to.
8389          *
8390          * This function can be called if the the reason for being blocked is:
8391          *      700: the account is supended for Weak Account Protection.
8392          *
8393          * If the logged in account is not suspended or is suspended for some other reason,
8394          * onRequestFinish will be called with the error code MegaError::API_EACCESS.
8395          *
8396          * If the logged in account has not been sent the unlock email before,
8397          * onRequestFinish will be called with the error code MegaError::API_EARGS.
8398          *
8399          * If the logged in account has already sent the unlock email and until it's available again,
8400          * onRequestFinish will be called with the error code MegaError::API_ETEMPUNAVAIL.
8401          *
8402          * @param listener MegaRequestListener to track this request
8403          */
8404         void resendVerificationEmail(MegaRequestListener *listener = NULL);
8405 
8406         /**
8407          * @brief Initialize the change of the email address associated to the account.
8408          *
8409          * The associated request type with this request is MegaRequest::TYPE_GET_CHANGE_EMAIL_LINK.
8410          * Valid data in the MegaRequest object received on all callbacks:
8411          * - MegaRequest::getEmail - Returns the email for the account
8412          *
8413          * If this request succeeds, a change-email link will be sent to the specified email address.
8414          * If no user is logged in, you will get the error code MegaError::API_EACCESS in onRequestFinish().
8415          *
8416          * If the MEGA account is a sub-user business account, onRequestFinish will
8417          * be called with the error code MegaError::API_EMASTERONLY.
8418          *
8419          * @param email The new email to be associated to the account.
8420          * @param listener MegaRequestListener to track this request
8421          */
8422         void changeEmail(const char *email, MegaRequestListener *listener = NULL);
8423 
8424         /**
8425          * @brief Get information about a change-email link created by MegaApi::changeEmail.
8426          *
8427          * The associated request type with this request is MegaRequest::TYPE_QUERY_RECOVERY_LINK
8428          * Valid data in the MegaRequest object received on all callbacks:
8429          * - MegaRequest::getLink - Returns the change-email link
8430          *
8431          * Valid data in the MegaRequest object received in onRequestFinish when the error code
8432          * is MegaError::API_OK:
8433          * - MegaRequest::getEmail - Return the email associated with the link
8434          *
8435          * If the account is logged-in into a different account than the account for which the link
8436          * was generated, onRequestFinish will be called with the error code MegaError::API_EACCESS.
8437          *
8438          * @param link Change-email link (#verify)
8439          * @param listener MegaRequestListener to track this request
8440          */
8441         void queryChangeEmailLink(const char *link, MegaRequestListener *listener = NULL);
8442 
8443         /**
8444          * @brief Effectively changes the email address associated to the account.
8445          *
8446          * If no user is logged in, you will get the error code MegaError::API_EACCESS in onRequestFinish().
8447          *
8448          * The associated request type with this request is MegaRequest::TYPE_CONFIRM_CHANGE_EMAIL_LINK.
8449          * Valid data in the MegaRequest object received on all callbacks:
8450          * - MegaRequest::getLink - Returns the change-email link
8451          * - MegaRequest::getPassword - Returns the password
8452          *
8453          * Valid data in the MegaRequest object received in onRequestFinish when the error code
8454          * is MegaError::API_OK:
8455          * - MegaRequest::getEmail - Return the email associated with the link
8456          *
8457          * If the account is logged-in into a different account than the account for which the link
8458          * was generated, onRequestFinish will be called with the error code MegaError::API_EACCESS.
8459          *
8460          * @param link Change-email link sent to the user's email address.
8461          * @param pwd Password for the account.
8462          * @param listener MegaRequestListener to track this request
8463          */
8464         void confirmChangeEmail(const char *link, const char *pwd, MegaRequestListener *listener = NULL);
8465 
8466         /**
8467          * @brief Set proxy settings
8468          *
8469          * The SDK will start using the provided proxy settings as soon as this function returns.
8470          *
8471          * @param proxySettings Proxy settings
8472          * @param listener MegaRequestListener to track this request
8473          * @see MegaProxy
8474          */
8475         void setProxySettings(MegaProxy *proxySettings, MegaRequestListener *listener = NULL);
8476 
8477         /**
8478          * @brief Try to detect the system's proxy settings
8479          *
8480          * Automatic proxy detection is currently supported on Windows only.
8481          * On other platforms, this fuction will return a MegaProxy object
8482          * of type MegaProxy::PROXY_NONE
8483          *
8484          * You take the ownership of the returned value.
8485          *
8486          * @return MegaProxy object with the detected proxy settings
8487          */
8488         MegaProxy *getAutoProxySettings();
8489 
8490         /**
8491          * @brief Check if the MegaApi object is logged in
8492          * @return 0 if not logged in, Otherwise, a number > 0
8493          */
8494         int isLoggedIn();
8495 
8496         /**
8497          * @brief Check the reason of being blocked.
8498          *
8499          * The associated request type with this request is MegaRequest::TYPE_WHY_AM_I_BLOCKED.
8500          *
8501          * This request can be sent internally at anytime (whenever an account gets blocked), so
8502          * a MegaGlobalListener should process the result, show the reason and logout.
8503          *
8504          * Valid data in the MegaRequest object received in onRequestFinish when the error code
8505          * is MegaError::API_OK:
8506          * - MegaRequest::getText - Returns the reason string (in English)
8507          * - MegaRequest::getNumber - Returns the reason code. Possible values:
8508          *          - MegaApi::ACCOUNT_NOT_BLOCKED = 0
8509          *              Account is not blocked in any way.
8510          *
8511          *          - MegaApi::ACCOUNT_BLOCKED_TOS_NON_COPYRIGHT = 200
8512          *              Suspension message for any type of suspension, but copyright suspension.
8513          *
8514          *          - MegaApi::ACCOUNT_BLOCKED_TOS_COPYRIGHT = 300
8515          *              Suspension only for multiple copyright violations.
8516          *
8517          *          - MegaApi::ACCOUNT_BLOCKED_SUBUSER_DISABLED = 400
8518          *              Subuser of the business account has been disabled.
8519          *
8520          *          - MegaApi::ACCOUNT_BLOCKED_SUBUSER_REMOVED = 401
8521          *              Subuser of business account has been removed.
8522          *
8523          *          - MegaApi::ACCOUNT_BLOCKED_VERIFICATION_SMS = 500
8524          *              The account is temporary blocked and needs to be verified by an SMS code.
8525          *
8526          *          - MegaApi::ACCOUNT_BLOCKED_VERIFICATION_EMAIL = 700
8527          *              The account is temporary blocked and needs to be verified by email (Weak Account Protection).
8528          *
8529          * If the error code in the MegaRequest object received in onRequestFinish
8530          * is MegaError::API_OK, the user is not blocked.
8531          */
8532         void whyAmIBlocked(MegaRequestListener *listener = NULL);
8533 
8534         /**
8535          * @brief Create a contact link
8536          *
8537          * The associated request type with this request is MegaRequest::TYPE_CONTACT_LINK_CREATE.
8538          *
8539          * Valid data in the MegaRequest object received on all callbacks:
8540          * - MegaRequest::getFlag - Returns the value of \c renew parameter
8541          *
8542          * Valid data in the MegaRequest object received in onRequestFinish when the error code
8543          * is MegaError::API_OK:
8544          * - MegaRequest::getNodeHandle - Return the handle of the new contact link
8545          *
8546          * @param renew True to invalidate the previous contact link (if any).
8547          * @param listener MegaRequestListener to track this request
8548          */
8549         void contactLinkCreate(bool renew = false, MegaRequestListener *listener = NULL);
8550 
8551         /**
8552          * @brief Get information about a contact link
8553          *
8554          * The associated request type with this request is MegaRequest::TYPE_CONTACT_LINK_QUERY.
8555          *
8556          * Valid data in the MegaRequest object received on all callbacks:
8557          * - MegaRequest::getNodeHandle - Returns the handle of the contact link
8558          *
8559          * Valid data in the MegaRequest object received in onRequestFinish when the error code
8560          * is MegaError::API_OK:
8561          * - MegaRequest::getParentHandle - Returns the userhandle of the contact
8562          * - MegaRequest::getEmail - Returns the email of the contact
8563          * - MegaRequest::getName - Returns the first name of the contact
8564          * - MegaRequest::getText - Returns the last name of the contact
8565          * - MegaRequest::getFile - Returns the avatar of the contact (JPG with Base64 encoding)
8566          *
8567          * @param handle Handle of the contact link to check
8568          * @param listener MegaRequestListener to track this request
8569          */
8570         void contactLinkQuery(MegaHandle handle, MegaRequestListener *listener = NULL);
8571 
8572         /**
8573          * @brief Delete a contact link
8574          *
8575          * The associated request type with this request is MegaRequest::TYPE_CONTACT_LINK_DELETE.
8576          *
8577          * Valid data in the MegaRequest object received on all callbacks:
8578          * - MegaRequest::getNodeHandle - Returns the handle of the contact link
8579          *
8580          * @param handle Handle of the contact link to delete
8581          * If the parameter is INVALID_HANDLE, the active contact link is deleted
8582          *
8583          * @param listener MegaRequestListener to track this request
8584          */
8585         void contactLinkDelete(MegaHandle handle = INVALID_HANDLE, MegaRequestListener *listener = NULL);
8586 
8587         /**
8588          * @brief Command to keep mobile apps alive when needed
8589          *
8590          * When this feature is enabled, API servers will regularly send push notifications
8591          * to keep the application running. Before using this function, it's needed to register
8592          * a notification token using MegaApi::registerPushNotifications
8593          *
8594          * The associated request type with this request is MegaRequest::TYPE_KEEP_ME_ALIVE.
8595          *
8596          * Valid data in the MegaRequest object received on all callbacks:
8597          * - MegaRequest::getParamType - Returns the type send in the first parameter
8598          * - MegaRequest::getFlag - Returns true when the feature is being enabled, otherwise false
8599          *
8600          * @param type Type of keep alive desired
8601          * Valid values for this parameter:
8602          * - MegaApi::KEEP_ALIVE_CAMERA_UPLOADS = 0
8603          *
8604          * @param enable True to enable this feature, false to disable it
8605          * @param listener MegaRequestListener to track this request
8606          *
8607          * @see MegaApi::registerPushNotifications
8608          */
8609         void keepMeAlive(int type, bool enable, MegaRequestListener *listener = NULL);
8610 
8611         /**
8612          * @brief Get the next PSA (Public Service Announcement) that should be shown to the user
8613          *
8614          * After the PSA has been accepted or dismissed by the user, app should
8615          * use MegaApi::setPSA to notify API servers about this event and
8616          * do not get the same PSA again in the next call to this function.
8617          *
8618          * The associated request type with this request is MegaRequest::TYPE_GET_PSA.
8619          *
8620          * Valid data in the MegaRequest object received in onRequestFinish when the error code
8621          * is MegaError::API_OK:
8622          * - MegaRequest::getNumber - Returns the id of the PSA (useful to call MegaApi::setPSA later)
8623          * - MegaRequest::getName - Returns the title of the PSA
8624          * - MegaRequest::getText - Returns the text of the PSA
8625          * - MegaRequest::getFile - Returns the URL of the image of the PSA
8626          * - MegaRequest::getPassword - Returns the text for the possitive button (or an empty string)
8627          * - MegaRequest::getLink - Returns the link for the possitive button (or an empty string)
8628          *
8629          * If there isn't any new PSA to show, onRequestFinish will be called with the error
8630          * code MegaError::API_ENOENT.
8631          *
8632          * @param listener MegaRequestListener to track this request
8633          * @see MegaApi::setPSA
8634          */
8635         void getPSA(MegaRequestListener *listener = NULL);
8636 
8637         /**
8638          * @brief Notify API servers that a PSA (Public Service Announcement) has been already seen
8639          *
8640          * The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER.
8641          *
8642          * Valid data in the MegaRequest object received on callbacks:
8643          * - MegaRequest::getParamType - Returns the value MegaApi::USER_ATTR_LAST_PSA
8644          * - MegaRequest::getText - Returns the id passed in the first parameter (as a string)
8645          *
8646          * @param id Identifier of the PSA
8647          * @param listener MegaRequestListener to track this request
8648          *
8649          * @see MegaApi::getPSA
8650          */
8651         void setPSA(int id, MegaRequestListener *listener = NULL);
8652 
8653         /**
8654         * @brief Command to acknowledge user alerts.
8655         *
8656         * Other clients will be notified that alerts to this point have been seen.
8657         *
8658         * The associated request type with this request is MegaRequest::TYPE_USERALERT_ACKNOWLEDGE.
8659         *
8660         * @param listener MegaRequestListener to track this request
8661         *
8662         * @see MegaApi::getUserAlerts
8663         */
8664         void acknowledgeUserAlerts(MegaRequestListener *listener = NULL);
8665 
8666         /**
8667          * @brief Retuns the email of the currently open account
8668          *
8669          * If the MegaApi object isn't logged in or the email isn't available,
8670          * this function returns NULL
8671          *
8672          * You take the ownership of the returned value
8673          *
8674          * @return Email of the account
8675          */
8676         char* getMyEmail();
8677 
8678         /**
8679          * @brief Returns the user handle of the currently open account
8680          *
8681          * If the MegaApi object isn't logged in,
8682          * this function returns NULL
8683          *
8684          * You take the ownership of the returned value
8685          *
8686          * @return User handle of the account
8687          */
8688         char* getMyUserHandle();
8689 
8690         /**
8691          * @brief Returns the user handle of the currently open account
8692          *
8693          * If the MegaApi object isn't logged in,
8694          * this function returns INVALID_HANDLE
8695          *
8696          * @return User handle of the account
8697          */
8698         MegaHandle getMyUserHandleBinary();
8699 
8700         /**
8701          * @brief Get the MegaUser of the currently open account
8702          *
8703          * If the MegaApi object isn't logged in, this function returns NULL.
8704          *
8705          * You take the ownership of the returned value
8706          *
8707          * @note The visibility of your own user is undefined and shouldn't be used.
8708          * @return MegaUser of the currently open account, otherwise NULL
8709          */
8710         MegaUser* getMyUser();
8711 
8712         /**
8713          * @brief Returns whether MEGA Achievements are enabled for the open account
8714          * @return True if enabled, false otherwise.
8715          */
8716         bool isAchievementsEnabled();
8717 
8718         /**
8719          * @brief Check if the account is a business account.
8720          *
8721          * @note This function must be called only if we have received the callback
8722          * MegaGlobalListener::onEvent and the callback MegaListener::onEvent
8723          * with the event type MegaEvent::EVENT_BUSINESS_STATUS
8724          *
8725          * @return returns true if it's a business account, otherwise false
8726          */
8727         bool isBusinessAccount();
8728 
8729         /**
8730          * @brief Check if the account is a master account.
8731          *
8732          * When a business account is a sub-user, not the master, some user actions will be blocked.
8733          * In result, the API will return the error code MegaError::API_EMASTERONLY. Some examples of
8734          * requests that may fail with this error are:
8735          *  - MegaApi::cancelAccount
8736          *  - MegaApi::changeEmail
8737          *  - MegaApi::remove
8738          *  - MegaApi::removeVersion
8739          *
8740          * @note This function must be called only if we have received the callback
8741          * MegaGlobalListener::onEvent and the callback MegaListener::onEvent
8742          * with the event type MegaEvent::EVENT_BUSINESS_STATUS
8743          *
8744          * @return returns true if it's a master account, false if it's a sub-user account
8745          */
8746         bool isMasterBusinessAccount();
8747 
8748         /**
8749          * @brief Check if the business account is active or not.
8750          *
8751          * When a business account is not active, some user actions will be blocked. In result, the API
8752          * will return the error code MegaError::API_EBUSINESSPASTDUE. Some examples of requests
8753          * that may fail with this error are:
8754          *  - MegaApi::startDownload
8755          *  - MegaApi::startUpload
8756          *  - MegaApi::copyNode
8757          *  - MegaApi::share
8758          *  - MegaApi::cleanRubbishBin
8759          *
8760          * @note This function must be called only if we have received the callback
8761          * MegaGlobalListener::onEvent and the callback MegaListener::onEvent
8762          * with the event type MegaEvent::EVENT_BUSINESS_STATUS
8763          *
8764          * @return returns true if the account is active, otherwise false
8765          */
8766         bool isBusinessAccountActive();
8767 
8768         /**
8769          * @brief Get the status of a business account.
8770          *
8771          * @note This function must be called only if we have received the callback
8772          * MegaGlobalListener::onEvent and the callback MegaListener::onEvent
8773          * with the event type MegaEvent::EVENT_BUSINESS_STATUS
8774          *
8775          * @return Returns the business account status, possible values:
8776          *      MegaApi::BUSINESS_STATUS_EXPIRED = -1
8777          *      MegaApi::BUSINESS_STATUS_INACTIVE = 0
8778          *      MegaApi::BUSINESS_STATUS_ACTIVE = 1
8779          *      MegaApi::BUSINESS_STATUS_GRACE_PERIOD = 2
8780          */
8781         int getBusinessStatus();
8782 
8783         /**
8784          * @brief Returns the deadline to remedy the storage overquota situation
8785          *
8786          * This value is valid only when MegaApi::getUserData has been called after
8787          * receiving a callback MegaListener/MegaGlobalListener::onEvent of type
8788          * MegaEvent::EVENT_STORAGE, reporting STORAGE_STATE_PAYWALL.
8789          * The value will become invalid once the state of storage changes.
8790          *
8791          * @return Timestamp representing the deadline to remedy the overquota
8792          */
8793         int64_t getOverquotaDeadlineTs();
8794 
8795         /**
8796          * @brief Returns when the user was warned about overquota state
8797          *
8798          * This value is valid only when MegaApi::getUserData has been called after
8799          * receiving a callback MegaListener/MegaGlobalListener::onEvent of type
8800          * MegaEvent::EVENT_STORAGE, reporting STORAGE_STATE_PAYWALL.
8801          * The value will become invalid once the state of storage changes.
8802          *
8803          * You take the ownership of the returned value.
8804          *
8805          * @return MegaIntegerList with the timestamp corresponding to each warning
8806          */
8807         MegaIntegerList *getOverquotaWarningsTs();
8808 
8809         /**
8810          * @brief Check if the password is correct for the current account
8811          * @param password Password to check
8812          * @return True if the password is correct for the current account, otherwise false.
8813          */
8814         bool checkPassword(const char *password);
8815 
8816         /**
8817          * @brief Returns the credentials of the currently open account
8818          *
8819          * If the MegaApi object isn't logged in or there's no signing key available,
8820          * this function returns NULL
8821          *
8822          * You take the ownership of the returned value.
8823          * Use delete [] to free it.
8824          *
8825          * @return Fingerprint of the signing key of the current account
8826          */
8827         char* getMyCredentials();
8828 
8829         /**
8830          * Returns the credentials of a given user
8831          *
8832          * The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
8833          * Valid data in the MegaRequest object received on callbacks:
8834          * - MegaRequest::getParamType - Returns MegaApi::USER_ATTR_ED25519_PUBLIC_KEY
8835          * - MegaRequest::getFlag - Returns true
8836          *
8837          * Valid data in the MegaRequest object received in onRequestFinish when the error code
8838          * is MegaError::API_OK:
8839          * - MegaRequest::getPassword - Returns the credentials in hexadecimal format
8840          *
8841          * @param user MegaUser of the contact (see MegaApi::getContact) to get the fingerprint
8842          * @param listener MegaRequestListener to track this request
8843          */
8844         void getUserCredentials(MegaUser *user, MegaRequestListener *listener = NULL);
8845 
8846         /**
8847          * @brief Checks if credentials are verified for the given user
8848          *
8849          * @param user MegaUser of the contact whose credentiasl want to be checked
8850          * @return true if verified, false otherwise
8851          */
8852         bool areCredentialsVerified(MegaUser *user);
8853 
8854         /**
8855          * @brief Verify credentials of a given user
8856          *
8857          * This function allow to tag credentials of a user as verified. It should be called when the
8858          * logged in user compares the fingerprint of the user (provided by an independent and secure
8859          * method) with the fingerprint shown by the app (@see MegaApi::getUserCredentials).
8860          *
8861          * The associated request type with this request is MegaRequest::TYPE_VERIFY_CREDENTIALS
8862          * Valid data in the MegaRequest object received on callbacks:
8863          * - MegaRequest::getNodeHandle - Returns userhandle
8864          *
8865          * @param user MegaUser of the contact whose credentials want to be verified
8866          * @param listener MegaRequestListener to track this request
8867          */
8868         void verifyCredentials(MegaUser *user, MegaRequestListener *listener = NULL);
8869 
8870         /**
8871          * @brief Reset credentials of a given user
8872          *
8873          * Call this function to forget the existing authentication of keys and signatures for a given
8874          * user. A full reload of the account will start the authentication process again.
8875          *
8876          * The associated request type with this request is MegaRequest::TYPE_VERIFY_CREDENTIALS
8877          * Valid data in the MegaRequest object received on callbacks:
8878          * - MegaRequest::getNodeHandle - Returns userhandle
8879          * - MegaRequest::getFlag - Returns true
8880          *
8881          * @param user MegaUser of the contact whose credentials want to be reset
8882          * @param listener MegaRequestListener to track this request
8883          */
8884         void resetCredentials(MegaUser *user, MegaRequestListener *listener = NULL);
8885 
8886         /**
8887          * @brief Returns RSA private key of the currently logged-in account
8888          *
8889          * If the MegaApi object is not logged-in or there is no private key available,
8890          * this function returns NULL.
8891          *
8892          * You take the ownership of the returned value.
8893          * Use delete [] to free it.
8894          *
8895          * @return RSA private key of the current account
8896          */
8897         char *getMyRSAPrivateKey();
8898 
8899         /**
8900          * @brief Set the active log level
8901          *
8902          * This function sets the log level of the logging system. Any log listener registered by
8903          * MegaApi::addLoggerObject will receive logs with the same or a lower level than
8904          * the one passed to this function.
8905          *
8906          * @param logLevel Active log level
8907          *
8908          * These are the valid values for this parameter:
8909          * - MegaApi::LOG_LEVEL_FATAL = 0
8910          * - MegaApi::LOG_LEVEL_ERROR = 1
8911          * - MegaApi::LOG_LEVEL_WARNING = 2
8912          * - MegaApi::LOG_LEVEL_INFO = 3
8913          * - MegaApi::LOG_LEVEL_DEBUG = 4
8914          * - MegaApi::LOG_LEVEL_MAX = 5
8915          */
8916         static void setLogLevel(int logLevel);
8917 
8918         /**
8919          * @brief Set the limit of size to requests payload
8920          *
8921          * This functions sets the max size that will be allowed for requests payload
8922          * If the payload exceeds that, the line will be truncated in the midle with [...] in between
8923          */
8924         static void setMaxPayloadLogSize(long long maxSize);
8925 
8926         /**
8927          * @brief Enable log to console
8928          *
8929          * By default, log to console is false. Logging to console is serialized via a mutex to
8930          * avoid interleaving by multiple threads, even in performance mode.
8931          *
8932          * @param enable True to show messages in console, false to skip them.
8933          */
8934         static void setLogToConsole(bool enable);
8935 
8936         /**
8937          * @brief Add a MegaLogger implementation to receive SDK logs
8938          *
8939          * Logs received by this objects depends on the active log level.
8940          * By default, it is MegaApi::LOG_LEVEL_INFO. You can change it
8941          * using MegaApi::setLogLevel.
8942          *
8943          * You can remove the existing logger by using MegaApi::removeLoggerObject.
8944          *
8945          * In performance mode, it is assumed that this is only called on startup and
8946          * not while actively logging.
8947          *
8948          * @param megaLogger MegaLogger implementation
8949          */
8950         static void addLoggerObject(MegaLogger *megaLogger);
8951 
8952         /**
8953          * @brief Remove a MegaLogger implementation to stop receiving SDK logs
8954          *
8955          * If the logger was registered in the past, it will stop receiving log
8956          * messages after the call to this function.
8957          *
8958          * In performance mode, it is assumed that this is only called on shutdown and
8959          * not while actively logging.
8960          *
8961          * @param megaLogger Previously registered MegaLogger implementation
8962          */
8963         static void removeLoggerObject(MegaLogger *megaLogger);
8964 
8965         /**
8966          * @brief Send a log to the logging system
8967          *
8968          * This log will be received by the active logger object (MegaApi::setLoggerObject) if
8969          * the log level is the same or lower than the active log level (MegaApi::setLogLevel)
8970          *
8971          * The third and the fouth parameter are optional. You may want to use __FILE__ and __LINE__
8972          * to complete them.
8973          *
8974          * In performance mode, only logging to console is serialized through a mutex.
8975          * Logging to `MegaLogger`s is not serialized and has to be done by the subclasses if needed.
8976          *
8977          * @param logLevel Log level for this message
8978          * @param message Message for the logging system
8979          * @param filename Origin of the log message
8980          * @param line Line of code where this message was generated
8981          */
8982         static void log(int logLevel, const char* message, const char *filename = "", int line = -1);
8983 
8984         /**
8985          * @brief Differentiate MegaApi log output from different instances.
8986          *
8987          * If multiple MegaApi instances are used in a single application, it can be useful to
8988          * distinguish their activity in the log. Setting a name here for this instance will
8989          * cause some particularly relevant log lines to contain it.
8990          * A very short name is best to avoid increasing the log size too much.
8991          *
8992          * @param loggingName Name of this instance, to be output in log messages from this MegaApi
8993          * or NULL to clear a previous logging name.
8994          */
8995         void setLoggingName(const char* loggingName);
8996 
8997         /**
8998          * @brief Create a folder in the MEGA account
8999          *
9000          * The associated request type with this request is MegaRequest::TYPE_CREATE_FOLDER
9001          * Valid data in the MegaRequest object received on callbacks:
9002          * - MegaRequest::getParentHandle - Returns the handle of the parent folder
9003          * - MegaRequest::getName - Returns the name of the new folder
9004          *
9005          * Valid data in the MegaRequest object received in onRequestFinish when the error code
9006          * is MegaError::API_OK:
9007          * - MegaRequest::getNodeHandle - Handle of the new folder
9008          *
9009          * If the MEGA account is a business account and it's status is expired, onRequestFinish will
9010          * be called with the error code MegaError::API_EBUSINESSPASTDUE.
9011          *
9012          * @param name Name of the new folder
9013          * @param parent Parent folder
9014          * @param listener MegaRequestListener to track this request
9015          */
9016         void createFolder(const char* name, MegaNode *parent, MegaRequestListener *listener = NULL);
9017 
9018         /**
9019          * @brief Create a new empty folder in your local file system
9020          *
9021          * @param localPath Path of the new folder
9022          * @return True if the local folder was successfully created, otherwise false.
9023          */
9024         bool createLocalFolder(const char* localPath);
9025 
9026         /**
9027          * @brief Move a node in the MEGA account
9028          *
9029          * The associated request type with this request is MegaRequest::TYPE_MOVE
9030          * Valid data in the MegaRequest object received on callbacks:
9031          * - MegaRequest::getNodeHandle - Returns the handle of the node to move
9032          * - MegaRequest::getParentHandle - Returns the handle of the new parent for the node
9033          *
9034          * If the MEGA account is a business account and it's status is expired, onRequestFinish will
9035          * be called with the error code MegaError::API_EBUSINESSPASTDUE.
9036          *
9037          * @param node Node to move
9038          * @param newParent New parent for the node
9039          * @param listener MegaRequestListener to track this request
9040          */
9041         void moveNode(MegaNode* node, MegaNode* newParent, MegaRequestListener *listener = NULL);
9042 
9043         /**
9044          * @brief Move a node in the MEGA account changing the file name
9045          *
9046          * The associated request type with this request is MegaRequest::TYPE_MOVE
9047          * Valid data in the MegaRequest object received on callbacks:
9048          * - MegaRequest::getNodeHandle - Returns the handle of the node to move
9049          * - MegaRequest::getParentHandle - Returns the handle of the new parent for the node
9050          * - MegaRequest::getName - Returns the name for the new node
9051          *
9052          * If the MEGA account is a business account and it's status is expired, onRequestFinish will
9053          * be called with the error code MegaError::API_EBUSINESSPASTDUE.
9054          *
9055          * @param node Node to move
9056          * @param newParent New parent for the node
9057          * @param newName Name for the new node
9058          * @param listener MegaRequestListener to track this request
9059          */
9060         void moveNode(MegaNode* node, MegaNode* newParent, const char* newName, MegaRequestListener *listener = NULL);
9061 
9062         /**
9063          * @brief Copy a node in the MEGA account
9064          *
9065          * The associated request type with this request is MegaRequest::TYPE_COPY
9066          * Valid data in the MegaRequest object received on callbacks:
9067          * - MegaRequest::getNodeHandle - Returns the handle of the node to copy
9068          * - MegaRequest::getParentHandle - Returns the handle of the new parent for the new node
9069          * - MegaRequest::getPublicMegaNode - Returns the node to copy (if it is a public node)
9070          *
9071          * Valid data in the MegaRequest object received in onRequestFinish when the error code
9072          * is MegaError::API_OK:
9073          * - MegaRequest::getNodeHandle - Handle of the new node
9074          *
9075          * If the status of the business account is expired, onRequestFinish will be called with the error
9076          * code MegaError::API_EBUSINESSPASTDUE.
9077          *
9078          * @param node Node to copy
9079          * @param newParent Parent for the new node
9080          * @param listener MegaRequestListener to track this request
9081          */
9082         void copyNode(MegaNode* node, MegaNode *newParent, MegaRequestListener *listener = NULL);
9083 
9084         /**
9085          * @brief Copy a node in the MEGA account changing the file name
9086          *
9087          * The associated request type with this request is MegaRequest::TYPE_COPY
9088          * Valid data in the MegaRequest object received on callbacks:
9089          * - MegaRequest::getNodeHandle - Returns the handle of the node to copy
9090          * - MegaRequest::getParentHandle - Returns the handle of the new parent for the new node
9091          * - MegaRequest::getPublicMegaNode - Returns the node to copy
9092          * - MegaRequest::getName - Returns the name for the new node
9093          *
9094          * Valid data in the MegaRequest object received in onRequestFinish when the error code
9095          * is MegaError::API_OK:
9096          * - MegaRequest::getNodeHandle - Handle of the new node
9097          *
9098          * If the status of the business account is expired, onRequestFinish will be called with the error
9099          * code MegaError::API_EBUSINESSPASTDUE.
9100          *
9101          * @param node Node to copy
9102          * @param newParent Parent for the new node
9103          * @param newName Name for the new node
9104          * @param listener MegaRequestListener to track this request
9105          */
9106         void copyNode(MegaNode* node, MegaNode *newParent, const char* newName, MegaRequestListener *listener = NULL);
9107 
9108         /**
9109          * @brief Rename a node in the MEGA account
9110          *
9111          * The associated request type with this request is MegaRequest::TYPE_RENAME
9112          * Valid data in the MegaRequest object received on callbacks:
9113          * - MegaRequest::getNodeHandle - Returns the handle of the node to rename
9114          * - MegaRequest::getName - Returns the new name for the node
9115          *
9116          * If the MEGA account is a business account and it's status is expired, onRequestFinish will
9117          * be called with the error code MegaError::API_EBUSINESSPASTDUE.
9118          *
9119          * @param node Node to modify
9120          * @param newName New name for the node
9121          * @param listener MegaRequestListener to track this request
9122          */
9123         void renameNode(MegaNode* node, const char* newName, MegaRequestListener *listener = NULL);
9124 
9125         /**
9126          * @brief Remove a node from the MEGA account
9127          *
9128          * This function doesn't move the node to the Rubbish Bin, it fully removes the node. To move
9129          * the node to the Rubbish Bin use MegaApi::moveNode
9130          *
9131          * If the node has previous versions, they will be deleted too
9132          *
9133          * The associated request type with this request is MegaRequest::TYPE_REMOVE
9134          * Valid data in the MegaRequest object received on callbacks:
9135          * - MegaRequest::getNodeHandle - Returns the handle of the node to remove
9136          * - MegaRequest::getFlag - Returns false because previous versions won't be preserved
9137          *
9138          * If the MEGA account is a sub-user business account, onRequestFinish will
9139          * be called with the error code MegaError::API_EMASTERONLY.
9140          *
9141          * @param node Node to remove
9142          * @param listener MegaRequestListener to track this request
9143          */
9144         void remove(MegaNode* node, MegaRequestListener *listener = NULL);
9145 
9146         /**
9147          * @brief Remove all versions from the MEGA account
9148          *
9149          * The associated request type with this request is MegaRequest::TYPE_REMOVE_VERSIONS
9150          *
9151          * When the request finishes, file versions might not be deleted yet.
9152          * Deletions are notified using onNodesUpdate callbacks.
9153          *
9154          * @param listener MegaRequestListener to track this request
9155          */
9156         void removeVersions(MegaRequestListener *listener = NULL);
9157 
9158         /**
9159          * @brief Remove a version of a file from the MEGA account
9160          *
9161          * This function doesn't move the node to the Rubbish Bin, it fully removes the node. To move
9162          * the node to the Rubbish Bin use MegaApi::moveNode.
9163          *
9164          * If the node has previous versions, they won't be deleted.
9165          *
9166          * The associated request type with this request is MegaRequest::TYPE_REMOVE
9167          * Valid data in the MegaRequest object received on callbacks:
9168          * - MegaRequest::getNodeHandle - Returns the handle of the node to remove
9169          * - MegaRequest::getFlag - Returns true because previous versions will be preserved
9170          *
9171          * If the MEGA account is a sub-user business account, onRequestFinish will
9172          * be called with the error code MegaError::API_EMASTERONLY.
9173          *
9174          * @param node Node to remove
9175          * @param listener MegaRequestListener to track this request
9176          */
9177         void removeVersion(MegaNode* node, MegaRequestListener *listener = NULL);
9178 
9179         /**
9180          * @brief Restore a previous version of a file
9181          *
9182          * Only versions of a file can be restored, not the current version (because it's already current).
9183          * The node will be copied and set as current. All the version history will be preserved without changes,
9184          * being the old current node the previous version of the new current node, and keeping the restored
9185          * node also in its previous place in the version history.
9186          *
9187          * The associated request type with this request is MegaRequest::TYPE_RESTORE
9188          * Valid data in the MegaRequest object received on callbacks:
9189          * - MegaRequest::getNodeHandle - Returns the handle of the node to restore
9190          *
9191          * If the MEGA account is a business account and it's status is expired, onRequestFinish will
9192          * be called with the error code MegaError::API_EBUSINESSPASTDUE.
9193          *
9194          * @param version Node with the version to restore
9195          * @param listener MegaRequestListener to track this request
9196          */
9197         void restoreVersion(MegaNode *version, MegaRequestListener *listener = NULL);
9198 
9199         /**
9200          * @brief Clean the Rubbish Bin in the MEGA account
9201          *
9202          * This function effectively removes every node contained in the Rubbish Bin. In order to
9203          * avoid accidental deletions, you might want to warn the user about the action.
9204          *
9205          * The associated request type with this request is MegaRequest::TYPE_CLEAN_RUBBISH_BIN. This
9206          * request returns MegaError::API_ENOENT if the Rubbish bin is already empty.
9207          *
9208          * If the MEGA account is a business account and it's status is expired, onRequestFinish will
9209          * be called with the error code MegaError::API_EBUSINESSPASTDUE.
9210          *
9211          * @param listener MegaRequestListener to track this request
9212          */
9213         void cleanRubbishBin(MegaRequestListener *listener = NULL);
9214 
9215         /**
9216          * @brief Send a node to the Inbox of another MEGA user using a MegaUser
9217          *
9218          * The associated request type with this request is MegaRequest::TYPE_COPY
9219          * Valid data in the MegaRequest object received on callbacks:
9220          * - MegaRequest::getNodeHandle - Returns the handle of the node to send
9221          * - MegaRequest::getEmail - Returns the email of the user that receives the node
9222          *
9223          * If the MEGA account is a business account and it's status is expired, onRequestFinish will
9224          * be called with the error code MegaError::API_EBUSINESSPASTDUE.
9225          *
9226          * @param node Node to send
9227          * @param user User that receives the node
9228          * @param listener MegaRequestListener to track this request
9229          */
9230         void sendFileToUser(MegaNode *node, MegaUser *user, MegaRequestListener *listener = NULL);
9231 
9232         /**
9233         * @brief Send a node to the Inbox of another MEGA user using his email
9234         *
9235         * The associated request type with this request is MegaRequest::TYPE_COPY
9236         * Valid data in the MegaRequest object received on callbacks:
9237         * - MegaRequest::getNodeHandle - Returns the handle of the node to send
9238         * - MegaRequest::getEmail - Returns the email of the user that receives the node
9239         *
9240         * If the MEGA account is a business account and it's status is expired, onRequestFinish will
9241         * be called with the error code MegaError::API_EBUSINESSPASTDUE.
9242         *
9243         * @param node Node to send
9244         * @param email Email of the user that receives the node
9245         * @param listener MegaRequestListener to track this request
9246         */
9247         void sendFileToUser(MegaNode *node, const char* email, MegaRequestListener *listener = NULL);
9248 
9249         /**
9250          * @brief Share or stop sharing a folder in MEGA with another user using a MegaUser
9251          *
9252          * To share a folder with an user, set the desired access level in the level parameter. If you
9253          * want to stop sharing a folder use the access level MegaShare::ACCESS_UNKNOWN
9254          *
9255          * The associated request type with this request is MegaRequest::TYPE_SHARE
9256          * Valid data in the MegaRequest object received on callbacks:
9257          * - MegaRequest::getNodeHandle - Returns the handle of the folder to share
9258          * - MegaRequest::getEmail - Returns the email of the user that receives the shared folder
9259          * - MegaRequest::getAccess - Returns the access that is granted to the user
9260          *
9261          * If the MEGA account is a business account and it's status is expired, onRequestFinish will
9262          * be called with the error code MegaError::API_EBUSINESSPASTDUE.
9263          *
9264          * @param node The folder to share. It must be a non-root folder
9265          * @param user User that receives the shared folder
9266          * @param level Permissions that are granted to the user
9267          * Valid values for this parameter:
9268          * - MegaShare::ACCESS_UNKNOWN = -1
9269          * Stop sharing a folder with this user
9270          *
9271          * - MegaShare::ACCESS_READ = 0
9272          * - MegaShare::ACCESS_READWRITE = 1
9273          * - MegaShare::ACCESS_FULL = 2
9274          * - MegaShare::ACCESS_OWNER = 3
9275          *
9276          * @param listener MegaRequestListener to track this request
9277          */
9278         void share(MegaNode *node, MegaUser* user, int level, MegaRequestListener *listener = NULL);
9279 
9280         /**
9281          * @brief Share or stop sharing a folder in MEGA with another user using his email
9282          *
9283          * To share a folder with an user, set the desired access level in the level parameter. If you
9284          * want to stop sharing a folder use the access level MegaShare::ACCESS_UNKNOWN
9285          *
9286          * The associated request type with this request is MegaRequest::TYPE_SHARE
9287          * Valid data in the MegaRequest object received on callbacks:
9288          * - MegaRequest::getNodeHandle - Returns the handle of the folder to share
9289          * - MegaRequest::getEmail - Returns the email of the user that receives the shared folder
9290          * - MegaRequest::getAccess - Returns the access that is granted to the user
9291          *
9292          * If the MEGA account is a business account and it's status is expired, onRequestFinish will
9293          * be called with the error code MegaError::API_EBUSINESSPASTDUE.
9294          *
9295          * @param node The folder to share. It must be a non-root folder
9296          * @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
9297          * and the user will be invited to register an account.
9298          *
9299          * @param level Permissions that are granted to the user
9300          * Valid values for this parameter:
9301          * - MegaShare::ACCESS_UNKNOWN = -1
9302          * Stop sharing a folder with this user
9303          *
9304          * - MegaShare::ACCESS_READ = 0
9305          * - MegaShare::ACCESS_READWRITE = 1
9306          * - MegaShare::ACCESS_FULL = 2
9307          * - MegaShare::ACCESS_OWNER = 3
9308          *
9309          * @param listener MegaRequestListener to track this request
9310          */
9311         void share(MegaNode *node, const char* email, int level, MegaRequestListener *listener = NULL);
9312 
9313         /**
9314          * @brief Import a public link to the account
9315          *
9316          * The associated request type with this request is MegaRequest::TYPE_IMPORT_LINK
9317          * Valid data in the MegaRequest object received on callbacks:
9318          * - MegaRequest::getLink - Returns the public link to the file
9319          * - MegaRequest::getParentHandle - Returns the folder that receives the imported file
9320          *
9321          * Valid data in the MegaRequest object received in onRequestFinish when the error code
9322          * is MegaError::API_OK:
9323          * - MegaRequest::getNodeHandle - Handle of the new node in the account
9324          *
9325          * If the MEGA account is a business account and it's status is expired, onRequestFinish will
9326          * be called with the error code MegaError::API_EBUSINESSPASTDUE.
9327          *
9328          * @param megaFileLink Public link to a file in MEGA
9329          * @param parent Parent folder for the imported file
9330          * @param listener MegaRequestListener to track this request
9331          */
9332         void importFileLink(const char* megaFileLink, MegaNode* parent, MegaRequestListener *listener = NULL);
9333 
9334         /**
9335          * @brief Decrypt password-protected public link
9336          *
9337          * The associated request type with this request is MegaRequest::TYPE_PASSWORD_LINK
9338          * Valid data in the MegaRequest object received on callbacks:
9339          * - MegaRequest::getLink - Returns the encrypted public link to the file/folder
9340          * - MegaRequest::getPassword - Returns the password to decrypt the link
9341          *
9342          * Valid data in the MegaRequest object received in onRequestFinish when the error code
9343          * is MegaError::API_OK:
9344          * - MegaRequest::getText - Decrypted public link
9345          *
9346          * @param link Password/protected public link to a file/folder in MEGA
9347          * @param password Password to decrypt the link
9348          * @param listener MegaRequestListener to track this request
9349          */
9350         void decryptPasswordProtectedLink(const char* link, const char* password, MegaRequestListener *listener = NULL);
9351 
9352         /**
9353          * @brief Encrypt public link with password
9354          *
9355          * The associated request type with this request is MegaRequest::TYPE_PASSWORD_LINK
9356          * Valid data in the MegaRequest object received on callbacks:
9357          * - MegaRequest::getLink - Returns the public link to be encrypted
9358          * - MegaRequest::getPassword - Returns the password to encrypt the link
9359          * - MegaRequest::getFlag - Returns true
9360          *
9361          * Valid data in the MegaRequest object received in onRequestFinish when the error code
9362          * is MegaError::API_OK:
9363          * - MegaRequest::getText - Encrypted public link
9364          *
9365          * @param link Public link to be encrypted, including encryption key for the link
9366          * @param password Password to encrypt the link
9367          * @param listener MegaRequestListener to track this request
9368          */
9369         void encryptLinkWithPassword(const char* link, const char* password, MegaRequestListener *listener = NULL);
9370 
9371         /**
9372          * @brief Get a MegaNode from a public link to a file
9373          *
9374          * A public node can be imported using MegaApi::copyNode or downloaded using MegaApi::startDownload
9375          *
9376          * The associated request type with this request is MegaRequest::TYPE_GET_PUBLIC_NODE
9377          * Valid data in the MegaRequest object received on callbacks:
9378          * - MegaRequest::getLink - Returns the public link to the file
9379          *
9380          * Valid data in the MegaRequest object received in onRequestFinish when the error code
9381          * is MegaError::API_OK:
9382          * - MegaRequest::getPublicMegaNode - Public MegaNode corresponding to the public link
9383          * - MegaRequest::getFlag - Return true if the provided key along the link is invalid.
9384          *
9385          * If the MEGA account is a business account and it's status is expired, onRequestFinish will
9386          * be called with the error code MegaError::API_EBUSINESSPASTDUE.
9387          *
9388          * @param megaFileLink Public link to a file in MEGA
9389          * @param listener MegaRequestListener to track this request
9390          */
9391         void getPublicNode(const char* megaFileLink, MegaRequestListener *listener = NULL);
9392 
9393         /**
9394          * @brief Build the URL for a public link
9395          *
9396          * @note This function does not create the public link itself. It simply builds the URL
9397          * from the provided data.
9398          *
9399          * You take the ownership of the returned value.
9400          *
9401          * @param publicHandle Public handle of the link, in B64url encoding.
9402          * @param key Encryption key of the link.
9403          * @param isFolder True for folder links, false for file links.
9404          * @return The public link for the provided data
9405          */
9406         const char *buildPublicLink(const char *publicHandle, const char *key, bool isFolder);
9407 
9408         /**
9409          * @brief Get the thumbnail of a node
9410          *
9411          * If the node doesn't have a thumbnail the request fails with the MegaError::API_ENOENT
9412          * error code
9413          *
9414          * The associated request type with this request is MegaRequest::TYPE_GET_ATTR_FILE
9415          * Valid data in the MegaRequest object received on callbacks:
9416          * - MegaRequest::getNodeHandle - Returns the handle of the node
9417          * - MegaRequest::getText - Returns the file attribute string if \c node is an attached node from chats. NULL otherwise
9418          * - MegaRequest::getFile - Returns the destination path
9419          * - MegaRequest::getParamType - Returns MegaApi::ATTR_TYPE_THUMBNAIL
9420          * - MegaRequest::getBase64Key - Returns the nodekey in Base64 (only when node has file attributes)
9421          * - MegaRequest::getPrivateKey - Returns the file-attribute string (only when node has file attributes)
9422          *
9423          * @param node Node to get the thumbnail
9424          * @param dstFilePath Destination path for the thumbnail.
9425          * If this path is a local folder, it must end with a '\' or '/' character and (Base64-encoded handle + "0.jpg")
9426          * will be used as the file name inside that folder. If the path doesn't finish with
9427          * one of these characters, the file will be downloaded to a file in that path.
9428          *
9429          * @param listener MegaRequestListener to track this request
9430          */
9431         void getThumbnail(MegaNode* node, const char *dstFilePath, MegaRequestListener *listener = NULL);
9432 
9433         /**
9434          * @brief Get the preview of a node
9435          *
9436          * If the node doesn't have a preview the request fails with the MegaError::API_ENOENT
9437          * error code
9438          *
9439          * The associated request type with this request is MegaRequest::TYPE_GET_ATTR_FILE
9440          * Valid data in the MegaRequest object received on callbacks:
9441          * - MegaRequest::getNodeHandle - Returns the handle of the node
9442          * - MegaRequest::getText - Returns the file attribute string if \c node is an attached node from chats. NULL otherwise
9443          * - MegaRequest::getFile - Returns the destination path
9444          * - MegaRequest::getParamType - Returns MegaApi::ATTR_TYPE_PREVIEW
9445          * - MegaRequest::getBase64Key - Returns the nodekey in Base64 (only when node has file attributes)
9446          * - MegaRequest::getPrivateKey - Returns the file-attribute string (only when node has file attributes)
9447          *
9448          * @param node Node to get the preview
9449          * @param dstFilePath Destination path for the preview.
9450          * If this path is a local folder, it must end with a '\' or '/' character and (Base64-encoded handle + "1.jpg")
9451          * will be used as the file name inside that folder. If the path doesn't finish with
9452          * one of these characters, the file will be downloaded to a file in that path.
9453          *
9454          * @param listener MegaRequestListener to track this request
9455          */
9456         void getPreview(MegaNode* node, const char *dstFilePath, MegaRequestListener *listener = NULL);
9457 
9458         /**
9459          * @brief Get the avatar of a MegaUser
9460          *
9461          * The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
9462          * Valid data in the MegaRequest object received on callbacks:
9463          * - MegaRequest::getFile - Returns the destination path
9464          * - MegaRequest::getEmail - Returns the email of the user
9465          *
9466          * @param user MegaUser to get the avatar. If this parameter is set to NULL, the avatar is obtained
9467          * for the active account
9468          * @param dstFilePath Destination path for the avatar. It has to be a path to a file, not to a folder.
9469          * If this path is a local folder, it must end with a '\' or '/' character and (email + "0.jpg")
9470          * will be used as the file name inside that folder. If the path doesn't finish with
9471          * one of these characters, the file will be downloaded to a file in that path.
9472          *
9473          * @param listener MegaRequestListener to track this request
9474          */
9475         void getUserAvatar(MegaUser* user, const char *dstFilePath, MegaRequestListener *listener = NULL);
9476 
9477         /**
9478          * @brief Get the avatar of any user in MEGA
9479          *
9480          * The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
9481          * Valid data in the MegaRequest object received on callbacks:
9482          * - MegaRequest::getFile - Returns the destination path
9483          * - MegaRequest::getEmail - Returns the email or the handle of the user (the provided one as parameter)
9484          *
9485          * @param email_or_handle Email or user handle (Base64 encoded) to get the avatar. If this parameter is
9486          * set to NULL, the avatar is obtained for the active account
9487          * @param dstFilePath Destination path for the avatar. It has to be a path to a file, not to a folder.
9488          * If this path is a local folder, it must end with a '\' or '/' character and (email + "0.jpg")
9489          * will be used as the file name inside that folder. If the path doesn't finish with
9490          * one of these characters, the file will be downloaded to a file in that path.
9491          *
9492          * @param listener MegaRequestListener to track this request
9493          */
9494         void getUserAvatar(const char *email_or_handle, const char *dstFilePath, MegaRequestListener *listener = NULL);
9495 
9496         /**
9497          * @brief Get the avatar of the active account
9498          *
9499          * The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
9500          * Valid data in the MegaRequest object received on callbacks:
9501          * - MegaRequest::getFile - Returns the destination path
9502          * - MegaRequest::getEmail - Returns the email of the user
9503          *
9504          * @param dstFilePath Destination path for the avatar. It has to be a path to a file, not to a folder.
9505          * If this path is a local folder, it must end with a '\' or '/' character and (email + "0.jpg")
9506          * will be used as the file name inside that folder. If the path doesn't finish with
9507          * one of these characters, the file will be downloaded to a file in that path.
9508          *
9509          * @param listener MegaRequestListener to track this request
9510          */
9511         void getUserAvatar(const char *dstFilePath, MegaRequestListener *listener = NULL);
9512 
9513         /**
9514          * @brief Get the default color for the avatar.
9515          *
9516          * This color should be used only when the user doesn't have an avatar.
9517          *
9518          * You take the ownership of the returned value.
9519          *
9520          * @param user MegaUser to get the color of the avatar.
9521          * @return The RGB color as a string with 3 components in hex: #RGB. Ie. "#FF6A19"
9522          */
9523         static char *getUserAvatarColor(MegaUser *user);
9524 
9525         /**
9526          * @brief Get the default color for the avatar.
9527          *
9528          * This color should be used only when the user doesn't have an avatar.
9529          *
9530          * You take the ownership of the returned value.
9531          *
9532          * @param userhandle User handle (Base64 encoded) to get the avatar.
9533          * @return The RGB color as a string with 3 components in hex: #RGB. Ie. "#FF6A19"
9534          */
9535         static char *getUserAvatarColor(const char *userhandle);
9536 
9537         /**
9538          * @brief Get the secondary color for the avatar.
9539          *
9540          * This color should be used only when the user doesn't have an avatar, making a
9541          * gradient in combination with the color returned from getUserAvatarColor.
9542          *
9543          * You take the ownership of the returned value.
9544          *
9545          * @param user MegaUser to get the color of the avatar.
9546          * @return The RGB color as a string with 3 components in hex: #RGB. Ie. "#FF6A19"
9547          */
9548         static char *getUserAvatarSecondaryColor(MegaUser *user);
9549 
9550         /**
9551          * @brief Get the secondary color for the avatar.
9552          *
9553          * This color should be used only when the user doesn't have an avatar, making a
9554          * gradient in combination with the color returned from getUserAvatarColor.
9555          *
9556          * You take the ownership of the returned value.
9557          *
9558          * @param userhandle User handle (Base64 encoded) to get the avatar.
9559          * @return The RGB color as a string with 3 components in hex: #RGB. Ie. "#FF6A19"
9560          */
9561         static char *getUserAvatarSecondaryColor(const char *userhandle);
9562 
9563         /**
9564          * @brief Get an attribute of a MegaUser.
9565          *
9566          * User attributes can be private or public. Private attributes are accessible only by
9567          * your own user, while public ones are retrievable by any of your contacts.
9568          *
9569          * The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
9570          * Valid data in the MegaRequest object received on callbacks:
9571          * - MegaRequest::getParamType - Returns the attribute type
9572          *
9573          * Valid data in the MegaRequest object received in onRequestFinish when the error code
9574          * is MegaError::API_OK:
9575          * - MegaRequest::getText - Returns the value for public attributes
9576          * - MegaRequest::getMegaStringMap - Returns the value for private attributes
9577          *
9578          * @param user MegaUser to get the attribute. If this parameter is set to NULL, the attribute
9579          * is obtained for the active account
9580          * @param type Attribute type
9581          *
9582          * Valid values are:
9583          *
9584          * MegaApi::USER_ATTR_FIRSTNAME = 1
9585          * Get the firstname of the user (public)
9586          * MegaApi::USER_ATTR_LASTNAME = 2
9587          * Get the lastname of the user (public)
9588          * MegaApi::USER_ATTR_AUTHRING = 3
9589          * Get the authentication ring of the user (private)
9590          * MegaApi::USER_ATTR_LAST_INTERACTION = 4
9591          * Get the last interaction of the contacts of the user (private)
9592          * MegaApi::USER_ATTR_ED25519_PUBLIC_KEY = 5
9593          * Get the public key Ed25519 of the user (public)
9594          * MegaApi::USER_ATTR_CU25519_PUBLIC_KEY = 6
9595          * Get the public key Cu25519 of the user (public)
9596          * MegaApi::USER_ATTR_KEYRING = 7
9597          * Get the key ring of the user: private keys for Cu25519 and Ed25519 (private)
9598          * MegaApi::USER_ATTR_SIG_RSA_PUBLIC_KEY = 8
9599          * Get the signature of RSA public key of the user (public)
9600          * MegaApi::USER_ATTR_SIG_CU255_PUBLIC_KEY = 9
9601          * Get the signature of Cu25519 public key of the user (public)
9602          * MegaApi::USER_ATTR_LANGUAGE = 14
9603          * Get the preferred language of the user (private, non-encrypted)
9604          * MegaApi::USER_ATTR_PWD_REMINDER = 15
9605          * Get the password-reminder-dialog information (private, non-encrypted)
9606          * MegaApi::USER_ATTR_DISABLE_VERSIONS = 16
9607          * Get whether user has versions disabled or enabled (private, non-encrypted)
9608          * MegaApi::USER_ATTR_RICH_PREVIEWS = 18
9609          * Get whether user generates rich-link messages or not (private)
9610          * MegaApi::USER_ATTR_RUBBISH_TIME = 19
9611          * Get number of days for rubbish-bin cleaning scheduler (private non-encrypted)
9612          * MegaApi::USER_ATTR_STORAGE_STATE = 21
9613          * Get the state of the storage (private non-encrypted)
9614          * MegaApi::ATTR_GEOLOCATION = 22
9615          * Get the user geolocation (private)
9616          * MegaApi::ATTR_CAMERA_UPLOADS_FOLDER = 23
9617          * Get the target folder for Camera Uploads (private)
9618          * MegaApi::ATTR_MY_CHAT_FILES_FOLDER = 24
9619          * Get the target folder for My chat files (private)
9620          * MegaApi::ATTR_ALIAS = 27
9621          * Get the list of the users's aliases (private)
9622          * MegaApi::ATTR_DEVICE_NAMES = 30
9623          * Get the list of device names (private)
9624          *
9625          * @param listener MegaRequestListener to track this request
9626          */
9627         void getUserAttribute(MegaUser* user, int type, MegaRequestListener *listener = NULL);
9628 
9629         /**
9630          * @brief Get public attributes of participants of public chats during preview mode.
9631          *
9632          * Other's public attributes are retrievable by contacts and users who participates in your chats.
9633          * During a preview of a public chat, the user does not fullfil the above requirements, so the
9634          * public handle of the chat being previewed is required as authorization.
9635          *
9636          * The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
9637          * Valid data in the MegaRequest object received on callbacks:
9638          * - MegaRequest::getParamType - Returns the attribute type
9639          * - MegaRequest::getEmail - Returns the email or the handle of the user (the provided one as parameter)
9640          * - MegaRequest::getSessionKey - Returns the public handle of the chat
9641          *
9642          * Valid data in the MegaRequest object received in onRequestFinish when the error code
9643          * is MegaError::API_OK:
9644          * - MegaRequest::getText - Returns the value for public attributes
9645          *
9646          * @param email_or_handle Email or user handle (Base64 encoded) to get the attribute.
9647          * This parameter cannot be NULL.
9648          * @param type Attribute type
9649          *
9650          * Valid values are:
9651          *
9652          * MegaApi::USER_ATTR_AVATAR = 0
9653          * Get the avatar of the user (public)
9654          * MegaApi::USER_ATTR_FIRSTNAME = 1
9655          * Get the firstname of the user (public)
9656          * MegaApi::USER_ATTR_LASTNAME = 2
9657          * Get the lastname of the user (public)
9658          * MegaApi::USER_ATTR_ED25519_PUBLIC_KEY = 5
9659          * Get the public key Ed25519 of the user (public)
9660          * MegaApi::USER_ATTR_CU25519_PUBLIC_KEY = 6
9661          * Get the public key Cu25519 of the user (public)
9662          *
9663          * @param listener MegaRequestListener to track this request
9664          */
9665         void getChatUserAttribute(const char *email_or_handle, int type, const char *ph, MegaRequestListener *listener = NULL);
9666 
9667         /**
9668          * @brief Get an attribute of any user in MEGA.
9669          *
9670          * User attributes can be private or public. Private attributes are accessible only by
9671          * your own user, while public ones are retrievable by any of your contacts.
9672          *
9673          * The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
9674          * Valid data in the MegaRequest object received on callbacks:
9675          * - MegaRequest::getParamType - Returns the attribute type
9676          * - MegaRequest::getEmail - Returns the email or the handle of the user (the provided one as parameter)
9677          *
9678          * Valid data in the MegaRequest object received in onRequestFinish when the error code
9679          * is MegaError::API_OK:
9680          * - MegaRequest::getText - Returns the value for public attributes
9681          * - MegaRequest::getMegaStringMap - Returns the value for private attributes
9682          *
9683          * @param email_or_handle Email or user handle (Base64 encoded) to get the attribute.
9684          * If this parameter is set to NULL, the attribute is obtained for the active account.
9685          * @param type Attribute type
9686          *
9687          * Valid values are:
9688          *
9689          * MegaApi::USER_ATTR_FIRSTNAME = 1
9690          * Get the firstname of the user (public)
9691          * MegaApi::USER_ATTR_LASTNAME = 2
9692          * Get the lastname of the user (public)
9693          * MegaApi::USER_ATTR_AUTHRING = 3
9694          * Get the authentication ring of the user (private)
9695          * MegaApi::USER_ATTR_LAST_INTERACTION = 4
9696          * Get the last interaction of the contacts of the user (private)
9697          * MegaApi::USER_ATTR_ED25519_PUBLIC_KEY = 5
9698          * Get the public key Ed25519 of the user (public)
9699          * MegaApi::USER_ATTR_CU25519_PUBLIC_KEY = 6
9700          * Get the public key Cu25519 of the user (public)
9701          * MegaApi::USER_ATTR_KEYRING = 7
9702          * Get the key ring of the user: private keys for Cu25519 and Ed25519 (private)
9703          * MegaApi::USER_ATTR_SIG_RSA_PUBLIC_KEY = 8
9704          * Get the signature of RSA public key of the user (public)
9705          * MegaApi::USER_ATTR_SIG_CU255_PUBLIC_KEY = 9
9706          * Get the signature of Cu25519 public key of the user (public)
9707          * MegaApi::USER_ATTR_LANGUAGE = 14
9708          * Get the preferred language of the user (private, non-encrypted)
9709          * MegaApi::USER_ATTR_PWD_REMINDER = 15
9710          * Get the password-reminder-dialog information (private, non-encrypted)
9711          * MegaApi::USER_ATTR_DISABLE_VERSIONS = 16
9712          * Get whether user has versions disabled or enabled (private, non-encrypted)
9713          * MegaApi::USER_ATTR_RUBBISH_TIME = 19
9714          * Get number of days for rubbish-bin cleaning scheduler (private non-encrypted)
9715          * MegaApi::USER_ATTR_STORAGE_STATE = 21
9716          * Get the state of the storage (private non-encrypted)
9717          *
9718          * @param listener MegaRequestListener to track this request
9719          */
9720         void getUserAttribute(const char *email_or_handle, int type, MegaRequestListener *listener = NULL);
9721 
9722         /**
9723          * @brief Get an attribute of the current account.
9724          *
9725          * User attributes can be private or public. Private attributes are accessible only by
9726          * your own user, while public ones are retrievable by any of your contacts.
9727          *
9728          * The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
9729          * Valid data in the MegaRequest object received on callbacks:
9730          * - MegaRequest::getParamType - Returns the attribute type
9731          *
9732          * Valid data in the MegaRequest object received in onRequestFinish when the error code
9733          * is MegaError::API_OK:
9734          * - MegaRequest::getText - Returns the value for public attributes
9735          * - MegaRequest::getMegaStringMap - Returns the value for private attributes
9736          *
9737          * @param type Attribute type
9738          *
9739          * Valid values are:
9740          *
9741          * MegaApi::USER_ATTR_FIRSTNAME = 1
9742          * Get the firstname of the user (public)
9743          * MegaApi::USER_ATTR_LASTNAME = 2
9744          * Get the lastname of the user (public)
9745          * MegaApi::USER_ATTR_AUTHRING = 3
9746          * Get the authentication ring of the user (private)
9747          * MegaApi::USER_ATTR_LAST_INTERACTION = 4
9748          * Get the last interaction of the contacts of the user (private)
9749          * MegaApi::USER_ATTR_ED25519_PUBLIC_KEY = 5
9750          * Get the public key Ed25519 of the user (public)
9751          * MegaApi::USER_ATTR_CU25519_PUBLIC_KEY = 6
9752          * Get the public key Cu25519 of the user (public)
9753          * MegaApi::USER_ATTR_KEYRING = 7
9754          * Get the key ring of the user: private keys for Cu25519 and Ed25519 (private)
9755          * MegaApi::USER_ATTR_SIG_RSA_PUBLIC_KEY = 8
9756          * Get the signature of RSA public key of the user (public)
9757          * MegaApi::USER_ATTR_SIG_CU255_PUBLIC_KEY = 9
9758          * Get the signature of Cu25519 public key of the user (public)
9759          * MegaApi::USER_ATTR_LANGUAGE = 14
9760          * Get the preferred language of the user (private, non-encrypted)
9761          * MegaApi::USER_ATTR_PWD_REMINDER = 15
9762          * Get the password-reminder-dialog information (private, non-encrypted)
9763          * MegaApi::USER_ATTR_DISABLE_VERSIONS = 16
9764          * Get whether user has versions disabled or enabled (private, non-encrypted)
9765          * MegaApi::USER_ATTR_RICH_PREVIEWS = 18
9766          * Get whether user generates rich-link messages or not (private)
9767          * MegaApi::USER_ATTR_RUBBISH_TIME = 19
9768          * Get number of days for rubbish-bin cleaning scheduler (private non-encrypted)
9769          * MegaApi::USER_ATTR_STORAGE_STATE = 21
9770          * Get the state of the storage (private non-encrypted)
9771          * MegaApi::USER_ATTR_GEOLOCATION = 22
9772          * Get whether the user has enabled send geolocation messages (private)
9773          * MegaApi::USER_ATTR_PUSH_SETTINGS = 23
9774          * Get the settings for push notifications (private non-encrypted)
9775          *
9776          * @param listener MegaRequestListener to track this request
9777          */
9778         void getUserAttribute(int type, MegaRequestListener *listener = NULL);
9779 
9780         /**
9781          * @brief Get the name associated to a user attribute
9782          *
9783          * You take the ownership of the returned value.
9784          *
9785          * @param attr Attribute
9786          * @return name associated to the user attribute
9787          */
9788         const char *userAttributeToString(int attr);
9789 
9790         /**
9791          * @brief Get the long descriptive name associated to a user attribute
9792          *
9793          * You take the ownership of the returned value.
9794          *
9795          * @param attr Attribute
9796          * @return descriptive name associated to the user attribute
9797          */
9798         const char *userAttributeToLongName(int attr);
9799 
9800         /**
9801          * @brief Get numeric value for user attribute given a string
9802          * @param name Name of the attribute
9803          * @return numeric value for user attribute
9804          */
9805         int userAttributeFromString(const char *name);
9806 
9807         /**
9808          * @brief Get the email address of any user in MEGA.
9809          *
9810          * The associated request type with this request is MegaRequest::TYPE_GET_USER_EMAIL
9811          * Valid data in the MegaRequest object received on callbacks:
9812          * - MegaRequest::getNodeHandle - Returns the handle of the user (the provided one as parameter)
9813          *
9814          * Valid data in the MegaRequest object received in onRequestFinish when the error code
9815          * is MegaError::API_OK:
9816          * - MegaRequest::getEmail - Returns the email address
9817          *
9818          * @param handle Handle of the user to get the attribute.
9819          * @param listener MegaRequestListener to track this request
9820          */
9821         void getUserEmail(MegaHandle handle, MegaRequestListener *listener = NULL);
9822 
9823         /**
9824          * @brief Cancel the retrieval of a thumbnail
9825          *
9826          * The associated request type with this request is MegaRequest::TYPE_CANCEL_ATTR_FILE
9827          * Valid data in the MegaRequest object received on callbacks:
9828          * - MegaRequest::getNodeHandle - Returns the handle of the node
9829          * - MegaRequest::getParamType - Returns MegaApi::ATTR_TYPE_THUMBNAIL
9830          *
9831          * @param node Node to cancel the retrieval of the thumbnail
9832          * @param listener MegaRequestListener to track this request
9833          *
9834          * @see MegaApi::getThumbnail
9835          */
9836 		void cancelGetThumbnail(MegaNode* node, MegaRequestListener *listener = NULL);
9837 
9838         /**
9839          * @brief Cancel the retrieval of a preview
9840          *
9841          * The associated request type with this request is MegaRequest::TYPE_CANCEL_ATTR_FILE
9842          * Valid data in the MegaRequest object received on callbacks:
9843          * - MegaRequest::getNodeHandle - Returns the handle of the node
9844          * - MegaRequest::getParamType - Returns MegaApi::ATTR_TYPE_PREVIEW
9845          *
9846          * @param node Node to cancel the retrieval of the preview
9847          * @param listener MegaRequestListener to track this request
9848          *
9849          * @see MegaApi::getPreview
9850          */
9851         void cancelGetPreview(MegaNode* node, MegaRequestListener *listener = NULL);
9852 
9853         /**
9854          * @brief Set the thumbnail of a MegaNode
9855          *
9856          * The associated request type with this request is MegaRequest::TYPE_SET_ATTR_FILE
9857          * Valid data in the MegaRequest object received on callbacks:
9858          * - MegaRequest::getNodeHandle - Returns the handle of the node
9859          * - MegaRequest::getFile - Returns the source path
9860          * - MegaRequest::getParamType - Returns MegaApi::ATTR_TYPE_THUMBNAIL
9861          *
9862          * @param node MegaNode to set the thumbnail
9863          * @param srcFilePath Source path of the file that will be set as thumbnail
9864          * @param listener MegaRequestListener to track this request
9865          */
9866         void setThumbnail(MegaNode* node, const char *srcFilePath, MegaRequestListener *listener = NULL);
9867 
9868         /**
9869          * @brief Uploads a thumbnail as part of a background media file upload
9870          *
9871          * The associated request type with this request is MegaRequest::TYPE_SET_ATTR_FILE
9872          * Valid data in the MegaRequest object received on callbacks:
9873          * - MegaRequest::getMegaBackgroundMediaUploadPtr - Returns the background upload object
9874          * - MegaRequest::getFile - Returns the source path
9875          * - MegaRequest::getParamType - Returns MegaApi::ATTR_TYPE_THUMBNAIL
9876          *
9877          * This value is valid for these requests in onRequestFinish when the
9878          * error code is MegaError::API_OK:
9879          * - MegaRequest::getNodeHandle - The handle of the uploaded file attribute.
9880          *
9881          * Use the result in the MegaRequest::getNodeHandle as the thumbnail handle in the
9882          * call to MegaApi::backgroundMediaUploadComplete.
9883          *
9884          * @param bu the MegaBackgroundMediaUpload that the fingernail will be assoicated with
9885          * @param srcFilePath Source path of the file that will be set as thumbnail
9886          * @param listener MegaRequestListener to track this request
9887          */
9888         void putThumbnail(MegaBackgroundMediaUpload* bu, const char *srcFilePath, MegaRequestListener *listener = NULL);
9889 
9890         /**
9891          * @brief Set the thumbnail of a MegaNode, via the result of MegaApi::putThumbnail
9892          *
9893          * The associated request type with this request is MegaRequest::TYPE_SET_ATTR_FILE
9894          * Valid data in the MegaRequest object received on callbacks:
9895          * - MegaRequest::getNodeHandle - Returns the handle of the node
9896          * - MegaRequest::getNumber - Returns the attribute handle
9897          * - MegaRequest::getParamType - Returns MegaApi::ATTR_TYPE_THUMBNAIL
9898          *
9899          * @param node MegaNode to set the thumbnail
9900          * @param fileattribute The result handle from a previous call to MegaApi::putThumbnail
9901          * @param listener MegaRequestListener to track this request
9902          */
9903         void setThumbnailByHandle(MegaNode* node, MegaHandle fileattribute, MegaRequestListener *listener = NULL);
9904 
9905         /**
9906          * @brief Set the preview of a MegaNode
9907          *
9908          * The associated request type with this request is MegaRequest::TYPE_SET_ATTR_FILE
9909          * Valid data in the MegaRequest object received on callbacks:
9910          * - MegaRequest::getNodeHandle - Returns the handle of the node
9911          * - MegaRequest::getFile - Returns the source path
9912          * - MegaRequest::getParamType - Returns MegaApi::ATTR_TYPE_PREVIEW
9913          *
9914          * @param node MegaNode to set the preview
9915          * @param srcFilePath Source path of the file that will be set as preview
9916          * @param listener MegaRequestListener to track this request
9917          */
9918         void setPreview(MegaNode* node, const char *srcFilePath, MegaRequestListener *listener = NULL);
9919 
9920         /**
9921          * @brief Uploads a preview as part of a background media file upload
9922          *
9923          * The associated request type with this request is MegaRequest::TYPE_SET_ATTR_FILE
9924          * Valid data in the MegaRequest object received on callbacks:
9925          * - MegaRequest::getMegaBackgroundMediaUploadPtr - Returns the background upload object
9926          * - MegaRequest::getFile - Returns the source path
9927          * - MegaRequest::getParamType - Returns MegaApi::ATTR_TYPE_THUMBNAIL
9928          *
9929          * This value is valid for these requests in onRequestFinish when the
9930          * error code is MegaError::API_OK:
9931          * - MegaRequest::getNodeHandle - The handle of the uploaded file attribute.
9932          *
9933          * Use the result in the MegaRequest::getNodeHandle as the preview handle in the
9934          * call to MegaApi::backgroundMediaUploadComplete.
9935          *
9936          * @param bu the MegaBackgroundMediaUpload that the fingernail will be assoicated with
9937          * @param srcFilePath Source path of the file that will be set as thumbnail
9938          * @param listener MegaRequestListener to track this request
9939          */
9940         void putPreview(MegaBackgroundMediaUpload* bu, const char *srcFilePath, MegaRequestListener *listener = NULL);
9941 
9942         /**
9943          * @brief Set the preview of a MegaNode, via the result of MegaApi::putPreview
9944          *
9945          * The associated request type with this request is MegaRequest::TYPE_SET_ATTR_FILE
9946          * Valid data in the MegaRequest object received on callbacks:
9947          * - MegaRequest::getNodeHandle - Returns the handle of the node
9948          * - MegaRequest::getNumber - Returns the attribute handle
9949          * - MegaRequest::getParamType - Returns MegaApi::ATTR_TYPE_PREVIEW
9950          *
9951          * @param node MegaNode to set the preview of
9952          * @param fileattribute The result handle from a previous call to MegaApi::putPreview
9953          * @param listener MegaRequestListener to track this request
9954          */
9955         void setPreviewByHandle(MegaNode* node, MegaHandle fileattribute, MegaRequestListener *listener = NULL);
9956 
9957         /**
9958          * @brief Set/Remove the avatar of the MEGA account
9959          *
9960          * The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER
9961          * Valid data in the MegaRequest object received on callbacks:
9962          * - MegaRequest::getFile - Returns the source path (optional)
9963          *
9964          * @param srcFilePath Source path of the file that will be set as avatar.
9965          * If NULL, the existing avatar will be removed (if any).
9966          * In case the avatar never existed before, removing the avatar returns MegaError::API_ENOENT
9967          * @param listener MegaRequestListener to track this request
9968          */
9969         void setAvatar(const char *srcFilePath, MegaRequestListener *listener = NULL);
9970 
9971         /**
9972          * @brief Confirm available memory to avoid OOM situations
9973          *
9974          * Before queueing a thumbnail or preview upload (or other memory intensive task),
9975          * it may be useful on some devices to check if there is plenty of memory available
9976          * in the memory pool used by MegaApi (especially since some platforms may not have
9977          * the facility to check for themselves, and/or deallocation may need to wait on a GC)
9978          * and if not, delay until any current resource constraints (eg. other current operations,
9979          * or other RAM-hungry apps in the device), have finished. This function just
9980          * makes several memory allocations and then immediately releases them. If all allocations
9981          * succeeded, it returns true, indicating that memory is (probably) available.
9982          * Of course, another app or operation may grab that memory immediately so it's not a
9983          * guarantee. However it may help to reduce the frequency of OOM situations on phones for example.
9984          *
9985          * @param allocCount The number of allocations to make
9986          * @param allocSize The size of those memory allocations.
9987          * @return True if all the allocations succeeded
9988          */
9989         bool testAllocation(unsigned allocCount, size_t allocSize);
9990 
9991         /**
9992          * @brief Set a public attribute of the current user
9993          *
9994          * The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER
9995          * Valid data in the MegaRequest object received on callbacks:
9996          * - MegaRequest::getParamType - Returns the attribute type
9997          * - MegaRequest::getText - Returns the new value for the attribute
9998          *
9999          * @param type Attribute type
10000          *
10001          * Valid values are:
10002          *
10003          * MegaApi::USER_ATTR_FIRSTNAME = 1
10004          * Set the firstname of the user (public)
10005          * MegaApi::USER_ATTR_LASTNAME = 2
10006          * Set the lastname of the user (public)
10007          * MegaApi::USER_ATTR_ED25519_PUBLIC_KEY = 5
10008          * Set the public key Ed25519 of the user (public)
10009          * MegaApi::USER_ATTR_CU25519_PUBLIC_KEY = 6
10010          * Set the public key Cu25519 of the user (public)
10011          * MegaApi::USER_ATTR_RUBBISH_TIME = 19
10012          * Set number of days for rubbish-bin cleaning scheduler (private non-encrypted)
10013          *
10014          * If the MEGA account is a sub-user business account, and the value of the parameter
10015          * type is equal to MegaApi::USER_ATTR_FIRSTNAME or MegaApi::USER_ATTR_LASTNAME
10016          * onRequestFinish will be called with the error code MegaError::API_EMASTERONLY.
10017          *
10018          * @param value New attribute value
10019          * @param listener MegaRequestListener to track this request
10020          */
10021         void setUserAttribute(int type, const char* value, MegaRequestListener *listener = NULL);
10022 
10023         /**
10024          * @brief Set a private attribute of the current user
10025          *
10026          * The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER
10027          * Valid data in the MegaRequest object received on callbacks:
10028          * - MegaRequest::getParamType - Returns the attribute type
10029          * - MegaRequest::getMegaStringMap - Returns the new value for the attribute
10030          *
10031          * @param type Attribute type
10032          *
10033          * Valid values are:
10034          *
10035          * MegaApi::USER_ATTR_AUTHRING = 3
10036          * Get the authentication ring of the user (private)
10037          * MegaApi::USER_ATTR_LAST_INTERACTION = 4
10038          * Get the last interaction of the contacts of the user (private)
10039          * MegaApi::USER_ATTR_KEYRING = 7
10040          * Get the key ring of the user: private keys for Cu25519 and Ed25519 (private)
10041          * MegaApi::USER_ATTR_RICH_PREVIEWS = 18
10042          * Get whether user generates rich-link messages or not (private)
10043          * MegaApi::USER_ATTR_RUBBISH_TIME = 19
10044          * Set number of days for rubbish-bin cleaning scheduler (private non-encrypted)
10045          * MegaApi::USER_ATTR_GEOLOCATION = 22
10046          * Set whether the user can send geolocation messages (private)
10047          * MegaApi::ATTR_ALIAS = 27
10048          * Set the list of users's aliases (private)
10049          * MegaApi::ATTR_DEVICE_NAMES = 30
10050          * Set the list of device names (private)
10051          *
10052          * @param value New attribute value
10053          * @param listener MegaRequestListener to track this request
10054          */
10055         void setUserAttribute(int type, const MegaStringMap *value, MegaRequestListener *listener = NULL);
10056 
10057         /**
10058          * @brief Set a custom attribute for the node
10059          *
10060          * The associated request type with this request is MegaRequest::TYPE_SET_ATTR_NODE
10061          * Valid data in the MegaRequest object received on callbacks:
10062          * - MegaRequest::getNodeHandle - Returns the handle of the node that receive the attribute
10063          * - MegaRequest::getName - Returns the name of the custom attribute
10064          * - MegaRequest::getText - Returns the text for the attribute
10065          * - MegaRequest::getFlag - Returns false (not official attribute)
10066          *
10067          * The attribute name must be an UTF8 string with between 1 and 7 bytes
10068          * If the attribute already has a value, it will be replaced
10069          * If value is NULL, the attribute will be removed from the node
10070          *
10071          * If the MEGA account is a business account and it's status is expired, onRequestFinish will
10072          * be called with the error code MegaError::API_EBUSINESSPASTDUE.
10073          *
10074          * @param node Node that will receive the attribute
10075          * @param attrName Name of the custom attribute.
10076          * The length of this parameter must be between 1 and 7 UTF8 bytes
10077          * @param value Value for the attribute
10078          * @param listener MegaRequestListener to track this request
10079          */
10080         void setCustomNodeAttribute(MegaNode *node, const char *attrName, const char* value, MegaRequestListener *listener = NULL);
10081 
10082         /**
10083          * @brief Set the duration of audio/video files as a node attribute.
10084          *
10085          * To remove the existing duration, set it to MegaNode::INVALID_DURATION.
10086          *
10087          * The associated request type with this request is MegaRequest::TYPE_SET_ATTR_NODE
10088          * Valid data in the MegaRequest object received on callbacks:
10089          * - MegaRequest::getNodeHandle - Returns the handle of the node that receive the attribute
10090          * - MegaRequest::getNumber - Returns the number of seconds for the node
10091          * - MegaRequest::getFlag - Returns true (official attribute)
10092          * - MegaRequest::getParamType - Returns MegaApi::NODE_ATTR_DURATION
10093          *
10094          * If the MEGA account is a business account and it's status is expired, onRequestFinish will
10095          * be called with the error code MegaError::API_EBUSINESSPASTDUE.
10096          *
10097          * @param node Node that will receive the information.
10098          * @param duration Length of the audio/video in seconds.
10099          * @param listener MegaRequestListener to track this request
10100          *
10101          * @deprecated Since the SDK started processing media information internally,
10102          * it is no longer needed nor recommended to use this function, so it will
10103          * be removed in a short time.
10104          */
10105         void setNodeDuration(MegaNode *node, int duration, MegaRequestListener *listener = NULL);
10106 
10107         /**
10108          * @brief Set the GPS coordinates of image files as a node attribute.
10109          *
10110          * To remove the existing coordinates, set both the latitude and longitude to
10111          * the value MegaNode::INVALID_COORDINATE.
10112          *
10113          * The associated request type with this request is MegaRequest::TYPE_SET_ATTR_NODE
10114          * Valid data in the MegaRequest object received on callbacks:
10115          * - MegaRequest::getNodeHandle - Returns the handle of the node that receive the attribute
10116          * - MegaRequest::getFlag - Returns true (official attribute)
10117          * - MegaRequest::getParamType - Returns MegaApi::NODE_ATTR_COORDINATES
10118          * - MegaRequest::getNumDetails - Returns the longitude, scaled to integer in the range of [0, 2^24]
10119          * - MegaRequest::getTransferTag() - Returns the latitude, scaled to integer in the range of [0, 2^24)
10120          *
10121          * If the MEGA account is a business account and it's status is expired, onRequestFinish will
10122          * be called with the error code MegaError::API_EBUSINESSPASTDUE.
10123          *
10124          * @param node Node that will receive the information.
10125          * @param latitude Latitude in signed decimal degrees notation
10126          * @param longitude Longitude in signed decimal degrees notation
10127          * @param listener MegaRequestListener to track this request
10128          */
10129         void setNodeCoordinates(MegaNode *node, double latitude, double longitude, MegaRequestListener *listener = NULL);
10130 
10131         /**
10132          * @brief Set the GPS coordinates of media files as a node attribute that is private
10133          *
10134          * To remove the existing coordinates, set both the latitude and longitude to
10135          * the value MegaNode::INVALID_COORDINATE.
10136          *
10137          * Compared to MegaApi::setNodeCoordinates, this function stores the coordinates with an extra
10138          * layer of encryption which only this user can decrypt, so that even if this node is shared
10139          * with others, they cannot read the coordinates.
10140          *
10141          * The associated request type with this request is MegaRequest::TYPE_SET_ATTR_NODE
10142          * Valid data in the MegaRequest object received on callbacks:
10143          * - MegaRequest::getNodeHandle - Returns the handle of the node that receive the attribute
10144          * - MegaRequest::getFlag - Returns true (official attribute)
10145          * - MegaRequest::getParamType - Returns MegaApi::NODE_ATTR_COORDINATES
10146          * - MegaRequest::getNumDetails - Returns the longitude, scaled to integer in the range of [0, 2^24]
10147          * - MegaRequest::getTransferTag() - Returns the latitude, scaled to integer in the range of [0, 2^24)
10148          *
10149          * @param node Node that will receive the information.
10150          * @param latitude Latitude in signed decimal degrees notation
10151          * @param longitude Longitude in signed decimal degrees notation
10152          * @param listener MegaRequestListener to track this request
10153          */
10154         void setUnshareableNodeCoordinates(MegaNode *node, double latitude, double longitude, MegaRequestListener *listener = NULL);
10155 
10156         /**
10157          * @brief Generate a public link of a file/folder in MEGA
10158          *
10159          * The associated request type with this request is MegaRequest::TYPE_EXPORT
10160          * Valid data in the MegaRequest object received on callbacks:
10161          * - MegaRequest::getNodeHandle - Returns the handle of the node
10162          * - MegaRequest::getAccess - Returns true
10163          *
10164          * Valid data in the MegaRequest object received in onRequestFinish when the error code
10165          * is MegaError::API_OK:
10166          * - MegaRequest::getLink - Public link
10167          *
10168          * If the MEGA account is a business account and it's status is expired, onRequestFinish will
10169          * be called with the error code MegaError::API_EBUSINESSPASTDUE.
10170          *
10171          * @param node MegaNode to get the public link
10172          * @param listener MegaRequestListener to track this request
10173          */
10174         void exportNode(MegaNode *node, MegaRequestListener *listener = NULL);
10175 
10176         /**
10177          * @brief Generate a temporary public link of a file/folder in MEGA
10178          *
10179          * The associated request type with this request is MegaRequest::TYPE_EXPORT
10180          * Valid data in the MegaRequest object received on callbacks:
10181          * - MegaRequest::getNodeHandle - Returns the handle of the node
10182          * - MegaRequest::getAccess - Returns true
10183          *
10184          * Valid data in the MegaRequest object received in onRequestFinish when the error code
10185          * is MegaError::API_OK:
10186          * - MegaRequest::getLink - Public link
10187          *
10188          * If the MEGA account is a business account and it's status is expired, onRequestFinish will
10189          * be called with the error code MegaError::API_EBUSINESSPASTDUE.
10190          *
10191          * @param node MegaNode to get the public link
10192          * @param expireTime Unix timestamp until the public link will be valid
10193          * @param listener MegaRequestListener to track this request
10194          *
10195          * @note A Unix timestamp represents the number of seconds since 00:00 hours, Jan 1, 1970 UTC
10196          */
10197         void exportNode(MegaNode *node, int64_t expireTime, MegaRequestListener *listener = NULL);
10198 
10199         /**
10200          * @brief Stop sharing a file/folder
10201          *
10202          * The associated request type with this request is MegaRequest::TYPE_EXPORT
10203          * Valid data in the MegaRequest object received on callbacks:
10204          * - MegaRequest::getNodeHandle - Returns the handle of the node
10205          * - MegaRequest::getAccess - Returns false
10206          *
10207          * If the MEGA account is a business account and it's status is expired, onRequestFinish will
10208          * be called with the error code MegaError::API_EBUSINESSPASTDUE.
10209          *
10210          * @param node MegaNode to stop sharing
10211          * @param listener MegaRequestListener to track this request
10212          */
10213         void disableExport(MegaNode *node, MegaRequestListener *listener = NULL);
10214 
10215         /**
10216          * @brief Fetch the filesystem in MEGA
10217          *
10218          * The MegaApi object must be logged in in an account or a public folder
10219          * to successfully complete this request.
10220          *
10221          * The associated request type with this request is MegaRequest::TYPE_FETCH_NODES
10222          *
10223          * Valid data in the MegaRequest object received in onRequestFinish when the error code
10224          * is MegaError::API_OK:
10225          * - MegaRequest::getFlag - Returns true if logged in into a folder and the provided key is invalid. Otherwise, false.
10226          * - MegaRequest::getNodeHandle - Returns the public handle if logged into a public folder. Otherwise, INVALID_HANDLE
10227          *
10228          * @param listener MegaRequestListener to track this request
10229          */
10230         void fetchNodes(MegaRequestListener *listener = NULL);
10231 
10232         /**
10233          * @brief Fetch the filesystem in MEGA and resumes syncs following a successful fetch
10234          *
10235          * The MegaApi object must be logged in in an account or a public folder
10236          * to successfully complete this request.
10237          *
10238          * The associated request type with this request is MegaRequest::TYPE_FETCH_NODES
10239          *
10240          * Valid data in the MegaRequest object received in onRequestFinish when the error code
10241          * is MegaError::API_OK:
10242          * - MegaRequest::getFlag - Returns true if logged in into a folder and the provided key is invalid. Otherwise, false.
10243          * - MegaRequest::getNodeHandle - Returns the public handle if logged into a public folder. Otherwise, INVALID_HANDLE
10244          *
10245          * @param listener MegaRequestListener to track this request
10246          */
10247         void fetchNodesAndResumeSyncs(MegaRequestListener *listener = NULL);
10248 
10249         /**
10250          * @brief Get the sum of sizes of all the files stored in the MEGA cloud.
10251          *
10252          * The SDK keeps a running total of the sum of the sizes of all the files stored in the cloud.
10253          * This function retrieves that sum, via listener in order to avoid any blocking when called
10254          * from a GUI thread. Provided the local state is caught up, the number will match the
10255          * storageUsed from MegaApi::getAccountDetails which requests data from the servers, and is much
10256          * quicker to retrieve.
10257          *
10258          * The MegaApi object must be logged in in an account or a public folder
10259          * to successfully complete this request.
10260          *
10261          * The associated request type with this request is MegaRequest::TYPE_GET_CLOUDSTORAGEUSED
10262          *
10263          * Valid data in the MegaRequest object received in onRequestFinish when the error code
10264          * is MegaError::API_OK:
10265          * - MegaRequest::getNumber - returns the cloud storage bytes used (calculated locally from the node data structures)
10266          *
10267          * @param listener MegaRequestListener to track this request
10268          */
10269         void getCloudStorageUsed(MegaRequestListener *listener = NULL);
10270 
10271         /**
10272          * @brief Get details about the MEGA account
10273          *
10274          * Only basic data will be available. If you can get more data (sessions, transactions, purchases),
10275          * use MegaApi::getExtendedAccountDetails.
10276          *
10277          * The associated request type with this request is MegaRequest::TYPE_ACCOUNT_DETAILS
10278          *
10279          * Valid data in the MegaRequest object received in onRequestFinish when the error code
10280          * is MegaError::API_OK:
10281          * - MegaRequest::getMegaAccountDetails - Details of the MEGA account
10282          * - MegaRequest::getNumDetails - Requested flags
10283          *
10284          * The available flags are:
10285          *  - storage quota: (numDetails & 0x01)
10286          *  - transfer quota: (numDetails & 0x02)
10287          *  - pro level: (numDetails & 0x04)
10288          *
10289          * @param listener MegaRequestListener to track this request
10290          */
10291         void getAccountDetails(MegaRequestListener *listener = NULL);
10292 
10293         /**
10294          * @brief Get details about the MEGA account
10295          *
10296          * Only basic data will be available. If you need more data (sessions, transactions, purchases),
10297          * use MegaApi::getExtendedAccountDetails.
10298          *
10299          * The associated request type with this request is MegaRequest::TYPE_ACCOUNT_DETAILS
10300          *
10301          * Use this version of the function to get just the details you need, to minimise server load
10302          * and keep the system highly available for all. At least one flag must be set.
10303          *
10304          * Valid data in the MegaRequest object received in onRequestFinish when the error code
10305          * is MegaError::API_OK:
10306          * - MegaRequest::getMegaAccountDetails - Details of the MEGA account
10307          * - MegaRequest::getNumDetails - Requested flags
10308          *
10309          * The available flags are:
10310          *  - storage quota: (numDetails & 0x01)
10311          *  - transfer quota: (numDetails & 0x02)
10312          *  - pro level: (numDetails & 0x04)
10313          *
10314          * In case none of the flags are set, the associated request will fail with error MegaError::API_EARGS.
10315          *
10316          * @param storage If true, account storage details are requested
10317          * @param transfer If true, account transfer details are requested
10318          * @param pro If true, pro level of account is requested
10319          * @param source code associated to trace the origin of storage requests, used for debugging purposes
10320          * @param listener MegaRequestListener to track this request
10321          */
10322         void getSpecificAccountDetails(bool storage, bool transfer, bool pro, int source = -1, MegaRequestListener *listener = NULL);
10323 
10324         /**
10325          * @brief Get details about the MEGA account
10326          *
10327          * This function allows to optionally get data about sessions, transactions and purchases related to the account.
10328          *
10329          * The associated request type with this request is MegaRequest::TYPE_ACCOUNT_DETAILS
10330          *
10331          * Valid data in the MegaRequest object received in onRequestFinish when the error code
10332          * is MegaError::API_OK:
10333          * - MegaRequest::getMegaAccountDetails - Details of the MEGA account
10334          * - MegaRequest::getNumDetails - Requested flags
10335          *
10336          * The available flags are:
10337          *  - transactions: (numDetails & 0x08)
10338          *  - purchases: (numDetails & 0x10)
10339          *  - sessions: (numDetails & 0x020)
10340          *
10341          * In case none of the flags are set, the associated request will fail with error MegaError::API_EARGS.
10342          *
10343          * @param sessions If true, sessions are requested
10344          * @param purchases If true, purchases are requested
10345          * @param transactions If true, transactions are requested
10346          * @param listener MegaRequestListener to track this request
10347          */
10348         void getExtendedAccountDetails(bool sessions = false, bool purchases = false, bool transactions = false, MegaRequestListener *listener = NULL);
10349 
10350         /**
10351          * @brief Check if the available transfer quota is enough to transfer an amount of bytes
10352          *
10353          * The associated request type with this request is MegaRequest::TYPE_QUERY_TRANSFER_QUOTA
10354          *
10355          * Valid data in the MegaRequest object received on callbacks:
10356          * - MegaRequest::getNumber - Returns the amount of bytes to be transferred
10357          *
10358          * Valid data in the MegaRequest object received in onRequestFinish when the error code
10359          * is MegaError::API_OK:
10360          * - MegaRequest::getFlag - True if it is expected to get an overquota error, otherwise false
10361          *
10362          * @param size Amount of bytes to be transferred
10363          * @param listener MegaRequestListener to track this request
10364          */
10365         void queryTransferQuota(long long size, MegaRequestListener *listener = NULL);
10366 
10367         /**
10368          * @brief Get the available pricing plans to upgrade a MEGA account
10369          *
10370          * You can get a payment ID for any of the pricing plans provided by this function
10371          * using MegaApi::getPaymentId
10372          *
10373          * The associated request type with this request is MegaRequest::TYPE_GET_PRICING
10374          *
10375          * Valid data in the MegaRequest object received in onRequestFinish when the error code
10376          * is MegaError::API_OK:
10377          * - MegaRequest::getPricing - MegaPricing object with all pricing plans
10378          *
10379          * @param listener MegaRequestListener to track this request
10380          *
10381          * @see MegaApi::getPaymentId
10382          */
10383         void getPricing(MegaRequestListener *listener = NULL);
10384 
10385         /**
10386          * @brief Get the payment URL for an upgrade
10387          *
10388          * The associated request type with this request is MegaRequest::TYPE_GET_PAYMENT_ID
10389          * Valid data in the MegaRequest object received on callbacks:
10390          * - MegaRequest::getNodeHandle - Returns the handle of the product
10391          *
10392          * Valid data in the MegaRequest object received in onRequestFinish when the error code
10393          * is MegaError::API_OK:
10394          * - MegaRequest::getLink - Payment ID
10395          *
10396          * @param productHandle Handle of the product (see MegaApi::getPricing)
10397          * @param listener MegaRequestListener to track this request
10398          *
10399          * @see MegaApi::getPricing
10400          */
10401         void getPaymentId(MegaHandle productHandle, MegaRequestListener *listener = NULL);
10402 
10403         /**
10404          * @brief Get the payment URL for an upgrade
10405          *
10406          * The associated request type with this request is MegaRequest::TYPE_GET_PAYMENT_ID
10407          * Valid data in the MegaRequest object received on callbacks:
10408          * - MegaRequest::getNodeHandle - Returns the handle of the product
10409          * - MegaRequest::getParentHandle - Returns the last public node handle accessed
10410          *
10411          * Valid data in the MegaRequest object received in onRequestFinish when the error code
10412          * is MegaError::API_OK:
10413          * - MegaRequest::getLink - Payment ID
10414          *
10415          * @param productHandle Handle of the product (see MegaApi::getPricing)
10416          * @param lastPublicHandle Last public node handle accessed by the user in the last 24h
10417          * @param listener MegaRequestListener to track this request
10418          *
10419          * @see MegaApi::getPricing
10420          */
10421         void getPaymentId(MegaHandle productHandle, MegaHandle lastPublicHandle, MegaRequestListener *listener = NULL);
10422 
10423         /**
10424          * @brief Get the payment URL for an upgrade
10425          *
10426          * The associated request type with this request is MegaRequest::TYPE_GET_PAYMENT_ID
10427          * Valid data in the MegaRequest object received on callbacks:
10428          * - MegaRequest::getNodeHandle - Returns the handle of the product
10429          *
10430          * Valid data in the MegaRequest object received in onRequestFinish when the error code
10431          * is MegaError::API_OK:
10432          * - MegaRequest::getLink - Payment ID
10433          * - MegaRequest::getParentHandle - Returns the last public node handle accessed
10434          * - MegaRequest::getParamType - Returns the type of lastPublicHandle
10435          * - MegaRequest::getTransferredBytes - Returns the timestamp of the last access
10436          *
10437          * @param productHandle Handle of the product (see MegaApi::getPricing)
10438          * @param lastPublicHandle Last public node handle accessed by the user in the last 24h
10439          * @param lastPublicHandleType Indicates the type of lastPublicHandle, valid values are:
10440          *      - MegaApi::AFFILIATE_TYPE_ID = 1
10441          *      - MegaApi::AFFILIATE_TYPE_FILE_FOLDER = 2
10442          *      - MegaApi::AFFILIATE_TYPE_CHAT = 3
10443          *      - MegaApi::AFFILIATE_TYPE_CONTACT = 4
10444          *
10445          * @param lastAccessTimestamp Timestamp of the last access
10446          * @param listener MegaRequestListener to track this request
10447          * @see MegaApi::getPricing
10448          */
10449         void getPaymentId(MegaHandle productHandle, MegaHandle lastPublicHandle, int lastPublicHandleType, int64_t lastAccessTimestamp, MegaRequestListener *listener = NULL);
10450 
10451         /**
10452          * @brief Upgrade an account
10453          * @param productHandle Product handle to purchase
10454          *
10455          * It's possible to get all pricing plans with their product handles using
10456          * MegaApi::getPricing
10457          *
10458          * The associated request type with this request is MegaRequest::TYPE_UPGRADE_ACCOUNT
10459          * Valid data in the MegaRequest object received on callbacks:
10460          * - MegaRequest::getNodeHandle - Returns the handle of the product
10461          * - MegaRequest::getNumber - Returns the payment method
10462          *
10463          * @param paymentMethod Payment method
10464          * Valid values are:
10465          * - MegaApi::PAYMENT_METHOD_BALANCE = 0
10466          * Use the account balance for the payment
10467          *
10468          * - MegaApi::PAYMENT_METHOD_CREDIT_CARD = 8
10469          * Complete the payment with your credit card. Use MegaApi::creditCardStore to add
10470          * a credit card to your account
10471          *
10472          * @param listener MegaRequestListener to track this request
10473          */
10474         void upgradeAccount(MegaHandle productHandle, int paymentMethod, MegaRequestListener *listener = NULL);
10475 
10476         /**
10477          * @brief Submit a purchase receipt for verification
10478          *
10479          * The associated request type with this request is MegaRequest::TYPE_SUBMIT_PURCHASE_RECEIPT
10480          * Valid data in the MegaRequest object received on callbacks:
10481          * - MegaRequest::getText - Returns the purchase receipt
10482          *
10483          * @param receipt Purchase receipt
10484          * @param listener MegaRequestListener to track this request
10485          *
10486          * @deprecated This function is only compatible with Google Play payments.
10487          * It only exists for compatibility with previous apps and will be removed soon.
10488          * Please use the other version of MegaApi::submitPurchaseReceipt that allows
10489          * to select the payment gateway.
10490          */
10491         void submitPurchaseReceipt(const char* receipt, MegaRequestListener *listener = NULL);
10492 
10493         /**
10494          * @brief Submit a purchase receipt for verification
10495          *
10496          * The associated request type with this request is MegaRequest::TYPE_SUBMIT_PURCHASE_RECEIPT
10497          * Valid data in the MegaRequest object received on callbacks:
10498          * - MegaRequest::getNumber - Returns the payment gateway
10499          * - MegaRequest::getText - Returns the purchase receipt
10500          *
10501          * @param gateway Payment gateway
10502          * Currently supported payment gateways are:
10503          * - MegaApi::PAYMENT_METHOD_ITUNES = 2
10504          * - MegaApi::PAYMENT_METHOD_GOOGLE_WALLET = 3
10505          * - MegaApi::PAYMENT_METHOD_WINDOWS_STORE = 13
10506          *
10507          * @param receipt Purchase receipt
10508          * @param listener MegaRequestListener to track this request
10509          */
10510         void submitPurchaseReceipt(int gateway, const char* receipt, MegaRequestListener *listener = NULL);
10511 
10512         /**
10513          * @brief Submit a purchase receipt for verification
10514          *
10515          * The associated request type with this request is MegaRequest::TYPE_SUBMIT_PURCHASE_RECEIPT
10516          * Valid data in the MegaRequest object received on callbacks:
10517          * - MegaRequest::getNumber - Returns the payment gateway
10518          * - MegaRequest::getText - Returns the purchase receipt
10519          * - MegaRequest::getNodeHandle - Returns the last public node handle accessed
10520          *
10521          * @param gateway Payment gateway
10522          * Currently supported payment gateways are:
10523          * - MegaApi::PAYMENT_METHOD_ITUNES = 2
10524          * - MegaApi::PAYMENT_METHOD_GOOGLE_WALLET = 3
10525          * - MegaApi::PAYMENT_METHOD_WINDOWS_STORE = 13
10526          *
10527          * @param receipt Purchase receipt
10528          * @param lastPublicHandle Last public node handle accessed by the user in the last 24h
10529          * @param listener MegaRequestListener to track this request
10530          */
10531         void submitPurchaseReceipt(int gateway, const char* receipt, MegaHandle lastPublicHandle, MegaRequestListener *listener = NULL);
10532 
10533         /**
10534          * @brief Submit a purchase receipt for verification
10535          *
10536          * The associated request type with this request is MegaRequest::TYPE_SUBMIT_PURCHASE_RECEIPT
10537          * Valid data in the MegaRequest object received on callbacks:
10538          * - MegaRequest::getNumber - Returns the payment gateway
10539          * - MegaRequest::getText - Returns the purchase receipt
10540          * - MegaRequest::getNodeHandle - Returns the last public node handle accessed
10541          * - MegaRequest::getParamType - Returns the type of lastPublicHandle
10542          * - MegaRequest::getTransferredBytes - Returns the timestamp of the last access
10543          *
10544          * @param gateway Payment gateway
10545          * Currently supported payment gateways are:
10546          * - MegaApi::PAYMENT_METHOD_ITUNES = 2
10547          * - MegaApi::PAYMENT_METHOD_GOOGLE_WALLET = 3
10548          * - MegaApi::PAYMENT_METHOD_WINDOWS_STORE = 13
10549          *
10550          * @param receipt Purchase receipt
10551          * @param lastPublicHandle Last public node handle accessed by the user in the last 24h
10552          * @param lastPublicHandleType Indicates the type of lastPublicHandle, valid values are:
10553          *      - MegaApi::AFFILIATE_TYPE_ID = 1
10554          *      - MegaApi::AFFILIATE_TYPE_FILE_FOLDER = 2
10555          *      - MegaApi::AFFILIATE_TYPE_CHAT = 3
10556          *      - MegaApi::AFFILIATE_TYPE_CONTACT = 4
10557          *
10558          * @param lastAccessTimestamp Timestamp of the last access
10559          * @param listener MegaRequestListener to track this request
10560          */
10561         void submitPurchaseReceipt(int gateway, const char *receipt, MegaHandle lastPublicHandle, int lastPublicHandleType, int64_t lastAccessTimestamp, MegaRequestListener *listener =  NULL);
10562 
10563         /**
10564          * @brief Store a credit card
10565          *
10566          * The associated request type with this request is MegaRequest::TYPE_CREDIT_CARD_STORE
10567          *
10568          * @param address1 Billing address
10569          * @param address2 Second line of the billing address (optional)
10570          * @param city City of the billing address
10571          * @param province Province of the billing address
10572          * @param country Contry of the billing address
10573          * @param postalcode Postal code of the billing address
10574          * @param firstname Firstname of the owner of the credit card
10575          * @param lastname Lastname of the owner of the credit card
10576          * @param creditcard Credit card number. Only digits, no spaces nor dashes
10577          * @param expire_month Expire month of the credit card. Must have two digits ("03" for example)
10578          * @param expire_year Expire year of the credit card. Must have four digits ("2010" for example)
10579          * @param cv2 Security code of the credit card (3 digits)
10580          * @param listener MegaRequestListener to track this request
10581          */
10582         void creditCardStore(const char* address1, const char* address2, const char* city,
10583                              const char* province, const char* country, const char *postalcode,
10584                              const char* firstname, const char* lastname, const char* creditcard,
10585                              const char* expire_month, const char* expire_year, const char* cv2,
10586                              MegaRequestListener *listener = NULL);
10587 
10588         /**
10589          * @brief Get the credit card subscriptions of the account
10590          *
10591          * The associated request type with this request is MegaRequest::TYPE_CREDIT_CARD_QUERY_SUBSCRIPTIONS
10592          *
10593          * Valid data in the MegaRequest object received in onRequestFinish when the error code
10594          * is MegaError::API_OK:
10595          * - MegaRequest::getNumber - Number of credit card subscriptions
10596          *
10597          * @param listener MegaRequestListener to track this request
10598          */
10599         void creditCardQuerySubscriptions(MegaRequestListener *listener = NULL);
10600 
10601         /**
10602          * @brief Cancel credit card subscriptions if the account
10603          *
10604          * The associated request type with this request is MegaRequest::TYPE_CREDIT_CARD_CANCEL_SUBSCRIPTIONS
10605          * @param reason Reason for the cancellation. It can be NULL.
10606          * @param listener MegaRequestListener to track this request
10607          */
10608         void creditCardCancelSubscriptions(const char* reason, MegaRequestListener *listener = NULL);
10609 
10610         /**
10611          * @brief Get the available payment methods
10612          *
10613          * The associated request type with this request is MegaRequest::TYPE_GET_PAYMENT_METHODS
10614          *
10615          * Valid data in the MegaRequest object received in onRequestFinish when the error code
10616          * is MegaError::API_OK:
10617          * - MegaRequest::getNumber - Bitfield with available payment methods
10618          *
10619          * To know if a payment method is available, you can do a check like this one:
10620          * request->getNumber() & (1 << MegaApi::PAYMENT_METHOD_CREDIT_CARD)
10621          *
10622          * @param listener MegaRequestListener to track this request
10623          */
10624         void getPaymentMethods(MegaRequestListener *listener = NULL);
10625 
10626         /**
10627          * @brief Export the master key of the account
10628          *
10629          * The returned value is a Base64-encoded string
10630          *
10631          * With the master key, it's possible to start the recovery of an account when the
10632          * password is lost:
10633          * - https://mega.nz/#recovery
10634          * - MegaApi::resetPassword()
10635          *
10636          * You take the ownership of the returned value.
10637          *
10638          * @return Base64-encoded master key
10639          */
10640         char *exportMasterKey();
10641 
10642         /**
10643          * @brief Notify the user has exported the master key
10644          *
10645          * This function should be called when the user exports the master key by
10646          * clicking on "Copy" or "Save file" options.
10647          *
10648          * As result, the user attribute MegaApi::USER_ATTR_PWD_REMINDER will be updated
10649          * to remember the user has a backup of his/her master key. In consequence,
10650          * MEGA will not ask the user to remind the password for the account.
10651          *
10652          * The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER
10653          * Valid data in the MegaRequest object received on callbacks:
10654          * - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_PWD_REMINDER
10655          * - MegaRequest::getText - Returns the new value for the attribute
10656          *
10657          * @param listener MegaRequestListener to track this request
10658          */
10659         void masterKeyExported(MegaRequestListener *listener = NULL);
10660 
10661         /**
10662          * @brief Notify the user has successfully checked his password
10663          *
10664          * This function should be called when the user demonstrates that he remembers
10665          * the password to access the account
10666          *
10667          * As result, the user attribute MegaApi::USER_ATTR_PWD_REMINDER will be updated
10668          * to remember this event. In consequence, MEGA will not continue asking the user
10669          * to remind the password for the account in a short time.
10670          *
10671          * The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER
10672          * Valid data in the MegaRequest object received on callbacks:
10673          * - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_PWD_REMINDER
10674          * - MegaRequest::getText - Returns the new value for the attribute
10675          *
10676          * @param listener MegaRequestListener to track this request
10677          */
10678         void passwordReminderDialogSucceeded(MegaRequestListener *listener = NULL);
10679 
10680         /**
10681          * @brief Notify the user has successfully skipped the password check
10682          *
10683          * This function should be called when the user skips the verification of
10684          * the password to access the account
10685          *
10686          * As result, the user attribute MegaApi::USER_ATTR_PWD_REMINDER will be updated
10687          * to remember this event. In consequence, MEGA will not continue asking the user
10688          * to remind the password for the account in a short time.
10689          *
10690          * The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER
10691          * Valid data in the MegaRequest object received on callbacks:
10692          * - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_PWD_REMINDER
10693          * - MegaRequest::getText - Returns the new value for the attribute
10694          *
10695          * @param listener MegaRequestListener to track this request
10696          */
10697         void passwordReminderDialogSkipped(MegaRequestListener *listener = NULL);
10698 
10699         /**
10700          * @brief Notify the user wants to totally disable the password check
10701          *
10702          * This function should be called when the user rejects to verify that he remembers
10703          * the password to access the account and doesn't want to see the reminder again.
10704          *
10705          * As result, the user attribute MegaApi::USER_ATTR_PWD_REMINDER will be updated
10706          * to remember this event. In consequence, MEGA will not ask the user
10707          * to remind the password for the account again.
10708          *
10709          * The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER
10710          * Valid data in the MegaRequest object received on callbacks:
10711          * - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_PWD_REMINDER
10712          * - MegaRequest::getText - Returns the new value for the attribute
10713          *
10714          * @param listener MegaRequestListener to track this request
10715          */
10716         void passwordReminderDialogBlocked(MegaRequestListener *listener = NULL);
10717 
10718         /**
10719          * @brief Check if the app should show the password reminder dialog to the user
10720          *
10721          * The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
10722          * Valid data in the MegaRequest object received on callbacks:
10723          * - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_PWD_REMINDER
10724          *
10725          * Valid data in the MegaRequest object received in onRequestFinish when the error code
10726          * is MegaError::API_OK:
10727          * - MegaRequest::getFlag - Returns true if the password reminder dialog should be shown
10728          *
10729          * If the corresponding user attribute is not set yet, the request will fail with the
10730          * error code MegaError::API_ENOENT but the value of MegaRequest::getFlag will still
10731          * be valid.
10732          *
10733          * @param atLogout True if the check is being done just before a logout
10734          * @param listener MegaRequestListener to track this request
10735          */
10736         void shouldShowPasswordReminderDialog(bool atLogout, MegaRequestListener *listener = NULL);
10737 
10738         /**
10739          * @brief Check if the master key has been exported
10740          *
10741          * The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
10742          * Valid data in the MegaRequest object received on callbacks:
10743          * - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_PWD_REMINDER
10744          *
10745          * Valid data in the MegaRequest object received in onRequestFinish when the error code
10746          * is MegaError::API_OK:
10747          * - MegaRequest::getAccess - Returns true if the master key has been exported
10748          *
10749          * If the corresponding user attribute is not set yet, the request will fail with the
10750          * error code MegaError::API_ENOENT.
10751          *
10752          * @param listener MegaRequestListener to track this request
10753          */
10754         void isMasterKeyExported(MegaRequestListener *listener = NULL);
10755 
10756 #ifdef ENABLE_CHAT
10757         /**
10758          * @brief Enable or disable the generation of rich previews
10759          *
10760          * The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER
10761          * Valid data in the MegaRequest object received on callbacks:
10762          * - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_RICH_PREVIEWS
10763          *
10764          * @param enable True to enable the generation of rich previews
10765          * @param listener MegaRequestListener to track this request
10766          */
10767         void enableRichPreviews(bool enable, MegaRequestListener *listener = NULL);
10768 
10769         /**
10770          * @brief Check if rich previews are automatically generated
10771          *
10772          * The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
10773          * Valid data in the MegaRequest object received on callbacks:
10774          * - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_RICH_PREVIEWS
10775          * - MegaRequest::getNumDetails - Returns zero
10776          *
10777          * Valid data in the MegaRequest object received in onRequestFinish when the error code
10778          * is MegaError::API_OK:
10779          * - MegaRequest::getFlag - Returns true if generation of rich previews is enabled
10780          * - MegaRequest::getMegaStringMap - Returns the raw content of the atribute: [<key><value>]*
10781          *
10782          * If the corresponding user attribute is not set yet, the request will fail with the
10783          * error code MegaError::API_ENOENT, but the value of MegaRequest::getFlag will still be valid (false).
10784          *
10785          * @param listener MegaRequestListener to track this request
10786          */
10787         void isRichPreviewsEnabled(MegaRequestListener *listener = NULL);
10788 
10789         /**
10790          * @brief Check if the app should show the rich link warning dialog to the user
10791          *
10792          * The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
10793          * Valid data in the MegaRequest object received on callbacks:
10794          * - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_RICH_PREVIEWS
10795          * - MegaRequest::getNumDetails - Returns one
10796          *
10797          * Valid data in the MegaRequest object received in onRequestFinish when the error code
10798          * is MegaError::API_OK:
10799          * - MegaRequest::getFlag - Returns true if it is necessary to show the rich link warning
10800          * - MegaRequest::getNumber - Returns the number of times that user has indicated that doesn't want
10801          * modify the message with a rich link. If number is bigger than three, the extra option "Never"
10802          * must be added to the warning dialog.
10803          * - MegaRequest::getMegaStringMap - Returns the raw content of the atribute: [<key><value>]*
10804          *
10805          * If the corresponding user attribute is not set yet, the request will fail with the
10806          * error code MegaError::API_ENOENT, but the value of MegaRequest::getFlag will still be valid (true).
10807          *
10808          * @param listener MegaRequestListener to track this request
10809          */
10810         void shouldShowRichLinkWarning(MegaRequestListener *listener = NULL);
10811 
10812         /**
10813          * @brief Set the number of times "Not now" option has been selected in the rich link warning dialog
10814          *
10815          * The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER
10816          * Valid data in the MegaRequest object received on callbacks:
10817          * - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_RICH_PREVIEWS
10818          *
10819          * @param value Number of times "Not now" option has been selected
10820          * @param listener MegaRequestListener to track this request
10821          */
10822         void setRichLinkWarningCounterValue(int value, MegaRequestListener *listener = NULL);
10823 
10824         /**
10825          * @brief Enable the sending of geolocation messages
10826          *
10827          * The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER
10828          * Valid data in the MegaRequest object received on callbacks:
10829          * - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_GEOLOCATION
10830          *
10831          * @param listener MegaRequestListener to track this request
10832          */
10833         void enableGeolocation(MegaRequestListener *listener = NULL);
10834 
10835         /**
10836          * @brief Check if the sending of geolocation messages is enabled
10837          *
10838          * The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
10839          * Valid data in the MegaRequest object received on callbacks:
10840          * - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_GEOLOCATION
10841          *
10842          * Sending a Geolocation message is enabled if the MegaRequest object, received in onRequestFinish,
10843          * has error code MegaError::API_OK. In other cases, send geolocation messages is not enabled and
10844          * the application has to answer before send a message of this type.
10845          *
10846          * @param listener MegaRequestListener to track this request
10847          */
10848         void isGeolocationEnabled(MegaRequestListener *listener = NULL);
10849 #endif
10850 
10851         /**
10852          * @brief Set My Chat Files target folder.
10853          *
10854          * The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER
10855          * Valid data in the MegaRequest object received on callbacks:
10856          * - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_MY_CHAT_FILES_FOLDER
10857          * - MegaRequest::getMegaStringMap - Returns a MegaStringMap.
10858          * The key "h" in the map contains the nodehandle specified as parameter encoded in B64
10859          *
10860          * @param nodehandle MegaHandle of the node to be used as target folder
10861          * @param listener MegaRequestListener to track this request
10862          */
10863         void setMyChatFilesFolder(MegaHandle nodehandle, MegaRequestListener *listener = NULL);
10864 
10865         /**
10866          * @brief Gets My chat files target folder.
10867          *
10868          * The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
10869          * Valid data in the MegaRequest object received on callbacks:
10870          * - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_MY_CHAT_FILES_FOLDER
10871          *
10872          * Valid data in the MegaRequest object received in onRequestFinish when the error code
10873          * is MegaError::API_OK:
10874          * - MegaRequest::getNodehandle - Returns the handle of the node where My Chat Files are stored
10875          *
10876          * If the folder is not set, the request will fail with the error code MegaError::API_ENOENT.
10877          *
10878          * @param listener MegaRequestListener to track this request
10879          */
10880         void getMyChatFilesFolder(MegaRequestListener *listener = NULL);
10881 
10882         /**
10883          * @brief Set Camera Uploads primary target folder.
10884          *
10885          * The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER
10886          * Valid data in the MegaRequest object received on callbacks:
10887          * - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_CAMERA_UPLOADS_FOLDER
10888          * - MegaRequest::getFlag - Returns false
10889          * - MegaRequest::getNodehandle - Returns the provided node handle
10890          * - MegaRequest::getMegaStringMap - Returns a MegaStringMap.
10891          * The key "h" in the map contains the nodehandle specified as parameter encoded in B64
10892          *
10893          * @param nodehandle MegaHandle of the node to be used as primary target folder
10894          * @param listener MegaRequestListener to track this request
10895          */
10896         void setCameraUploadsFolder(MegaHandle nodehandle, MegaRequestListener *listener = NULL);
10897 
10898         /**
10899          * @brief Set Camera Uploads secondary target folder.
10900          *
10901          * The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER
10902          * Valid data in the MegaRequest object received on callbacks:
10903          * - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_CAMERA_UPLOADS_FOLDER
10904          * - MegaRequest::getFlag - Returns true
10905          * - MegaRequest::getNodehandle - Returns the provided node handle
10906          * - MegaRequest::getMegaStringMap - Returns a MegaStringMap.
10907          * The key "sh" in the map contains the nodehandle specified as parameter encoded in B64
10908          *
10909          * @param nodehandle MegaHandle of the node to be used as secondary target folder
10910          * @param listener MegaRequestListener to track this request
10911          *
10912          * @deprecated Use MegaApi::setCameraUploadsFolders instead
10913          */
10914         void setCameraUploadsFolderSecondary(MegaHandle nodehandle, MegaRequestListener *listener = NULL);
10915 
10916         /**
10917          * @brief Set Camera Uploads for both primary and secondary target folder.
10918          *
10919          * If only one of the target folders wants to be set, simply pass a INVALID_HANDLE to
10920          * as the other target folder and it will remain untouched.
10921          *
10922          * The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER
10923          * Valid data in the MegaRequest object received on callbacks:
10924          * - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_CAMERA_UPLOADS_FOLDER
10925          * - MegaRequest::getNodehandle - Returns the provided node handle for primary folder
10926          * - MegaRequest::getParentHandle - Returns the provided node handle for secondary folder
10927          *
10928          * @param primaryFolder MegaHandle of the node to be used as primary target folder
10929          * @param secondaryFolder MegaHandle of the node to be used as secondary target folder
10930          * @param listener MegaRequestListener to track this request
10931          */
10932         void setCameraUploadsFolders(MegaHandle primaryFolder, MegaHandle secondaryFolder, MegaRequestListener *listener = NULL);
10933 
10934         /**
10935          * @brief Gets Camera Uploads primary target folder.
10936          *
10937          * The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
10938          * Valid data in the MegaRequest object received on callbacks:
10939          * - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_CAMERA_UPLOADS_FOLDER
10940          * - MegaRequest::getFlag - Returns false
10941          *
10942          * Valid data in the MegaRequest object received in onRequestFinish when the error code
10943          * is MegaError::API_OK:
10944          * - MegaRequest::getNodehandle - Returns the handle of the primary node where Camera Uploads files are stored
10945          *
10946          * If the folder is not set, the request will fail with the error code MegaError::API_ENOENT.
10947          *
10948          * @param listener MegaRequestListener to track this request
10949          */
10950         void getCameraUploadsFolder(MegaRequestListener *listener = NULL);
10951 
10952         /**
10953          * @brief Gets Camera Uploads secondary target folder.
10954          *
10955          * The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
10956          * Valid data in the MegaRequest object received on callbacks:
10957          * - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_CAMERA_UPLOADS_FOLDER
10958          * - MegaRequest::getFlag - Returns true
10959          *
10960          * Valid data in the MegaRequest object received in onRequestFinish when the error code
10961          * is MegaError::API_OK:
10962          * - MegaRequest::getNodehandle - Returns the handle of the secondary node where Camera Uploads files are stored
10963          *
10964          * If the secondary folder is not set, the request will fail with the error code MegaError::API_ENOENT.
10965          *
10966          * @param listener MegaRequestListener to track this request
10967          */
10968         void getCameraUploadsFolderSecondary(MegaRequestListener *listener = NULL);
10969 
10970         /**
10971          * @brief Gets the alias for an user
10972          *
10973          * The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
10974          * Valid data in the MegaRequest object received on callbacks:
10975          * - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_ALIAS
10976          * - MegaRequest::getNodeHandle - user handle in binary
10977          * - MegaRequest::getText - user handle encoded in B64
10978          *
10979          * Valid data in the MegaRequest object received in onRequestFinish when the error code
10980          * is MegaError::API_OK:
10981          * - MegaRequest::getName - Returns the user alias
10982          *
10983          * If the user alias doesn't exists the request will fail with the error code MegaError::API_ENOENT.
10984          *
10985          * @param uh handle of the user in binary
10986          * @param listener MegaRequestListener to track this request
10987          */
10988         void getUserAlias(MegaHandle uh, MegaRequestListener *listener = NULL);
10989 
10990         /**
10991          * @brief Set or reset an alias for a user
10992          *
10993          * The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER
10994          * Valid data in the MegaRequest object received on callbacks:
10995          * - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_ALIAS
10996          * - MegaRequest::getNodeHandle - Returns the user handle in binary
10997          * - MegaRequest::getText - Returns the user alias
10998          *
10999          * @param uh handle of the user in binary
11000          * @param alias the user alias, or null to reset the existing
11001          * @param listener MegaRequestListener to track this request
11002          */
11003         void setUserAlias(MegaHandle uh, const char *alias, MegaRequestListener *listener = NULL);
11004 
11005         /**
11006          * @brief Get push notification settings
11007          *
11008          * The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
11009          * Valid data in the MegaRequest object received on callbacks:
11010          * - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_PUSH_SETTINGS
11011          *
11012          * Valid data in the MegaRequest object received in onRequestFinish when the error code
11013          * is MegaError::API_OK:
11014          * - MegaRequest::getMegaPushNotificationSettings - Returns settings for push notifications
11015          *
11016          * @see MegaPushNotificationSettings class for more details.
11017          *
11018          * @param listener MegaRequestListener to track this request
11019          */
11020         void getPushNotificationSettings(MegaRequestListener *listener = NULL);
11021 
11022         /**
11023          * @brief Set push notification settings
11024          *
11025          * The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER
11026          * Valid data in the MegaRequest object received on callbacks:
11027          * - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_PUSH_SETTINGS
11028          * - MegaRequest::getMegaPushNotificationSettings - Returns settings for push notifications
11029          *
11030          * @see MegaPushNotificationSettings class for more details. You can prepare a new object by
11031          * calling MegaPushNotificationSettings::createInstance.
11032          *
11033          * @param settings MegaPushNotificationSettings with the new settings
11034          * @param listener MegaRequestListener to track this request
11035          */
11036         void setPushNotificationSettings(MegaPushNotificationSettings *settings, MegaRequestListener *listener = NULL);
11037 
11038         /**
11039          * @brief Get the number of days for rubbish-bin cleaning scheduler
11040          *
11041          * The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
11042          * Valid data in the MegaRequest object received on callbacks:
11043          * - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_RUBBISH_TIME
11044          *
11045          * Valid data in the MegaRequest object received in onRequestFinish when the error code
11046          * is MegaError::API_OK:
11047          * - MegaRequest::getNumber - Returns the days for rubbish-bin cleaning scheduler.
11048          * Zero means that the rubbish-bin cleaning scheduler is disabled (only if the account is PRO)
11049          * Any negative value means that the configured value is invalid.
11050          *
11051          * @param listener MegaRequestListener to track this request
11052          */
11053         void getRubbishBinAutopurgePeriod(MegaRequestListener *listener = NULL);
11054 
11055         /**
11056          * @brief Set the number of days for rubbish-bin cleaning scheduler
11057          *
11058          * The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER
11059          * Valid data in the MegaRequest object received on callbacks:
11060          * - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_RUBBISH_TIME
11061          * - MegaRequest::getNumber - Returns the days for rubbish-bin cleaning scheduler passed as parameter
11062          *
11063          * @param days Number of days for rubbish-bin cleaning scheduler. It must be >= 0.
11064          * The value zero disables the rubbish-bin cleaning scheduler (only for PRO accounts).
11065          *
11066          * @param listener MegaRequestListener to track this request
11067          */
11068         void setRubbishBinAutopurgePeriod(int days, MegaRequestListener *listener = NULL);
11069 
11070         /**
11071          * @brief Returns the name set for this device
11072          *
11073          * The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
11074          * Valid data in the MegaRequest object received on callbacks:
11075          * - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_DEVICE_NAMES
11076          *
11077          * Valid data in the MegaRequest object received in onRequestFinish when the error code
11078          * is MegaError::API_OK:
11079          * - MegaRequest::getName - Returns device name.
11080          *
11081          * @param listener MegaRequestListener to track this request
11082          */
11083         void getDeviceName(MegaRequestListener *listener = NULL);
11084 
11085         /**
11086          * @brief Sets device name
11087          *
11088          * The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER
11089          * Valid data in the MegaRequest object received on callbacks:
11090          * - MegaRequest::getParamType - Returns the attribute type MegaApi::USER_ATTR_DEVICE_NAMES
11091          * - MegaRequest::getName - Returns device name.
11092          *
11093          * @param deviceName String with device name
11094          * @param listener MegaRequestListener to track this request
11095          */
11096         void setDeviceName(const char* deviceName, MegaRequestListener *listener = NULL);
11097 
11098         /**
11099          * @brief Change the password of the MEGA account
11100          *
11101          * The associated request type with this request is MegaRequest::TYPE_CHANGE_PW
11102          * Valid data in the MegaRequest object received on callbacks:
11103          * - MegaRequest::getPassword - Returns the old password (if it was passed as parameter)
11104          * - MegaRequest::getNewPassword - Returns the new password
11105          *
11106          * @param oldPassword Old password (optional, it can be NULL to not check the old password)
11107          * @param newPassword New password
11108          * @param listener MegaRequestListener to track this request
11109          */
11110         void changePassword(const char *oldPassword, const char *newPassword, MegaRequestListener *listener = NULL);
11111 
11112         /**
11113          * @brief Invite another person to be your MEGA contact
11114          *
11115          * The user doesn't need to be registered on MEGA. If the email isn't associated with
11116          * a MEGA account, an invitation email will be sent with the text in the "message" parameter.
11117          *
11118          * The associated request type with this request is MegaRequest::TYPE_INVITE_CONTACT
11119          * Valid data in the MegaRequest object received on callbacks:
11120          * - MegaRequest::getEmail - Returns the email of the contact
11121          * - MegaRequest::getText - Returns the text of the invitation
11122          * - MegaRequest::getNumber - Returns the action
11123          *
11124          * Sending a reminder within a two week period since you started or your last reminder will
11125          * fail the API returning the error code MegaError::API_EACCESS.
11126          *
11127          * @param email Email of the new contact
11128          * @param message Message for the user (can be NULL)
11129          * @param action Action for this contact request. Valid values are:
11130          * - MegaContactRequest::INVITE_ACTION_ADD = 0
11131          * - MegaContactRequest::INVITE_ACTION_DELETE = 1
11132          * - MegaContactRequest::INVITE_ACTION_REMIND = 2
11133          *
11134          * @param listener MegaRequestListener to track this request
11135          */
11136         void inviteContact(const char* email, const char* message, int action, MegaRequestListener* listener = NULL);
11137 
11138         /**
11139          * @brief Invite another person to be your MEGA contact using a contact link handle
11140          *
11141          * The associated request type with this request is MegaRequest::TYPE_INVITE_CONTACT
11142          * Valid data in the MegaRequest object received on callbacks:
11143          * - MegaRequest::getEmail - Returns the email of the contact
11144          * - MegaRequest::getText - Returns the text of the invitation
11145          * - MegaRequest::getNumber - Returns the action
11146          * - MegaRequest::getNodeHandle - Returns the contact link handle
11147          *
11148          * Sending a reminder within a two week period since you started or your last reminder will
11149          * fail the API returning the error code MegaError::API_EACCESS.
11150          *
11151          * @param email Email of the new contact
11152          * @param message Message for the user (can be NULL)
11153          * @param action Action for this contact request. Valid values are:
11154          * - MegaContactRequest::INVITE_ACTION_ADD = 0
11155          * - MegaContactRequest::INVITE_ACTION_DELETE = 1
11156          * - MegaContactRequest::INVITE_ACTION_REMIND = 2
11157          * @param contactLink Contact link handle of the other account. This parameter is considered only if the
11158          * \c action is MegaContactRequest::INVITE_ACTION_ADD. Otherwise, it's ignored and it has no effect.
11159          *
11160          * @param listener MegaRequestListener to track this request
11161          */
11162         void inviteContact(const char* email, const char* message, int action, MegaHandle contactLink, MegaRequestListener* listener = NULL);
11163 
11164         /**
11165          * @brief Reply to a contact request
11166          * @param request Contact request. You can get your pending contact requests using MegaApi::getIncomingContactRequests
11167          * @param action Action for this contact request. Valid values are:
11168          * - MegaContactRequest::REPLY_ACTION_ACCEPT = 0
11169          * - MegaContactRequest::REPLY_ACTION_DENY = 1
11170          * - MegaContactRequest::REPLY_ACTION_IGNORE = 2
11171          *
11172          * The associated request type with this request is MegaRequest::TYPE_REPLY_CONTACT_REQUEST
11173          * Valid data in the MegaRequest object received on callbacks:
11174          * - MegaRequest::getNodeHandle - Returns the handle of the contact request
11175          * - MegaRequest::getNumber - Returns the action
11176          *
11177          * @param listener MegaRequestListener to track this request
11178          */
11179         void replyContactRequest(MegaContactRequest *request, int action, MegaRequestListener* listener = NULL);
11180 
11181         /**
11182          * @brief Remove a contact to the MEGA account
11183          *
11184          * The associated request type with this request is MegaRequest::TYPE_REMOVE_CONTACT
11185          * Valid data in the MegaRequest object received on callbacks:
11186          * - MegaRequest::getEmail - Returns the email of the contact
11187          *
11188          * @param user MegaUser of the contact (see MegaApi::getContact)
11189          * @param listener MegaRequestListener to track this request
11190          */
11191         void removeContact(MegaUser *user, MegaRequestListener* listener = NULL);
11192 
11193         /**
11194          * @brief Logout of the MEGA account invalidating the session
11195          *
11196          * The associated request type with this request is MegaRequest::TYPE_LOGOUT
11197          *
11198          * Under certain circumstances, this request might return the error code
11199          * MegaError::API_ESID. It should not be taken as an error, since the reason
11200          * is that the logout action has been notified before the reception of the
11201          * logout response itself.
11202          *
11203          * In case of an automatic logout (ie. when the account become blocked by
11204          * ToS infringment), the MegaRequest::getParamType indicates the error that
11205          * triggered the automatic logout (MegaError::API_EBLOCKED for the example).
11206          *
11207          * @param listener MegaRequestListener to track this request
11208          */
11209         void logout(MegaRequestListener *listener = NULL);
11210 
11211         /**
11212          * @brief Logout of the MEGA account without invalidating the session
11213          *
11214          * The associated request type with this request is MegaRequest::TYPE_LOGOUT
11215          *
11216          * @param listener MegaRequestListener to track this request
11217          */
11218         void localLogout(MegaRequestListener *listener = NULL);
11219 
11220         /**
11221          * @brief Invalidate the existing cache and create a fresh one
11222          */
11223         void invalidateCache();
11224 
11225         /**
11226          * @brief Estimate the strength of a password
11227          *
11228          * Possible return values are:
11229          * - PASSWORD_STRENGTH_VERYWEAK = 0
11230          * - PASSWORD_STRENGTH_WEAK = 1
11231          * - PASSWORD_STRENGTH_MEDIUM = 2
11232          * - PASSWORD_STRENGTH_GOOD = 3
11233          * - PASSWORD_STRENGTH_STRONG = 4
11234          *
11235          * @param password Password to check
11236          * @return Estimated strength of the password
11237          */
11238         int getPasswordStrength(const char *password);
11239 
11240         /**
11241          * @brief Submit feedback about the app
11242          *
11243          * The associated request type with this request is MegaRequest::TYPE_SUBMIT_FEEDBACK
11244          * Valid data in the MegaRequest object received on callbacks:
11245          * - MegaRequest::getText - Retuns the comment about the app
11246          * - MegaRequest::getNumber - Returns the rating for the app
11247          *
11248          * @param rating Integer to rate the app. Valid values: from 1 to 5.
11249          * @param comment Comment about the app
11250          * @param listener MegaRequestListener to track this request
11251          *
11252          * @deprecated This function is for internal usage of MEGA apps. This feedback
11253          * is sent to MEGA servers.
11254          */
11255         void submitFeedback(int rating, const char *comment, MegaRequestListener *listener = NULL);
11256 
11257         /**
11258          * @brief Send events to the stats server
11259          *
11260          * The associated request type with this request is MegaRequest::TYPE_SEND_EVENT
11261          * Valid data in the MegaRequest object received on callbacks:
11262          * - MegaRequest::getNumber - Returns the event type
11263          * - MegaRequest::getText - Returns the event message
11264          *
11265          * @param eventType Event type
11266          * @param message Event message
11267          * @param listener MegaRequestListener to track this request
11268          *
11269          * @deprecated This function is for internal usage of MEGA apps for debug purposes. This info
11270          * is sent to MEGA servers.
11271          *
11272          * @note Event types are restricted to the following ranges:
11273          *  - MEGAcmd:   [98900, 99000)
11274          *  - MEGAchat:  [99000, 99150)
11275          *  - Android:   [99200, 99300)
11276          *  - iOS:       [99300, 99400)
11277          *  - MEGA SDK:  [99400, 99500)
11278          *  - MEGAsync:  [99500, 99600)
11279          *  - Webclient: [99600, 99800]
11280          */
11281         void sendEvent(int eventType, const char* message, MegaRequestListener *listener = NULL);
11282 
11283         /**
11284          * @brief Create a new ticket for support with attached description
11285          *
11286          * The associated request type with this request is MegaRequest::TYPE_SUPPORT_TICKET
11287          * Valid data in the MegaRequest object received on callbacks:
11288          * - MegaRequest::getParamType - Returns the type of the ticket
11289          * - MegaRequest::getText - Returns the description of the issue
11290          *
11291          * @param message Description of the issue for support
11292          * @param type Ticket type. These are the available types:
11293          *          0 for General Enquiry
11294          *          1 for Technical Issue
11295          *          2 for Payment Issue
11296          *          3 for Forgotten Password
11297          *          4 for Transfer Issue
11298          *          5 for Contact/Sharing Issue
11299          *          6 for MEGAsync Issue
11300          *          7 for Missing/Invisible Data
11301          * @param listener MegaRequestListener to track this request
11302          */
11303         void createSupportTicket(const char* message, int type = 1, MegaRequestListener *listener = NULL);
11304 
11305         /**
11306          * @brief Send a debug report
11307          *
11308          * The User-Agent is used to identify the app. It can be set in MegaApi::MegaApi
11309          *
11310          * The associated request type with this request is MegaRequest::TYPE_REPORT_EVENT
11311          * Valid data in the MegaRequest object received on callbacks:
11312          * - MegaRequest::getParamType - Returns MegaApi::EVENT_DEBUG
11313          * - MegaRequest::getText - Retuns the debug message
11314          *
11315          * @param text Debug message
11316          * @param listener MegaRequestListener to track this request
11317          *
11318          * @deprecated This function is for internal usage of MEGA apps. This feedback
11319          * is sent to MEGA servers.
11320          */
11321         void reportDebugEvent(const char *text, MegaRequestListener *listener = NULL);
11322 
11323         /**
11324          * @brief Use HTTPS communications only
11325          *
11326          * The default behavior is to use HTTP for transfers and the persistent connection
11327          * to wait for external events. Those communications don't require HTTPS because
11328          * all transfer data is already end-to-end encrypted and no data is transmitted
11329          * over the connection to wait for events (it's just closed when there are new events).
11330          *
11331          * This feature should only be enabled if there are problems to contact MEGA servers
11332          * through HTTP because otherwise it doesn't have any benefit and will cause a
11333          * higher CPU usage.
11334          *
11335          * See MegaApi::usingHttpsOnly
11336          *
11337          * @param httpsOnly True to use HTTPS communications only
11338          * @param listener MegaRequestListener to track this request
11339          */
11340         void useHttpsOnly(bool httpsOnly, MegaRequestListener *listener = NULL);
11341 
11342         /**
11343          * @brief Check if the SDK is using HTTPS communications only
11344          *
11345          * The default behavior is to use HTTP for transfers and the persistent connection
11346          * to wait for external events. Those communications don't require HTTPS because
11347          * all transfer data is already end-to-end encrypted and no data is transmitted
11348          * over the connection to wait for events (it's just closed when there are new events).
11349          *
11350          * See MegaApi::useHttpsOnly
11351          *
11352          * @return True if the SDK is using HTTPS communications only. Otherwise false.
11353          */
11354         bool usingHttpsOnly();
11355 
11356         ///////////////////   TRANSFERS ///////////////////
11357 
11358         /**
11359          * @brief Upload a file to support
11360          *
11361          * If the status of the business account is expired, onTransferFinish will be called with the error
11362          * code MegaError::API_EBUSINESSPASTDUE. In this case, apps should show a warning message similar to
11363          * "Your business account is overdue, please contact your administrator."
11364          *
11365          * For folders, onTransferFinish will be called with error MegaError:API_EARGS;
11366          *
11367          * @param localPath Local path of the file
11368          * @param isSourceTemporary Pass the ownership of the file to the SDK, that will DELETE it when the upload finishes.
11369          * This parameter is intended to automatically delete temporary files that are only created to be uploaded.
11370          * Use this parameter with caution. Set it to true only if you are sure about what are you doing.
11371          * @param listener MegaTransferListener to track this transfer
11372          */
11373         void startUploadForSupport(const char* localPath, bool isSourceTemporary = false, MegaTransferListener *listener=NULL);
11374 
11375 
11376         /**
11377          * @brief Upload a file or a folder
11378          *
11379          * If the status of the business account is expired, onTransferFinish will be called with the error
11380          * code MegaError::API_EBUSINESSPASTDUE. In this case, apps should show a warning message similar to
11381          * "Your business account is overdue, please contact your administrator."
11382          *
11383          * @param localPath Local path of the file or folder
11384          * @param parent Parent node for the file or folder in the MEGA account
11385          * @param listener MegaTransferListener to track this transfer
11386          */
11387         void startUpload(const char* localPath, MegaNode *parent, MegaTransferListener *listener=NULL);
11388 
11389         /**
11390          * @brief Upload a file or a folder, saving custom app data during the transfer
11391          *
11392          * If the status of the business account is expired, onTransferFinish will be called with the error
11393          * code MegaError::API_EBUSINESSPASTDUE. In this case, apps should show a warning message similar to
11394          * "Your business account is overdue, please contact your administrator."
11395          *
11396          * @param localPath Local path of the file or folder
11397          * @param parent Parent node for the file or folder in the MEGA account
11398          * @param appData Custom app data to save in the MegaTransfer object
11399          * The data in this parameter can be accessed using MegaTransfer::getAppData in callbacks
11400          * related to the transfer. If a transfer is started with exactly the same data
11401          * (local path and target parent) as another one in the transfer queue, the new transfer
11402          * fails with the error API_EEXISTS and the appData of the new transfer is appended to
11403          * the appData of the old transfer, using a '!' separator if the old transfer had already
11404          * appData.
11405          * @param listener MegaTransferListener to track this transfer
11406          */
11407         void startUploadWithData(const char* localPath, MegaNode *parent, const char* appData, MegaTransferListener *listener=NULL);
11408 
11409         /**
11410          * @brief Upload a file or a folder, saving custom app data during the transfer
11411          *
11412          *If the status of the business account is expired, onTransferFinish will be called with the error
11413          * code MegaError::API_EBUSINESSPASTDUE. In this case, apps should show a warning message similar to
11414          * "Your business account is overdue, please contact your administrator."
11415          *
11416          * @param localPath Local path of the file or folder
11417          * @param parent Parent node for the file or folder in the MEGA account
11418          * @param appData Custom app data to save in the MegaTransfer object
11419          * The data in this parameter can be accessed using MegaTransfer::getAppData in callbacks
11420          * related to the transfer. If a transfer is started with exactly the same data
11421          * (local path and target parent) as another one in the transfer queue, the new transfer
11422          * fails with the error API_EEXISTS and the appData of the new transfer is appended to
11423          * the appData of the old transfer, using a '!' separator if the old transfer had already
11424          * appData.
11425          * @param isSourceTemporary Pass the ownership of the file to the SDK, that will DELETE it when the upload finishes.
11426          * This parameter is intended to automatically delete temporary files that are only created to be uploaded.
11427          * Use this parameter with caution. Set it to true only if you are sure about what are you doing.
11428          * @param listener MegaTransferListener to track this transfer
11429          */
11430         void startUploadWithData(const char* localPath, MegaNode *parent, const char* appData, bool isSourceTemporary, MegaTransferListener *listener=NULL);
11431 
11432         /**
11433          * @brief Upload a file or a folder, putting the transfer on top of the upload queue
11434          *
11435          *If the status of the business account is expired, onTransferFinish will be called with the error
11436          * code MegaError::API_EBUSINESSPASTDUE. In this case, apps should show a warning message similar to
11437          * "Your business account is overdue, please contact your administrator."
11438          *
11439          * @param localPath Local path of the file or folder
11440          * @param parent Parent node for the file or folder in the MEGA account
11441          * @param appData Custom app data to save in the MegaTransfer object
11442          * The data in this parameter can be accessed using MegaTransfer::getAppData in callbacks
11443          * related to the transfer. If a transfer is started with exactly the same data
11444          * (local path and target parent) as another one in the transfer queue, the new transfer
11445          * fails with the error API_EEXISTS and the appData of the new transfer is appended to
11446          * the appData of the old transfer, using a '!' separator if the old transfer had already
11447          * appData.
11448          * @param isSourceTemporary Pass the ownership of the file to the SDK, that will DELETE it when the upload finishes.
11449          * This parameter is intended to automatically delete temporary files that are only created to be uploaded.
11450          * Use this parameter with caution. Set it to true only if you are sure about what are you doing.
11451          * @param listener MegaTransferListener to track this transfer
11452          */
11453         void startUploadWithTopPriority(const char* localPath, MegaNode *parent, const char* appData, bool isSourceTemporary, MegaTransferListener *listener=NULL);
11454 
11455         /**
11456          * @brief Upload a file or a folder with a custom modification time
11457          *
11458          *If the status of the business account is expired, onTransferFinish will be called with the error
11459          * code MegaError::API_EBUSINESSPASTDUE. In this case, apps should show a warning message similar to
11460          * "Your business account is overdue, please contact your administrator."
11461          *
11462          * @param localPath Local path of the file
11463          * @param parent Parent node for the file in the MEGA account
11464          * @param mtime Custom modification time for the file in MEGA (in seconds since the epoch)
11465          * @param listener MegaTransferListener to track this transfer
11466          *
11467          * @note The custom modification time will be only applied for file transfers. If a folder
11468          * is transferred using this function, the custom modification time won't have any effect,
11469          */
11470         void startUpload(const char* localPath, MegaNode *parent, int64_t mtime, MegaTransferListener *listener=NULL);
11471 
11472         /**
11473          * @brief Upload a file or a folder with a custom modification time
11474          *
11475          *If the status of the business account is expired, onTransferFinish will be called with the error
11476          * code MegaError::API_EBUSINESSPASTDUE. In this case, apps should show a warning message similar to
11477          * "Your business account is overdue, please contact your administrator."
11478          *
11479          * @param localPath Local path of the file
11480          * @param parent Parent node for the file in the MEGA account
11481          * @param mtime Custom modification time for the file in MEGA (in seconds since the epoch)
11482          * @param isSourceTemporary Pass the ownership of the file to the SDK, that will DELETE it when the upload finishes.
11483          * This parameter is intended to automatically delete temporary files that are only created to be uploaded.
11484          * @param listener MegaTransferListener to track this transfer
11485          */
11486         void startUpload(const char* localPath, MegaNode *parent, int64_t mtime, bool isSourceTemporary, MegaTransferListener *listener=NULL);
11487 
11488         /**
11489          * @brief Upload a file or folder with a custom name
11490          *
11491          *If the status of the business account is expired, onTransferFinish will be called with the error
11492          * code MegaError::API_EBUSINESSPASTDUE. In this case, apps should show a warning message similar to
11493          * "Your business account is overdue, please contact your administrator."
11494          *
11495          * @param localPath Local path of the file or folder
11496          * @param parent Parent node for the file or folder in the MEGA account
11497          * @param fileName Custom file name for the file or folder in MEGA
11498          * @param listener MegaTransferListener to track this transfer
11499          */
11500         void startUpload(const char* localPath, MegaNode* parent, const char* fileName, MegaTransferListener *listener = NULL);
11501 
11502         /**
11503          * @brief Upload a file or a folder with a custom name and a custom modification time
11504          *
11505          *If the status of the business account is expired, onTransferFinish will be called with the error
11506          * code MegaError::API_EBUSINESSPASTDUE. In this case, apps should show a warning message similar to
11507          * "Your business account is overdue, please contact your administrator."
11508          *
11509          * @param localPath Local path of the file
11510          * @param parent Parent node for the file in the MEGA account
11511          * @param fileName Custom file name for the file in MEGA
11512          * @param mtime Custom modification time for the file in MEGA (in seconds since the epoch)
11513          * @param listener MegaTransferListener to track this transfer
11514          *
11515          * The custom modification time will be only applied for file transfers. If a folder
11516          * is transferred using this function, the custom modification time won't have any effect
11517          */
11518         void startUpload(const char* localPath, MegaNode* parent, const char* fileName, int64_t mtime, MegaTransferListener *listener = NULL);
11519 
11520         /**
11521          * @brief Upload a file or a folder with a custom name and a custom modification time
11522          *
11523          *If the status of the business account is expired, onTransferFinish will be called with the error
11524          * code MegaError::API_EBUSINESSPASTDUE. In this case, apps should show a warning message similar to
11525          * "Your business account is overdue, please contact your administrator."
11526          *
11527          * @param localPath Local path of the file
11528          * @param parent Parent node for the file in the MEGA account
11529          * @param appData Custom app data to save in the MegaTransfer object
11530          * The data in this parameter can be accessed using MegaTransfer::getAppData in callbacks
11531          * related to the transfer. If a transfer is started with exactly the same data
11532          * (local path and target parent) as another one in the transfer queue, the new transfer
11533          * fails with the error API_EEXISTS and the appData of the new transfer is appended to
11534          * the appData of the old transfer, using a '!' separator if the old transfer had already
11535          * appData.
11536          * @param fileName Custom file name for the file in MEGA
11537          * @param mtime Custom modification time for the file in MEGA (in seconds since the epoch)
11538          * @param listener MegaTransferListener to track this transfer
11539          *
11540          * The custom modification time will be only applied for file transfers. If a folder
11541          * is transferred using this function, the custom modification time won't have any effect
11542          */
11543         void startUpload(const char* localPath, MegaNode* parent, const char* appData, const char* fileName, int64_t mtime, MegaTransferListener *listener = NULL);
11544 
11545         /**
11546          * @brief Upload a file or a folder
11547          *
11548          * This method should be used ONLY to share by chat a local file. In case the file
11549          * is already uploaded, but the corresponding node is missing the thumbnail and/or preview,
11550          * this method will force a new upload from the scratch (ensuring the file attributes are set),
11551          * instead of doing a remote copy.
11552          *
11553          * If the status of the business account is expired, onTransferFinish will be called with the error
11554          * code MegaError::API_EBUSINESSPASTDUE. In this case, apps should show a warning message similar to
11555          * "Your business account is overdue, please contact your administrator."
11556          *
11557          * @param localPath Local path of the file or folder
11558          * @param parent Parent node for the file or folder in the MEGA account
11559          * @param appData Custom app data to save in the MegaTransfer object
11560          * The data in this parameter can be accessed using MegaTransfer::getAppData in callbacks
11561          * related to the transfer. If a transfer is started with exactly the same data
11562          * (local path and target parent) as another one in the transfer queue, the new transfer
11563          * fails with the error API_EEXISTS and the appData of the new transfer is appended to
11564          * the appData of the old transfer, using a '!' separator if the old transfer had already
11565          * appData.
11566          * @param isSourceTemporary Pass the ownership of the file to the SDK, that will DELETE it when the upload finishes.
11567          * This parameter is intended to automatically delete temporary files that are only created to be uploaded.
11568          * Use this parameter with caution. Set it to true only if you are sure about what are you doing.
11569          * @param listener MegaTransferListener to track this transfer
11570          */
11571         void startUploadForChat(const char *localPath, MegaNode *parent, const char *appData, bool isSourceTemporary, MegaTransferListener *listener = nullptr);
11572 
11573         /**
11574          * @brief Download a file or a folder from MEGA
11575          *
11576          *If the status of the business account is expired, onTransferFinish will be called with the error
11577          * code MegaError::API_EBUSINESSPASTDUE. In this case, apps should show a warning message similar to
11578          * "Your business account is overdue, please contact your administrator."
11579          *
11580          * @param node MegaNode that identifies the file or folder
11581          * @param localPath Destination path for the file or folder
11582          * If this path is a local folder, it must end with a '\' or '/' character and the file name
11583          * in MEGA will be used to store a file inside that folder. If the path doesn't finish with
11584          * one of these characters, the file will be downloaded to a file in that path.
11585          *
11586          * @param listener MegaTransferListener to track this transfer
11587          */
11588         void startDownload(MegaNode* node, const char* localPath, MegaTransferListener *listener = NULL);
11589 
11590         /**
11591          * @brief Download a file or a folder from MEGA, saving custom app data during the transfer
11592          *
11593          * If the status of the business account is expired, onTransferFinish will be called with the error
11594          * code MegaError::API_EBUSINESSPASTDUE. In this case, apps should show a warning message similar to
11595          * "Your business account is overdue, please contact your administrator."
11596          *
11597          * @param node MegaNode that identifies the file or folder
11598          * @param localPath Destination path for the file or folder
11599          * If this path is a local folder, it must end with a '\' or '/' character and the file name
11600          * in MEGA will be used to store a file inside that folder. If the path doesn't finish with
11601          * one of these characters, the file will be downloaded to a file in that path.
11602          * @param appData Custom app data to save in the MegaTransfer object
11603          * The data in this parameter can be accessed using MegaTransfer::getAppData in callbacks
11604          * related to the transfer.
11605          * @param listener MegaTransferListener to track this transfer
11606          */
11607         void startDownloadWithData(MegaNode* node, const char* localPath, const char *appData, MegaTransferListener *listener = NULL);
11608 
11609         /**
11610          * @brief Download a file or a folder from MEGA, putting the transfer on top of the download queue.
11611          *
11612          * If the status of the business account is expired, onTransferFinish will be called with the error
11613          * code MegaError::API_EBUSINESSPASTDUE. In this case, apps should show a warning message similar to
11614          * "Your business account is overdue, please contact your administrator."
11615          *
11616          * @param node MegaNode that identifies the file or folder
11617          * @param localPath Destination path for the file or folder
11618          * If this path is a local folder, it must end with a '\' or '/' character and the file name
11619          * in MEGA will be used to store a file inside that folder. If the path doesn't finish with
11620          * one of these characters, the file will be downloaded to a file in that path.
11621          * @param appData Custom app data to save in the MegaTransfer object
11622          * The data in this parameter can be accessed using MegaTransfer::getAppData in callbacks
11623          * related to the transfer.
11624          * @param listener MegaTransferListener to track this transfer
11625          */
11626         void startDownloadWithTopPriority(MegaNode* node, const char* localPath, const char *appData, MegaTransferListener *listener = NULL);
11627 
11628         /**
11629          * @brief Start an streaming download for a file in MEGA
11630          *
11631          * Streaming downloads don't save the downloaded data into a local file. It is provided
11632          * in MegaTransferListener::onTransferUpdate in a byte buffer. The pointer is returned by
11633          * MegaTransfer::getLastBytes and the size of the buffer in MegaTransfer::getDeltaSize
11634          *
11635          * The same byte array is also provided in the callback MegaTransferListener::onTransferData for
11636          * compatibility with other programming languages. Only the MegaTransferListener passed to this function
11637          * will receive MegaTransferListener::onTransferData callbacks. MegaTransferListener objects registered
11638          * with MegaApi::addTransferListener won't receive them for performance reasons
11639          *
11640          * If the status of the business account is expired, onTransferFinish will be called with the error
11641          * code MegaError::API_EBUSINESSPASTDUE. In this case, apps should show a warning message similar to
11642          * "Your business account is overdue, please contact your administrator."
11643          *
11644          * @param node MegaNode that identifies the file
11645          * @param startPos First byte to download from the file
11646          * @param size Size of the data to download
11647          * @param listener MegaTransferListener to track this transfer
11648          */
11649         void startStreaming(MegaNode* node, int64_t startPos, int64_t size, MegaTransferListener *listener);
11650 
11651         /**
11652          * @brief Set the miniumum acceptable streaming speed for streaming transfers
11653          *
11654          * When streaming a file with startStreaming(), the SDK monitors the transfer rate.
11655          * After a few seconds grace period, the monitoring starts. If the average rate is below
11656          * the minimum rate specified (determined by this function, or by default a reasonable rate
11657          * for audio/video, then the streaming operation will fail with MegaError::API_EAGAIN.
11658          *
11659          * @param bytesPerSecond The minimum acceptable rate for streaming.
11660          *                       Use -1 to use the default built into the library.
11661          *                       Use 0 to prevent the check.
11662          */
11663         void setStreamingMinimumRate(int bytesPerSecond);
11664 
11665         /**
11666          * @brief Cancel a transfer
11667          *
11668          * When a transfer is cancelled, it will finish and will provide the error code
11669          * MegaError::API_EINCOMPLETE in MegaTransferListener::onTransferFinish and
11670          * MegaListener::onTransferFinish
11671          *
11672          * The associated request type with this request is MegaRequest::TYPE_CANCEL_TRANSFER
11673          * Valid data in the MegaRequest object received on callbacks:
11674          * - MegaRequest::getTransferTag - Returns the tag of the cancelled transfer (MegaTransfer::getTag)
11675          *
11676          * @param transfer MegaTransfer object that identifies the transfer
11677          * You can get this object in any MegaTransferListener callback or any MegaListener callback
11678          * related to transfers.
11679          *
11680          * @param listener MegaRequestListener to track this request
11681          */
11682         void cancelTransfer(MegaTransfer *transfer, MegaRequestListener *listener = NULL);
11683 
11684         /**
11685          * @brief Retry a transfer
11686          *
11687          * This function allows to start a transfer based on a MegaTransfer object. It can be used,
11688          * for example, to retry transfers that finished with an error. To do it, you can retain the
11689          * MegaTransfer object in onTransferFinish (calling MegaTransfer::copy to take the ownership)
11690          * and use it later with this function.
11691          *
11692          * If the transfer parameter is NULL or is not of type MegaTransfer::TYPE_DOWNLOAD or
11693          * MegaTransfer::TYPE_UPLOAD (transfers started with MegaApi::startDownload or
11694          * MegaApi::startUpload) the function returns without doing anything.
11695          *
11696          * @param transfer Transfer to be retried
11697          * @param listener MegaTransferListener to track this transfer
11698          */
11699         void retryTransfer(MegaTransfer *transfer, MegaTransferListener *listener = NULL);
11700 
11701         /**
11702          * @brief Move a transfer one position up in the transfer queue
11703          *
11704          * If the transfer is successfully moved, onTransferUpdate will be called
11705          * for the corresponding listeners of the moved transfer and the new priority
11706          * of the transfer will be available using MegaTransfer::getPriority
11707          *
11708          * The associated request type with this request is MegaRequest::TYPE_MOVE_TRANSFER
11709          * Valid data in the MegaRequest object received on callbacks:
11710          * - MegaRequest::getTransferTag - Returns the tag of the transfer to move
11711          * - MegaRequest::getFlag - Returns true (it means that it's an automatic move)
11712          * - MegaRequest::getNumber - Returns MegaTransfer::MOVE_TYPE_UP
11713          *
11714          * @param transfer Transfer to move
11715          * @param listener MegaRequestListener to track this request
11716          */
11717         void moveTransferUp(MegaTransfer *transfer, MegaRequestListener *listener = NULL);
11718 
11719         /**
11720          * @brief Move a transfer one position up in the transfer queue
11721          *
11722          * If the transfer is successfully moved, onTransferUpdate will be called
11723          * for the corresponding listeners of the moved transfer and the new priority
11724          * of the transfer will be available using MegaTransfer::getPriority
11725          *
11726          * The associated request type with this request is MegaRequest::TYPE_MOVE_TRANSFER
11727          * Valid data in the MegaRequest object received on callbacks:
11728          * - MegaRequest::getTransferTag - Returns the tag of the transfer to move
11729          * - MegaRequest::getFlag - Returns true (it means that it's an automatic move)
11730          * - MegaRequest::getNumber - Returns MegaTransfer::MOVE_TYPE_UP
11731          *
11732          * @param transferTag Tag of the transfer to move
11733          * @param listener MegaRequestListener to track this request
11734          */
11735         void moveTransferUpByTag(int transferTag, MegaRequestListener *listener = NULL);
11736 
11737         /**
11738          * @brief Move a transfer one position down in the transfer queue
11739          *
11740          * If the transfer is successfully moved, onTransferUpdate will be called
11741          * for the corresponding listeners of the moved transfer and the new priority
11742          * of the transfer will be available using MegaTransfer::getPriority
11743          *
11744          * The associated request type with this request is MegaRequest::TYPE_MOVE_TRANSFER
11745          * Valid data in the MegaRequest object received on callbacks:
11746          * - MegaRequest::getTransferTag - Returns the tag of the transfer to move
11747          * - MegaRequest::getFlag - Returns true (it means that it's an automatic move)
11748          * - MegaRequest::getNumber - Returns MegaTransfer::MOVE_TYPE_DOWN
11749          *
11750          * @param transfer Transfer to move
11751          * @param listener MegaRequestListener to track this request
11752          */
11753         void moveTransferDown(MegaTransfer *transfer, MegaRequestListener *listener = NULL);
11754 
11755         /**
11756          * @brief Move a transfer one position down in the transfer queue
11757          *
11758          * If the transfer is successfully moved, onTransferUpdate will be called
11759          * for the corresponding listeners of the moved transfer and the new priority
11760          * of the transfer will be available using MegaTransfer::getPriority
11761          *
11762          * The associated request type with this request is MegaRequest::TYPE_MOVE_TRANSFER
11763          * Valid data in the MegaRequest object received on callbacks:
11764          * - MegaRequest::getTransferTag - Returns the tag of the transfer to move
11765          * - MegaRequest::getFlag - Returns true (it means that it's an automatic move)
11766          * - MegaRequest::getNumber - Returns MegaTransfer::MOVE_TYPE_DOWN
11767          *
11768          * @param transferTag Tag of the transfer to move
11769          * @param listener MegaRequestListener to track this request
11770          */
11771         void moveTransferDownByTag(int transferTag, MegaRequestListener *listener = NULL);
11772 
11773         /**
11774          * @brief Move a transfer to the top of the transfer queue
11775          *
11776          * If the transfer is successfully moved, onTransferUpdate will be called
11777          * for the corresponding listeners of the moved transfer and the new priority
11778          * of the transfer will be available using MegaTransfer::getPriority
11779          *
11780          * The associated request type with this request is MegaRequest::TYPE_MOVE_TRANSFER
11781          * Valid data in the MegaRequest object received on callbacks:
11782          * - MegaRequest::getTransferTag - Returns the tag of the transfer to move
11783          * - MegaRequest::getFlag - Returns true (it means that it's an automatic move)
11784          * - MegaRequest::getNumber - Returns MegaTransfer::MOVE_TYPE_TOP
11785          *
11786          * @param transfer Transfer to move
11787          * @param listener MegaRequestListener to track this request
11788          */
11789         void moveTransferToFirst(MegaTransfer *transfer, MegaRequestListener *listener = NULL);
11790 
11791         /**
11792          * @brief Move a transfer to the top of the transfer queue
11793          *
11794          * If the transfer is successfully moved, onTransferUpdate will be called
11795          * for the corresponding listeners of the moved transfer and the new priority
11796          * of the transfer will be available using MegaTransfer::getPriority
11797          *
11798          * The associated request type with this request is MegaRequest::TYPE_MOVE_TRANSFER
11799          * Valid data in the MegaRequest object received on callbacks:
11800          * - MegaRequest::getTransferTag - Returns the tag of the transfer to move
11801          * - MegaRequest::getFlag - Returns true (it means that it's an automatic move)
11802          * - MegaRequest::getNumber - Returns MegaTransfer::MOVE_TYPE_TOP
11803          *
11804          * @param transferTag Tag of the transfer to move
11805          * @param listener MegaRequestListener to track this request
11806          */
11807         void moveTransferToFirstByTag(int transferTag, MegaRequestListener *listener = NULL);
11808 
11809         /**
11810          * @brief Move a transfer to the bottom of the transfer queue
11811          *
11812          * If the transfer is successfully moved, onTransferUpdate will be called
11813          * for the corresponding listeners of the moved transfer and the new priority
11814          * of the transfer will be available using MegaTransfer::getPriority
11815          *
11816          * The associated request type with this request is MegaRequest::TYPE_MOVE_TRANSFER
11817          * Valid data in the MegaRequest object received on callbacks:
11818          * - MegaRequest::getTransferTag - Returns the tag of the transfer to move
11819          * - MegaRequest::getFlag - Returns true (it means that it's an automatic move)
11820          * - MegaRequest::getNumber - Returns MegaTransfer::MOVE_TYPE_BOTTOM
11821          *
11822          * @param transfer Transfer to move
11823          * @param listener MegaRequestListener to track this request
11824          */
11825         void moveTransferToLast(MegaTransfer *transfer, MegaRequestListener *listener = NULL);
11826 
11827         /**
11828          * @brief Move a transfer to the bottom of the transfer queue
11829          *
11830          * If the transfer is successfully moved, onTransferUpdate will be called
11831          * for the corresponding listeners of the moved transfer and the new priority
11832          * of the transfer will be available using MegaTransfer::getPriority
11833          *
11834          * The associated request type with this request is MegaRequest::TYPE_MOVE_TRANSFER
11835          * Valid data in the MegaRequest object received on callbacks:
11836          * - MegaRequest::getTransferTag - Returns the tag of the transfer to move
11837          * - MegaRequest::getFlag - Returns true (it means that it's an automatic move)
11838          * - MegaRequest::getNumber - Returns MegaTransfer::MOVE_TYPE_BOTTOM
11839          *
11840          * @param transferTag Tag of the transfer to move
11841          * @param listener MegaRequestListener to track this request
11842          */
11843         void moveTransferToLastByTag(int transferTag, MegaRequestListener *listener = NULL);
11844 
11845         /**
11846          * @brief Move a transfer before another one in the transfer queue
11847          *
11848          * If the transfer is successfully moved, onTransferUpdate will be called
11849          * for the corresponding listeners of the moved transfer and the new priority
11850          * of the transfer will be available using MegaTransfer::getPriority
11851          *
11852          * The associated request type with this request is MegaRequest::TYPE_MOVE_TRANSFER
11853          * Valid data in the MegaRequest object received on callbacks:
11854          * - MegaRequest::getTransferTag - Returns the tag of the transfer to move
11855          * - MegaRequest::getFlag - Returns false (it means that it's a manual move)
11856          * - MegaRequest::getNumber - Returns the tag of the transfer with the target position
11857          *
11858          * @param transfer Transfer to move
11859          * @param prevTransfer Transfer with the target position
11860          * @param listener MegaRequestListener to track this request
11861          */
11862         void moveTransferBefore(MegaTransfer *transfer, MegaTransfer *prevTransfer, MegaRequestListener *listener = NULL);
11863 
11864         /**
11865          * @brief Move a transfer before another one in the transfer queue
11866          *
11867          * If the transfer is successfully moved, onTransferUpdate will be called
11868          * for the corresponding listeners of the moved transfer and the new priority
11869          * of the transfer will be available using MegaTransfer::getPriority
11870          *
11871          * The associated request type with this request is MegaRequest::TYPE_MOVE_TRANSFER
11872          * Valid data in the MegaRequest object received on callbacks:
11873          * - MegaRequest::getTransferTag - Returns the tag of the transfer to move
11874          * - MegaRequest::getFlag - Returns false (it means that it's a manual move)
11875          * - MegaRequest::getNumber - Returns the tag of the transfer with the target position
11876          *
11877          * @param transferTag Tag of the transfer to move
11878          * @param prevTransferTag Tag of the transfer with the target position
11879          * @param listener MegaRequestListener to track this request
11880          */
11881         void moveTransferBeforeByTag(int transferTag, int prevTransferTag, MegaRequestListener *listener = NULL);
11882 
11883         /**
11884          * @brief Cancel the transfer with a specific tag
11885          *
11886          * When a transfer is cancelled, it will finish and will provide the error code
11887          * MegaError::API_EINCOMPLETE in MegaTransferListener::onTransferFinish and
11888          * MegaListener::onTransferFinish
11889          *
11890          * The associated request type with this request is MegaRequest::TYPE_CANCEL_TRANSFER
11891          * Valid data in the MegaRequest object received on callbacks:
11892          * - MegaRequest::getTransferTag - Returns the tag of the cancelled transfer (MegaTransfer::getTag)
11893          *
11894          * @param transferTag tag that identifies the transfer
11895          * You can get this tag using MegaTransfer::getTag
11896          *
11897          * @param listener MegaRequestListener to track this request
11898          */
11899         void cancelTransferByTag(int transferTag, MegaRequestListener *listener = NULL);
11900 
11901         /**
11902          * @brief Cancel all transfers of the same type
11903          *
11904          * The associated request type with this request is MegaRequest::TYPE_CANCEL_TRANSFERS
11905          * Valid data in the MegaRequest object received on callbacks:
11906          * - MegaRequest::getParamType - Returns the first parameter
11907          *
11908          * @param type Type of transfers to cancel.
11909          * Valid values are:
11910          * - MegaTransfer::TYPE_DOWNLOAD = 0
11911          * - MegaTransfer::TYPE_UPLOAD = 1
11912          *
11913          * @param listener MegaRequestListener to track this request
11914          */
11915         void cancelTransfers(int type, MegaRequestListener *listener = NULL);
11916 
11917         /**
11918          * @brief Pause/resume all transfers
11919          *
11920          * The associated request type with this request is MegaRequest::TYPE_PAUSE_TRANSFERS
11921          * Valid data in the MegaRequest object received on callbacks:
11922          * - MegaRequest::getFlag - Returns the first parameter
11923          *
11924          * @param pause true to pause all transfers / false to resume all transfers
11925          * @param listener MegaRequestListener to track this request
11926          */
11927         void pauseTransfers(bool pause, MegaRequestListener* listener = NULL);
11928 
11929         /**
11930          * @brief Pause/resume all transfers in one direction (uploads or downloads)
11931          *
11932          * The associated request type with this request is MegaRequest::TYPE_PAUSE_TRANSFERS
11933          * Valid data in the MegaRequest object received on callbacks:
11934          * - MegaRequest::getFlag - Returns the first parameter
11935          * - MegaRequest::getNumber - Returns the direction of the transfers to pause/resume
11936          *
11937          * @param pause true to pause transfers / false to resume transfers
11938          * @param direction Direction of transfers to pause/resume
11939          * Valid values for this parameter are:
11940          * - MegaTransfer::TYPE_DOWNLOAD = 0
11941          * - MegaTransfer::TYPE_UPLOAD = 1
11942          *
11943          * @param listener MegaRequestListener to track this request
11944          */
11945         void pauseTransfers(bool pause, int direction, MegaRequestListener* listener = NULL);
11946 
11947         /**
11948          * @brief Pause/resume a transfer
11949          *
11950          * The request finishes with MegaError::API_OK if the state of the transfer is the
11951          * desired one at that moment. That means that the request succeed when the transfer
11952          * is successfully paused or resumed, but also if the transfer was already in the
11953          * desired state and it wasn't needed to change anything.
11954          *
11955          * Resumed transfers don't necessarily continue just after the resumption. They
11956          * are tagged as queued and are processed according to its position on the request queue.
11957          *
11958          * The associated request type with this request is MegaRequest::TYPE_PAUSE_TRANSFER
11959          * Valid data in the MegaRequest object received on callbacks:
11960          * - MegaRequest::getTransferTag - Returns the tag of the transfer to pause or resume
11961          * - MegaRequest::getFlag - Returns true if the transfer has to be pause or false if it has to be resumed
11962          *
11963          * @param transfer Transfer to pause or resume
11964          * @param pause True to pause the transfer or false to resume it
11965          * @param listener MegaRequestListener to track this request
11966          */
11967         void pauseTransfer(MegaTransfer *transfer, bool pause, MegaRequestListener* listener = NULL);
11968 
11969         /**
11970          * @brief Pause/resume a transfer
11971          *
11972          * The request finishes with MegaError::API_OK if the state of the transfer is the
11973          * desired one at that moment. That means that the request succeed when the transfer
11974          * is successfully paused or resumed, but also if the transfer was already in the
11975          * desired state and it wasn't needed to change anything.
11976          *
11977          * Resumed transfers don't necessarily continue just after the resumption. They
11978          * are tagged as queued and are processed according to its position on the request queue.
11979          *
11980          * The associated request type with this request is MegaRequest::TYPE_PAUSE_TRANSFER
11981          * Valid data in the MegaRequest object received on callbacks:
11982          * - MegaRequest::getTransferTag - Returns the tag of the transfer to pause or resume
11983          * - MegaRequest::getFlag - Returns true if the transfer has to be pause or false if it has to be resumed
11984          *
11985          * @param transferTag Tag of the transfer to pause or resume
11986          * @param pause True to pause the transfer or false to resume it
11987          * @param listener MegaRequestListener to track this request
11988          */
11989         void pauseTransferByTag(int transferTag, bool pause, MegaRequestListener* listener = NULL);
11990 
11991         /**
11992          * @brief Enable the resumption of transfers
11993          *
11994          * This function enables the cache of transfers, so they can be resumed later.
11995          * Additionally, if a previous cache already exists (from previous executions),
11996          * then this function also resumes the existing cached transfers.
11997          *
11998          * @note Cached uploads expire after 24 hours since the last time they were active.
11999          * @note Cached transfers related to files that have been modified since they were
12000          * added to the cache are discarded, since the file has changed.
12001          *
12002          * A log in or a log out automatically disables this feature.
12003          *
12004          * When the MegaApi object is logged in, the cache of transfers is identified
12005          * and protected using the session and the master key, so transfers won't
12006          * be resumable using a different session or a different account. The
12007          * recommended way of using this function to resume transfers for an account
12008          * is calling it in the callback onRequestFinish related to MegaApi::fetchNodes
12009          *
12010          * When the MegaApi object is not logged in, it's still possible to use this
12011          * feature. However, since there isn't any available data to identify
12012          * and protect the cache, a default identifier and key are used. To improve
12013          * the protection of the transfer cache and allow the usage of this feature
12014          * with several non logged in instances of MegaApi at once without clashes,
12015          * it's possible to set a custom identifier for the transfer cache in the
12016          * optional parameter of this function. If that parameter is used, the
12017          * encryption key for the transfer cache will be derived from it.
12018          *
12019          * @param loggedOutId Identifier for a non logged in instance of MegaApi.
12020          * It doesn't have any effect if MegaApi is logged in.
12021          */
12022         void enableTransferResumption(const char* loggedOutId = NULL);
12023 
12024         /**
12025          * @brief Disable the resumption of transfers
12026          *
12027          * This function disables the resumption of transfers and also deletes
12028          * the transfer cache if it exists. See also MegaApi.enableTransferResumption.
12029          *
12030          * @param loggedOutId Identifier for a non logged in instance of MegaApi.
12031          * It doesn't have any effect if MegaApi is logged in.
12032          */
12033         void disableTransferResumption(const char* loggedOutId = NULL);
12034 
12035         /**
12036          * @brief Returns the state (paused/unpaused) of transfers
12037          * @param direction Direction of transfers to check
12038          * Valid values for this parameter are:
12039          * - MegaTransfer::TYPE_DOWNLOAD = 0
12040          * - MegaTransfer::TYPE_UPLOAD = 1
12041          *
12042          * @return true if transfers on that direction are paused, false otherwise
12043          */
12044         bool areTransfersPaused(int direction);
12045 
12046         /**
12047          * @brief Set the upload speed limit
12048          *
12049          * The limit will be applied on the server side when starting a transfer. Thus the limit won't be
12050          * applied for already started uploads and it's applied per storage server.
12051          *
12052          * @param bpslimit -1 to automatically select the limit, 0 for no limit, otherwise the speed limit
12053          * in bytes per second
12054          */
12055         void setUploadLimit(int bpslimit);
12056 
12057         /**
12058          * @brief Set the maximum number of connections per transfer
12059          *
12060          * The maximum number of allowed connections is 6. If a higher number of connections is passed
12061          * to this function, it will fail with the error code API_ETOOMANY.
12062          *
12063          * The associated request type with this request is MegaRequest::TYPE_SET_MAX_CONNECTIONS
12064          * Valid data in the MegaRequest object received on callbacks:
12065          * - MegaRequest::getParamType - Returns the value for \c direction parameter
12066          * - MegaRequest::getNumber - Returns the number of \c connections
12067          *
12068          * @param direction Direction of transfers
12069          * Valid values for this parameter are:
12070          * - MegaTransfer::TYPE_DOWNLOAD = 0
12071          * - MegaTransfer::TYPE_UPLOAD = 1
12072          * @param connections Maximum number of connection (it should between 1 and 6)
12073          */
12074         void setMaxConnections(int direction, int connections, MegaRequestListener* listener = NULL);
12075 
12076         /**
12077          * @brief Set the maximum number of connections per transfer for downloads and uploads
12078          *
12079          * The maximum number of allowed connections is 6. If a higher number of connections is passed
12080          * to this function, it will fail with the error code API_ETOOMANY.
12081          *
12082          * The associated request type with this request is MegaRequest::TYPE_SET_MAX_CONNECTIONS
12083          * Valid data in the MegaRequest object received on callbacks:
12084          * - MegaRequest::getNumber - Returns the number of connections
12085          *
12086          * @param connections Maximum number of connection (it should between 1 and 6)
12087          */
12088         void setMaxConnections(int connections, MegaRequestListener* listener = NULL);
12089 
12090         /**
12091          * @brief Set the transfer method for downloads
12092          *
12093          * Valid methods are:
12094          * - TRANSFER_METHOD_NORMAL = 0
12095          * HTTP transfers using port 80. Data is already encrypted.
12096          *
12097          * - TRANSFER_METHOD_ALTERNATIVE_PORT = 1
12098          * HTTP transfers using port 8080. Data is already encrypted.
12099          *
12100          * - TRANSFER_METHOD_AUTO = 2
12101          * The SDK selects the transfer method automatically
12102          *
12103          * - TRANSFER_METHOD_AUTO_NORMAL = 3
12104          * The SDK selects the transfer method automatically starting with port 80.
12105          *
12106          *  - TRANSFER_METHOD_AUTO_ALTERNATIVE = 4
12107          * The SDK selects the transfer method automatically starting with alternative port 8080.
12108          *
12109          * @param method Selected transfer method for downloads
12110          */
12111         void setDownloadMethod(int method);
12112 
12113         /**
12114          * @brief Set the transfer method for uploads
12115          *
12116          * Valid methods are:
12117          * - TRANSFER_METHOD_NORMAL = 0
12118          * HTTP transfers using port 80. Data is already encrypted.
12119          *
12120          * - TRANSFER_METHOD_ALTERNATIVE_PORT = 1
12121          * HTTP transfers using port 8080. Data is already encrypted.
12122          *
12123          * - TRANSFER_METHOD_AUTO = 2
12124          * The SDK selects the transfer method automatically
12125          *
12126          * - TRANSFER_METHOD_AUTO_NORMAL = 3
12127          * The SDK selects the transfer method automatically starting with port 80.
12128          *
12129          * - TRANSFER_METHOD_AUTO_ALTERNATIVE = 4
12130          * The SDK selects the transfer method automatically starting with alternative port 8080.
12131          *
12132          * @param method Selected transfer method for uploads
12133          */
12134         void setUploadMethod(int method);
12135 
12136         /**
12137          * @brief Set the maximum download speed in bytes per second
12138          *
12139          * Currently, this method is only available using the cURL-based network layer.
12140          * It doesn't work with WinHTTP. You can check if the function will have effect
12141          * by checking the return value. If it's true, the value will be applied. Otherwise,
12142          * this function returns false.
12143          *
12144          * A value <= 0 means unlimited speed
12145          *
12146          * @param bpslimit Download speed in bytes per second
12147          * @return true if the network layer allows to control the download speed, otherwise false
12148          */
12149         bool setMaxDownloadSpeed(long long bpslimit);
12150 
12151         /**
12152          * @brief Set the maximum upload speed in bytes per second
12153          *
12154          * Currently, this method is only available using the cURL-based network layer.
12155          * It doesn't work with WinHTTP. You can check if the function will have effect
12156          * by checking the return value. If it's true, the value will be applied. Otherwise,
12157          * this function returns false.
12158          *
12159          * A value <= 0 means unlimited speed
12160          *
12161          * @param bpslimit Upload speed in bytes per second
12162          * @return true if the network layer allows to control the upload speed, otherwise false
12163          */
12164         bool setMaxUploadSpeed(long long bpslimit);
12165 
12166         /**
12167          * @brief Get the maximum download speed in bytes per second
12168          *
12169          * The value 0 means unlimited speed
12170          *
12171          * @return Download speed in bytes per second
12172          */
12173         int getMaxDownloadSpeed();
12174 
12175         /**
12176          * @brief Get the maximum upload speed in bytes per second
12177          *
12178          * The value 0 means unlimited speed
12179          *
12180          * @return Upload speed in bytes per second
12181          */
12182         int getMaxUploadSpeed();
12183 
12184         /**
12185          * @brief Return the current download speed
12186          * @return Download speed in bytes per second
12187          */
12188         int getCurrentDownloadSpeed();
12189 
12190         /**
12191          * @brief Return the current download speed
12192          * @return Download speed in bytes per second
12193          */
12194         int getCurrentUploadSpeed();
12195 
12196         /**
12197          * @brief Return the current transfer speed
12198          * @param type Type of transfer to get the speed.
12199          * Valid values are MegaTransfer::TYPE_DOWNLOAD or MegaTransfer::TYPE_UPLOAD
12200          * @return Transfer speed for the transfer type, or 0 if the parameter is invalid
12201          */
12202         int getCurrentSpeed(int type);
12203 
12204         /**
12205          * @brief Get the active transfer method for downloads
12206          *
12207          * Valid values for the return parameter are:
12208          * - TRANSFER_METHOD_NORMAL = 0
12209          * HTTP transfers using port 80. Data is already encrypted.
12210          *
12211          * - TRANSFER_METHOD_ALTERNATIVE_PORT = 1
12212          * HTTP transfers using port 8080. Data is already encrypted.
12213          *
12214          * - TRANSFER_METHOD_AUTO = 2
12215          * The SDK selects the transfer method automatically
12216          *
12217          * - TRANSFER_METHOD_AUTO_NORMAL = 3
12218          * The SDK selects the transfer method automatically starting with port 80.
12219          *
12220          * - TRANSFER_METHOD_AUTO_ALTERNATIVE = 4
12221          * The SDK selects the transfer method automatically starting with alternative port 8080.
12222          *
12223          * @return Active transfer method for downloads
12224          */
12225         int getDownloadMethod();
12226 
12227         /**
12228          * @brief Get the active transfer method for uploads
12229          *
12230          * Valid values for the return parameter are:
12231          * - TRANSFER_METHOD_NORMAL = 0
12232          * HTTP transfers using port 80. Data is already encrypted.
12233          *
12234          * - TRANSFER_METHOD_ALTERNATIVE_PORT = 1
12235          * HTTP transfers using port 8080. Data is already encrypted.
12236          *
12237          * - TRANSFER_METHOD_AUTO = 2
12238          * The SDK selects the transfer method automatically
12239          *
12240          * - TRANSFER_METHOD_AUTO_NORMAL = 3
12241          * The SDK selects the transfer method automatically starting with port 80.
12242          *
12243          * - TRANSFER_METHOD_AUTO_ALTERNATIVE = 4
12244          * The SDK selects the transfer method automatically starting with alternative port 8080.
12245          *
12246          * @return Active transfer method for uploads
12247          */
12248         int getUploadMethod();
12249 
12250         /**
12251          * @brief Get information about transfer queues
12252          * @param listener MegaTransferListener to start receiving information about transfers
12253          * @return Information about transfer queues
12254          */
12255         MegaTransferData *getTransferData(MegaTransferListener *listener = NULL);
12256 
12257         /**
12258          * @brief Get the first transfer in a transfer queue
12259          *
12260          * You take the ownership of the returned value.
12261          *
12262          * @param type Transfer queue to get the first transfer (MegaTransfer::TYPE_DOWNLOAD or MegaTransfer::TYPE_UPLOAD)
12263          * @return MegaTransfer object related to the first transfer in the queue or NULL if there isn't any transfer
12264          */
12265         MegaTransfer *getFirstTransfer(int type);
12266 
12267         /**
12268          * @brief Force an onTransferUpdate callback for the specified transfer
12269          *
12270          * The callback will be received by transfer listeners registered to receive all
12271          * callbacks related to callbacks and additionally by the listener in the last
12272          * parameter of this function, if it's not NULL.
12273          *
12274          * @param transfer Transfer that will be provided in the onTransferUpdate callback
12275          * @param listener Listener that will receive the callback
12276          */
12277         void notifyTransfer(MegaTransfer *transfer, MegaTransferListener *listener = NULL);
12278 
12279         /**
12280          * @brief Force an onTransferUpdate callback for the specified transfer
12281          *
12282          * The callback will be received by transfer listeners registered to receive all
12283          * callbacks related to callbacks and additionally by the listener in the last
12284          * parameter of this function, if it's not NULL.
12285          *
12286          * @param transferTag Tag of the transfer that will be provided in the onTransferUpdate callback
12287          * @param listener Listener that will receive the callback
12288          */
12289         void notifyTransferByTag(int transferTag, MegaTransferListener *listener = NULL);
12290 
12291         /**
12292          * @brief Get all active transfers
12293          *
12294          * You take the ownership of the returned value
12295          *
12296          * @return List with all active transfers
12297          * @see MegaApi::startUpload, MegaApi::startDownload
12298          */
12299         MegaTransferList *getTransfers();
12300 
12301         /**
12302          * @brief Get all active streaming transfers
12303          *
12304          * You take the ownership of the returned value
12305          *
12306          * @return List with all active streaming transfers
12307          * @see MegaApi::startStreaming
12308          */
12309         MegaTransferList *getStreamingTransfers();
12310 
12311         /**
12312          * @brief Get the transfer with a transfer tag
12313          *
12314          * That tag can be got using MegaTransfer::getTag
12315          *
12316          * You take the ownership of the returned value
12317          *
12318          * @param transferTag tag to check
12319          * @return MegaTransfer object with that tag, or NULL if there isn't any
12320          * active transfer with it
12321          *
12322          */
12323         MegaTransfer* getTransferByTag(int transferTag);
12324 
12325         /**
12326          * @brief Get all transfers of a specific type (downloads or uploads)
12327          *
12328          * If the parameter isn't MegaTransfer::TYPE_DOWNLOAD or MegaTransfer::TYPE_UPLOAD
12329          * this function returns an empty list.
12330          *
12331          * You take the ownership of the returned value
12332          *
12333          * @param type MegaTransfer::TYPE_DOWNLOAD or MegaTransfer::TYPE_UPLOAD
12334          * @return List with transfers of the desired type
12335          */
12336         MegaTransferList *getTransfers(int type);
12337 
12338         /**
12339          * @brief Get a list of transfers that belong to a folder transfer
12340          *
12341          * This function provides the list of transfers started in the context
12342          * of a folder transfer.
12343          *
12344          * If the tag in the parameter doesn't belong to a folder transfer,
12345          * this function returns an empty list.
12346          *
12347          * The transfers provided by this function are the ones that are added to the
12348          * transfer queue when this function is called. Finished transfers, or transfers
12349          * not added to the transfer queue yet (for example, uploads that are waiting for
12350          * the creation of the parent folder in MEGA) are not returned by this function.
12351          *
12352          * You take the ownership of the returned value
12353          *
12354          * @param transferTag Tag of the folder transfer to check
12355          * @return List of transfers in the context of the selected folder transfer
12356          * @see MegaTransfer::isFolderTransfer, MegaTransfer::getFolderTransferTag
12357          */
12358         MegaTransferList *getChildTransfers(int transferTag);
12359 
12360 
12361         /**
12362          * @brief Returns the folder paths of a backup
12363          *
12364          * You take ownership of the returned value.
12365          *
12366          * @param backuptag backup tag
12367          * @return Folder paths that contain each of the backups or NULL if tag not found.
12368          */
12369         MegaStringList *getBackupFolders(int backuptag) const;
12370 
12371 
12372         /**
12373          * @brief Starts a backup of a local folder into a remote location
12374          *
12375          * Determined by the selected period several backups will be stored in the selected location
12376          * If a backup with the same local folder and remote location exists, its parameters will be updated
12377          *
12378          * The associated request type with this request is MegaRequest::TYPE_ADD_BACKUP
12379          * Valid data in the MegaRequest object received on callbacks:
12380          * - MegaRequest::getNumber - Returns the period between backups in deciseconds (-1 if cron time used)
12381          * - MegaRequest::getText - Returns the cron like time string to define period
12382          * - MegaRequest::getFile - Returns the path of the local folder
12383          * - MegaRequest::getNumRetry - Returns the maximun number of backups to keep
12384          * - MegaRequest::getTransferTag - Returns the tag asociated with the backup
12385          * - MegaRequest::getFlag - Returns whether to attend past backups (ocurred while not running)
12386          *
12387          *
12388          * @param localPath Local path of the folder
12389          * @param parent MEGA folder to hold the backups
12390          * @param attendPastBackups attend backups that ought to have started before
12391          * @param period period between backups in deciseconds
12392          * @param periodstring cron like time string to define period
12393          * @param numBackups maximun number of backups to keep
12394          * @param listener MegaRequestListener to track this request
12395          *
12396          */
12397         void setBackup(const char* localPath, MegaNode *parent, bool attendPastBackups, int64_t period, const char *periodstring, int numBackups, MegaRequestListener *listener=NULL);
12398 
12399         /**
12400          * @brief Remove a backup
12401          *
12402          * The backup will stop being performed. No files in the local nor in the remote folder
12403          * will be deleted due to the usage of this function.
12404          *
12405          * The associated request type with this request is MegaRequest::TYPE_REMOVE_BACKUP
12406          * Valid data in the MegaRequest object received on callbacks:
12407          * - MegaRequest::getNumber - Returns the tag of the deleted backup
12408          *
12409          * @param tag tag of the backup to delete
12410          * @param listener MegaRequestListener to track this request
12411          */
12412         void removeBackup(int tag, MegaRequestListener *listener=NULL);
12413 
12414         /**
12415          * @brief Aborts current ONGOING backup.
12416          *
12417          * This will cancell all current active backups.
12418          *
12419          * The associated request type with this request is MegaRequest::TYPE_ABORT_CURRENT_BACKUP
12420          * Valid data in the MegaRequest object received on callbacks:
12421          * - MegaRequest::getNumber - Returns the tag of the aborted backup
12422          *
12423          * Possible return values for this function are:
12424          * - MegaError::API_OK if successfully aborted an ongoing backup
12425          * - MegaError::API_ENOENT if backup could not be found or no ongoing backup found
12426          *
12427          * @param tag tag of the backup to delete
12428          */
12429         void abortCurrentBackup(int tag, MegaRequestListener *listener=NULL);
12430 
12431         /**
12432          * @brief Starts a timer.
12433          *
12434          * This, besides the classic timer usage, can be used to enforce a loop of the SDK thread when the time passes
12435          *
12436          * The associated request type with this request is MegaRequest::TYPE_TIMER
12437          * Valid data in the MegaRequest object received on callbacks:
12438          * - MegaRequest::getNumber - Returns the selected period
12439 
12440          * An OnRequestFinish will be caled when the time is passed
12441          *
12442          * @param period time to wait
12443          * @param listener MegaRequestListener to track this request
12444          *
12445         */
12446         void startTimer(int64_t period, MegaRequestListener *listener = NULL);
12447 
12448 
12449 #ifdef ENABLE_SYNC
12450 
12451         ///////////////////   SYNCHRONIZATION   ///////////////////
12452 
12453         /**
12454          * @brief Get the synchronization state of a local file
12455          * @param Path of the local file
12456          * @return Synchronization state of the local file.
12457          * Valid values are:
12458          * - STATE_NONE = 0
12459          * The file isn't inside a synced folder
12460          *
12461          * - MegaApi::STATE_SYNCED = 1
12462          * The file is in sync with the MEGA account
12463          *
12464          * - MegaApi::STATE_PENDING = 2
12465          * The file is pending to be synced with the MEGA account
12466          *
12467          * - MegaApi::STATE_SYNCING = 3
12468          * The file is being synced with the MEGA account
12469          *
12470          * - MegaApi::STATE_IGNORED = 4
12471          * The file is inside a synced folder, but it is ignored
12472          * by the selected exclusion filters
12473          *
12474          */
12475         int syncPathState(std::string *path);
12476 
12477         /**
12478          * @brief Get the MegaNode associated with a local synced file
12479          * @param path Local path of the file
12480          * @return The same file in MEGA or NULL if the file isn't synced
12481          */
12482         MegaNode *getSyncedNode(std::string *path);
12483 
12484         /**
12485          * @brief Synchronize a local folder and a folder in MEGA
12486          *
12487          * This function should be used to add a new synchronized folders. To resume a previously
12488          * added synchronized folder, use MegaApi::resumeSync
12489          *
12490          * The associated request type with this request is MegaRequest::TYPE_ADD_SYNC
12491          * Valid data in the MegaRequest object received on callbacks:
12492          * - MegaRequest::getNodeHandle - Returns the handle of the folder in MEGA
12493          * - MegaRequest::getFile - Returns the path of the local folder
12494          *
12495          * Valid data in the MegaRequest object received in onRequestFinish when the error code
12496          * is MegaError::API_OK:
12497          * - MegaRequest::getNumber - Fingerprint of the local folder to resume the sync (MegaApi::resumeSync)
12498          *
12499          * @param localFolder Local folder
12500          * @param megaFolder MEGA folder
12501          * @param listener MegaRequestListener to track this request
12502          *
12503          * @see MegaApi::resumeSync
12504          */
12505         void syncFolder(const char *localFolder, MegaNode *megaFolder, MegaRequestListener *listener = NULL);
12506 
12507         /**
12508          * @brief Resume a previously synced folder
12509          *
12510          * This function should be called in the onRequestFinish callback for MegaApi::fetchNodes, before the callback
12511          * returns, to ensure that all changes made in the MEGA account while the synchronization was stopped
12512          * are correctly applied.
12513          *
12514          * The third parameter allows to pass a fingerprint of the local folder to check if it has changed since
12515          * the previous execution. That fingerprint can be obtained using MegaRequest::getParentHandle in the
12516          * onRequestFinish callback if the MegaApi::syncFolder request. If the provided fingerprint doesn't match
12517          * the current fingerprint of the local folder, this request will fail with the error code
12518          * MegaError::API_EFAILED
12519          *
12520          * The associated request type with this request is MegaRequest::TYPE_ADD_SYNC
12521          * Valid data in the MegaRequest object received on callbacks:
12522          * - MegaRequest::getNodeHandle - Returns the handle of the folder in MEGA
12523          * - MegaRequest::getFile - Returns the path of the local folder
12524          * - MegaRequest::getNumber - Returns the fingerprint of the local folder
12525          *
12526          * @param localFolder Local folder
12527          * @param megaFolder MEGA folder
12528          * @param localfp Fingerprint of the local file
12529          * @param listener MegaRequestListener to track this request
12530          */
12531         void resumeSync(const char *localFolder, MegaNode *megaFolder, long long localfp, MegaRequestListener *listener = NULL);
12532 
12533 #ifdef USE_PCRE
12534         /**
12535          * @brief Synchronize a local folder and a folder in MEGA, having an exclusion list
12536          *
12537          * This function should be used to add a new synchronized pair of folders. To resume a previously
12538          * added synchronized folder, use MegaApi::resumeSync
12539          *
12540          * The associated request type with this request is MegaRequest::TYPE_ADD_SYNC
12541          * Valid data in the MegaRequest object received on callbacks:
12542          * - MegaRequest::getNodeHandle - Returns the handle of the folder in MEGA
12543          * - MegaRequest::getFile - Returns the path of the local folder
12544          *
12545          * Valid data in the MegaRequest object received in onRequestFinish when the error code
12546          * is MegaError::API_OK:
12547          * - MegaRequest::getNumber - Fingerprint of the local folder to resume the sync (MegaApi::resumeSync)
12548          *
12549          * @param localFolder Local folder
12550          * @param megaFolder MEGA folder
12551          * @param regExp Regular expressions to handle excluded files/folders
12552          * @param listener MegaRequestListener to track this request
12553          *
12554          * @see MegaApi::resumeSync
12555          */
12556         void syncFolder(const char *localFolder, MegaNode *megaFolder, MegaRegExp *regExp, MegaRequestListener *listener = NULL);
12557 
12558         /**
12559          * @brief Resume a previously synced folder, having an exclusion list
12560          *
12561          * This function should be called in the onRequestFinish callback for MegaApi::fetchNodes, before the callback
12562          * returns, to ensure that all changes made in the MEGA account while the synchronization was stopped
12563          * are correctly applied.
12564          *
12565          * The third parameter allows to pass a fingerprint of the local folder to check if it has changed since
12566          * the previous execution. That fingerprint can be obtained using MegaRequest::getParentHandle in the
12567          * onRequestFinish callback if the MegaApi::syncFolder request. If the provided fingerprint doesn't match
12568          * the current fingerprint of the local folder, this request will fail with the error code
12569          * MegaError::API_EFAILED
12570          *
12571          * The associated request type with this request is MegaRequest::TYPE_ADD_SYNC
12572          * Valid data in the MegaRequest object received on callbacks:
12573          * - MegaRequest::getNodeHandle - Returns the handle of the folder in MEGA
12574          * - MegaRequest::getFile - Returns the path of the local folder
12575          * - MegaRequest::getNumber - Returns the fingerprint of the local folder
12576          *
12577          * @param localFolder Local folder
12578          * @param megaFolder MEGA folder
12579          * @param localfp Fingerprint of the local file
12580          * @param regExp Regular expressions to handle excluded files/folders
12581          * @param listener MegaRequestListener to track this request
12582          */
12583         void resumeSync(const char *localFolder, MegaNode *megaFolder, long long localfp, MegaRegExp *regExp, MegaRequestListener *listener = NULL);
12584 #endif
12585 
12586         /**
12587          * @brief Remove a synced folder
12588          *
12589          * The folder will stop being synced. No files in the local nor in the remote folder
12590          * will be deleted due to the usage of this function.
12591          *
12592          * The synchronization will stop and the cache of local files will be deleted
12593          * If you don't want to delete the local cache use MegaApi::disableSync
12594          *
12595          * The associated request type with this request is MegaRequest::TYPE_REMOVE_SYNC
12596          * Valid data in the MegaRequest object received on callbacks:
12597          * - MegaRequest::getNodeHandle - Returns the handle of the folder in MEGA
12598          * - MegaRequest::getFlag - Returns true
12599          *
12600          * @param megaFolder MEGA folder
12601          * @param listener MegaRequestListener to track this request
12602          */
12603         void removeSync(MegaNode *megaFolder, MegaRequestListener *listener = NULL);
12604 
12605         /**
12606          * @brief Remove a synced folder
12607          *
12608          * The folder will stop being synced. No files in the local nor in the remote folder
12609          * will be deleted due to the usage of this function.
12610          *
12611          * The synchronization will stop and the cache of local files will be deleted
12612          * If you don't want to delete the local cache use MegaApi::disableSync
12613          *
12614          * The associated request type with this request is MegaRequest::TYPE_REMOVE_SYNC
12615          * Valid data in the MegaRequest object received on callbacks:
12616          * - MegaRequest::getNodeHandle - Returns the handle of the folder in MEGA
12617          * - MegaRequest::getFlag - Returns true
12618          *
12619          * @param sync Synchronization to cancel
12620          * @param listener MegaRequestListener to track this request
12621          */
12622         void removeSync(MegaSync *sync, MegaRequestListener *listener = NULL);
12623 
12624         /**
12625          * @brief Disable a synced folder
12626          *
12627          * The folder will stop being synced. No files in the local nor in the remote folder
12628          * will be deleted due to the usage of this function.
12629          *
12630          * The synchronization will stop but the cache of local files won't be deleted.
12631          * If you want to also delete the local cache use MegaApi::removeSync
12632          *
12633          * The associated request type with this request is MegaRequest::TYPE_REMOVE_SYNC
12634          * Valid data in the MegaRequest object received on callbacks:
12635          * - MegaRequest::getNodeHandle - Returns the handle of the folder in MEGA
12636          * - MegaRequest::getFlag - Returns false
12637          *
12638          * @param megaFolder MEGA folder
12639          * @param listener MegaRequestListener to track this request
12640          */
12641         void disableSync(MegaNode *megaFolder, MegaRequestListener *listener=NULL);
12642 
12643         /**
12644          * @brief Disable a synced folder
12645          *
12646          * The folder will stop being synced. No files in the local nor in the remote folder
12647          * will be deleted due to the usage of this function.
12648          *
12649          * The synchronization will stop but the cache of local files won't be deleted.
12650          * If you want to also delete the local cache use MegaApi::removeSync
12651          *
12652          * The associated request type with this request is MegaRequest::TYPE_REMOVE_SYNC
12653          * Valid data in the MegaRequest object received on callbacks:
12654          * - MegaRequest::getNodeHandle - Returns the handle of the folder in MEGA
12655          * - MegaRequest::getFlag - Returns false
12656          *
12657          * @param sync Synchronization to disable
12658          * @param listener MegaRequestListener to track this request
12659          */
12660         void disableSync(MegaSync *sync, MegaRequestListener *listener = NULL);
12661 
12662         /**
12663          * @brief Remove all active synced folders
12664          *
12665          * All folders will stop being synced. Nothing in the local nor in the remote folders
12666          * will be deleted due to the usage of this function.
12667          *
12668          * The associated request type with this request is MegaRequest::TYPE_REMOVE_SYNCS
12669          *
12670          * @param listener MegaRequestListener to track this request
12671          */
12672         void removeSyncs(MegaRequestListener *listener = NULL);
12673 
12674         /**
12675          * @brief Get the number of active synced folders
12676          * @return The number of active synced folders
12677          *
12678          * @deprecated New functions to manage synchronizations are being implemented. This funtion will
12679          * be removed in future updates.
12680          */
12681         int getNumActiveSyncs();
12682 
12683         /**
12684          * @brief Check if the synchronization engine is scanning files
12685          * @return true if it is scanning, otherwise false
12686          */
12687         bool isScanning();
12688 
12689         /**
12690          * @brief Check if any synchronization is in state syncing or pending
12691          * @return true if it is syncing, otherwise false
12692          */
12693         bool isSyncing();
12694 
12695         /**
12696          * @brief Check if the MegaNode is synchronized with a local file
12697          * @param MegaNode to check
12698          * @return true if the node is synchronized, othewise false
12699          * @see MegaApi::getLocalPath
12700          */
12701         bool isSynced(MegaNode *n);
12702 
12703         /**
12704          * @brief Set a list of excluded file names
12705          *
12706          * Wildcards (* and ?) are allowed
12707          *
12708          * @param List of excluded file names
12709          * @deprecated A more powerful exclusion system based on regular expresions is being developed. This
12710          * function will be removed in future updates
12711          */
12712         void setExcludedNames(std::vector<std::string> *excludedNames);
12713 
12714         /**
12715          * @brief Set a list of excluded paths
12716          *
12717          * Wildcards (* and ?) are allowed
12718          *
12719          * @param List of excluded paths
12720          * @deprecated A more powerful exclusion system based on regular expresions is being developed. This
12721          * function will be removed in future updates
12722          */
12723         void setExcludedPaths(std::vector<std::string> *excludedPaths);
12724 
12725         /**
12726          * @brief Set a lower limit for synchronized files
12727          *
12728          * Files with a size lower than this limit won't be synchronized
12729          * To disable the limit, you can set it to 0
12730          *
12731          * If both limits are enabled and the lower one is greater than the upper one,
12732          * only files between both limits will be excluded
12733          *
12734          * @param limit Lower limit for synchronized files
12735          */
12736         void setExclusionLowerSizeLimit(long long limit);
12737 
12738         /**
12739          * @brief Set an upper limit for synchronized files
12740          *
12741          * Files with a size greater than this limit won't be synchronized
12742          * To disable the limit, you can set it to 0
12743          *
12744          * If both limits are enabled and the lower one is greater than the upper one,
12745          * only files between both limits will be excluded
12746          *
12747          * @param limit Upper limit for synchronized files
12748          */
12749         void setExclusionUpperSizeLimit(long long limit);
12750 
12751         /**
12752          * @brief Move a local file to the local "Debris" folder
12753          *
12754          * The file have to be inside a local synced folder
12755          *
12756          * @param path Path of the local file
12757          * @return true on success, false on failure
12758          */
12759         bool moveToLocalDebris(const char *path);
12760 
12761         /**
12762          * @brief Check if a path is syncable based on the excluded names and paths and sizes
12763          * @param name Path to check
12764          * @param size Size of the file or -1 to ignore the size
12765          * @return true if the path is syncable, otherwise false
12766          */
12767         bool isSyncable(const char *path, long long size);
12768 
12769         /**
12770          * @brief Check if a node is inside a synced folder
12771          * @param node Node to check
12772          * @return true if the node is inside a synced folder, otherwise false
12773          */
12774         bool isInsideSync(MegaNode *node);
12775 
12776         /**
12777          * @brief Check if it's possible to start synchronizing a folder node.
12778          *
12779          * Possible return values for this function are:
12780          * - MegaError::API_OK if the folder is syncable
12781          * - MegaError::API_ENOENT if the node doesn't exist in the account
12782          * - MegaError::API_EARGS if the node is NULL or is not a folder
12783          * - MegaError::API_EACCESS if the node doesn't have full access
12784          * - MegaError::API_EEXIST if there is a conflicting synchronization (nodes can't be synced twice)
12785          * - MegaError::API_EINCOMPLETE if the SDK hasn't been built with support for synchronization
12786          *
12787          * @param Folder node to check
12788          * @return MegaError::API_OK if the node is syncable, otherwise it returns an error.
12789          */
12790         int isNodeSyncable(MegaNode *node);
12791 
12792         /**
12793          * @brief Get the corresponding local path of a synced node
12794          * @param Node to check
12795          * @return Local path of the corresponding file in the local computer. If the node is't synced
12796          * this function returns an empty string.
12797          *
12798          * @deprecated New functions to manage synchronizations are being implemented. This funtion will
12799          * be removed in future updates.
12800          */
12801         std::string getLocalPath(MegaNode *node);
12802 
12803         /**
12804          * @brief Get the synchronization identified with a tag
12805          *
12806          * You take the ownership of the returned value
12807          *
12808          * @param tag Tag that identifies the synchronization
12809          * @return Synchronization identified by the tag
12810          */
12811         MegaSync *getSyncByTag(int tag);
12812 
12813         /**
12814          * @brief getSyncByNode Get the synchronization associated with a node
12815          *
12816          * You take the ownership of the returned value
12817          *
12818          * @param node Root node of the synchronization
12819          * @return Synchronization with the specified root node
12820          */
12821         MegaSync *getSyncByNode(MegaNode *node);
12822 
12823         /**
12824          * @brief getSyncByPath Get the synchronization associated with a local path
12825          *
12826          * You take the ownership of the returned value
12827          *
12828          * @param localPath Root local path of the synchronization
12829          * @return Synchronization with the specified root local path
12830          */
12831         MegaSync *getSyncByPath(const char *localPath);
12832 
12833 #ifdef USE_PCRE
12834         /**
12835         * @brief Set a list of rules to exclude files and folders for a given synchronized folder
12836         * @param sync Synchronization whose rules want to be updated
12837         * @param regExp List of regular expressions (rules) to exclude file / folders
12838         */
12839         void setExcludedRegularExpressions(MegaSync *sync, MegaRegExp *regExp);
12840 #endif
12841 
12842         /**
12843          * @brief Get the total number of local nodes in the account
12844          * @return Total number of local nodes in the account
12845          */
12846         long long getNumLocalNodes();
12847 
12848         /**
12849          * @brief Get the path if the file/folder that is blocking the sync engine
12850          *
12851          * If the sync engine is not blocked, this function returns NULL
12852          * You take the ownership of the returned value
12853          *
12854          * @return Path of the file that is blocking the sync engine, or NULL if it isn't blocked
12855          */
12856         char *getBlockedPath();
12857 #endif
12858 
12859         /**
12860          * @brief Get the backup identified with a tag
12861          *
12862          * You take the ownership of the returned value
12863          *
12864          * @param tag Tag that identifies the backup
12865          * @return Backup identified by the tag
12866          */
12867         MegaBackup *getBackupByTag(int tag);
12868 
12869         /**
12870          * @brief getBackupByNode Get the backup associated with a node
12871          *
12872          * You take the ownership of the returned value
12873          * Caveat: Two backups can have the same parent node, the first one encountered is returned
12874          *
12875          * @param node Root node of the backup
12876          * @return Backup with the specified root node
12877          */
12878         MegaBackup *getBackupByNode(MegaNode *node);
12879 
12880         /**
12881          * @brief getBackupByPath Get the backup associated with a local path
12882          *
12883          * You take the ownership of the returned value
12884          *
12885          * @param localPath Root local path of the backup
12886          * @return Backup with the specified root local path
12887          */
12888         MegaBackup *getBackupByPath(const char *localPath);
12889 
12890         /**
12891          * @brief Force a loop of the SDK thread
12892          * @deprecated This function is only here for debugging purposes. It will probably
12893          * be removed in future updates
12894          */
12895         void update();
12896 
12897         /**
12898          * @brief Check if the SDK is waiting to complete a request and get the reason
12899          * @return State of SDK.
12900          *
12901          * Valid values are:
12902          * - MegaApi::RETRY_NONE = 0
12903          * SDK is not waiting for the server to complete a request
12904          *
12905          * - MegaApi::RETRY_CONNECTIVITY = 1
12906          * SDK is waiting for the server to complete a request due to connectivity issues
12907          *
12908          * - MegaApi::RETRY_SERVERS_BUSY = 2
12909          * SDK is waiting for the server to complete a request due to a HTTP error 500
12910          *
12911          * - MegaApi::RETRY_API_LOCK = 3
12912          * SDK is waiting for the server to complete a request due to an API lock (API error -3)
12913          *
12914          * - MegaApi::RETRY_RATE_LIMIT = 4,
12915          * SDK is waiting for the server to complete a request due to a rate limit (API error -4)
12916          *
12917          * - MegaApi::RETRY_LOCAL_LOCK = 5
12918          * SDK is waiting for a local locked file
12919          *
12920          * - MegaApi::RETRY_UNKNOWN = 6
12921          * SDK is waiting for the server to complete a request with unknown reason
12922          *
12923          */
12924         int isWaiting();
12925 
12926         /**
12927          * @brief Check if the SDK is waiting to complete a request and get the reason
12928          * @return State of SDK.
12929          *
12930          * Valid values are:
12931          * - MegaApi::RETRY_NONE = 0
12932          * SDK is not waiting for the server to complete a request
12933          *
12934          * - MegaApi::RETRY_CONNECTIVITY = 1
12935          * SDK is waiting for the server to complete a request due to connectivity issues
12936          *
12937          * - MegaApi::RETRY_SERVERS_BUSY = 2
12938          * SDK is waiting for the server to complete a request due to a HTTP error 500
12939          *
12940          * - MegaApi::RETRY_API_LOCK = 3
12941          * SDK is waiting for the server to complete a request due to an API lock (API error -3)
12942          *
12943          * - MegaApi::RETRY_RATE_LIMIT = 4,
12944          * SDK is waiting for the server to complete a request due to a rate limit (API error -4)
12945          *
12946          * - MegaApi::RETRY_LOCAL_LOCK = 5
12947          * SDK is waiting for a local locked file
12948          *
12949          * - MegaApi::RETRY_UNKNOWN = 6
12950          * SDK is waiting for the server to complete a request with unknown reason
12951          *
12952          * @deprecated Use MegaApi::isWaiting instead of this function.
12953          */
12954         int areServersBusy();
12955 
12956         /**
12957          * @brief Get the number of pending uploads
12958          *
12959          * @return Pending uploads
12960          *
12961          * @deprecated Function related to statistics will be reviewed in future updates to
12962          * provide more data and avoid race conditions. They could change or be removed in the current form.
12963          */
12964         int getNumPendingUploads();
12965 
12966         /**
12967          * @brief Get the number of pending downloads
12968          * @return Pending downloads
12969          *
12970          * @deprecated Function related to statistics will be reviewed in future updates to
12971          * provide more data and avoid race conditions. They could change or be removed in the current form.
12972          */
12973         int getNumPendingDownloads();
12974 
12975         /**
12976          * @brief Get the number of queued uploads since the last call to MegaApi::resetTotalUploads
12977          * @return Number of queued uploads since the last call to MegaApi::resetTotalUploads
12978          *
12979          * @deprecated Function related to statistics will be reviewed in future updates to
12980          * provide more data and avoid race conditions. They could change or be removed in the current form.
12981          */
12982         int getTotalUploads();
12983 
12984         /**
12985          * @brief Get the number of queued uploads since the last call to MegaApi::resetTotalDownloads
12986          * @return Number of queued uploads since the last call to MegaApi::resetTotalDownloads
12987          *
12988          * @deprecated Function related to statistics will be reviewed in future updates. They
12989          * could change or be removed in the current form.
12990          */
12991         int getTotalDownloads();
12992 
12993         /**
12994          * @brief Reset the number of total downloads
12995          * This function resets the number returned by MegaApi::getTotalDownloads
12996          *
12997          * @deprecated Function related to statistics will be reviewed in future updates to
12998          * provide more data and avoid race conditions. They could change or be removed in the current form.
12999          *
13000          */
13001         void resetTotalDownloads();
13002 
13003         /**
13004          * @brief Reset the number of total uploads
13005          * This function resets the number returned by MegaApi::getTotalUploads
13006          *
13007          * @deprecated Function related to statistics will be reviewed in future updates to
13008          * provide more data and avoid race conditions. They could change or be removed in the current form.
13009          */
13010         void resetTotalUploads();
13011 
13012         /**
13013          * @brief Get the total downloaded bytes
13014          * @return Total downloaded bytes
13015          *
13016          * The count starts with the creation of MegaApi and is reset with calls to MegaApi::resetTotalDownloads
13017          * or just before a log in or a log out.
13018          *
13019          * Only regular downloads are taken into account, not streaming nor folder transfers.
13020          *
13021          * @deprecated Function related to statistics will be reviewed in future updates to
13022          * provide more data and avoid race conditions. They could change or be removed in the current form.
13023          */
13024         long long getTotalDownloadedBytes();
13025 
13026         /**
13027          * @brief Get the total uploaded bytes
13028          * @return Total uploaded bytes
13029          *
13030          * The count starts with the creation of MegaApi and is reset with calls to MegaApi::resetTotalUploads
13031          * or just before a log in or a log out.
13032          *
13033          * Only regular uploads are taken into account, not folder transfers.
13034          *
13035          * @deprecated Function related to statistics will be reviewed in future updates to
13036          * provide more data and avoid race conditions. They could change or be removed in the current form.
13037          *
13038          */
13039         long long getTotalUploadedBytes();
13040 
13041         /**
13042          * @brief Get the total bytes of started downloads
13043          * @return Total bytes of started downloads
13044          *
13045          * The count starts with the creation of MegaApi and is reset with calls to MegaApi::resetTotalDownloads
13046          * or just before a log in or a log out.
13047          *
13048          * Only regular downloads are taken into account, not streaming nor folder transfers.
13049          *
13050          * @deprecated Function related to statistics will be reviewed in future updates to
13051          * provide more data and avoid race conditions. They could change or be removed in the current form.
13052          */
13053         long long getTotalDownloadBytes();
13054 
13055         /**
13056          * @brief Get the total bytes of started uploads
13057          * @return Total bytes of started uploads
13058          *
13059          * The count starts with the creation of MegaApi and is reset with calls to MegaApi::resetTotalUploads
13060          * or just before a log in or a log out.
13061          *
13062          * Only regular uploads are taken into account, not folder transfers.
13063          *
13064          * @deprecated Function related to statistics will be reviewed in future updates to
13065          * provide more data and avoid race conditions. They could change or be removed in the current form.
13066          *
13067          */
13068         long long getTotalUploadBytes();
13069 
13070         /**
13071          * @brief Update the number of pending downloads/uploads
13072          *
13073          * This function forces a count of the pending downloads/uploads. It could
13074          * affect the return value of MegaApi::getNumPendingDownloads and
13075          * MegaApi::getNumPendingUploads.
13076          *
13077          * @deprecated Function related to statistics will be reviewed in future updates to
13078          * provide more data and avoid race conditions. They could change or be removed in the current form.
13079          *
13080          */
13081         void updateStats();
13082 
13083         /**
13084          * @brief Get the total number of nodes in the account
13085          * @return Total number of nodes in the account
13086          */
13087         long long getNumNodes();
13088 
13089         enum { ORDER_NONE = 0, ORDER_DEFAULT_ASC, ORDER_DEFAULT_DESC,
13090             ORDER_SIZE_ASC, ORDER_SIZE_DESC,
13091             ORDER_CREATION_ASC, ORDER_CREATION_DESC,
13092             ORDER_MODIFICATION_ASC, ORDER_MODIFICATION_DESC,
13093             ORDER_ALPHABETICAL_ASC, ORDER_ALPHABETICAL_DESC,
13094             ORDER_PHOTO_ASC, ORDER_PHOTO_DESC,
13095             ORDER_VIDEO_ASC, ORDER_VIDEO_DESC,
13096             ORDER_LINK_CREATION_ASC, ORDER_LINK_CREATION_DESC,};
13097 
13098         /**
13099          * @brief Get the number of child nodes
13100          *
13101          * If the node doesn't exist in MEGA or isn't a folder,
13102          * this function returns 0
13103          *
13104          * This function doesn't search recursively, only returns the direct child nodes.
13105          *
13106          * @param parent Parent node
13107          * @return Number of child nodes
13108          */
13109         int getNumChildren(MegaNode* parent);
13110 
13111         /**
13112          * @brief Get the number of child files of a node
13113          *
13114          * If the node doesn't exist in MEGA or isn't a folder,
13115          * this function returns 0
13116          *
13117          * This function doesn't search recursively, only returns the direct child files.
13118          *
13119          * @param parent Parent node
13120          * @return Number of child files
13121          */
13122         int getNumChildFiles(MegaNode* parent);
13123 
13124         /**
13125          * @brief Get the number of child folders of a node
13126          *
13127          * If the node doesn't exist in MEGA or isn't a folder,
13128          * this function returns 0
13129          *
13130          * This function doesn't search recursively, only returns the direct child folders.
13131          *
13132          * @param parent Parent node
13133          * @return Number of child folders
13134          */
13135         int getNumChildFolders(MegaNode* parent);
13136 
13137         /**
13138          * @brief Get all children of a MegaNode
13139          *
13140          * If the parent node doesn't exist or it isn't a folder, this function
13141          * returns NULL
13142          *
13143          * You take the ownership of the returned value
13144          *
13145          * @param parent Parent node
13146          * @param order Order for the returned list
13147          * Valid values for this parameter are:
13148          * - MegaApi::ORDER_NONE = 0
13149          * Undefined order
13150          *
13151          * - MegaApi::ORDER_DEFAULT_ASC = 1
13152          * Folders first in alphabetical order, then files in the same order
13153          *
13154          * - MegaApi::ORDER_DEFAULT_DESC = 2
13155          * Files first in reverse alphabetical order, then folders in the same order
13156          *
13157          * - MegaApi::ORDER_SIZE_ASC = 3
13158          * Sort by size, ascending
13159          *
13160          * - MegaApi::ORDER_SIZE_DESC = 4
13161          * Sort by size, descending
13162          *
13163          * - MegaApi::ORDER_CREATION_ASC = 5
13164          * Sort by creation time in MEGA, ascending
13165          *
13166          * - MegaApi::ORDER_CREATION_DESC = 6
13167          * Sort by creation time in MEGA, descending
13168          *
13169          * - MegaApi::ORDER_MODIFICATION_ASC = 7
13170          * Sort by modification time of the original file, ascending
13171          *
13172          * - MegaApi::ORDER_MODIFICATION_DESC = 8
13173          * Sort by modification time of the original file, descending
13174          *
13175          * - MegaApi::ORDER_ALPHABETICAL_ASC = 9
13176          * Same behavior than MegaApi::ORDER_DEFAULT_ASC
13177          *
13178          * - MegaApi::ORDER_ALPHABETICAL_DESC = 10
13179          * Same behavior than MegaApi::ORDER_DEFAULT_DESC
13180          *
13181          * - MegaApi::ORDER_PHOTO_ASC = 11
13182          * Sort with photos first, then by date ascending
13183          *
13184          * - MegaApi::ORDER_PHOTO_DESC = 12
13185          * Sort with photos first, then by date descending
13186          *
13187          * - MegaApi::ORDER_VIDEO_ASC = 13
13188          * Sort with videos first, then by date ascending
13189          *
13190          * - MegaApi::ORDER_VIDEO_DESC = 14
13191          * Sort with videos first, then by date descending
13192          *
13193          * @deprecated MegaApi::ORDER_ALPHABETICAL_ASC and MegaApi::ORDER_ALPHABETICAL_DESC
13194          * are equivalent to MegaApi::ORDER_DEFAULT_ASC and MegaApi::ORDER_DEFAULT_DESC.
13195          * They will be eventually removed.
13196          *
13197          * @return List with all child MegaNode objects
13198          */
13199         MegaNodeList* getChildren(MegaNode *parent, int order = 1);
13200 
13201         /**
13202          * @brief Get all versions of a file
13203          * @param node Node to check
13204          * @return List with all versions of the node, including the current version
13205          */
13206         MegaNodeList* getVersions(MegaNode *node);
13207 
13208         /**
13209          * @brief Get the number of versions of a file
13210          * @param node Node to check
13211          * @return Number of versions of the node, including the current version
13212          */
13213         int getNumVersions(MegaNode *node);
13214 
13215         /**
13216          * @brief Check if a file has previous versions
13217          * @param node Node to check
13218          * @return true if the node has any previous version
13219          */
13220         bool hasVersions(MegaNode *node);
13221 
13222         /**
13223          * @brief Get information about the contents of a folder
13224          *
13225          * The associated request type with this request is MegaRequest::TYPE_FOLDER_INFO
13226          * Valid data in the MegaRequest object received in onRequestFinish when the error code
13227          * is MegaError::API_OK:
13228          * - MegaRequest::getMegaFolderInfo - MegaFolderInfo object with the information related to the folder
13229          *
13230          * @param node Folder node to inspect
13231          * @param listener MegaRequestListener to track this request
13232          */
13233         void getFolderInfo(MegaNode *node, MegaRequestListener *listener = NULL);
13234 
13235         /**
13236          * @brief Get file and folder children of a MegaNode separatedly
13237          *
13238          * If the parent node doesn't exist or it isn't a folder, this function
13239          * returns NULL
13240          *
13241          * You take the ownership of the returned value
13242          *
13243          * @param p Parent node
13244          * @param order Order for the returned lists
13245          * Valid values for this parameter are:
13246          * - MegaApi::ORDER_NONE = 0
13247          * Undefined order
13248          *
13249          * - MegaApi::ORDER_DEFAULT_ASC = 1
13250          * Folders first in alphabetical order, then files in the same order
13251          *
13252          * - MegaApi::ORDER_DEFAULT_DESC = 2
13253          * Files first in reverse alphabetical order, then folders in the same order
13254          *
13255          * - MegaApi::ORDER_SIZE_ASC = 3
13256          * Sort by size, ascending
13257          *
13258          * - MegaApi::ORDER_SIZE_DESC = 4
13259          * Sort by size, descending
13260          *
13261          * - MegaApi::ORDER_CREATION_ASC = 5
13262          * Sort by creation time in MEGA, ascending
13263          *
13264          * - MegaApi::ORDER_CREATION_DESC = 6
13265          * Sort by creation time in MEGA, descending
13266          *
13267          * - MegaApi::ORDER_MODIFICATION_ASC = 7
13268          * Sort by modification time of the original file, ascending
13269          *
13270          * - MegaApi::ORDER_MODIFICATION_DESC = 8
13271          * Sort by modification time of the original file, descending
13272          *
13273          * - MegaApi::ORDER_ALPHABETICAL_ASC = 9
13274          * Same behavior than MegaApi::ORDER_DEFAULT_ASC
13275          *
13276          * - MegaApi::ORDER_ALPHABETICAL_DESC = 10
13277          * Same behavior than MegaApi::ORDER_DEFAULT_DESC
13278          *
13279          * @deprecated MegaApi::ORDER_ALPHABETICAL_ASC and MegaApi::ORDER_ALPHABETICAL_DESC
13280          * are equivalent to MegaApi::ORDER_DEFAULT_ASC and MegaApi::ORDER_DEFAULT_DESC.
13281          * They will be eventually removed.
13282          *
13283          * - MegaApi::ORDER_PHOTO_ASC = 11
13284          * Sort with photos first, then by date ascending
13285          *
13286          * - MegaApi::ORDER_PHOTO_DESC = 12
13287          * Sort with photos first, then by date descending
13288          *
13289          * - MegaApi::ORDER_VIDEO_ASC = 13
13290          * Sort with videos first, then by date ascending
13291          *
13292          * - MegaApi::ORDER_VIDEO_DESC = 14
13293          * Sort with videos first, then by date descending
13294          *
13295          * @return Lists with files and folders child MegaNode objects
13296          */
13297         MegaChildrenLists* getFileFolderChildren(MegaNode *p, int order = 1);
13298 
13299         /**
13300          * @brief Returns true if the node has children
13301          * @return true if the node has children
13302          */
13303         bool hasChildren(MegaNode *parent);
13304 
13305         /**
13306          * @brief Get the child node with the provided name
13307          *
13308          * If the node doesn't exist, this function returns NULL
13309          *
13310          * You take the ownership of the returned value
13311          *
13312          * @param parent Parent node
13313          * @param name Name of the node
13314          * @return The MegaNode that has the selected parent and name
13315          */
13316         MegaNode *getChildNode(MegaNode *parent, const char* name);
13317 
13318         /**
13319          * @brief Get the parent node of a MegaNode
13320          *
13321          * If the node doesn't exist in the account or
13322          * it is a root node, this function returns NULL
13323          *
13324          * You take the ownership of the returned value.
13325          *
13326          * @param node MegaNode to get the parent
13327          * @return The parent of the provided node
13328          */
13329         MegaNode *getParentNode(MegaNode *node);
13330 
13331         /**
13332          * @brief Get the path of a MegaNode
13333          *
13334          * If the node doesn't exist, this function returns NULL.
13335          * You can recoved the node later using MegaApi::getNodeByPath
13336          * except if the path contains names with '/', '\' or ':' characters.
13337          *
13338          * You take the ownership of the returned value
13339          *
13340          * @param node MegaNode for which the path will be returned
13341          * @return The path of the node
13342          */
13343         char* getNodePath(MegaNode *node);
13344 
13345         /**
13346          * @brief Get the MegaNode in a specific path in the MEGA account
13347          *
13348          * The path separator character is '/'
13349          * The Root node is /
13350          * The Inbox root node is //in/
13351          * The Rubbish root node is //bin/
13352          *
13353          * Paths with names containing '/', '\' or ':' aren't compatible
13354          * with this function.
13355          *
13356          * It is needed to be logged in and to have successfully completed a fetchNodes
13357          * request before calling this function. Otherwise, it will return NULL.
13358          *
13359          * You take the ownership of the returned value
13360          *
13361          * @param path Path to check
13362          * @param n Base node if the path is relative
13363          * @return The MegaNode object in the path, otherwise NULL
13364          */
13365         MegaNode *getNodeByPath(const char *path, MegaNode *n = NULL);
13366 
13367         /**
13368          * @brief Get the MegaNode that has a specific handle
13369          *
13370          * You can get the handle of a MegaNode using MegaNode::getHandle. The same handle
13371          * can be got in a Base64-encoded string using MegaNode::getBase64Handle. Conversions
13372          * between these formats can be done using MegaApi::base64ToHandle and MegaApi::handleToBase64
13373          *
13374          * It is needed to be logged in and to have successfully completed a fetchNodes
13375          * request before calling this function. Otherwise, it will return NULL.
13376          *
13377          * You take the ownership of the returned value.
13378          *
13379          * @param h Node handle to check
13380          * @return MegaNode object with the handle, otherwise NULL
13381          */
13382         MegaNode *getNodeByHandle(MegaHandle h);
13383 
13384         /**
13385          * @brief Get the MegaContactRequest that has a specific handle
13386          *
13387          * You can get the handle of a MegaContactRequest using MegaContactRequest::getHandle.
13388          *
13389          * You take the ownership of the returned value.
13390          *
13391          * @param handle Contact request handle to check
13392          * @return MegaContactRequest object with the handle, otherwise NULL
13393          */
13394         MegaContactRequest *getContactRequestByHandle(MegaHandle handle);
13395 
13396         /**
13397          * @brief Get all contacts of this MEGA account
13398          *
13399          * You take the ownership of the returned value
13400          *
13401          * @return List of MegaUser object with all contacts of this account
13402          */
13403         MegaUserList* getContacts();
13404 
13405         /**
13406          * @brief Get the MegaUser that has a specific email address
13407          *
13408          * You can get the email of a MegaUser using MegaUser::getEmail
13409          *
13410          * You take the ownership of the returned value
13411          *
13412          * @param user Email or Base64 handle of the user
13413          * @return MegaUser that has the email address, otherwise NULL
13414          */
13415         MegaUser* getContact(const char *user);
13416 
13417         /**
13418         * @brief Get all MegaUserAlerts for the logged in user
13419         *
13420         * You take the ownership of the returned value
13421         *
13422         * @return List of MegaUserAlert objects
13423         */
13424         MegaUserAlertList* getUserAlerts();
13425 
13426         /**
13427          * @brief Get the number of unread user alerts for the logged in user
13428          *
13429          * @return Number of unread user alerts
13430          */
13431         int getNumUnreadUserAlerts();
13432 
13433         /**
13434          * @brief Get a list with all inbound sharings from one MegaUser
13435          *
13436          * Valid value for order are: MegaApi::ORDER_NONE, MegaApi::ORDER_DEFAULT_ASC,
13437          * MegaApi::ORDER_DEFAULT_DESC
13438          *
13439          * You take the ownership of the returned value
13440          *
13441          * @param user MegaUser sharing folders with this account
13442          * @param order Sorting order to use
13443          * @return List of MegaNode objects that this user is sharing with this account
13444          */
13445         MegaNodeList *getInShares(MegaUser* user, int order = ORDER_NONE);
13446 
13447         /**
13448          * @brief Get a list with all inboud sharings
13449          *
13450          * Valid value for order are: MegaApi::ORDER_NONE, MegaApi::ORDER_DEFAULT_ASC,
13451          * MegaApi::ORDER_DEFAULT_DESC
13452          *
13453          * You take the ownership of the returned value
13454          *
13455          * @param order Sorting order to use
13456          * @return List of MegaNode objects that other users are sharing with this account
13457          */
13458         MegaNodeList *getInShares(int order = ORDER_NONE);
13459 
13460         /**
13461          * @brief Get a list with all active inboud sharings
13462          *
13463          * Valid value for order are: MegaApi::ORDER_NONE, MegaApi::ORDER_DEFAULT_ASC,
13464          * MegaApi::ORDER_DEFAULT_DESC
13465          *
13466          * You take the ownership of the returned value
13467          *
13468          * @param order Sorting order to use
13469          * @return List of MegaShare objects that other users are sharing with this account
13470          */
13471         MegaShareList *getInSharesList(int order = ORDER_NONE);
13472 
13473         /**
13474          * @brief Get the user relative to an incoming share
13475          *
13476          * This function will return NULL if the node is not found
13477          *
13478          * When recurse is true and the root of the specified node is not an incoming share,
13479          * this function will return NULL.
13480          * When recurse is false and the specified node doesn't represent the root of an
13481          * incoming share, this function will return NULL.
13482          *
13483          * You take the ownership of the returned value
13484          *
13485          * @param node Node to look for inshare user.
13486          * @param recurse use root node corresponding to the node passed
13487          * @return MegaUser relative to the incoming share
13488          */
13489         MegaUser *getUserFromInShare(MegaNode *node, bool recurse = false);
13490 
13491         /**
13492           * @brief Check if a MegaNode is being shared by/with your own user
13493           *
13494           * For nodes that are being shared, you can get a list of MegaShare
13495           * objects using MegaApi::getOutShares, or a list of MegaNode objects
13496           * using MegaApi::getInShares
13497           *
13498           * @param node Node to check
13499           * @return true is the MegaNode is being shared, otherwise false
13500           * @deprecated This function is intended for debugging and internal purposes and will be probably removed in future updates.
13501           * Use MegaNode::isShared instead
13502          */
13503          bool isShared(MegaNode *node);
13504 
13505          /**
13506           * @brief Check if a MegaNode is being shared with other users
13507           *
13508           * For nodes that are being shared, you can get a list of MegaShare
13509           * objects using MegaApi::getOutShares
13510           *
13511           * @param node Node to check
13512           * @return true is the MegaNode is being shared, otherwise false
13513           * @deprecated This function is intended for debugging and internal purposes and will be probably removed in future updates.
13514           * Use MegaNode::isOutShare instead
13515           */
13516          bool isOutShare(MegaNode *node);
13517 
13518          /**
13519           * @brief Check if a MegaNode belong to another User, but it is shared with you
13520           *
13521           * For nodes that are being shared, you can get a list of MegaNode
13522           * objects using MegaApi::getInShares
13523           *
13524           * @param node Node to check
13525           * @return true is the MegaNode is being shared, otherwise false
13526           * @deprecated This function is intended for debugging and internal purposes and will be probably removed in future updates.
13527           * Use MegaNode::isInShare instead
13528           */
13529          bool isInShare(MegaNode *node);
13530 
13531         /**
13532          * @brief Check if a MegaNode is pending to be shared with another User. This situation
13533          * happens when a node is to be shared with a User which is not a contact yet.
13534          *
13535          * For nodes that are pending to be shared, you can get a list of MegaNode
13536          * objects using MegaApi::getPendingShares
13537          *
13538          * @param node Node to check
13539          * @return true is the MegaNode is pending to be shared, otherwise false
13540          */
13541         bool isPendingShare(MegaNode *node);
13542 
13543         /**
13544          * @brief Get a list with all active and pending outbound sharings
13545          *
13546          * Valid value for order are: MegaApi::ORDER_NONE, MegaApi::ORDER_DEFAULT_ASC,
13547          * MegaApi::ORDER_DEFAULT_DESC
13548          *
13549          * You take the ownership of the returned value
13550          *
13551          * @param order Sorting order to use
13552          * @return List of MegaShare objects
13553          */
13554         MegaShareList *getOutShares(int order = ORDER_NONE);
13555 
13556         /**
13557          * @brief Get a list with the active and pending outbound sharings for a MegaNode
13558          *
13559          * If the node doesn't exist in the account, this function returns an empty list.
13560          *
13561          * You take the ownership of the returned value
13562          *
13563          * @param node MegaNode to check
13564          * @return List of MegaShare objects
13565          */
13566         MegaShareList *getOutShares(MegaNode *node);
13567 
13568         /**
13569          * @brief Get a list with all pending outbound sharings
13570          *
13571          * You take the ownership of the returned value
13572          *
13573          * @return List of MegaShare objects
13574          * @deprecated Use MegaNode::getOutShares instead of this function
13575          */
13576         MegaShareList *getPendingOutShares();
13577 
13578         /**
13579          * @brief Get a list with all pending outbound sharings
13580          *
13581          * You take the ownership of the returned value
13582          *
13583          * @deprecated Use MegaNode::getOutShares instead of this function
13584          * @return List of MegaShare objects
13585          */
13586         MegaShareList *getPendingOutShares(MegaNode *node);
13587 
13588         /**
13589          * @brief Get a list with all public links
13590          *
13591          * Valid value for order are: MegaApi::ORDER_NONE, MegaApi::ORDER_DEFAULT_ASC,
13592          * MegaApi::ORDER_DEFAULT_DESC, MegaApi::ORDER_LINK_CREATION_ASC,
13593          * MegaApi::ORDER_LINK_CREATION_DESC
13594          *
13595          * You take the ownership of the returned value
13596          *
13597          * @param order Sorting order to use
13598          * @return List of MegaNode objects that are shared with everyone via public link
13599          */
13600         MegaNodeList *getPublicLinks(int order = ORDER_NONE);
13601 
13602         /**
13603          * @brief Get a list with all incoming contact requests
13604          *
13605          * You take the ownership of the returned value
13606          *
13607          * @return List of MegaContactRequest objects
13608          */
13609         MegaContactRequestList *getIncomingContactRequests();
13610 
13611         /**
13612          * @brief Get a list with all outgoing contact requests
13613          *
13614          * You take the ownership of the returned value
13615          *
13616          * @return List of MegaContactRequest objects
13617          */
13618         MegaContactRequestList *getOutgoingContactRequests();
13619 
13620         /**
13621          * @brief Get the access level of a MegaNode
13622          * @param node MegaNode to check
13623          * @return Access level of the node
13624          * Valid values are:
13625          * - MegaShare::ACCESS_OWNER
13626          * - MegaShare::ACCESS_FULL
13627          * - MegaShare::ACCESS_READWRITE
13628          * - MegaShare::ACCESS_READ
13629          * - MegaShare::ACCESS_UNKNOWN
13630          */
13631         int getAccess(MegaNode* node);
13632 
13633         /**
13634          * @brief Get the size of a node tree
13635          *
13636          * If the MegaNode is a file, this function returns the size of the file.
13637          * If it's a folder, this fuction returns the sum of the sizes of all nodes
13638          * in the node tree.
13639          *
13640          * @param node Parent node
13641          * @return Size of the node tree
13642          */
13643         long long getSize(MegaNode *node);
13644 
13645         /**
13646          * @brief Get a Base64-encoded fingerprint for a local file
13647          *
13648          * The fingerprint is created taking into account the modification time of the file
13649          * and file contents. This fingerprint can be used to get a corresponding node in MEGA
13650          * using MegaApi::getNodeByFingerprint
13651          *
13652          * If the file can't be found or can't be opened, this function returns NULL
13653          *
13654          * You take the ownership of the returned value
13655          *
13656          * @param filePath Local file path
13657          * @return Base64-encoded fingerprint for the file
13658          */
13659         char* getFingerprint(const char *filePath);
13660 
13661         /**
13662          * @brief Get a Base64-encoded fingerprint for a node
13663          *
13664          * If the node doesn't exist or doesn't have a fingerprint, this function returns NULL
13665          *
13666          * You take the ownership of the returned value
13667          *
13668          * @param node Node for which we want to get the fingerprint
13669          * @return Base64-encoded fingerprint for the file
13670          * @deprecated Use MegaNode::getFingerprint instead of this function
13671          */
13672         char *getFingerprint(MegaNode *node);
13673 
13674         /**
13675          * @brief Get a Base64-encoded fingerprint from an input stream and a modification time
13676          *
13677          * If the input stream is NULL, has a negative size or can't be read, this function returns NULL
13678          *
13679          * You take the ownership of the returned value
13680          *
13681          * @param inputStream Input stream that provides the data to create the fingerprint
13682          * @param mtime Modification time that will be taken into account for the creation of the fingerprint
13683          * @return Base64-encoded fingerprint
13684          */
13685         char* getFingerprint(MegaInputStream *inputStream, int64_t mtime);
13686 
13687         /**
13688          * @brief Returns a node with the provided fingerprint
13689          *
13690          * If there isn't any node in the account with that fingerprint, this function returns NULL.
13691          *
13692          * You take the ownership of the returned value.
13693          *
13694          * @param fingerprint Fingerprint to check
13695          * @return MegaNode object with the provided fingerprint
13696          */
13697         MegaNode *getNodeByFingerprint(const char* fingerprint);
13698 
13699         /**
13700          * @brief Returns a node with the provided fingerprint
13701          *
13702          * If there isn't any node in the account with that fingerprint, this function returns NULL.
13703          * If there are several nodes with the same fingerprint, nodes in the preferred
13704          * parent folder take precedence.
13705          *
13706          * You take the ownership of the returned value.
13707          *
13708          * @param fingerprint Fingerprint to check
13709          * @param parent Preferred parent node
13710          * @return MegaNode object with the provided fingerprint
13711          */
13712         MegaNode *getNodeByFingerprint(const char *fingerprint, MegaNode* parent);
13713 
13714         /**
13715          * @brief Returns all nodes that have a fingerprint
13716          *
13717          * If there isn't any node in the account with that fingerprint, this function returns an empty MegaNodeList.
13718          *
13719          * You take the ownership of the returned value.
13720          *
13721          * @param fingerprint Fingerprint to check
13722          * @return List of nodes with the same fingerprint
13723          */
13724         MegaNodeList *getNodesByFingerprint(const char* fingerprint);
13725 
13726         /**
13727          * @brief Returns nodes that have an originalFingerprint equal to the supplied value
13728          *
13729          * Search the node tree and return a list of nodes that have an originalFingerprint, which
13730          * matches the supplied originalfingerprint.
13731          *
13732          * If the parent node supplied is not NULL, it only searches nodes below that parent folder,
13733          * otherwise all nodes are searched. If no nodes are found with that original fingerprint,
13734          * this function returns an empty MegaNodeList.
13735          *
13736          * You take the ownership of the returned value.
13737          *
13738          * @param originalfingerprint Original Fingerprint to check
13739          * @param parent Only return nodes below this specified parent folder. Pass NULL to consider all nodes.
13740          * @return List of nodes with the same original fingerprint
13741          */
13742         MegaNodeList *getNodesByOriginalFingerprint(const char* originalFingerprint, MegaNode* parent);
13743 
13744         /**
13745          * @brief Returns a node with the provided fingerprint that can be exported
13746          *
13747          * If there isn't any node in the account with that fingerprint, this function returns NULL.
13748          * If a file name is passed in the second parameter, it's also checked if nodes with a matching
13749          * fingerprint has that name. If there isn't any matching node, this function returns NULL.
13750          * This function ignores nodes that are inside the Rubbish Bin because public links to those nodes
13751          * can't be downloaded.
13752          *
13753          * You take the ownership of the returned value.
13754          *
13755          * @param fingerprint Fingerprint to check
13756          * @param name Name that the node should have (optional)
13757          * @return Exportable node that meet the requirements
13758          */
13759         MegaNode *getExportableNodeByFingerprint(const char *fingerprint, const char *name = NULL);
13760 
13761         /**
13762          * @brief Check if the account already has a node with the provided fingerprint
13763          *
13764          * A fingerprint for a local file can be generated using MegaApi::getFingerprint
13765          *
13766          * @param fingerprint Fingerprint to check
13767          * @return true if the account contains a node with the same fingerprint
13768          */
13769         bool hasFingerprint(const char* fingerprint);
13770 
13771         /**
13772          * @brief getCRC Get the CRC of a file
13773          *
13774          * The CRC of a file is a hash of its contents.
13775          * If you need a more realiable method to check files, use fingerprint functions
13776          * (MegaApi::getFingerprint, MegaApi::getNodeByFingerprint) that also takes into
13777          * account the size and the modification time of the file to create the fingerprint.
13778          *
13779          * You take the ownership of the returned value.
13780          *
13781          * @param filePath Local file path
13782          * @return Base64-encoded CRC of the file
13783          */
13784         char* getCRC(const char *filePath);
13785 
13786         /**
13787          * @brief Get the CRC from a fingerprint
13788          *
13789          * You take the ownership of the returned value.
13790          *
13791          * @param fingerprint fingerprint from which we want to get the CRC
13792          * @return Base64-encoded CRC from the fingerprint
13793          */
13794         char *getCRCFromFingerprint(const char *fingerprint);
13795 
13796         /**
13797          * @brief getCRC Get the CRC of a node
13798          *
13799          * The CRC of a node is a hash of its contents.
13800          * If you need a more realiable method to check files, use fingerprint functions
13801          * (MegaApi::getFingerprint, MegaApi::getNodeByFingerprint) that also takes into
13802          * account the size and the modification time of the node to create the fingerprint.
13803          *
13804          * You take the ownership of the returned value.
13805          *
13806          * @param node Node for which we want to get the CRC
13807          * @return Base64-encoded CRC of the node
13808          */
13809         char* getCRC(MegaNode *node);
13810 
13811         /**
13812          * @brief getNodeByCRC Returns a node with the provided CRC
13813          *
13814          * If there isn't any node in the selected folder with that CRC, this function returns NULL.
13815          * If there are several nodes with the same CRC, anyone can be returned.
13816          *
13817          * You take the ownership of the returned value.
13818          *
13819          * @param crc CRC to check
13820          * @param parent Parent node to scan. It must be a folder.
13821          * @return Node with the selected CRC in the selected folder, or NULL
13822          * if it's not found.
13823          */
13824         MegaNode* getNodeByCRC(const char *crc, MegaNode* parent);
13825 
13826         /**
13827          * @brief Check if a node has an access level
13828          *
13829          * @deprecated Use checkAccessErrorExtended
13830          *
13831          * @param node Node to check
13832          * @param level Access level to check
13833          * Valid values for this parameter are:
13834          * - MegaShare::ACCESS_OWNER
13835          * - MegaShare::ACCESS_FULL
13836          * - MegaShare::ACCESS_READWRITE
13837          * - MegaShare::ACCESS_READ
13838          *
13839          * @return MegaError object with the result.
13840          * Valid values for the error code are:
13841          * - MegaError::API_OK - The node has the required access level
13842          * - MegaError::API_EACCESS - The node doesn't have the required access level
13843          * - MegaError::API_ENOENT - The node doesn't exist in the account
13844          * - MegaError::API_EARGS - Invalid parameters
13845          */
13846         MegaError checkAccess(MegaNode* node, int level);
13847 
13848         /**
13849          * @brief Check if a node has an access level
13850          *
13851          * You take the ownership of the returned value
13852          *
13853          * @param node Node to check
13854          * @param level Access level to check
13855          * Valid values for this parameter are:
13856          * - MegaShare::ACCESS_OWNER
13857          * - MegaShare::ACCESS_FULL
13858          * - MegaShare::ACCESS_READWRITE
13859          * - MegaShare::ACCESS_READ
13860          *
13861          * @return Pointer to MegaError with the result.
13862          * Valid values for the error code are:
13863          * - MegaError::API_OK - The node has the required access level
13864          * - MegaError::API_EACCESS - The node doesn't have the required access level
13865          * - MegaError::API_ENOENT - The node doesn't exist in the account
13866          * - MegaError::API_EARGS - Invalid parameters
13867          */
13868         MegaError* checkAccessErrorExtended(MegaNode* node, int level);
13869 
13870         /**
13871          * @brief Check if a node can be moved to a target node
13872          *
13873          * @deprecated Use checkMoveErrorExtended
13874          *
13875          * @param node Node to check
13876          * @param target Target for the move operation
13877          * @return MegaError object with the result:
13878          * Valid values for the error code are:
13879          * - MegaError::API_OK - The node can be moved to the target
13880          * - MegaError::API_EACCESS - The node can't be moved because of permissions problems
13881          * - MegaError::API_ECIRCULAR - The node can't be moved because that would create a circular linkage
13882          * - MegaError::API_ENOENT - The node or the target doesn't exist in the account
13883          * - MegaError::API_EARGS - Invalid parameters
13884          */
13885         MegaError checkMove(MegaNode* node, MegaNode* target);
13886 
13887         /**
13888          * @brief Check if a node can be moved to a target node
13889          *
13890          * You take the ownership of the returned value
13891          *
13892          * @param node Node to check
13893          * @param target Target for the move operation
13894          * @return MegaError object with the result:
13895          * Valid values for the error code are:
13896          * - MegaError::API_OK - The node can be moved to the target
13897          * - MegaError::API_EACCESS - The node can't be moved because of permissions problems
13898          * - MegaError::API_ECIRCULAR - The node can't be moved because that would create a circular linkage
13899          * - MegaError::API_ENOENT - The node or the target doesn't exist in the account
13900          * - MegaError::API_EARGS - Invalid parameters
13901          */
13902         MegaError* checkMoveErrorExtended(MegaNode* node, MegaNode* target);
13903 
13904         /**
13905          * @brief Check if the MEGA filesystem is available in the local computer
13906          *
13907          * This function returns true after a successful call to MegaApi::fetchNodes,
13908          * otherwise it returns false
13909          *
13910          * @return True if the MEGA filesystem is available
13911          */
13912         bool isFilesystemAvailable();
13913 
13914         /**
13915          * @brief Returns the root node of the account
13916          *
13917          * You take the ownership of the returned value
13918          *
13919          * If you haven't successfully called MegaApi::fetchNodes before,
13920          * this function returns NULL
13921          *
13922          * @return Root node of the account
13923          */
13924         MegaNode *getRootNode();
13925 
13926         /**
13927          * @brief Returns the inbox node of the account
13928          *
13929          * You take the ownership of the returned value
13930          *
13931          * If you haven't successfully called MegaApi::fetchNodes before,
13932          * this function returns NULL
13933          *
13934          * @return Inbox node of the account
13935          */
13936         MegaNode* getInboxNode();
13937 
13938         /**
13939          * @brief Returns the rubbish node of the account
13940          *
13941          * You take the ownership of the returned value
13942          *
13943          * If you haven't successfully called MegaApi::fetchNodes before,
13944          * this function returns NULL
13945          *
13946          * @return Rubbish node of the account
13947          */
13948         MegaNode *getRubbishNode();
13949 
13950         /**
13951          * @brief Returns the root node of one node
13952          *
13953          * You take the ownership of the returned value
13954          *
13955          * @param node Node to check
13956          * @return Root node for the \c node
13957          */
13958         MegaNode *getRootNode(MegaNode *node);
13959 
13960         /**
13961          * @brief Check if a node is in the Cloud Drive tree
13962          *
13963          * @param node Node to check
13964          * @return True if the node is in the cloud drive
13965          */
13966         bool isInCloud(MegaNode *node);
13967 
13968         /**
13969          * @brief Check if a node is in the Rubbish bin tree
13970          *
13971          * @param node Node to check
13972          * @return True if the node is in the Rubbish bin
13973          */
13974         bool isInRubbish(MegaNode *node);
13975 
13976         /**
13977          * @brief Check if a node is in the Inbox tree
13978          *
13979          * @param node Node to check
13980          * @return True if the node is in the Inbox
13981          */
13982         bool isInInbox(MegaNode *node);
13983 
13984         /**
13985          * @brief Set default permissions for new files
13986          *
13987          * This function allows to change the permissions that will be received
13988          * by newly created files.
13989          *
13990          * It's possible to change group permissions, public permissions and the
13991          * executable permission for the user. "rw" permissions for the user will
13992          * be always granted to prevent synchronization problems.
13993          *
13994          * To check the effective permissions that will be applied, please use
13995          * MegaApi::getDefaultFilePermissions
13996          *
13997          * Currently, this function only works for OS X and Linux (or any other
13998          * platform using the Posix filesystem layer). On Windows, it doesn't have
13999          * any effect.
14000          *
14001          * @param permissions Permissions for new files in the same format accepted by chmod() (0755, for example)
14002          */
14003         void setDefaultFilePermissions(int permissions);
14004 
14005         /**
14006          * @brief Get default permissions for new files
14007          *
14008          * This function returns the permissions that will be applied to new files.
14009          *
14010          * Currently, this function only works on OS X and Linux (or any other
14011          * platform using the Posix filesystem layer). On Windows it returns 0600
14012          *
14013          * @return Permissions for new files in the same format accepted by chmod() (0755, for example)
14014          */
14015         int getDefaultFilePermissions();
14016 
14017         /**
14018          * @brief Set default permissions for new folders
14019          *
14020          * This function allows to change the permissions that will be received
14021          * by newly created folders.
14022          *
14023          * It's possible to change group permissions and public permissions.
14024          * "rwx" permissions for the user will be always granted to prevent
14025          * synchronization problems.
14026          *
14027          * To check the effective permissions that will be applied, please use
14028          * MegaApi::getDefaultFolderPermissions
14029          *
14030          * Currently, this function only works for OS X and Linux (or any other
14031          * platform using the Posix filesystem layer). On Windows, it doesn't have
14032          * any effect.
14033          *
14034          * @param permissions Permissions for new folders in the same format accepted by chmod() (0755, for example)
14035          */
14036         void setDefaultFolderPermissions(int permissions);
14037 
14038         /**
14039          * @brief Get default permissions for new folders
14040          *
14041          * This function returns the permissions that will be applied to new folders.
14042          *
14043          * Currently, this function only works on OS X and Linux (or any other
14044          * platform using the Posix filesystem layer). On Windows, it returns 0700
14045          *
14046          * @return Permissions for new folders in the same format accepted by chmod() (0755, for example)
14047          */
14048         int getDefaultFolderPermissions();
14049 
14050         /**
14051          * @brief Get the time (in seconds) during which transfers will be stopped due to a bandwidth overquota
14052          * @return Time (in seconds) during which transfers will be stopped, otherwise 0
14053          */
14054         long long getBandwidthOverquotaDelay();
14055 
14056         /**
14057          * @brief Search nodes containing a search string in their name
14058          *
14059          * The search is case-insensitive.
14060          *
14061          * You take the ownership of the returned value.
14062          *
14063          * @param node The parent node of the tree to explore
14064          * @param searchString Search string. The search is case-insensitive
14065          * @param recursive True if you want to seach recursively in the node tree.
14066          * False if you want to seach in the children of the node only
14067          * @param order Order for the returned list
14068          * Valid values for this parameter are:
14069          * - MegaApi::ORDER_NONE = 0
14070          * Undefined order
14071          *
14072          * - MegaApi::ORDER_DEFAULT_ASC = 1
14073          * Folders first in alphabetical order, then files in the same order
14074          *
14075          * - MegaApi::ORDER_DEFAULT_DESC = 2
14076          * Files first in reverse alphabetical order, then folders in the same order
14077          *
14078          * - MegaApi::ORDER_SIZE_ASC = 3
14079          * Sort by size, ascending
14080          *
14081          * - MegaApi::ORDER_SIZE_DESC = 4
14082          * Sort by size, descending
14083          *
14084          * - MegaApi::ORDER_CREATION_ASC = 5
14085          * Sort by creation time in MEGA, ascending
14086          *
14087          * - MegaApi::ORDER_CREATION_DESC = 6
14088          * Sort by creation time in MEGA, descending
14089          *
14090          * - MegaApi::ORDER_MODIFICATION_ASC = 7
14091          * Sort by modification time of the original file, ascending
14092          *
14093          * - MegaApi::ORDER_MODIFICATION_DESC = 8
14094          * Sort by modification time of the original file, descending
14095          *
14096          * - MegaApi::ORDER_ALPHABETICAL_ASC = 9
14097          * Same behavior than MegaApi::ORDER_DEFAULT_ASC
14098          *
14099          * - MegaApi::ORDER_ALPHABETICAL_DESC = 10
14100          * Same behavior than MegaApi::ORDER_DEFAULT_DESC
14101          *
14102          * @deprecated MegaApi::ORDER_ALPHABETICAL_ASC and MegaApi::ORDER_ALPHABETICAL_DESC
14103          * are equivalent to MegaApi::ORDER_DEFAULT_ASC and MegaApi::ORDER_DEFAULT_DESC.
14104          * They will be eventually removed.
14105          *
14106          * - MegaApi::ORDER_PHOTO_ASC = 11
14107          * Sort with photos first, then by date ascending
14108          *
14109          * - MegaApi::ORDER_PHOTO_DESC = 12
14110          * Sort with photos first, then by date descending
14111          *
14112          * - MegaApi::ORDER_VIDEO_ASC = 13
14113          * Sort with videos first, then by date ascending
14114          *
14115          * - MegaApi::ORDER_VIDEO_DESC = 14
14116          * Sort with videos first, then by date descending
14117          *
14118          * @return List of nodes that contain the desired string in their name
14119          */
14120         MegaNodeList* search(MegaNode* node, const char* searchString, bool recursive = 1, int order = ORDER_NONE);
14121 
14122         /**
14123          * @brief Search nodes containing a search string in their name
14124          *
14125          * The search is case-insensitive.
14126          *
14127          * You take the ownership of the returned value.
14128          *
14129          * This function allows to cancel the processing at any time by passing a MegaCancelToken and calling
14130          * to MegaCancelToken::setCancelFlag(true). If a valid object is passed, it must be kept alive until
14131          * this method returns.
14132          *
14133          * @param node The parent node of the tree to explore
14134          * @param searchString Search string. The search is case-insensitive
14135          * @param cancelToken MegaCancelToken to be able to cancel the processing at any time.
14136          * @param recursive True if you want to seach recursively in the node tree.
14137          * False if you want to seach in the children of the node only
14138          * @param order Order for the returned list
14139          * Valid values for this parameter are:
14140          * - MegaApi::ORDER_NONE = 0
14141          * Undefined order
14142          *
14143          * - MegaApi::ORDER_DEFAULT_ASC = 1
14144          * Folders first in alphabetical order, then files in the same order
14145          *
14146          * - MegaApi::ORDER_DEFAULT_DESC = 2
14147          * Files first in reverse alphabetical order, then folders in the same order
14148          *
14149          * - MegaApi::ORDER_SIZE_ASC = 3
14150          * Sort by size, ascending
14151          *
14152          * - MegaApi::ORDER_SIZE_DESC = 4
14153          * Sort by size, descending
14154          *
14155          * - MegaApi::ORDER_CREATION_ASC = 5
14156          * Sort by creation time in MEGA, ascending
14157          *
14158          * - MegaApi::ORDER_CREATION_DESC = 6
14159          * Sort by creation time in MEGA, descending
14160          *
14161          * - MegaApi::ORDER_MODIFICATION_ASC = 7
14162          * Sort by modification time of the original file, ascending
14163          *
14164          * - MegaApi::ORDER_MODIFICATION_DESC = 8
14165          * Sort by modification time of the original file, descending
14166          *
14167          * - MegaApi::ORDER_ALPHABETICAL_ASC = 9
14168          * Same behavior than MegaApi::ORDER_DEFAULT_ASC
14169          *
14170          * - MegaApi::ORDER_ALPHABETICAL_DESC = 10
14171          * Same behavior than MegaApi::ORDER_DEFAULT_DESC
14172          *
14173          * @deprecated MegaApi::ORDER_ALPHABETICAL_ASC and MegaApi::ORDER_ALPHABETICAL_DESC
14174          * are equivalent to MegaApi::ORDER_DEFAULT_ASC and MegaApi::ORDER_DEFAULT_DESC.
14175          * They will be eventually removed.
14176          *
14177          * - MegaApi::ORDER_PHOTO_ASC = 11
14178          * Sort with photos first, then by date ascending
14179          *
14180          * - MegaApi::ORDER_PHOTO_DESC = 12
14181          * Sort with photos first, then by date descending
14182          *
14183          * - MegaApi::ORDER_VIDEO_ASC = 13
14184          * Sort with videos first, then by date ascending
14185          *
14186          * - MegaApi::ORDER_VIDEO_DESC = 14
14187          * Sort with videos first, then by date descending
14188          *
14189          * @return List of nodes that contain the desired string in their name
14190          */
14191         MegaNodeList* search(MegaNode* node, const char* searchString, MegaCancelToken *cancelToken, bool recursive = 1, int order = ORDER_NONE);
14192 
14193         /**
14194          * @brief Search nodes containing a search string in their name
14195          *
14196          * The search is case-insensitive.
14197          *
14198          * The search will consider every accessible node for the account:
14199          *  - Cloud drive
14200          *  - Inbox
14201          *  - Rubbish bin
14202          *  - Incoming shares from other users
14203          *
14204          * You take the ownership of the returned value.
14205          *
14206          * @param searchString Search string. The search is case-insensitive
14207          * @param order Order for the returned list
14208          * Valid values for this parameter are:
14209          * - MegaApi::ORDER_NONE = 0
14210          * Undefined order
14211          *
14212          * - MegaApi::ORDER_DEFAULT_ASC = 1
14213          * Folders first in alphabetical order, then files in the same order
14214          *
14215          * - MegaApi::ORDER_DEFAULT_DESC = 2
14216          * Files first in reverse alphabetical order, then folders in the same order
14217          *
14218          * - MegaApi::ORDER_SIZE_ASC = 3
14219          * Sort by size, ascending
14220          *
14221          * - MegaApi::ORDER_SIZE_DESC = 4
14222          * Sort by size, descending
14223          *
14224          * - MegaApi::ORDER_CREATION_ASC = 5
14225          * Sort by creation time in MEGA, ascending
14226          *
14227          * - MegaApi::ORDER_CREATION_DESC = 6
14228          * Sort by creation time in MEGA, descending
14229          *
14230          * - MegaApi::ORDER_MODIFICATION_ASC = 7
14231          * Sort by modification time of the original file, ascending
14232          *
14233          * - MegaApi::ORDER_MODIFICATION_DESC = 8
14234          * Sort by modification time of the original file, descending
14235          *
14236          * - MegaApi::ORDER_ALPHABETICAL_ASC = 9
14237          * Same behavior than MegaApi::ORDER_DEFAULT_ASC
14238          *
14239          * - MegaApi::ORDER_ALPHABETICAL_DESC = 10
14240          * Same behavior than MegaApi::ORDER_DEFAULT_DESC
14241          *
14242          * @deprecated MegaApi::ORDER_ALPHABETICAL_ASC and MegaApi::ORDER_ALPHABETICAL_DESC
14243          * are equivalent to MegaApi::ORDER_DEFAULT_ASC and MegaApi::ORDER_DEFAULT_DESC.
14244          * They will be eventually removed.
14245          *
14246          * - MegaApi::ORDER_PHOTO_ASC = 11
14247          * Sort with photos first, then by date ascending
14248          *
14249          * - MegaApi::ORDER_PHOTO_DESC = 12
14250          * Sort with photos first, then by date descending
14251          *
14252          * - MegaApi::ORDER_VIDEO_ASC = 13
14253          * Sort with videos first, then by date ascending
14254          *
14255          * - MegaApi::ORDER_VIDEO_DESC = 14
14256          * Sort with videos first, then by date descending
14257          *
14258          * @return List of nodes that contain the desired string in their name
14259          */
14260         MegaNodeList* search(const char* searchString, int order = ORDER_NONE);
14261 
14262         /**
14263          * @brief Search nodes containing a search string in their name
14264          *
14265          * The search is case-insensitive.
14266          *
14267          * The search will consider every accessible node for the account:
14268          *  - Cloud drive
14269          *  - Inbox
14270          *  - Rubbish bin
14271          *  - Incoming shares from other users
14272          *
14273          * This function allows to cancel the processing at any time by passing a MegaCancelToken and calling
14274          * to MegaCancelToken::setCancelFlag(true). If a valid object is passed, it must be kept alive until
14275          * this method returns.
14276          *
14277          * You take the ownership of the returned value.
14278          *
14279          * @param searchString Search string. The search is case-insensitive
14280          * @param cancelToken MegaCancelToken to be able to cancel the processing at any time.
14281          * @param order Order for the returned list
14282          * Valid values for this parameter are:
14283          * - MegaApi::ORDER_NONE = 0
14284          * Undefined order
14285          *
14286          * - MegaApi::ORDER_DEFAULT_ASC = 1
14287          * Folders first in alphabetical order, then files in the same order
14288          *
14289          * - MegaApi::ORDER_DEFAULT_DESC = 2
14290          * Files first in reverse alphabetical order, then folders in the same order
14291          *
14292          * - MegaApi::ORDER_SIZE_ASC = 3
14293          * Sort by size, ascending
14294          *
14295          * - MegaApi::ORDER_SIZE_DESC = 4
14296          * Sort by size, descending
14297          *
14298          * - MegaApi::ORDER_CREATION_ASC = 5
14299          * Sort by creation time in MEGA, ascending
14300          *
14301          * - MegaApi::ORDER_CREATION_DESC = 6
14302          * Sort by creation time in MEGA, descending
14303          *
14304          * - MegaApi::ORDER_MODIFICATION_ASC = 7
14305          * Sort by modification time of the original file, ascending
14306          *
14307          * - MegaApi::ORDER_MODIFICATION_DESC = 8
14308          * Sort by modification time of the original file, descending
14309          *
14310          * - MegaApi::ORDER_ALPHABETICAL_ASC = 9
14311          * Same behavior than MegaApi::ORDER_DEFAULT_ASC
14312          *
14313          * - MegaApi::ORDER_ALPHABETICAL_DESC = 10
14314          * Same behavior than MegaApi::ORDER_DEFAULT_DESC
14315          *
14316          * @deprecated MegaApi::ORDER_ALPHABETICAL_ASC and MegaApi::ORDER_ALPHABETICAL_DESC
14317          * are equivalent to MegaApi::ORDER_DEFAULT_ASC and MegaApi::ORDER_DEFAULT_DESC.
14318          * They will be eventually removed.
14319          *
14320          * - MegaApi::ORDER_PHOTO_ASC = 11
14321          * Sort with photos first, then by date ascending
14322          *
14323          * - MegaApi::ORDER_PHOTO_DESC = 12
14324          * Sort with photos first, then by date descending
14325          *
14326          * - MegaApi::ORDER_VIDEO_ASC = 13
14327          * Sort with videos first, then by date ascending
14328          *
14329          * - MegaApi::ORDER_VIDEO_DESC = 14
14330          * Sort with videos first, then by date descending
14331          *
14332          * @return List of nodes that contain the desired string in their name
14333          */
14334         MegaNodeList* search(const char* searchString, MegaCancelToken *cancelToken, int order = ORDER_NONE);
14335 
14336         /**
14337          * @brief Search nodes on incoming shares containing a search string in their name
14338          *
14339          * The search is case-insensitive.
14340          *
14341          * The method will search exclusively on incoming shares
14342          *
14343          * This function allows to cancel the processing at any time by passing a MegaCancelToken and calling
14344          * to MegaCancelToken::setCancelFlag(true). If a valid object is passed, it must be kept alive until
14345          * this method returns.
14346          *
14347          * You take the ownership of the returned value.
14348          *
14349          * @param searchString Search string. The search is case-insensitive
14350          * @param cancelToken MegaCancelToken to be able to cancel the processing at any time.
14351          * @param order Order for the returned list
14352          * Valid values for this parameter are:
14353          * - MegaApi::ORDER_NONE = 0
14354          * Undefined order
14355          *
14356          * - MegaApi::ORDER_DEFAULT_ASC = 1
14357          * Folders first in alphabetical order, then files in the same order
14358          *
14359          * - MegaApi::ORDER_DEFAULT_DESC = 2
14360          * Files first in reverse alphabetical order, then folders in the same order
14361          *
14362          * - MegaApi::ORDER_SIZE_ASC = 3
14363          * Sort by size, ascending
14364          *
14365          * - MegaApi::ORDER_SIZE_DESC = 4
14366          * Sort by size, descending
14367          *
14368          * - MegaApi::ORDER_CREATION_ASC = 5
14369          * Sort by creation time in MEGA, ascending
14370          *
14371          * - MegaApi::ORDER_CREATION_DESC = 6
14372          * Sort by creation time in MEGA, descending
14373          *
14374          * - MegaApi::ORDER_MODIFICATION_ASC = 7
14375          * Sort by modification time of the original file, ascending
14376          *
14377          * - MegaApi::ORDER_MODIFICATION_DESC = 8
14378          * Sort by modification time of the original file, descending
14379          *
14380          * - MegaApi::ORDER_ALPHABETICAL_ASC = 9
14381          * Same behavior than MegaApi::ORDER_DEFAULT_ASC
14382          *
14383          * - MegaApi::ORDER_ALPHABETICAL_DESC = 10
14384          * Same behavior than MegaApi::ORDER_DEFAULT_DESC
14385          *
14386          * @deprecated MegaApi::ORDER_ALPHABETICAL_ASC and MegaApi::ORDER_ALPHABETICAL_DESC
14387          * are equivalent to MegaApi::ORDER_DEFAULT_ASC and MegaApi::ORDER_DEFAULT_DESC.
14388          * They will be eventually removed.
14389          *
14390          * - MegaApi::ORDER_PHOTO_ASC = 11
14391          * Sort with photos first, then by date ascending
14392          *
14393          * - MegaApi::ORDER_PHOTO_DESC = 12
14394          * Sort with photos first, then by date descending
14395          *
14396          * - MegaApi::ORDER_VIDEO_ASC = 13
14397          * Sort with videos first, then by date ascending
14398          *
14399          * - MegaApi::ORDER_VIDEO_DESC = 14
14400          * Sort with videos first, then by date descending
14401          *
14402          * @return List of nodes that contain the desired string in their name
14403          */
14404         MegaNodeList* searchOnInShares(const char *searchString, MegaCancelToken *cancelToken, int order = ORDER_NONE);
14405 
14406         /**
14407          * @brief Search nodes on outbound shares containing a search string in their name
14408          *
14409          * The search is case-insensitive.
14410          *
14411          * The method will search exclusively on outbound shares
14412          *
14413          * This function allows to cancel the processing at any time by passing a MegaCancelToken and calling
14414          * to MegaCancelToken::setCancelFlag(true). If a valid object is passed, it must be kept alive until
14415          * this method returns.
14416          *
14417          * You take the ownership of the returned value.
14418          *
14419          * @param searchString Search string. The search is case-insensitive
14420          * @param cancelToken MegaCancelToken to be able to cancel the processing at any time.
14421          * @param order Order for the returned list
14422          * Valid values for this parameter are:
14423          * - MegaApi::ORDER_NONE = 0
14424          * Undefined order
14425          *
14426          * - MegaApi::ORDER_DEFAULT_ASC = 1
14427          * Folders first in alphabetical order, then files in the same order
14428          *
14429          * - MegaApi::ORDER_DEFAULT_DESC = 2
14430          * Files first in reverse alphabetical order, then folders in the same order
14431          *
14432          * - MegaApi::ORDER_SIZE_ASC = 3
14433          * Sort by size, ascending
14434          *
14435          * - MegaApi::ORDER_SIZE_DESC = 4
14436          * Sort by size, descending
14437          *
14438          * - MegaApi::ORDER_CREATION_ASC = 5
14439          * Sort by creation time in MEGA, ascending
14440          *
14441          * - MegaApi::ORDER_CREATION_DESC = 6
14442          * Sort by creation time in MEGA, descending
14443          *
14444          * - MegaApi::ORDER_MODIFICATION_ASC = 7
14445          * Sort by modification time of the original file, ascending
14446          *
14447          * - MegaApi::ORDER_MODIFICATION_DESC = 8
14448          * Sort by modification time of the original file, descending
14449          *
14450          * - MegaApi::ORDER_ALPHABETICAL_ASC = 9
14451          * Same behavior than MegaApi::ORDER_DEFAULT_ASC
14452          *
14453          * - MegaApi::ORDER_ALPHABETICAL_DESC = 10
14454          * Same behavior than MegaApi::ORDER_DEFAULT_DESC
14455          *
14456          * @deprecated MegaApi::ORDER_ALPHABETICAL_ASC and MegaApi::ORDER_ALPHABETICAL_DESC
14457          * are equivalent to MegaApi::ORDER_DEFAULT_ASC and MegaApi::ORDER_DEFAULT_DESC.
14458          * They will be eventually removed.
14459          *
14460          * - MegaApi::ORDER_PHOTO_ASC = 11
14461          * Sort with photos first, then by date ascending
14462          *
14463          * - MegaApi::ORDER_PHOTO_DESC = 12
14464          * Sort with photos first, then by date descending
14465          *
14466          * - MegaApi::ORDER_VIDEO_ASC = 13
14467          * Sort with videos first, then by date ascending
14468          *
14469          * - MegaApi::ORDER_VIDEO_DESC = 14
14470          * Sort with videos first, then by date descending
14471          *
14472          * @return List of nodes that contain the desired string in their name
14473          */
14474         MegaNodeList* searchOnOutShares(const char *searchString, MegaCancelToken *cancelToken, int order = ORDER_NONE);
14475 
14476         /**
14477          * @brief Search nodes on public links containing a search string in their name
14478          *
14479          * The search is case-insensitive.
14480          *
14481          * The method will search exclusively on public links
14482          *
14483          * This function allows to cancel the processing at any time by passing a MegaCancelToken and calling
14484          * to MegaCancelToken::setCancelFlag(true). If a valid object is passed, it must be kept alive until
14485          * this method returns.
14486          *
14487          * You take the ownership of the returned value.
14488          *
14489          * @param searchString Search string. The search is case-insensitive
14490          * @param cancelToken MegaCancelToken to be able to cancel the processing at any time.
14491          * @param order Order for the returned list
14492          * Valid values for this parameter are:
14493          * - MegaApi::ORDER_NONE = 0
14494          * Undefined order
14495          *
14496          * - MegaApi::ORDER_DEFAULT_ASC = 1
14497          * Folders first in alphabetical order, then files in the same order
14498          *
14499          * - MegaApi::ORDER_DEFAULT_DESC = 2
14500          * Files first in reverse alphabetical order, then folders in the same order
14501          *
14502          * - MegaApi::ORDER_SIZE_ASC = 3
14503          * Sort by size, ascending
14504          *
14505          * - MegaApi::ORDER_SIZE_DESC = 4
14506          * Sort by size, descending
14507          *
14508          * - MegaApi::ORDER_CREATION_ASC = 5
14509          * Sort by creation time in MEGA, ascending
14510          *
14511          * - MegaApi::ORDER_CREATION_DESC = 6
14512          * Sort by creation time in MEGA, descending
14513          *
14514          * - MegaApi::ORDER_MODIFICATION_ASC = 7
14515          * Sort by modification time of the original file, ascending
14516          *
14517          * - MegaApi::ORDER_MODIFICATION_DESC = 8
14518          * Sort by modification time of the original file, descending
14519          *
14520          * - MegaApi::ORDER_ALPHABETICAL_ASC = 9
14521          * Same behavior than MegaApi::ORDER_DEFAULT_ASC
14522          *
14523          * - MegaApi::ORDER_ALPHABETICAL_DESC = 10
14524          * Same behavior than MegaApi::ORDER_DEFAULT_DESC
14525          *
14526          * @deprecated MegaApi::ORDER_ALPHABETICAL_ASC and MegaApi::ORDER_ALPHABETICAL_DESC
14527          * are equivalent to MegaApi::ORDER_DEFAULT_ASC and MegaApi::ORDER_DEFAULT_DESC.
14528          * They will be eventually removed.
14529          *
14530          * - MegaApi::ORDER_PHOTO_ASC = 11
14531          * Sort with photos first, then by date ascending
14532          *
14533          * - MegaApi::ORDER_PHOTO_DESC = 12
14534          * Sort with photos first, then by date descending
14535          *
14536          * - MegaApi::ORDER_VIDEO_ASC = 13
14537          * Sort with videos first, then by date ascending
14538          *
14539          * - MegaApi::ORDER_VIDEO_DESC = 14
14540          * Sort with videos first, then by date descending
14541          *
14542          * @return List of nodes that contain the desired string in their name
14543          */
14544         MegaNodeList* searchOnPublicLinks(const char *searchString, MegaCancelToken *cancelToken, int order = ORDER_NONE);
14545 
14546         /**
14547          * @brief Return a list of buckets, each bucket containing a list of recently added/modified nodes
14548          *
14549          * Each bucket contains files that were added/modified in a set, by a single user.
14550          *
14551          * @param days Age of actions since added/modified nodes will be considered (in days)
14552          * @param maxnodes Maximum amount of nodes to be considered
14553          *
14554          * @return List of buckets containing nodes that were added/modifed as a set
14555          */
14556         MegaRecentActionBucketList* getRecentActions(unsigned days, unsigned maxnodes);
14557 
14558         /**
14559          * @brief Return a list of buckets, each bucket containing a list of recently added/modified nodes
14560          *
14561          * Each bucket contains files that were added/modified in a set, by a single user.
14562          *
14563          * This function uses the default parameters for the MEGA apps, which consider (currently)
14564          * interactions during the last 30 days and max 10.000 nodes.
14565          *
14566          * @return List of buckets containing nodes that were added/modifed as a set
14567          */
14568         MegaRecentActionBucketList* getRecentActions();
14569 
14570         /**
14571          * @brief Process a node tree using a MegaTreeProcessor implementation
14572          * @param node The parent node of the tree to explore
14573          * @param processor MegaTreeProcessor that will receive callbacks for every node in the tree
14574          * @param recursive True if you want to recursively process the whole node tree.
14575          * False if you want to process the children of the node only
14576          *
14577          * @return True if all nodes were processed. False otherwise (the operation can be
14578          * cancelled by MegaTreeProcessor::processMegaNode())
14579          */
14580         bool processMegaTree(MegaNode* node, MegaTreeProcessor* processor, bool recursive = 1);
14581 
14582         /**
14583          * @brief Create a MegaNode that represents a file of a different account
14584          *
14585          * The resulting node can be used in MegaApi::startDownload and MegaApi::startStreaming but
14586          * can not be copied.
14587          *
14588          * At least the parameters handle, key, size, mtime and auth must be correct to be able to use the resulting node.
14589          *
14590          * You take the ownership of the returned value.
14591          *
14592          * @param handle Handle of the node
14593          * @param key Key of the node (Base64 encoded)
14594          * @param name Name of the node (Base64 encoded)
14595          * @param size Size of the node
14596          * @param mtime Modification time of the node
14597          * @param parentHandle Handle of the parent node
14598          * @param privateAuth Private authentication token to access the node
14599          * @param publicAuth Public authentication token to access the node
14600          * @param chatAuth Chat authentication token to access the node
14601          * @return MegaNode object
14602          */
14603         MegaNode *createForeignFileNode(MegaHandle handle, const char *key, const char *name,
14604                                        int64_t size, int64_t mtime, MegaHandle parentHandle, const char *privateAuth, const char *publicAuth, const char *chatAuth);
14605 
14606         /**
14607          * @brief Create a MegaNode that represents a folder of a different account
14608          *
14609          * The resulting node can not be successfully used in any other function of MegaApi.
14610          * The resulting object is only useful to store the values passed as parameters.
14611          *
14612          * You take the ownership of the returned value.
14613 
14614          * @param handle Handle of the node
14615          * @param name Name of the node (Base64 encoded)
14616          * @param parentHandle Handle of the parent node
14617          * @param privateAuth Private authentication token to access the node
14618          * @param publicAuth Public authentication token to access the node
14619          * @return MegaNode object
14620          */
14621         MegaNode *createForeignFolderNode(MegaHandle handle, const char *name, MegaHandle parentHandle, const char *privateAuth, const char *publicAuth);
14622 
14623         /**
14624          * @brief Returns a MegaNode that can be downloaded with any instance of MegaApi
14625          *
14626          * You can use MegaApi::startDownload with the resulting node with any instance
14627          * of MegaApi, even if it's logged into another account, a public folder, or not
14628          * logged in.
14629          *
14630          * If the first parameter is a public node or an already authorized node, this
14631          * function returns a copy of the node, because it can be already downloaded
14632          * with any MegaApi instance.
14633          *
14634          * If the node in the first parameter belongs to the account or public folder
14635          * in which the current MegaApi object is logged in, this funtion returns an
14636          * authorized node.
14637          *
14638          * If the first parameter is NULL or a node that is not a public node, is not
14639          * already authorized and doesn't belong to the current MegaApi, this function
14640          * returns NULL.
14641          *
14642          * You take the ownership of the returned value.
14643          *
14644          * @param node MegaNode to authorize
14645          * @return Authorized node, or NULL if the node can't be authorized
14646          */
14647         MegaNode *authorizeNode(MegaNode *node);
14648 
14649 #ifdef ENABLE_CHAT
14650         /**
14651          * @brief Returns a MegaNode that can be downloaded/copied with a chat-authorization
14652          *
14653          * During preview of chat-links, you need to call this method to authorize the MegaNode
14654          * from a node-attachment message, so the API allows to access to it. The parameter to
14655          * authorize the access can be retrieved from MegaChatRoom::getAuthorizationToken when
14656          * the chatroom in in preview mode.
14657          *
14658          * You can use MegaApi::startDownload and/or MegaApi::copyNode with the resulting
14659          * node with any instance of MegaApi, even if it's logged into another account,
14660          * a public folder, or not logged in.
14661          *
14662          * You take the ownership of the returned value.
14663          *
14664          * @param node MegaNode to authorize
14665          * @param cauth Authorization token (public handle of the chatroom in B64url encoding)
14666          * @return Authorized node, or NULL if the node can't be authorized
14667          */
14668         MegaNode *authorizeChatNode(MegaNode *node, const char *cauth);
14669 #endif
14670 
14671         /**
14672          * @brief Get the SDK version
14673          *
14674          * The returned string is an statically allocated array.
14675          * Do not delete it.
14676          *
14677          * @return SDK version
14678          */
14679         const char *getVersion();
14680 
14681         /**
14682          * @brief Get a string with the version of the operating system
14683          *
14684          * You take the ownership of the returned string
14685          *
14686          * @return Version of the operating system
14687          */
14688         char *getOperatingSystemVersion();
14689 
14690         /**
14691          * @brief Get the last available version of the app
14692          *
14693          * It returns the last available version corresponding to an app token
14694          *
14695          * The associated request type with this request is MegaRequest::TYPE_APP_VERSION
14696          * Valid data in the MegaRequest object received on callbacks:
14697          * - MegaRequest::getText - Returns the app token
14698          *
14699          * Valid data in the MegaRequest object received in onRequestFinish when the error code
14700          * is MegaError::API_OK:
14701          * - MegaRequest::getNumber - Returns the last available version code of the app
14702          * - MegaRequest::getName - Returns the last available version string of the app
14703          *
14704          * Usually, the version code is used to internally control updates, and the version
14705          * string is intended to be shown to final users.
14706          *
14707          * @param appKey Token of the app to check or NULL to use the same value as in the
14708          * initialization of the MegaApi object
14709          * @param listener MegaRequestListener to track this request
14710          */
14711         void getLastAvailableVersion(const char *appKey = NULL, MegaRequestListener *listener = NULL);
14712 
14713         /**
14714          * @brief Get a SSL certificate for communications with the webclient
14715          *
14716          * The associated request type with this request is MegaRequest::TYPE_GET_LOCAL_SSL_CERT
14717          *
14718          * Valid data in the MegaRequest object received in onRequestFinish when the error code
14719          * is MegaError::API_OK:
14720          * - MegaRequest::getNumber - Returns the expiration time of the certificate (in seconds since the Epoch)
14721          * - MegaRequest::getMegaStringMap - Returns the data of the certificate
14722          *
14723          * The data returned in the string map is encoded in PEM format.
14724          * The key "key" of the map contains the private key of the certificate.
14725          * The key "cert" of the map contains the certificate.
14726          * Intermediate certificates are provided in keys "intermediate_1" - "intermediate_X".
14727          *
14728          * @param listener MegaRequestListener to track this request
14729          */
14730         void getLocalSSLCertificate(MegaRequestListener *listener = NULL);
14731 
14732         /**
14733          * @brief Get the IP of a MegaChat server
14734          *
14735          * This function allows to get the correct IP to connect to a MEGAchat server
14736          * using Websockets.
14737          *
14738          * The associated request type with this request is MegaRequest::TYPE_QUERY_DNS
14739          *
14740          * Valid data in the MegaRequest object received in onRequestFinish when the error code
14741          * is MegaError::API_OK:
14742          * - MegaRequest::getText - Returns the IP of the hostname.
14743          * IPv6 addresses are returned between brackets
14744          *
14745          * @param hostname Hostname to resolve
14746          * @param listener MegaRequestListener to track this request
14747          */
14748         void queryDNS(const char *hostname, MegaRequestListener *listener = NULL);
14749 
14750         /**
14751          * @brief queryGeLB Query the GeLB server for a given service
14752          *
14753          * The associated request type with this request is MegaRequest::TYPE_QUERY_GELB
14754          *
14755          * Valid data in the MegaRequest object received in onRequestFinish when the error code
14756          * is MegaError::API_OK:
14757          * - MegaRequest::getNumber - Return the HTTP status code from the GeLB server
14758          * - MegaRequest::getText - Returns the JSON response from the GeLB server
14759          * - MegaRequest::getTotalBytes - Returns the number of bytes in the response
14760          *
14761          * @param service Service to check
14762          * @param timeoutds Timeout for the request, including all possible retries (in deciseconds)
14763          * A value <= 0 means no (or infinite) timeout.
14764          * @param maxretries Maximum number of retries for the request
14765          * @param listener MegaRequestListener to track this request
14766          */
14767         void queryGeLB(const char *service, int timeoutds = 40, int maxretries = 4, MegaRequestListener *listener = NULL);
14768 
14769         /**
14770          * @brief Download a file using a HTTP GET request
14771          *
14772          * The associated request type with this request is MegaRequest::TYPE_DOWNLOAD_FILE
14773          *
14774          * Valid data in the MegaRequest object received in onRequestFinish when the error code
14775          * is MegaError::API_OK:
14776          * - MegaRequest::getNumber - Return the HTTP status code from the server
14777          * - MegaRequest::getTotalBytes - Returns the number of bytes of the file
14778          *
14779          * If the request finishes with the error code MegaError::API_OK, the destination path
14780          * contains the downloaded file. If it's not possible to write in the destination path
14781          * the error code will be MegaError::API_EWRITE
14782          *
14783          * @param url URL of the file
14784          * @param dstpath Destination path for the downloaded file
14785          * @param listener MegaRequestListener to track this request
14786          */
14787         void downloadFile(const char *url, const char *dstpath, MegaRequestListener *listener = NULL);
14788 
14789         /**
14790          * @brief Get the User-Agent header used by the SDK
14791          *
14792          * The SDK retains the ownership of the returned value. It will be valid until
14793          * the MegaApi object is deleted.
14794          *
14795          * @return User-Agent used by the SDK
14796          */
14797         const char *getUserAgent();
14798 
14799         /**
14800          * @brief Get the base path set during initialization
14801          *
14802          * The SDK retains the ownership of the returned value. It will be valid until
14803          * the MegaApi object is deleted.
14804          *
14805          * @return Base path
14806          */
14807         const char *getBasePath();
14808 
14809         /**
14810          * @brief Disable special features related to images and videos
14811          *
14812          * Disabling these features will avoid the upload of previews and thumbnails
14813          * for images and videos.
14814          *
14815          * It's only recommended to disable these features before uploading files
14816          * with image or video extensions that are not really images or videos,
14817          * or that are encrypted in the local drive so they can't be analyzed anyway.
14818          *
14819          * By default, graphic features are enabled if the SDK was built with a valid
14820          * graphic processor or a valid graphic processor was provided in the constructor
14821          * of MegaApi.
14822          *
14823          * @param disable True to disable special features related to images and videos
14824          */
14825         void disableGfxFeatures(bool disable);
14826 
14827         /**
14828          * @brief Check if special graphic features are disabled
14829          *
14830          * By default, graphic features are enabled so this function will return false.
14831          * If graphic features were previously disabled, or the SDK wasn't built with
14832          * a valid graphic processor and it wasn't provided in the constructor on MegaApi,
14833          * this function will return true.
14834          *
14835          * @return True if special features related to images and videos are disabled
14836          */
14837         bool areGfxFeaturesDisabled();
14838 
14839         /**
14840          * @brief Change the API URL
14841          *
14842          * This function allows to change the API URL.
14843          * It's only useful for testing or debugging purposes.
14844          *
14845          * @param apiURL New API URL
14846          * @param disablepkp true to disable public key pinning for this URL
14847          */
14848         void changeApiUrl(const char *apiURL, bool disablepkp = false);
14849 
14850         /**
14851          * @brief Set the language code used by the app
14852          * @param languageCode Language code used by the app
14853          *
14854          * @return True if the language code is known for the SDK, otherwise false
14855          */
14856         bool setLanguage(const char* languageCode);
14857 
14858         /**
14859          * @brief Set the preferred language of the user
14860          *
14861          * Valid data in the MegaRequest object received in onRequestFinish:
14862          * - MegaRequest::getText - Return the language code
14863          *
14864          * If the language code is unknown for the SDK, the error code will be MegaError::API_ENOENT
14865          *
14866          * This attribute is automatically created by the server. Apps only need
14867          * to set the new value when the user changes the language.
14868          *
14869          * @param languageCode Language code to be set
14870          * @param listener MegaRequestListener to track this request
14871          */
14872         void setLanguagePreference(const char* languageCode, MegaRequestListener *listener = NULL);
14873 
14874         /**
14875          * @brief Get the preferred language of the user
14876          *
14877          * Valid data in the MegaRequest object received in onRequestFinish when the error code
14878          * is MegaError::API_OK:
14879          * - MegaRequest::getText - Return the language code
14880          *
14881          * @param listener MegaRequestListener to track this request
14882          */
14883         void getLanguagePreference(MegaRequestListener *listener = NULL);
14884 
14885         /**
14886          * @brief Enable or disable file versioning
14887          *
14888          * The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER
14889          *
14890          * Valid data in the MegaRequest object received on callbacks:
14891          * - MegaRequest::getParamType - Returns the value MegaApi::USER_ATTR_DISABLE_VERSIONS
14892          *
14893          * Valid data in the MegaRequest object received in onRequestFinish:
14894          * - MegaRequest::getText - "1" for disable, "0" for enable
14895          *
14896          * @param disable True to disable file versioning. False to enable it
14897          * @param listener MegaRequestListener to track this request
14898          */
14899         void setFileVersionsOption(bool disable, MegaRequestListener *listener = NULL);
14900 
14901         /**
14902          * @brief Enable or disable the automatic approval of incoming contact requests using a contact link
14903          *
14904          * The associated request type with this request is MegaRequest::TYPE_SET_ATTR_USER
14905          *
14906          * Valid data in the MegaRequest object received on callbacks:
14907          * - MegaRequest::getParamType - Returns the value MegaApi::USER_ATTR_CONTACT_LINK_VERIFICATION
14908          *
14909          * Valid data in the MegaRequest object received in onRequestFinish:
14910          * - MegaRequest::getText - "0" for disable, "1" for enable
14911          *
14912          * @param disable True to disable the automatic approval of incoming contact requests using a contact link
14913          * @param listener MegaRequestListener to track this request
14914          */
14915         void setContactLinksOption(bool disable, MegaRequestListener *listener = NULL);
14916 
14917         /**
14918          * @brief Check if file versioning is enabled or disabled
14919          *
14920          * The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
14921          *
14922          * Valid data in the MegaRequest object received on callbacks:
14923          * - MegaRequest::getParamType - Returns the value MegaApi::USER_ATTR_DISABLE_VERSIONS
14924          *
14925          * Valid data in the MegaRequest object received in onRequestFinish when the error code
14926          * is MegaError::API_OK:
14927          * - MegaRequest::getText - "1" for disable, "0" for enable
14928          * - MegaRequest::getFlag - True if disabled, false if enabled
14929          *
14930          * If the option has never been set, the error code will be MegaError::API_ENOENT.
14931          * In that case, file versioning is enabled by default and MegaRequest::getFlag returns false.
14932          *
14933          * @param listener MegaRequestListener to track this request
14934          */
14935         void getFileVersionsOption(MegaRequestListener *listener = NULL);
14936 
14937         /**
14938          * @brief Check if the automatic approval of incoming contact requests using contact links is enabled or disabled
14939          *
14940          * If the option has never been set, the error code will be MegaError::API_ENOENT.
14941          *
14942          * The associated request type with this request is MegaRequest::TYPE_GET_ATTR_USER
14943          *
14944          * Valid data in the MegaRequest object received on callbacks:
14945          * - MegaRequest::getParamType - Returns the value MegaApi::USER_ATTR_CONTACT_LINK_VERIFICATION
14946          *
14947          * Valid data in the MegaRequest object received in onRequestFinish when the error code
14948          * is MegaError::API_OK:
14949          * - MegaRequest::getText - "0" for disable, "1" for enable
14950          * - MegaRequest::getFlag - false if disabled, true if enabled
14951          *
14952          * @param listener MegaRequestListener to track this request
14953          */
14954         void getContactLinksOption(MegaRequestListener *listener = NULL);
14955 
14956         /**
14957          * @brief Keep retrying when public key pinning fails
14958          *
14959          * By default, when the check of the MEGA public key fails, it causes an automatic
14960          * logout. Pass false to this function to disable that automatic logout and
14961          * keep the SDK retrying the request.
14962          *
14963          * Even if the automatic logout is disabled, a request of the type MegaRequest::TYPE_LOGOUT
14964          * will be automatically created and callbacks (onRequestStart, onRequestFinish) will
14965          * be sent. However, logout won't be really executed and in onRequestFinish the error code
14966          * for the request will be MegaError::API_EINCOMPLETE
14967          *
14968          * @param enable true to keep retrying failed requests due to a fail checking the MEGA public key
14969          * or false to perform an automatic logout in that case
14970          */
14971         void retrySSLerrors(bool enable);
14972 
14973         /**
14974          * @brief Enable / disable the public key pinning
14975          *
14976          * Public key pinning is enabled by default for all sensible communications.
14977          * It is strongly discouraged to disable this feature.
14978          *
14979          * @param enable true to keep public key pinning enabled, false to disable it
14980          */
14981         void setPublicKeyPinning(bool enable);
14982 
14983         /**
14984          * @brief Pause the reception of action packets
14985          *
14986          * This function is intended to help apps to initialize themselves
14987          * after the reception of nodes (MegaApi::fetchNodes) but before the reception
14988          * of action packets.
14989          *
14990          * For that purpose, this function can be called synchronously in the callback
14991          * onRequestFinish related to the fetchNodes request.
14992          *
14993          * After your initialization is finished, you can call MegaApi::resumeActionPackets
14994          * to start receiving external updates.
14995          *
14996          * If you forget to call MegaApi::resumeActionPackets after the usage of this function
14997          * the SDK won't work properly. Do not use this function for other purposes.
14998          */
14999         void pauseActionPackets();
15000 
15001         /**
15002          * @brief Resume the reception of action packets
15003          * @see MegaApi::pauseActionPackets
15004          */
15005         void resumeActionPackets();
15006 
15007 	#ifdef _WIN32
15008 		/**
15009 		 * @brief Convert an UTF16 string to UTF8 (Windows only)
15010          *
15011          * If the conversion fails, the size of the string will be 0
15012          * If the input string is empty, the size of the result will be also 0
15013          * You can know that the conversion failed checking if the size of the input
15014          * is not 0 and the size of the output is zero
15015          *
15016 		 * @param utf16data UTF16 buffer
15017 		 * @param utf16size Size of the UTF16 buffer (in characters)
15018 		 * @param utf8string Pointer to a string that will be filled with UTF8 characters
15019 		 */
15020         static void utf16ToUtf8(const wchar_t* utf16data, int utf16size, std::string* utf8string);
15021 
15022         /**
15023          * @brief Convert an UTF8 string to UTF16 (Windows only)
15024          *
15025          * The converted string will always be a valid UTF16 string. It will have a trailing null byte
15026          * added to the string, that along with the null character of the string itself forms a valid
15027          * UTF16 string terminator character. Thus, it's valid to pass utf16string->data() to any function
15028          * accepting a UTF16 string.
15029          *
15030          * If the conversion fails, the size of the string will be 1 (null character)
15031          * If the input string is empty, the size of the result will be also 1 (null character)
15032          * You can know that the conversion failed checking if the size of the input
15033          * is not 0 (or NULL) and the size of the output is zero
15034          *
15035          * @param utf8data NULL-terminated UTF8 character array
15036          * @param utf16string Pointer to a string that will be filled with UTF16 characters
15037          */
15038         static void utf8ToUtf16(const char* utf8data, std::string* utf16string);
15039     #endif
15040 
15041         /**
15042          * @brief Make a name suitable for a file name in the local filesystem
15043          *
15044          * This function escapes (%xx) the characters contained in the following list: \/:?\"<>|*
15045          * You can revert this operation using MegaApi::unescapeFsIncompatible
15046          *
15047          * The input string must be UTF8 encoded. The returned value will be UTF8 too.
15048          *
15049          * You take the ownership of the returned value
15050          *
15051          * @param filename Name to convert (UTF8)
15052          * @return Converted name (UTF8)
15053          * @deprecated There is a new prototype that includes path for filesystem detection
15054          */
15055         char* escapeFsIncompatible(const char *filename);
15056 
15057         /**
15058          * @brief Make a name suitable for a file name in the local filesystem
15059          *
15060          * This function escapes (%xx) forbidden characters in the local filesystem if needed.
15061          * You can revert this operation using MegaApi::unescapeFsIncompatible
15062          *
15063          * If no dstPath is provided or filesystem type it's not supported this method will
15064          * escape characters contained in the following list: \/:?\"<>|*
15065          * Otherwise it will check forbidden characters for local filesystem type
15066          *
15067          * The input string must be UTF8 encoded. The returned value will be UTF8 too.
15068          *
15069          * You take the ownership of the returned value
15070          *
15071          * @param filename Name to convert (UTF8)
15072          * @param dstPath Destination path
15073          * @return Converted name (UTF8)
15074          */
15075         char* escapeFsIncompatible(const char *filename, const char *dstPath);
15076 
15077         /**
15078          * @brief Unescape a file name escaped with MegaApi::escapeFsIncompatible
15079          *
15080          * This method will unescape those sequences that once has been unescaped results
15081          * in any character of the following list: \/:?\"<>|*
15082          *
15083          * The input string must be UTF8 encoded. The returned value will be UTF8 too.
15084          * You take the ownership of the returned value
15085          *
15086          * @param name Escaped name to convert (UTF8)
15087          * @return Converted name (UTF8)
15088          * @deprecated There is a new prototype that includes path for filesystem detection
15089          */
15090         char* unescapeFsIncompatible(const char* name);
15091 
15092         /**
15093          * @brief Unescape a file name escaped with MegaApi::escapeFsIncompatible
15094          *
15095          * If no localPath is provided or filesystem type it's not supported, this method will
15096          * unescape those sequences that once has been unescaped results in any character
15097          * of the following list: \/:?\"<>|*
15098          * Otherwise it will unescape those characters forbidden in local filesystem type
15099          *
15100          * The input string must be UTF8 encoded. The returned value will be UTF8 too.
15101          * You take the ownership of the returned value
15102          *
15103          * @param name Escaped name to convert (UTF8)
15104          * @param localPath Local path
15105          * @return Converted name (UTF8)
15106          */
15107         char* unescapeFsIncompatible(const char *name, const char *localPath);
15108 
15109 
15110         /**
15111          * @brief Create a thumbnail for an image
15112          * @param imagePath Image path
15113          * @param dstPath Destination path for the thumbnail (including the file name)
15114          * @return True if the thumbnail was successfully created, otherwise false.
15115          */
15116         bool createThumbnail(const char *imagePath, const char *dstPath);
15117 
15118         /**
15119          * @brief Create a preview for an image
15120          * @param imagePath Image path
15121          * @param dstPath Destination path for the preview (including the file name)
15122          * @return True if the preview was successfully created, otherwise false.
15123          */
15124         bool createPreview(const char *imagePath, const char *dstPath);
15125 
15126         /**
15127          * @brief Create an avatar from an image
15128          * @param imagePath Image path
15129          * @param dstPath Destination path for the avatar (including the file name)
15130          * @return True if the avatar was successfully created, otherwise false.
15131          */
15132         bool createAvatar(const char *imagePath, const char *dstPath);
15133 
15134         /**
15135          * @brief Request the URL suitable for uploading a media file.
15136          *
15137          * This function requests the URL needed for uploading the file. The URL will need the urlSuffix
15138          * from the MegaBackgroundMediaUpload::encryptFile to be appended before actually sending.
15139          *
15140          * The associated request type with this request is MegaRequest::TYPE_GET_BACKGROUND_UPLOAD_URL
15141          * Valid data in the MegaRequest object received in onRequestFinish when the error code
15142          * is MegaError::API_OK:
15143          * - MegaRequest::getMegaBackgroundMediaUpload - The updated state of the upload with the URL in the MegaBackgroundMediaUpload::getUploadUrl
15144          *
15145          * Call this function just once (per file) to find out the URL to upload to, and upload all the pieces to the same
15146          * URL. If errors are encountered and the operation must be restarted from scratch, then a new URL should be requested.
15147          * A new URL could specify a different upload server for example.
15148          *
15149          * @param fullFileSize The size of the file
15150          * @param state A pointer to the MegaBackgroundMediaUpload object tracking this upload
15151          * @param listener MegaRequestListener to track this request
15152          */
15153         void backgroundMediaUploadRequestUploadURL(int64_t fullFileSize, MegaBackgroundMediaUpload* state, MegaRequestListener *listener);
15154 
15155         /**
15156          * @brief Create the node after completing the background upload of the file.
15157          *
15158          * Call this function after completing the background upload of all the file data
15159          * The node representing the file will be created in the cloud, with all the suitable
15160          * attributes and file attributes attached.
15161          *
15162          * The associated request type with this request is MegaRequest::TYPE_COMPLETE_BACKGROUND_UPLOAD
15163          * Valid data in the MegaRequest object received on callbacks:
15164          * - MegaRequest::getMegaBackgroundMediaUploadPtr() - Returns the provided state
15165          * - MegaRequest::getPassword - Returns the original fingerprint
15166          * - MegaRequest::getNewPassword - Returns the fingerprint
15167          * - MegaRequest::getName - Returns the name
15168          * - MegaRequest::getParentHandle - Returns the parent nodehandle
15169          * - MegaRequest::getSessionKey - Returns the upload token converted to B64url encoding
15170          *
15171          * Valid data in the MegaRequest object received in onRequestFinish when the error code
15172          * is MegaError::API_OK:
15173          * - MegaRequest::getNodeHandle - Returns the handle of the uploaded node
15174          *
15175          * @param state The MegaBackgroundMediaUpload object tracking this upload
15176          * @param utf8Name The leaf name of the file, utf-8 encoded
15177          * @param parent The folder node under which this new file should appear
15178          * @param fingerprint The fingerprint for the uploaded file (use MegaApi::getFingerprint to generate this)
15179          * @param fingerprintoriginal If the file uploaded is modified from the original,
15180          *        pass the fingerprint of the original file here, otherwise NULL.
15181          * @param string64UploadToken The token returned from the upload of the last portion of the file,
15182          *        which is exactly 36 binary bytes, converted to a base 64 string with MegaApi::binaryToString64.
15183          * @param listener MegaRequestListener to track this request
15184          */
15185         void backgroundMediaUploadComplete(MegaBackgroundMediaUpload* state, const char *utf8Name, MegaNode *parent,
15186             const char *fingerprint, const char *fingerprintoriginal, const char *string64UploadToken, MegaRequestListener *listener);
15187 
15188         /**
15189          * @brief Call this to enable the library to attach media info attributes
15190          *
15191          * Those attributes allows to know if a file is a video, and play it with the correct codec.
15192          *
15193          * If media info is not ready, this function returns false and automatically retrieves the mappings for type names
15194          * and MEGA encodings, required to analyse media files. When media info is received, the callbacks
15195          * MegaListener::onEvent and MegaGlobalListener::onEvent are called with the MegaEvent::EVENT_MEDIA_INFO_READY.
15196          *
15197          * @return True if the library is ready, otherwise false (the request for media translation data is sent to MEGA)
15198          */
15199         bool ensureMediaInfo();
15200 
15201         /**
15202          * @brief Set the OriginalFingerprint of a node.
15203          *
15204          * Use this call to attach an originalFingerprint to a node. The fingerprint must
15205          * be generated from the file prior to modification, where this node is the modified file.
15206          *
15207          * The associated request type with this request is MegaRequest::TYPE_SET_ATTR_NODE
15208          * Valid data in the MegaRequest object received on callbacks:
15209          * - MegaRequest::getNodeHandle - Returns the handle of the node
15210          * - MegaRequest::getText - Returns the specified fingerprint
15211          * - MegaRequest::getFlag - Returns true (official attribute)
15212          * - MegaRequest::getParamType - Returns MegaApi::NODE_ATTR_ORIGINALFINGERPRINT
15213          *
15214          * @param node The node to attach the originalFingerprint to.
15215          * @param originalFingerprint The fingerprint of the file before modification
15216          * @param listener MegaRequestListener to track this request
15217          */
15218         void setOriginalFingerprint(MegaNode* node, const char* originalFingerprint, MegaRequestListener *listener);
15219 
15220         /**
15221          * @brief Convert a Base64 string to Base32
15222          *
15223          * If the input pointer is NULL, this function will return NULL.
15224          * If the input character array isn't a valid base64 string
15225          * the effect is undefined
15226          *
15227          * You take the ownership of the returned value
15228          *
15229          * @param base64 NULL-terminated Base64 character array
15230          * @return NULL-terminated Base32 character array
15231          */
15232         static char *base64ToBase32(const char *base64);
15233 
15234         /**
15235          * @brief Convert a Base32 string to Base64
15236          *
15237          * If the input pointer is NULL, this function will return NULL.
15238          * If the input character array isn't a valid base32 string
15239          * the effect is undefined
15240          *
15241          * You take the ownership of the returned value
15242          *
15243          * @param base32 NULL-terminated Base32 character array
15244          * @return NULL-terminated Base64 character array
15245          */
15246         static char *base32ToBase64(const char *base32);
15247 
15248         /**
15249          * @brief Function to copy a buffer
15250          *
15251          * The new buffer is allocated by new[] so you should release
15252          * it with delete[].
15253          * If the function is passed NULL, it will return NULL.
15254          *
15255          * @param buffer Character buffer to copy
15256          * @return Copy of the character buffer
15257          */
15258         static char* strdup(const char* buffer);
15259 
15260         /**
15261          * @brief Recursively remove all local files/folders inside a local path
15262          * @param path Local path of a folder to start the recursive deletion
15263          * The folder itself is not deleted
15264          */
15265         static void removeRecursively(const char *path);
15266 
15267         /**
15268          * @brief Check if the connection with MEGA servers is OK
15269          *
15270          * It can briefly return false even if the connection is good enough when
15271          * some storage servers are temporarily not available or the load of API
15272          * servers is high.
15273          *
15274          * @return true if the connection is perfectly OK, otherwise false
15275          */
15276         bool isOnline();
15277 
15278 #ifdef HAVE_LIBUV
15279 
15280         enum {
15281             TCP_SERVER_DENY_ALL = -1,
15282             TCP_SERVER_ALLOW_ALL = 0,
15283             TCP_SERVER_ALLOW_CREATED_LOCAL_LINKS = 1,
15284             TCP_SERVER_ALLOW_LAST_LOCAL_LINK = 2
15285         };
15286 
15287         //kept for backwards compatibility
15288         enum {
15289             HTTP_SERVER_DENY_ALL = -1,
15290             HTTP_SERVER_ALLOW_ALL = 0,
15291             HTTP_SERVER_ALLOW_CREATED_LOCAL_LINKS = 1,
15292             HTTP_SERVER_ALLOW_LAST_LOCAL_LINK = 2
15293         };
15294 
15295         /**
15296          * @brief Start an HTTP proxy server in specified port
15297          *
15298          * If this function returns true, that means that the server is
15299          * ready to accept connections. The initialization is synchronous.
15300          *
15301          * The server will serve files using this URL format:
15302          * http://127.0.0.1/<NodeHandle>/<NodeName>
15303          *
15304          * The node name must be URL encoded and must match with the node handle.
15305          * You can generate a correct link for a MegaNode using MegaApi::httpServerGetLocalLink
15306          *
15307          * If the node handle belongs to a folder node, a web with the list of files
15308          * inside the folder is returned.
15309          *
15310          * It's important to know that the HTTP proxy server has several configuration options
15311          * that can restrict the nodes that will be served and the connections that will be accepted.
15312          *
15313          * These are the default options:
15314          * - The restricted mode of the server is set to MegaApi::TCP_SERVER_ALLOW_CREATED_LOCAL_LINKS
15315          * (see MegaApi::httpServerSetRestrictedMode)
15316          *
15317          * - Folder nodes are NOT allowed to be served (see MegaApi::httpServerEnableFolderServer)
15318          * - File nodes are allowed to be served (see MegaApi::httpServerEnableFileServer)
15319          * - Subtitles support is disabled (see MegaApi::httpServerEnableSubtitlesSupport)
15320          *
15321          * The HTTP server will only stream a node if it's allowed by all configuration options.
15322          *
15323          * @param localOnly true to listen on 127.0.0.1 only, false to listen on all network interfaces
15324          * @param port Port in which the server must accept connections
15325          * @param useTLS Use TLS (default false).
15326          * If the SDK compilation does not support TLS,
15327          * enabling this flag will cause the function to return false.
15328          * @param certificatepath path to certificate (PEM format)
15329          * @param keypath path to certificate key
15330          * @param useIPv6 true to use [::1] as host, false to use 127.0.0.1
15331          * @return True if the server is ready, false if the initialization failed
15332          */
15333         bool httpServerStart(bool localOnly = true, int port = 4443, bool useTLS = false, const char *certificatepath = NULL, const char * keypath = NULL, bool useIPv6 = false);
15334 
15335         /**
15336          * @brief Stop the HTTP proxy server
15337          *
15338          * When this function returns, the server is already shutdown.
15339          * If the HTTP proxy server isn't running, this functions does nothing
15340          */
15341         void httpServerStop();
15342 
15343         /**
15344          * @brief Check if the HTTP proxy server is running
15345          * @return 0 if the server is not running. Otherwise the port in which it's listening to
15346          */
15347         int httpServerIsRunning();
15348 
15349         /**
15350          * @brief Check if the HTTP proxy server is listening on all network interfaces
15351          * @return true if the HTTP proxy server is listening on 127.0.0.1 only, or it's not started.
15352          * If it's started and listening on all network interfaces, this function returns false
15353          */
15354         bool httpServerIsLocalOnly();
15355 
15356         /**
15357          * @brief Allow/forbid to serve files
15358          *
15359          * By default, files are served (when the server is running)
15360          *
15361          * Even if files are allowed to be served by this function, restrictions related to
15362          * other configuration options (MegaApi::httpServerSetRestrictedMode) are still applied.
15363          *
15364          * @param enable true to allow to server files, false to forbid it
15365          */
15366         void httpServerEnableFileServer(bool enable);
15367 
15368         /**
15369          * @brief Check if it's allowed to serve files
15370          *
15371          * This function can return true even if the HTTP proxy server is not running
15372          *
15373          * Even if files are allowed to be served by this function, restrictions related to
15374          * other configuration options (MegaApi::httpServerSetRestrictedMode) are still applied.
15375          *
15376          * @return true if it's allowed to serve files, otherwise false
15377          */
15378         bool httpServerIsFileServerEnabled();
15379 
15380         /**
15381          * @brief Allow/forbid to serve folders
15382          *
15383          * By default, folders are NOT served
15384          *
15385          * Even if folders are allowed to be served by this function, restrictions related to
15386          * other configuration options (MegaApi::httpServerSetRestrictedMode) are still applied.
15387          *
15388          * @param enable true to allow to server folders, false to forbid it
15389          */
15390         void httpServerEnableFolderServer(bool enable);
15391 
15392         /**
15393          * @brief Check if it's allowed to serve folders
15394          *
15395          * This function can return true even if the HTTP proxy server is not running
15396          *
15397          * Even if folders are allowed to be served by this function, restrictions related to
15398          * other configuration options (MegaApi::httpServerSetRestrictedMode) are still applied.
15399          *
15400          * @return true if it's allowed to serve folders, otherwise false
15401          */
15402         bool httpServerIsFolderServerEnabled();
15403 
15404         /**
15405          * @brief Stablish FILE_ATTRIBUTE_OFFLINE attribute
15406          *
15407          * By default, it is not enabled
15408          *
15409          * This is used when serving files in WEBDAV, it will cause windows clients to not load a file
15410          * when it is selected. It is intended to reduce unnecessary traffic.
15411          *
15412          * @param enable true to enable the FILE_ATTRIBUTE_OFFLINE attribute, false to disable it
15413          */
15414         void httpServerEnableOfflineAttribute(bool enable);
15415 
15416         /**
15417          * @brief Check if FILE_ATTRIBUTE_OFFLINE it's enabled
15418          *
15419          * @return true if the FILE_ATTRIBUTE_OFFLINE attribute is enabled, otherwise false
15420          */
15421         bool httpServerIsOfflineAttributeEnabled();
15422 
15423         /**
15424          * @brief Enable/disable the restricted mode of the HTTP server
15425          *
15426          * This function allows to restrict the nodes that are allowed to be served.
15427          * For not allowed links, the server will return "407 Forbidden".
15428          *
15429          * Possible values are:
15430          * - HTTP_SERVER_DENY_ALL = -1
15431          * All nodes are forbidden
15432          *
15433          * - HTTP_SERVER_ALLOW_ALL = 0
15434          * All nodes are allowed to be served
15435          *
15436          * - HTTP_SERVER_ALLOW_CREATED_LOCAL_LINKS = 1 (default)
15437          * Only links created with MegaApi::httpServerGetLocalLink are allowed to be served
15438          *
15439          * - HTTP_SERVER_ALLOW_LAST_LOCAL_LINK = 2
15440          * Only the last link created with MegaApi::httpServerGetLocalLink is allowed to be served
15441          *
15442          * If a different value from the list above is passed to this function, it won't have any effect and the previous
15443          * state of this option will be preserved.
15444          *
15445          * The default value of this property is MegaApi::HTTP_SERVER_ALLOW_CREATED_LOCAL_LINKS
15446          *
15447          * The state of this option is preserved even if the HTTP server is restarted, but
15448          * the HTTP proxy server only remembers the generated links since the last call to
15449          * MegaApi::httpServerStart
15450          *
15451          * Even if nodes are allowed to be served by this function, restrictions related to
15452          * other configuration options (MegaApi::httpServerEnableFileServer,
15453          * MegaApi::httpServerEnableFolderServer) are still applied.
15454          *
15455          * @param mode Required state for the restricted mode of the HTTP proxy server
15456          */
15457         void httpServerSetRestrictedMode(int mode);
15458 
15459         /**
15460          * @brief Check if the HTTP proxy server is working in restricted mode
15461          *
15462          * Possible return values are:
15463          * - HTTP_SERVER_DENY_ALL = -1
15464          * All nodes are forbidden
15465          *
15466          * - HTTP_SERVER_ALLOW_ALL = 0
15467          * All nodes are allowed to be served
15468          *
15469          * - HTTP_SERVER_ALLOW_CREATED_LOCAL_LINKS = 1
15470          * Only links created with MegaApi::httpServerGetLocalLink are allowed to be served
15471          *
15472          * - HTTP_SERVER_ALLOW_LAST_LOCAL_LINK = 2
15473          * Only the last link created with MegaApi::httpServerGetLocalLink is allowed to be served
15474          *
15475          * The default value of this property is MegaApi::HTTP_SERVER_ALLOW_CREATED_LOCAL_LINKS
15476          *
15477          * See MegaApi::httpServerEnableRestrictedMode and MegaApi::httpServerStart
15478          *
15479          * Even if nodes are allowed to be served by this function, restrictions related to
15480          * other configuration options (MegaApi::httpServerEnableFileServer,
15481          * MegaApi::httpServerEnableFolderServer) are still applied.
15482          *
15483          * @return State of the restricted mode of the HTTP proxy server
15484          */
15485         int httpServerGetRestrictedMode();
15486 
15487         /**
15488          * @brief Enable/disable the support for subtitles
15489          *
15490          * Subtitles support allows to stream some special links that otherwise wouldn't be valid.
15491          * For example, let's suppose that the server is streaming this video:
15492          * http://120.0.0.1:4443/<Base64Handle>/MyHolidays.avi
15493          *
15494          * Some media players scan HTTP servers looking for subtitle files and request links like these ones:
15495          * http://120.0.0.1:4443/<Base64Handle>/MyHolidays.txt
15496          * http://120.0.0.1:4443/<Base64Handle>/MyHolidays.srt
15497          *
15498          * Even if a file with that name is in the same folder of the MEGA account, the node wouldn't be served because
15499          * the node handle wouldn't match.
15500          *
15501          * When this feature is enabled, the HTTP proxy server will check if there are files with that name
15502          * in the same folder as the node corresponding to the handle in the link.
15503          *
15504          * If a matching file is found, the name is exactly the same as the the node with the specified handle
15505          * (except the extension), the node with that handle is allowed to be streamed and this feature is enabled
15506          * the HTTP proxy server will serve that file.
15507          *
15508          * This feature is disabled by default.
15509          *
15510          * @param enable True to enable subtitles support, false to disable it
15511          */
15512         void httpServerEnableSubtitlesSupport(bool enable);
15513 
15514         /**
15515          * @brief Check if the support for subtitles is enabled
15516          *
15517          * See MegaApi::httpServerEnableSubtitlesSupport.
15518          *
15519          * This feature is disabled by default.
15520          *
15521          * @return true of the support for subtibles is enables, otherwise false
15522          */
15523         bool httpServerIsSubtitlesSupportEnabled();
15524 
15525         /**
15526          * @brief Add a listener to receive information about the HTTP proxy server
15527          *
15528          * This is the valid data that will be provided on callbacks:
15529          * - MegaTransfer::getType - It will be MegaTransfer::TYPE_LOCAL_TCP_DOWNLOAD
15530          * - MegaTransfer::getPath - URL requested to the HTTP proxy server
15531          * - MegaTransfer::getFileName - Name of the requested file (if any, otherwise NULL)
15532          * - MegaTransfer::getNodeHandle - Handle of the requested file (if any, otherwise NULL)
15533          * - MegaTransfer::getTotalBytes - Total bytes of the response (response headers + file, if required)
15534          * - MegaTransfer::getStartPos - Start position (for range requests only, otherwise -1)
15535          * - MegaTransfer::getEndPos - End position (for range requests only, otherwise -1)
15536          *
15537          * On the onTransferFinish error, the error code associated to the MegaError can be:
15538          * - MegaError::API_EINCOMPLETE - If the whole response wasn't sent
15539          * (it's normal to get this error code sometimes because media players close connections when they have
15540          * the data that they need)
15541          *
15542          * - MegaError::API_EREAD - If the connection with MEGA storage servers failed
15543          * - MegaError::API_EAGAIN - If the download speed is too slow for streaming
15544          * - A number > 0 means an HTTP error code returned to the client
15545          *
15546          * @param listener Listener to receive information about the HTTP proxy server
15547          */
15548         void httpServerAddListener(MegaTransferListener *listener);
15549 
15550         /**
15551          * @brief Stop the reception of callbacks related to the HTTP proxy server on this listener
15552          * @param listener Listener that won't continue receiving information
15553          */
15554         void httpServerRemoveListener(MegaTransferListener *listener);
15555 
15556         /**
15557          * @brief Returns a URL to a node in the local HTTP proxy server
15558          *
15559          * The HTTP proxy server must be running before using this function, otherwise
15560          * it will return NULL.
15561          *
15562          * You take the ownership of the returned value
15563          *
15564          * @param node Node to generate the local HTTP link
15565          * @return URL to the node in the local HTTP proxy server, otherwise NULL
15566          */
15567         char *httpServerGetLocalLink(MegaNode *node);
15568 
15569         /**
15570          * @brief Returns a WEBDAV valid URL to a node in the local HTTP proxy server
15571          *
15572          * The HTTP proxy server must be running before using this function, otherwise
15573          * it will return NULL.
15574          *
15575          * You take the ownership of the returned value
15576          *
15577          * @param node Node to generate the local HTTP link
15578          * @return URL to the node in the local HTTP proxy server, otherwise NULL
15579          */
15580         char *httpServerGetLocalWebDavLink(MegaNode *node);
15581 
15582         /**
15583          * @brief Returns the list with the links of locations served via WEBDAV
15584          *
15585          * The HTTP server must be running before using this function, otherwise
15586          * it will return NULL.
15587          *
15588          * You take the ownership of the returned value
15589          *
15590          * @return URL to the node in the local HTTP server, otherwise NULL
15591          */
15592         MegaStringList *httpServerGetWebDavLinks();
15593 
15594         /**
15595          * @brief Returns the list of nodes served via WEBDAV
15596          *
15597          * The HTTP server must be running before using this function, otherwise
15598          * it will return NULL.
15599          *
15600          * You take the ownership of the returned value
15601          *
15602          * @return URL to the node in the local HTTP server, otherwise NULL
15603          */
15604         MegaNodeList *httpServerGetWebDavAllowedNodes();
15605 
15606         /**
15607          * @brief Stops serving a node via webdav.
15608          * The webdav link will no longer be valid.
15609          *
15610          * @param handle Handle of the node to stop serving
15611          */
15612         void httpServerRemoveWebDavAllowedNode(MegaHandle handle);
15613 
15614         /**
15615          * @brief Stops serving all nodes served via webdav.
15616          * The webdav links will no longer be valid.
15617          *
15618          */
15619         void httpServerRemoveWebDavAllowedNodes();
15620 
15621         /**
15622          * @brief Set the maximum buffer size for the internal buffer
15623          *
15624          * The HTTP proxy server has an internal buffer to store the data received from MEGA
15625          * while it's being sent to clients. When the buffer is full, the connection with
15626          * the MEGA storage server is closed, when the buffer has few data, the connection
15627          * with the MEGA storage server is started again.
15628          *
15629          * Even with very fast connections, due to the possible latency starting new connections,
15630          * if this buffer is small the streaming can have problems due to the overhead caused by
15631          * the excessive number of POST requests.
15632          *
15633          * It's recommended to set this buffer at least to 1MB
15634          *
15635          * For connections that request less data than the buffer size, the HTTP proxy server
15636          * will only allocate the required memory to complete the request to minimize the
15637          * memory usage.
15638          *
15639          * The new value will be taken into account since the next request received by
15640          * the HTTP proxy server, not for ongoing requests. It's possible and effective
15641          * to call this function even before the server has been started, and the value
15642          * will be still active even if the server is stopped and started again.
15643          *
15644          * @param bufferSize Maximum buffer size (in bytes) or a number <= 0 to use the
15645          * internal default value
15646          */
15647         void httpServerSetMaxBufferSize(int bufferSize);
15648 
15649         /**
15650          * @brief Get the maximum size of the internal buffer size
15651          *
15652          * See MegaApi::httpServerSetMaxBufferSize
15653          *
15654          * @return Maximum size of the internal buffer size (in bytes)
15655          */
15656         int httpServerGetMaxBufferSize();
15657 
15658         /**
15659          * @brief Set the maximum size of packets sent to clients
15660          *
15661          * For each connection, the HTTP proxy server only sends one write to the underlying
15662          * socket at once. This parameter allows to set the size of that write.
15663          *
15664          * A small value could cause a lot of writes and would lower the performance.
15665          *
15666          * A big value could send too much data to the output buffer of the socket. That could
15667          * keep the internal buffer full of data that hasn't been sent to the client yet,
15668          * preventing the retrieval of additional data from the MEGA storage server. In that
15669          * circumstances, the client could read a lot of data at once and the HTTP server
15670          * could not have enough time to get more data fast enough.
15671          *
15672          * It's recommended to set this value to at least 8192 and no more than the 25% of
15673          * the maximum buffer size (MegaApi::httpServerSetMaxBufferSize).
15674          *
15675          * The new value will be taken into account since the next request received by
15676          * the HTTP proxy server, not for ongoing requests. It's possible and effective
15677          * to call this function even before the server has been started, and the value
15678          * will be still active even if the server is stopped and started again.
15679          *
15680          * @param outputSize Maximun size of data packets sent to clients (in bytes) or
15681          * a number <= 0 to use the internal default value
15682          */
15683         void httpServerSetMaxOutputSize(int outputSize);
15684 
15685         /**
15686          * @brief Get the maximum size of the packets sent to clients
15687          *
15688          * See MegaApi::httpServerSetMaxOutputSize
15689          *
15690          * @return Maximum size of the packets sent to clients (in bytes)
15691          */
15692         int httpServerGetMaxOutputSize();
15693 
15694         /**
15695          * @brief Start an FTP server in specified port
15696          *
15697          * If this function returns true, that means that the server is
15698          * ready to accept connections. The initialization is synchronous.
15699          *
15700          * The server will serve files using this URL format:
15701          * ftp://127.0.0.1:PORT/<NodeHandle>/<NodeName>
15702          *
15703          * The node name must be URL encoded and must match with the node handle.
15704          * You can generate a correct link for a MegaNode using MegaApi::ftpServerGetLocalLink
15705          *
15706          * It's important to know that the FTP server has several configuration options
15707          * that can restrict the nodes that will be served and the connections that will be accepted.
15708          *
15709          * These are the default options:
15710          * - The restricted mode of the server is set to MegaApi::FTP_SERVER_ALLOW_CREATED_LOCAL_LINKS
15711          * (see MegaApi::ftpServerSetRestrictedMode)
15712          *
15713          * The FTP server will only stream a node if it's allowed by all configuration options.
15714          *
15715          * @param localOnly true to listen on 127.0.0.1 only, false to listen on all network interfaces
15716          * @param port Port in which the server must accept connections
15717          * @param dataportBegin Initial port for FTP data channel
15718          * @param dataPortEnd Final port for FTP data channel (included)
15719          * @param useTLS Use TLS (default false)
15720          * @param certificatepath path to certificate (PEM format)
15721          * @param keypath path to certificate key
15722          * @return True if the server is ready, false if the initialization failed
15723          */
15724         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);
15725 
15726         /**
15727          * @brief Stop the FTP server
15728          *
15729          * When this function returns, the server is already shutdown.
15730          * If the FTP server isn't running, this functions does nothing
15731          */
15732         void ftpServerStop();
15733 
15734         /**
15735          * @brief Check if the FTP server is running
15736          * @return 0 if the server is not running. Otherwise the port in which it's listening to
15737          */
15738         int ftpServerIsRunning();
15739 
15740          /**
15741          * @brief Check if the FTP server is listening on all network interfaces
15742          * @return true if the FTP server is listening on 127.0.0.1 only, or it's not started.
15743          * If it's started and listening on all network interfaces, this function returns false
15744          */
15745         bool ftpServerIsLocalOnly();
15746 
15747         /**
15748          * @brief Enable/disable the restricted mode of the FTP server
15749          *
15750          * This function allows to restrict the nodes that are allowed to be served.
15751          * For not allowed links, the server will return a corresponding "550" error.
15752          *
15753          * Possible values are:
15754          * - TCP_SERVER_DENY_ALL = -1
15755          * All nodes are forbidden
15756          *
15757          * - TCP_SERVER_ALLOW_ALL = 0
15758          * All nodes are allowed to be served
15759          *
15760          * - TCP_SERVER_ALLOW_CREATED_LOCAL_LINKS = 1 (default)
15761          * Only links created with MegaApi::ftpServerGetLocalLink are allowed to be served
15762          *
15763          * - TCP_SERVER_ALLOW_LAST_LOCAL_LINK = 2
15764          * Only the last link created with MegaApi::ftpServerGetLocalLink is allowed to be served
15765          *
15766          * If a different value from the list above is passed to this function, it won't have any effect and the previous
15767          * state of this option will be preserved.
15768          *
15769          * The default value of this property is MegaApi::FTP_SERVER_ALLOW_CREATED_LOCAL_LINKS
15770          *
15771          * The state of this option is preserved even if the FTP server is restarted, but the
15772          * the FTP server only remembers the generated links since the last call to
15773          * MegaApi::ftpServerStart
15774          *
15775          * @param mode State for the restricted mode of the FTP server
15776          */
15777         void ftpServerSetRestrictedMode(int mode);
15778 
15779         /**
15780          * @brief Check if the FTP server is working in restricted mode
15781          *
15782          * Possible return values are:
15783          * - TCP_SERVER_DENY_ALL = -1
15784          * All nodes are forbidden
15785          *
15786          * - TCP_SERVER_ALLOW_ALL = 0
15787          * All nodes are allowed to be served
15788          *
15789          * - TCP_SERVER_ALLOW_CREATED_LOCAL_LINKS = 1
15790          * Only links created with MegaApi::ftpServerGetLocalLink are allowed to be served
15791          *
15792          * - TCP_SERVER_ALLOW_LAST_LOCAL_LINK = 2
15793          * Only the last link created with MegaApi::ftpServerGetLocalLink is allowed to be served
15794          *
15795          * The default value of this property is MegaApi::FTP_SERVER_ALLOW_CREATED_LOCAL_LINKS
15796          *
15797          * See MegaApi::ftpServerEnableRestrictedMode and MegaApi::ftpServerStart
15798          *
15799          * @return State of the restricted mode of the FTP server
15800          */
15801         int ftpServerGetRestrictedMode();
15802 
15803         /**
15804          * @brief Add a listener to receive information about the FTP server
15805          *
15806          * This is the valid data that will be provided on callbacks:
15807          * - MegaTransfer::getType - It will be MegaTransfer::TYPE_LOCAL_TCP_DOWNLOAD
15808          * - MegaTransfer::getPath - URL requested to the FTP server
15809          * - MegaTransfer::getFileName - Name of the requested file (if any, otherwise NULL)
15810          * - MegaTransfer::getNodeHandle - Handle of the requested file (if any, otherwise NULL)
15811          * - MegaTransfer::getTotalBytes - Total bytes of the response (response headers + file, if required)
15812          * - MegaTransfer::getStartPos - Start position (for range requests only, otherwise -1)
15813          * - MegaTransfer::getEndPos - End position (for range requests only, otherwise -1)
15814          *
15815          * On the onTransferFinish error, the error code associated to the MegaError can be:
15816          * - MegaError::API_EINCOMPLETE - If the whole response wasn't sent
15817          * (it's normal to get this error code sometimes because media players close connections when they have
15818          * the data that they need)
15819          *
15820          * - MegaError::API_EREAD - If the connection with MEGA storage servers failed
15821          * - MegaError::API_EAGAIN - If the download speed is too slow for streaming
15822          * - A number > 0 means an FTP error code returned to the client
15823          *
15824          * @param listener Listener to receive information about the FTP server
15825          */
15826         void ftpServerAddListener(MegaTransferListener *listener);
15827 
15828         /**
15829          * @brief Stop the reception of callbacks related to the FTP server on this listener
15830          * @param listener Listener that won't continue receiving information
15831          */
15832         void ftpServerRemoveListener(MegaTransferListener *listener);
15833 
15834         /**
15835          * @brief Returns a URL to a node in the local FTP server
15836          *
15837          * The FTP server must be running before using this function, otherwise
15838          * it will return NULL.
15839          *
15840          * You take the ownership of the returned value
15841          *
15842          * @param node Node to generate the local FTP link
15843          * @return URL to the node in the local FTP server, otherwise NULL
15844          */
15845         char *ftpServerGetLocalLink(MegaNode *node);
15846 
15847         /**
15848          * @brief Returns the list with the links of locations served via FTP
15849          *
15850          * The FTP server must be running before using this function, otherwise
15851          * it will return NULL.
15852          *
15853          * You take the ownership of the returned value
15854          *
15855          * @return URL to the node in the local FTP server, otherwise NULL
15856          */
15857         MegaStringList *ftpServerGetLinks();
15858 
15859         /**
15860          * @brief Returns the list of nodes served via FTP
15861          *
15862          * The FTP server must be running before using this function, otherwise
15863          * it will return NULL.
15864          *
15865          * You take the ownership of the returned value
15866          *
15867          * @return URL to the node in the local FTP server, otherwise NULL
15868          */
15869         MegaNodeList *ftpServerGetAllowedNodes();
15870 
15871         /**
15872          * @brief Stops serving a node via ftp.
15873          * The ftp link will no longer be valid.
15874          *
15875          * @param handle Handle of the node to stop serving
15876          * @return URL to the node in the local FTP server, otherwise NULL
15877          */
15878         void ftpServerRemoveAllowedNode(MegaHandle handle);
15879 
15880         /**
15881          * @brief Stops serving all nodes served via ftp.
15882          * The ftp links will no longer be valid.
15883          *
15884          */
15885         void ftpServerRemoveAllowedNodes();
15886 
15887         /**
15888          * @brief Set the maximum buffer size for the internal buffer
15889          *
15890          * The FTP server has an internal buffer to store the data received from MEGA
15891          * while it's being sent to clients. When the buffer is full, the connection with
15892          * the MEGA storage server is closed, when the buffer has few data, the connection
15893          * with the MEGA storage server is started again.
15894          *
15895          * Even with very fast connections, due to the possible latency starting new connections,
15896          * if this buffer is small the streaming can have problems due to the overhead caused by
15897          * the excessive number of RETR/REST requests.
15898          *
15899          * It's recommended to set this buffer at least to 1MB
15900          *
15901          * For connections that request less data than the buffer size, the FTP server
15902          * will only allocate the required memory to complete the request to minimize the
15903          * memory usage.
15904          *
15905          * The new value will be taken into account since the next request received by
15906          * the FTP server, not for ongoing requests. It's possible and effective
15907          * to call this function even before the server has been started, and the value
15908          * will be still active even if the server is stopped and started again.
15909          *
15910          * @param bufferSize Maximum buffer size (in bytes) or a number <= 0 to use the
15911          * internal default value
15912          */
15913         void ftpServerSetMaxBufferSize(int bufferSize);
15914 
15915         /**
15916          * @brief Get the maximum size of the internal buffer size
15917          *
15918          * See MegaApi::ftpServerSetMaxBufferSize
15919          *
15920          * @return Maximum size of the internal buffer size (in bytes)
15921          */
15922         int ftpServerGetMaxBufferSize();
15923 
15924         /**
15925          * @brief Set the maximum size of packets sent to clients
15926          *
15927          * For each connection, the FTP server only sends one write to the underlying
15928          * socket at once. This parameter allows to set the size of that write.
15929          *
15930          * A small value could cause a lot of writes and would lower the performance.
15931          *
15932          * A big value could send too much data to the output buffer of the socket. That could
15933          * keep the internal buffer full of data that hasn't been sent to the client yet,
15934          * preventing the retrieval of additional data from the MEGA storage server. In that
15935          * circumstances, the client could read a lot of data at once and the FTP server
15936          * could not have enough time to get more data fast enough.
15937          *
15938          * It's recommended to set this value to at least 8192 and no more than the 25% of
15939          * the maximum buffer size (MegaApi::ftpServerSetMaxBufferSize).
15940          *
15941          * The new value will be taken into account since the next request received by
15942          * the FTP server, not for ongoing requests. It's possible and effective
15943          * to call this function even before the server has been started, and the value
15944          * will be still active even if the server is stopped and started again.
15945          *
15946          * @param outputSize Maximun size of data packets sent to clients (in bytes) or
15947          * a number <= 0 to use the internal default value
15948          */
15949         void ftpServerSetMaxOutputSize(int outputSize);
15950 
15951         /**
15952          * @brief Get the maximum size of the packets sent to clients
15953          *
15954          * See MegaApi::ftpServerSetMaxOutputSize
15955          *
15956          * @return Maximum size of the packets sent to clients (in bytes)
15957          */
15958         int ftpServerGetMaxOutputSize();
15959 
15960 #endif
15961 
15962         /**
15963          * @brief Get the MIME type associated with the extension
15964          *
15965          * You take the ownership of the returned value
15966          *
15967          * @param extension File extension (with or without a leading dot)
15968          * @return MIME type associated with the extension
15969          */
15970         static char *getMimeType(const char* extension);
15971 
15972 #ifdef ENABLE_CHAT
15973         /**
15974          * @brief Creates a chat for one or more participants, allowing you to specify their
15975          * permissions and if the chat should be a group chat or not (when it is just for 2 participants).
15976          *
15977          * There are two types of chat: permanent an group. A permanent chat is between two people, and
15978          * participants can not leave it. It's also called 1on1 or 1:1.
15979          *
15980          * The creator of the chat will have moderator level privilege and should not be included in the
15981          * list of peers.
15982          *
15983          * On 1:1 chats, the other participant has also moderator level privilege, regardless the
15984          * privilege level specified.
15985          *
15986          * The associated request type with this request is MegaRequest::TYPE_CHAT_CREATE
15987          * Valid data in the MegaRequest object received on callbacks:
15988          * - MegaRequest::getFlag - Returns if the new chat is a group chat or permanent chat
15989          * - MegaRequest::getAccess - Returns zero (private mode)
15990          * - MegaRequest::getMegaTextChatPeerList - List of participants and their privilege level
15991          * - MegaRequest::getText - Returns the title of the chat.
15992          *
15993          * Valid data in the MegaRequest object received in onRequestFinish when the error code
15994          * is MegaError::API_OK:
15995          * - MegaRequest::getMegaTextChatList - Returns the new chat's information
15996          *
15997          * On the onRequestFinish error, the error code associated to the MegaError can be:
15998          * - MegaError::API_EACCESS - If more than 1 peer is provided for a 1on1 chatroom.
15999          *
16000          * @note If peers list contains only one person, group chat is not set and a permament chat already
16001          * exists with that person, then this call will return the information for the existing chat, rather
16002          * than a new chat.
16003          *
16004          * @param group Flag to indicate if the chat is a group chat or not
16005          * @param peers MegaTextChatPeerList including other users and their privilege level
16006          * @param title Byte array that contains the chat topic if exists. NULL if no custom title is required.
16007          * @param listener MegaRequestListener to track this request
16008          */
16009         void createChat(bool group, MegaTextChatPeerList *peers, const char *title = NULL, MegaRequestListener *listener = NULL);
16010 
16011         /**
16012          * @brief Creates a public chatroom for multiple participants (groupchat)
16013          *
16014          * This function allows to create public chats, where the moderator can create chat links to share
16015          * the access to the chatroom via a URL (chat-link). In order to create a public chat-link, the
16016          * moderator needs to create / get a public handle for the chatroom by using \c MegaApi::chatLinkCreate.
16017          *
16018          * The resulting chat-link allows anyone (even users without an account in MEGA) to review the
16019          * history of the chatroom. The \c MegaApi::getChatLinkURL provides the chatd URL to connect.
16020          *
16021          * Users with an account in MEGA can freely join the room by themselves (the privilege
16022          * upon join will be standard / read-write) by using \c MegaApi::chatLinkJoin.
16023          *
16024          * The creator of the chat will have moderator level privilege and should not be included in the
16025          * list of peers.
16026          *
16027          * The associated request type with this request is MegaChatRequest::TYPE_CREATE_CHATROOM
16028          * Valid data in the MegaChatRequest object received on callbacks:
16029          * - MegaChatRequest::getFlag - Returns if the new chat is a group chat or permanent chat
16030          * - MegaRequest::getAccess - Returns one (public mode)
16031          * - MegaChatRequest::getMegaChatPeerList - List of participants and their privilege level
16032          * - MegaChatRequest::getMegaStringMap - MegaStringMap with handles and unified keys or each peer
16033          * - MegaRequest::getText - Returns the title of the chat.
16034          *
16035          * Valid data in the MegaChatRequest object received in onRequestFinish when the error code
16036          * is MegaError::ERROR_OK:
16037          * - MegaChatRequest::getChatHandle - Returns the handle of the new chatroom
16038          *
16039          * On the onRequestFinish error, the error code associated to the MegaError can be:
16040          * - MegaError::API_EARGS - If the number of keys doesn't match the number of peers plus one (own user)
16041          *
16042          * @param peers MegaChatPeerList including other users and their privilege level
16043          * @param title Byte array that contains the chat topic if exists. NULL if no custom title is required.
16044          * @param userKeyMap MegaStringMap of user handles in B64 as keys, and unified keys in B64 as values. Own user included
16045          *
16046          * @param listener MegaChatRequestListener to track this request
16047          */
16048         void createPublicChat(MegaTextChatPeerList *peers, const MegaStringMap *userKeyMap, const char *title = NULL, MegaRequestListener *listener = NULL);
16049 
16050         /**
16051          * @brief Adds a user to an existing chat. To do this you must have the
16052          * operator privilege in the chat, and the chat must be a group chat in private mode.
16053          *
16054          * In case the chat has a title already set, the title must be encrypted for the new
16055          * peer and passed to this function. Note that only participants with privilege level
16056          * MegaTextChatPeerList::PRIV_MODERATOR are allowed to set the title of a chat.
16057          *
16058          * The associated request type with this request is MegaRequest::TYPE_CHAT_INVITE
16059          * Valid data in the MegaRequest object received on callbacks:
16060          * - MegaRequest::getNodeHandle - Returns the chat identifier
16061          * - MegaRequest::getParentHandle - Returns the MegaHandle of the user to be invited
16062          * - MegaRequest::getAccess - Returns the privilege level wanted for the user
16063          * - MegaRequest::getText - Returns the title of the chat
16064          * - MegaRequest::getFlag - Returns false (private/closed mode)
16065          * - MegaRequest::getSessionKey - Returns the unified key for the new peer
16066          *
16067          * On the onRequestFinish error, the error code associated to the MegaError can be:
16068          * - MegaError::API_EACCESS - If the logged in user doesn't have privileges to invite peers or the chatroom is in public mode.
16069          * - MegaError::API_EINCOMPLETE - If no valid title is provided and the chatroom has a custom title already.
16070          * - MegaError::API_ENOENT- If no valid chatid or user handle is provided, of if the chatroom does not exists.
16071          *
16072          * @param chatid MegaHandle that identifies the chat room
16073          * @param uh MegaHandle that identifies the user
16074          * @param privilege Privilege level for the new peers. Valid values are:
16075          * - MegaTextChatPeerList::PRIV_UNKNOWN = -2
16076          * - MegaTextChatPeerList::PRIV_RM = -1
16077          * - MegaTextChatPeerList::PRIV_RO = 0
16078          * - MegaTextChatPeerList::PRIV_STANDARD = 2
16079          * - MegaTextChatPeerList::PRIV_MODERATOR = 3
16080          * @param title Byte array representing the title that wants to be set, already encrypted and
16081          * converted to Base64url encoding (optional).
16082          * @param listener MegaRequestListener to track this request
16083          */
16084         void inviteToChat(MegaHandle chatid, MegaHandle uh, int privilege, const char *title = NULL, MegaRequestListener *listener = NULL);
16085 
16086         /**
16087          * @brief Adds a user to an existing chat. To do this you must have the
16088          * operator privilege in the chat, and the chat must be a group chat in public mode.
16089          *
16090          * The associated request type with this request is MegaRequest::TYPE_CHAT_INVITE
16091          * Valid data in the MegaRequest object received on callbacks:
16092          * - MegaRequest::getNodeHandle - Returns the chat identifier
16093          * - MegaRequest::getParentHandle - Returns the MegaHandle of the user to be invited
16094          * - MegaRequest::getAccess - Returns the privilege level wanted for the user
16095          * - MegaRequest::getFlag - Returns true (open/public mode)
16096          * - MegaRequest::getSessionKey - Returns the unified key for the new peer
16097          *
16098          * On the onRequestFinish error, the error code associated to the MegaError can be:
16099          * - MegaError::API_EACCESS - If the logged in user doesn't have privileges to invite peers or the chatroom is in private mode.
16100          * - MegaError::API_EARGS - If there's a title and it's not Base64url encoded.
16101          * - MegaError::API_ENOENT- If no valid chatid or user handle is provided, of if the chatroom does not exists.
16102          * - MegaError::API_EINCOMPLETE - If no unified key is provided.
16103          *
16104          * @param chatid MegaHandle that identifies the chat room
16105          * @param uh MegaHandle that identifies the user
16106          * @param privilege Privilege level for the new peers. Valid values are:
16107          * - MegaTextChatPeerList::PRIV_UNKNOWN = -2
16108          * - MegaTextChatPeerList::PRIV_RM = -1
16109          * - MegaTextChatPeerList::PRIV_RO = 0
16110          * - MegaTextChatPeerList::PRIV_STANDARD = 2
16111          * - MegaTextChatPeerList::PRIV_MODERATOR = 3
16112          * @param unifiedKey Byte array that contains the unified key, already encrypted and
16113          * converted to Base64url encoding.
16114          * @param listener MegaRequestListener to track this request
16115          */
16116         void inviteToPublicChat(MegaHandle chatid, MegaHandle uh, int privilege, const char *unifiedKey = NULL, MegaRequestListener *listener = NULL);
16117 
16118         /**
16119          * @brief Remove yourself or another user from a chat. To remove a user other than
16120          * yourself you need to have the operator privilege. Only a group chat may be left.
16121          *
16122          * The associated request type with this request is MegaRequest::TYPE_CHAT_REMOVE
16123          * Valid data in the MegaRequest object received on callbacks:
16124          * - MegaRequest::getNodeHandle - Returns the chat identifier
16125          * - MegaRequest::getParentHandle - Returns the MegaHandle of the user to be removed
16126          *
16127          * On the onRequestFinish error, the error code associated to the MegaError can be:
16128          * - MegaError::API_ENOENT- If no valid chatid is provided or the chatroom does not exists.
16129          * - MegaError::API_EACCESS - If the chatroom is 1on1 or the caller is not operator or is not a
16130          * chat member, or the target is not a chat member.
16131          *
16132          * @param chatid MegaHandle that identifies the chat room
16133          * @param uh MegaHandle that identifies the user. If not provided (INVALID_HANDLE), the requester is removed
16134          * @param listener MegaRequestListener to track this request
16135          */
16136         void removeFromChat(MegaHandle chatid, MegaHandle uh = INVALID_HANDLE, MegaRequestListener *listener = NULL);
16137 
16138         /**
16139          * @brief Get your current, user-specific url to connect to chatd with
16140          *
16141          * The associated request type with this request is MegaRequest::TYPE_CHAT_URL
16142          * Valid data in the MegaRequest object received on callbacks:
16143          * - MegaRequest::getNodeHandle - Returns the chat identifier
16144          *
16145          * Valid data in the MegaRequest object received in onRequestFinish when the error code
16146          * is MegaError::API_OK:
16147          * - MegaRequest::getLink - Returns the user-specific URL for the chat
16148          *
16149          * @param chatid MegaHandle that identifies the chat room
16150          * @param listener MegaRequestListener to track this request
16151          */
16152         void getUrlChat(MegaHandle chatid, MegaRequestListener *listener = NULL);
16153 
16154         /**
16155          * @brief Grants another user access to download a file using MegaApi::startDownload like
16156          * a user would do so for their own file, rather than a public link.
16157          *
16158          * Currently, this method only supports files, not folders.
16159          *
16160          * The associated request type with this request is MegaRequest::TYPE_CHAT_GRANT_ACCESS
16161          * Valid data in the MegaRequest object received on callbacks:
16162          * - MegaRequest::getNodeHandle - Returns the node handle
16163          * - MegaRequest::getParentHandle - Returns the chat identifier
16164          * - MegaRequest::getEmail - Returns the MegaHandle of the user in Base64 enconding
16165          *
16166          * On the onRequestFinish error, the error code associated to the MegaError can be:
16167          * - MegaError::API_ENOENT- If the chatroom, the node or the target user don't exist.
16168          * - MegaError::API_EACCESS- If the target user is the same as caller, or if the target
16169          * user is anonymous but the chatroom is in private mode, or if caller is not an operator
16170          * or the target user is not a chat member.
16171          *
16172          * If the MEGA account is a business account and it's status is expired, onRequestFinish will
16173          * be called with the error code MegaError::API_EBUSINESSPASTDUE.
16174          *
16175          * @param chatid MegaHandle that identifies the chat room
16176          * @param n MegaNode that wants to be shared
16177          * @param uh MegaHandle that identifies the user
16178          * @param listener MegaRequestListener to track this request
16179          */
16180         void grantAccessInChat(MegaHandle chatid, MegaNode *n, MegaHandle uh, MegaRequestListener *listener = NULL);
16181 
16182         /**
16183          * @brief Removes access to a node from a user you previously granted access to.
16184          *
16185          * The associated request type with this request is MegaRequest::TYPE_CHAT_REMOVE_ACCESS
16186          * Valid data in the MegaRequest object received on callbacks:
16187          * - MegaRequest::getNodeHandle - Returns the node handle
16188          * - MegaRequest::getParentHandle - Returns the chat identifier
16189          * - MegaRequest::getEmail - Returns the MegaHandle of the user in Base64 enconding
16190          *
16191          * On the onRequestFinish error, the error code associated to the MegaError can be:
16192          * - MegaError::API_ENOENT- If the chatroom, the node or the target user don't exist.
16193          *
16194          * @param chatid MegaHandle that identifies the chat room
16195          * @param n MegaNode whose access wants to be revokesd
16196          * @param uh MegaHandle that identifies the user
16197          * @param listener MegaRequestListener to track this request
16198          */
16199         void removeAccessInChat(MegaHandle chatid, MegaNode *n, MegaHandle uh, MegaRequestListener *listener = NULL);
16200 
16201         /**
16202          * @brief Allows a logged in operator/moderator to adjust the permissions on any other user
16203          * in their group chat. This does not work for a 1:1 chat.
16204          *
16205          * The associated request type with this request is MegaRequest::TYPE_CHAT_UPDATE_PERMISSIONS
16206          * Valid data in the MegaRequest object received on callbacks:
16207          * - MegaRequest::getNodeHandle - Returns the chat identifier
16208          * - MegaRequest::getParentHandle - Returns the MegaHandle of the user whose permission
16209          * is to be upgraded
16210          * - MegaRequest::getAccess - Returns the privilege level wanted for the user
16211          *
16212          * On the onRequestFinish error, the error code associated to the MegaError can be:
16213          * - MegaError::API_ENOENT- If the chatroom doesn't exist or if the user specified is not a participant.
16214          * - MegaError::API_EACCESS- If caller is not operator or the chatroom is 1on1.
16215          *
16216          * @param chatid MegaHandle that identifies the chat room
16217          * @param uh MegaHandle that identifies the user
16218          * @param privilege Privilege level for the existing peer. Valid values are:
16219          * - MegaTextChatPeerList::PRIV_RO = 0
16220          * - MegaTextChatPeerList::PRIV_STANDARD = 2
16221          * - MegaTextChatPeerList::PRIV_MODERATOR = 3
16222          * @param listener MegaRequestListener to track this request
16223          */
16224         void updateChatPermissions(MegaHandle chatid, MegaHandle uh, int privilege, MegaRequestListener *listener = NULL);
16225 
16226         /**
16227          * @brief Allows a logged in operator/moderator to truncate their chat, i.e. to clear
16228          * the entire chat history up to a certain message. All earlier messages are wiped,
16229          * but his specific message gets overridden with an API message.
16230          *
16231          * The associated request type with this request is MegaRequest::TYPE_CHAT_TRUNCATE
16232          * Valid data in the MegaRequest object received on callbacks:
16233          * - MegaRequest::getNodeHandle - Returns the chat identifier
16234          * - MegaRequest::getParentHandle - Returns the message identifier to truncate from.
16235          *
16236          * @param chatid MegaHandle that identifies the chat room
16237          * @param messageid MegaHandle that identifies the message to truncate from
16238          * @param listener MegaRequestListener to track this request
16239          */
16240         void truncateChat(MegaHandle chatid, MegaHandle messageid, MegaRequestListener *listener = NULL);
16241 
16242 
16243         /**
16244          * @brief Allows to set the title of a chat
16245          *
16246          * Only participants with privilege level MegaTextChatPeerList::PRIV_MODERATOR are allowed to
16247          * set the title of a chat.
16248          *
16249          * The associated request type with this request is MegaRequest::TYPE_CHAT_SET_TITLE
16250          * Valid data in the MegaRequest object received on callbacks:
16251          * - MegaRequest::getText - Returns the title of the chat.
16252          *
16253          * On the onRequestFinish error, the error code associated to the MegaError can be:
16254          * - MegaError::API_EACCESS - If the logged in user doesn't have privileges to invite peers.
16255          * - MegaError::API_EARGS - If there's a title and it's not Base64url encoded.
16256          *
16257          * @param chatid MegaHandle that identifies the chat room
16258          * @param title Byte array representing the title that wants to be set, already encrypted and
16259          * converted to Base64url encoding.
16260          * @param listener MegaRequestListener to track this request
16261          */
16262         void setChatTitle(MegaHandle chatid, const char *title, MegaRequestListener *listener = NULL);
16263 
16264         /**
16265          * @brief Get your current URL to connect to the presence server
16266          *
16267          * The associated request type with this request is MegaRequest::TYPE_CHAT_PRESENCE_URL
16268          * Valid data in the MegaRequest object received in onRequestFinish when the error code
16269          * is MegaError::API_OK:
16270          * - MegaRequest::getLink - Returns the user-specific URL for the chat presence server
16271          *
16272          * @param listener MegaRequestListener to track this request
16273          */
16274         void getChatPresenceURL(MegaRequestListener *listener = NULL);
16275 
16276         /**
16277          * @brief Register a token for push notifications
16278          *
16279          * This function attach a token to the current session, which is intended to get push notifications
16280          * on mobile platforms like Android and iOS.
16281          *
16282          * The push notification mechanism is platform-dependent. Hence, the app should indicate the
16283          * type of push notification to be registered. Currently, the different types are:
16284          *  - MegaApi::PUSH_NOTIFICATION_ANDROID    = 1
16285          *  - MegaApi::PUSH_NOTIFICATION_IOS_VOIP   = 2
16286          *  - MegaApi::PUSH_NOTIFICATION_IOS_STD    = 3
16287          *  - MegaApi::PUSH_NOTIFICATION_ANDROID_HUAWEI = 4
16288          *
16289          * The associated request type with this request is MegaRequest::TYPE_REGISTER_PUSH_NOTIFICATION
16290          * Valid data in the MegaRequest object received on callbacks:
16291          * - MegaRequest::getText - Returns the token provided.
16292          * - MegaRequest::getNumber - Returns the device type provided.
16293          *
16294          * @param deviceType Type of notification to be registered.
16295          * @param token Character array representing the token to be registered.
16296          * @param listener MegaRequestListener to track this request
16297          */
16298         void registerPushNotifications(int deviceType, const char *token, MegaRequestListener *listener = NULL);
16299 
16300         /**
16301          * @brief Send data related to MEGAchat to the stats server
16302          *
16303          * The associated request type with this request is MegaRequest::TYPE_CHAT_STATS
16304          * Valid data in the MegaRequest object received on callbacks:
16305          * - MegaRequest::getName - Returns the data provided.
16306          * - MegaRequest::getParamType - Returns number 1
16307          * - MegaRequest::getNumber - Returns the connection port
16308          *
16309          * Valid data in the MegaRequest object received in onRequestFinish when the error code
16310          * is MegaError::API_OK:
16311          * - MegaRequest::getNumber - Return the HTTP status code from the stats server
16312          * - MegaRequest::getText - Returns the JSON response from the stats server
16313          * - MegaRequest::getTotalBytes - Returns the number of bytes in the response
16314          *
16315          * @param data JSON data to send to the stats server
16316          * @param port Server port to connect
16317          * @param listener MegaRequestListener to track this request
16318          */
16319         void sendChatStats(const char *data, int port = 0, MegaRequestListener *listener = NULL);
16320 
16321         /**
16322          * @brief Send logs related to MEGAchat to the logs server
16323          *
16324          * The associated request type with this request is MegaRequest::TYPE_CHAT_STATS
16325          * Valid data in the MegaRequest object received on callbacks:
16326          * - MegaRequest::getName - Returns the data provided.
16327          * - MegaRequest::getSessionKey - Returns the aid provided
16328          * - MegaRequest::getParamType - Returns number 2
16329          * - MegaRequest::getNumber - Returns the connection port
16330          *
16331          * Valid data in the MegaRequest object received in onRequestFinish when the error code
16332          * is MegaError::API_OK:
16333          * - MegaRequest::getNumber - Return the HTTP status code from the stats server
16334          * - MegaRequest::getText - Returns the JSON response from the stats server
16335          * - MegaRequest::getTotalBytes - Returns the number of bytes in the response
16336          *
16337          * @param data JSON data to send to the logs server
16338          * @param aid User's anonymous identifier for logging
16339          * @param port Server port to connect
16340          * @param listener MegaRequestListener to track this request
16341          */
16342         void sendChatLogs(const char *data, const char *aid, int port = 0, MegaRequestListener *listener = NULL);
16343 
16344         /**
16345          * @brief Get the list of chatrooms for this account
16346          *
16347          * You take the ownership of the returned value
16348          *
16349          * @return A list of MegaTextChat objects with detailed information about each chatroom.
16350          */
16351         MegaTextChatList *getChatList();
16352 
16353         /**
16354          * @brief Get the list of users with access to the specified node
16355          *
16356          * You take the ownership of the returned value
16357          *
16358          * @param chatid MegaHandle that identifies the chat room
16359          * @param h MegaNode to check the access
16360          *
16361          * @return A list of user handles that have access to the node
16362          */
16363         MegaHandleList *getAttachmentAccess(MegaHandle chatid, MegaHandle h);
16364 
16365         /**
16366          * @brief Check if the logged-in user has access to the specified node
16367          *
16368          * @param chatid MegaHandle that identifies the chat room
16369          * @param h MegaHandle that identifies the node to check the access
16370          * @param uh MegaHandle that identifies the user to check the access
16371          *
16372          * @return True the user has access to the node in that chat. Otherwise, it returns false
16373          */
16374         bool hasAccessToAttachment(MegaHandle chatid, MegaHandle h, MegaHandle uh);
16375 
16376         /**
16377          * @brief Get files attributes from a node
16378          * You take the ownership of the returned value
16379          * @param h Handle from node
16380          * @return char array with files attributes from the node.
16381          */
16382         const char* getFileAttribute(MegaHandle h);
16383 
16384         /**
16385          * @brief Archive a chat
16386          *
16387          * The associated request type with this request is MegaRequest::TYPE_CHAT_ARCHIVE
16388          * Valid data in the MegaRequest object received on callbacks:
16389          * - MegaRequest::getNodeHandle - Returns the chat identifier
16390          * - MegaRequest::getFlag - Returns chat desired state
16391          *
16392          * On the onRequestFinish error, the error code associated to the MegaError can be:
16393          * - MegaError::API_ENOENT - If the chatroom does not exists.
16394          *
16395          * @param chatid MegaHandle that identifies the chat room
16396          * @param archive Desired chat state
16397          * @param listener MegaRequestListener to track this request
16398          */
16399         void archiveChat(MegaHandle chatid, int archive, MegaRequestListener *listener = NULL);
16400 
16401         /**
16402          * @brief Set a retention timeframe after which older messages in the chat are automatically deleted.
16403          *
16404          * Allows a logged in operator/moderator to specify a message retention timeframe in seconds,
16405          * after which older messages in the chat are automatically deleted.
16406          *
16407          * The associated request type with this request is MegaRequest::TYPE_SET_RETENTION_TIME
16408          * Valid data in the MegaRequest object received on callbacks:
16409          * - MegaRequest::getNodeHandle - Returns the chat identifier
16410          * - MegaRequest::getNumdetails - Returns the retention timeframe
16411          *
16412          * On the onRequestFinish error, the error code associated to the MegaError can be:
16413          * - MegaError::API_EARGS - If the chatid is invalid
16414          * - MegaError::API_ENOENT - If there isn't any chat with the specified chatid.
16415          * - MegaError::API_EACCESS - If the logged in user doesn't have operator privileges
16416          *
16417          * @param chatid MegaHandle that identifies the chat room
16418          * @param period retention timeframe in seconds, after which older messages in the chat are automatically deleted
16419          * @param listener MegaRequestListener to track this request
16420          */
16421         void setChatRetentionTime(MegaHandle chatid, int period, MegaRequestListener *listener = NULL);
16422 
16423         /**
16424          * @brief Request rich preview information for specified URL
16425          *
16426          * The associated request type with this request is MegaRequest::TYPE_RICH_LINK
16427          * Valid data in the MegaRequest object received on callbacks:
16428          * - MegaRequest::getLink - Returns the requested URL
16429          *
16430          * Valid data in the MegaRequest object received in onRequestFinish when the error code
16431          * is MegaError::API_OK:
16432          * - MegaRequest::getText - Returns a JSON containing metadata from the URL
16433          *
16434          * @param url URL to request metadata (format: http://servername.domain)
16435          * @param listener MegaRequestListener to track this request
16436          */
16437         void requestRichPreview(const char *url, MegaRequestListener *listener = NULL);
16438 
16439         /**
16440          * @brief Query if there is a chat link for this chatroom
16441          *
16442          * This function can be called by a chat operator to check and retrieve the current
16443          * public handle for the specified chat without creating it.
16444          *
16445          * The associated request type with this request is MegaRequest::TYPE_CHAT_LINK_HANDLE.
16446          *
16447          * Valid data in the MegaRequest object received on all callbacks:
16448          * - MegaRequest::getNodeHandle - Returns the chat identifier
16449          *
16450          * Valid data in the MegaRequest object received in onRequestFinish when the error code
16451          * is MegaError::API_OK:
16452          * - MegaRequest::getParentHandle - Returns the public handle of the chat link, if any
16453          *
16454          * On the onTransferFinish error, the error code associated to the MegaError can be:
16455          * - MegaError::API_ENOENT - If the chatroom does not have a valid chatlink, or the chatroom does not exists.
16456          * - MegaError::API_EACCESS - If caller is not operator or the chat is not a public chat or it's a 1on1 room.
16457          *
16458          * @param chatid MegaHandle that identifies the chat room
16459          * @param listener MegaRequestListener to track this request
16460          */
16461         void chatLinkQuery(MegaHandle chatid, MegaRequestListener *listener = NULL);
16462 
16463         /**
16464          * @brief Create or retrieve the public handle of a chat link
16465          *
16466          * This function can be called by a chat operator to create or retrieve the current
16467          * public handle for the specified chat. It will create a management message.
16468          *
16469          * The associated request type with this request is MegaRequest::TYPE_CHAT_LINK_HANDLE.
16470          *
16471          * Valid data in the MegaRequest object received on all callbacks:
16472          * - MegaRequest::getNodeHandle - Returns the chat identifier
16473          *
16474          * Valid data in the MegaRequest object received in onRequestFinish when the error code
16475          * is MegaError::API_OK:
16476          * - MegaRequest::getParentHandle - Returns the public handle of the chat link
16477          *
16478          * On the onRequestFinish error, the error code associated to the MegaError can be:
16479          * - MegaError::API_ENOENT - If the chatroom does not have a valid chatlink, or the chatroom does not exists.
16480          * - MegaError::API_EACCESS - If caller is not operator or the chat is not a public chat or it's a 1on1 room.
16481          *
16482          * @param chatid MegaHandle that identifies the chat room
16483          * @param listener MegaRequestListener to track this request
16484          */
16485         void chatLinkCreate(MegaHandle chatid, MegaRequestListener *listener = NULL);
16486 
16487         /**
16488          * @brief Delete the public handle of a chat link
16489          *
16490          * This function can be called by a chat operator to remove the current public handle
16491          * for the specified chat. It will create a management message.
16492          *
16493          * The associated request type with this request is MegaRequest::TYPE_CHAT_LINK_HANDLE.
16494          *
16495          * Valid data in the MegaRequest object received on all callbacks:
16496          * - MegaRequest::getNodeHandle - Returns the chat identifier
16497          *
16498          * On the onRequestFinish error, the error code associated to the MegaError can be:
16499          * - MegaError::API_ENOENT - If the chatroom does not have a valid chatlink, or the chatroom does not exists.
16500          * - MegaError::API_EACCESS - If caller is not operator or the chat is not a public chat or it's a 1on1 room.
16501          *
16502          * @param chatid MegaHandle that identifies the chat room
16503          * @param listener MegaRequestListener to track this request
16504          */
16505         void chatLinkDelete(MegaHandle chatid, MegaRequestListener *listener = NULL);
16506 
16507         /**
16508          * @brief Get the URL to connect to chatd for a chat link
16509          *
16510          * This function can be used by anonymous and registered users to request the URL to connect
16511          * to chatd, for a given public handle. @see \c MegaApi::chatLinkCreate.
16512          * It also returns the shard hosting the chatroom, the real chatid and the title (if any).
16513          * The chat-topic, for public chats, can be decrypted by using the unified-key, already
16514          * available as part of the link for previewers and available to participants as part of
16515          * the room's information. @see \c MegaTextChat::getUnifiedKey.
16516          *
16517          * The associated request type with this request is MegaRequest::TYPE_CHAT_LINK_URL
16518          *
16519          * Valid data in the MegaRequest object received on all callbacks:
16520          * - MegaRequest::getNodeHandle - Returns the public handle of the chat link
16521          *
16522          * Valid data in the MegaRequest object received in onRequestFinish when the error code
16523          * is MegaError::API_OK:
16524          * - MegaRequest::getLink - Returns the URL to connect to chatd for the chat link
16525          * - MegaRequest::getParentHandle - Returns the chat identifier
16526          * - MegaRequest::getAccess - Returns the shard
16527          * - MegaRequest::getText - Returns the chat-topic (if any)
16528          * - MegaRequest::getNumDetails - Returns the current number of participants
16529          * - MegaRequest::getNumber - Returns the creation timestamp
16530          *
16531          * On the onRequestFinish error, the error code associated to the MegaError can be:
16532          * - MegaError::API_ENOENT - If the public handle is not valid or the chatroom does not exists.
16533          *
16534          * @note This function can be called without being logged in. In that case, the returned
16535          * URL will be different than for logged in users, so chatd knows whether user has a session.
16536          *
16537          * @param publichandle MegaHandle that represents the public handle of the chat link
16538          * @param listener MegaRequestListener to track this request
16539          */
16540         void getChatLinkURL(MegaHandle publichandle, MegaRequestListener *listener = NULL);
16541 
16542         /**
16543          * @brief Convert an public chat into a private private mode chat
16544          *
16545          * This function allows a chat operator to convert an existing public chat into a private
16546          * chat (closed mode, key rotation enabled). It will create a management message.
16547          *
16548          * If the groupchat already has a customized title, it's required to provide the title encrypted
16549          * to a new key, so it becomes private for non-participants.
16550          *
16551          * The associated request type with this request is MegaRequest::TYPE_SET_PRIVATE_MODE.
16552          *
16553          * Valid data in the MegaRequest object received on all callbacks:
16554          * - MegaRequest::getNodeHandle - Returns the chat identifier
16555          * - MegaRequest::getText - Returns the title of the chat
16556          *
16557          * On the onRequestFinish error, the error code associated to the MegaError can be:
16558          * - MegaError::API_ENOENT - If the chatroom does not exists.
16559          * - MegaError::API_EACCESS - If caller is not operator or it's a 1on1 room.
16560          * - MegaError::API_EEXIST - If the chat is already in private mode.
16561          * - MegaError::API_EARGS - If custom title is set and no title is provided.
16562          *
16563          * @param chatid MegaHandle that identifies the chat room
16564          * @param title Byte array representing the title, already encrypted and converted to Base64url
16565          * encoding. If the chatroom doesn't have a title yet, this parameter should be NULL.
16566          * @param listener MegaRequestListener to track this request
16567          */
16568         void chatLinkClose(MegaHandle chatid, const char *title, MegaRequestListener *listener = NULL);
16569 
16570         /**
16571          * @brief Allows to join a public chat
16572          *
16573          * This function allows any user with a MEGA account to join an open chat that has the
16574          * specified public handle. It will create a management message like any new user join.
16575          *
16576          * @see \c MegaApi::chatLinkCreate
16577          *
16578          * The associated request type with this request is MegaRequest::TYPE_AUTOJOIN_PUBLIC_CHAT
16579          *
16580          * Valid data in the MegaRequest object received on all callbacks:
16581          * - MegaRequest::getNodeHandle - Returns the public handle of the chat link
16582          * - MegaRequest::getSessionKey - Returns the unified key of the chat link
16583          *
16584          * On the onRequestFinish error, the error code associated to the MegaError can be:
16585          * - MegaError::API_ENOENT - If the public handle is not valid.
16586          * - MegaError::API_EINCOMPLETE - If the no unified key is provided.
16587          *
16588          * @param publichandle MegaHandle that represents the public handle of the chat link
16589          * @param unifiedKey Byte array that contains the unified key, already encrypted and
16590          * converted to Base64url encoding.
16591          * @param listener MegaRequestListener to track this request
16592          */
16593         void chatLinkJoin(MegaHandle publichandle, const char *unifiedKey, MegaRequestListener *listener = NULL);
16594 
16595         /**
16596          * @brief Returns whether notifications about a chat have to be generated
16597          *
16598          * @param chatid MegaHandle that identifies the chat room
16599          * @return true if notification has to be created
16600          */
16601         bool isChatNotifiable(MegaHandle chatid);
16602 
16603 #endif
16604 
16605         /**
16606          * @brief Returns whether notifications about incoming have to be generated
16607          *
16608          * @return true if notification has to be created
16609          */
16610         bool isSharesNotifiable();
16611 
16612         /**
16613          * @brief Returns whether notifications about pending contact requests have to be generated
16614          *
16615          * @return true if notification has to be created
16616          */
16617         bool isContactsNotifiable();
16618 
16619         /**
16620          * @brief Get the MEGA Achievements of the account logged in
16621          *
16622          * The associated request type with this request is MegaRequest::TYPE_GET_ACHIEVEMENTS
16623          * Valid data in the MegaRequest object received on callbacks:
16624          * - MegaRequest::getFlag - Always false
16625          *
16626          * Valid data in the MegaRequest object received in onRequestFinish when the error code
16627          * is MegaError::API_OK:
16628          * - MegaRequest::getMegaAchievementsDetails - Details of the MEGA Achievements of this account
16629          *
16630          * @param listener MegaRequestListener to track this request
16631          */
16632         void getAccountAchievements(MegaRequestListener *listener = NULL);
16633 
16634         /**
16635          * @brief Get the list of existing MEGA Achievements
16636          *
16637          * Similar to MegaApi::getAccountAchievements, this method returns only the base storage and
16638          * the details for the different achievement classes, but not awards or rewards related to the
16639          * account that is logged in.
16640          * This function can be used to give an indication of what is available for advertising
16641          * for unregistered users, despite it can be used with a logged in account with no difference.
16642          *
16643          * @note: if the IP address is not achievement enabled (it belongs to a country where MEGA
16644          * Achievements are not enabled), the request will fail with MegaError::API_EACCESS.
16645          *
16646          * The associated request type with this request is MegaRequest::TYPE_GET_ACHIEVEMENTS
16647          * Valid data in the MegaRequest object received on callbacks:
16648          * - MegaRequest::getFlag - Always true
16649          *
16650          * Valid data in the MegaRequest object received in onRequestFinish when the error code
16651          * is MegaError::API_OK:
16652          * - MegaRequest::getMegaAchievementsDetails - Details of the list of existing MEGA Achievements
16653          *
16654          * @param listener MegaRequestListener to track this request
16655          */
16656         void getMegaAchievements(MegaRequestListener *listener = NULL);
16657 
16658        /**
16659          * @brief Catch up with API for pending actionpackets
16660          *
16661          * The associated request type with this request is MegaRequest::TYPE_CATCHUP
16662          *
16663          * When onRequestFinish is called with MegaError::API_OK, the SDK is guaranteed to be
16664          * up to date (as for the time this function is called).
16665          *
16666          * @param listener MegaRequestListener to track this request
16667          */
16668         void catchup(MegaRequestListener *listener = NULL);
16669 
16670         /**
16671          * @brief Send a verification code txt to the supplied phone number
16672          *
16673          * Sends a 6 digit code to the user's phone. The phone number is supplied in this function call.
16674          * The code is sent by SMS to the user. Once the user receives it, they can type it into the app
16675          * and the call MegaApi::checkSMSVerificationCode can be used to validate the user did
16676          * receive the verification code, so that really is their phone number.
16677          *
16678          * The frequency with which this call can be used is very limited (the API allows at most
16679          * two SMS mssages sent for phone number per 24 hour period), so it's important to get the
16680          * number right on the first try. The result will be MegaError::API_ETEMPUNAVAIL if it has
16681          * been tried too frequently.
16682          *
16683          * Make sure to test the result of MegaApi::smsAllowedState before calling this function.
16684          *
16685          * The associated request type with this request is MegaRequest::TYPE_SEND_SMS_VERIFICATIONCODE
16686          * Valid data in the MegaRequest object received on callbacks:
16687          * - MegaRequest::getText - the phoneNumber as supplied to this function
16688          *
16689          * When the operation completes, onRequestFinish is called and the MegaError object can be:
16690          * - MegaError::API_ETEMPUNAVAIL if a limit is reached.
16691          * - MegaError::API_EACCESS if your account is already verified with an SMS number
16692          * - MegaError::API_EEXIST if the number is already verified for some other account.
16693          * - MegaError::API_EARGS if the phone number is badly formatted or invalid.
16694          * - MegaError::API_OK is returned upon success.
16695          *
16696          * @param phoneNumber The phone number to txt the code to, supplied by the user.
16697          * @param listener MegaRequestListener to track this request
16698          * @param reverifying_whitelisted debug usage only.  May be removed in future.
16699          */
16700         void sendSMSVerificationCode(const char* phoneNumber, MegaRequestListener *listener = NULL, bool reverifying_whitelisted = false);
16701 
16702         /**
16703          * @brief Check a verification code that the user should have received via txt
16704          *
16705          * This function validates that the user received the verification code sent by MegaApi::sendSMSVerificationCode.
16706          *
16707          * The associated request type with this request is MegaRequest::TYPE_CHECK_SMS_VERIFICATIONCODE
16708          * Valid data in the MegaRequest object received on callbacks:
16709          * - MegaRequest::getText - the verificationCode as supplied to this function
16710          *
16711          * Valid data in the MegaRequest object received in onRequestFinish when the error code
16712          * is MegaError::API_OK:
16713          * - MegaRequest::getName - the phone number that has been verified
16714          *
16715          * When the operation completes, onRequestFinish is called and the MegaError object can be:
16716          * - MegaError::API_EEACCESS if you have reached the verification limits.
16717          * - MegaError::API_EFAILED if the verification code does not match.
16718          * - MegaError::API_EEXPIRED if the phone number was verified on a different account.
16719          * - MegaError::API_OK is returned upon success.
16720          *
16721          * @param verificationCode A string supplied by the user, that they should have received via txt.
16722          * @param listener MegaRequestListener to track this request
16723          */
16724         void checkSMSVerificationCode(const char* verificationCode, MegaRequestListener *listener = NULL);
16725 
16726         /**
16727          * @brief Requests the contacts that are registered at MEGA (currently verified through SMS)
16728          *
16729          * The request will return any of the provided contacts that are registered at MEGA, i.e.,
16730          * are verified through SMS (currently).
16731          *
16732          * The associated request type with this request is MegaRequest::TYPE_GET_REGISTERED_CONTACTS
16733          * Valid data in the MegaRequest object received on callbacks:
16734          * - MegaRequest::getMegaStringMap - Returns the contacts that are to be checked
16735          * \c contacts is a MegaStringMap from 'user detail' to the user's name. For instance:
16736          * {
16737          *   "+0000000010": "John Smith",
16738          *   "+0000000011": "Peter Smith",
16739          * }
16740          *
16741          * Valid data in the MegaRequest object received in onRequestFinish when the error code
16742          * is MegaError::API_OK:
16743          * - MegaRequest::getMegaStringTable - Returns the information about the contacts with three columns:
16744          *  1. entry user detail (the user detail as it was provided in the request)
16745          *  2. identifier (the user's identifier)
16746          *  3. user detail (the normalized user detail, e.g., +00 0000 0010)
16747          *
16748          * There is a limit on how many unique details can be looked up per account, to prevent
16749          * abuse and iterating over the phone number space to find users in Mega.
16750          * An API_ETOOMANY error will be returned if you hit one of these limits.
16751          * An API_EARGS error will be returned if your contact details are invalid (malformed SMS number for example)
16752          *
16753          * @param contacts The map of contacts to get registered contacts from
16754          * @param listener MegaRequestListener to track this request
16755          */
16756         void getRegisteredContacts(const MegaStringMap* contacts, MegaRequestListener *listener = NULL);
16757 
16758         /**
16759          * @brief Requests the currently available country calling codes
16760          *
16761          * The response value is stored as a MegaStringListMap mapping from two-letter country code
16762          * to a list of calling codes. For instance:
16763          * {
16764          *   "AD": ["376"],
16765          *   "AE": ["971", "13"],
16766          * }
16767          *
16768          * The associated request type with this request is MegaRequest::TYPE_GET_COUNTRY_CALLING_CODES
16769          * Valid data in the MegaRequest object received in onRequestFinish when the error code
16770          * is MegaError::API_OK:
16771          * - MegaRequest::getMegaStringListMap where the keys are two-letter country codes and the
16772          *   values a list of calling codes.
16773          *
16774          * For this command, there are currently no command specific error codes returned by the API.
16775          *
16776          * @param listener MegaRequestListener to track this request
16777          */
16778         void getCountryCallingCodes(MegaRequestListener *listener = NULL);
16779 
16780         /**
16781          * @brief Retrieve basic information about a folder link
16782          *
16783          * This function retrieves basic information from a folder link, like the number of files / folders
16784          * and the name of the folder. For folder links containing a lot of files/folders,
16785          * this function is more efficient than a fetchnodes.
16786          *
16787          * Valid data in the MegaRequest object received on all callbacks:
16788          * - MegaRequest::getLink() - Returns the public link to the folder
16789          *
16790          * Valid data in the MegaRequest object received in onRequestFinish when the error code
16791          * is MegaError::API_OK:
16792          * - MegaRequest::getMegaFolderInfo() - Returns information about the contents of the folder
16793          * - MegaRequest::getNodeHandle() - Returns the public handle of the folder
16794          * - MegaRequest::getParentHandle() - Returns the handle of the owner of the folder
16795          * - MegaRequest::getText() - Returns the name of the folder.
16796          * If there's no name, it returns the special status string "CRYPTO_ERROR".
16797          * If the length of the name is zero, it returns the special status string "BLANK".
16798          *
16799          * On the onRequestFinish error, the error code associated to the MegaError can be:
16800          * - MegaError::API_EARGS - If the link is not a valid folder link
16801          * - MegaError::API_EKEY - If the public link does not contain the key or it is invalid
16802          *
16803          * @param megaFolderLink Public link to a folder in MEGA
16804          * @param listener MegaRequestListener to track this request
16805          */
16806         void getPublicLinkInformation(const char *megaFolderLink, MegaRequestListener *listener = NULL);
16807 
16808 
16809         /**
16810          * @brief Get an object that can lock the MegaApi, allowing multiple quick synchronous calls.
16811          *
16812          * This object must be used very carefully.  It is meant to be used  when the application is about
16813          * to make a burst of synchronous calls (that return data immediately, without using a listener)
16814          * to the API over a very short time period, which could otherwise be blocked multiple times
16815          * interrupted by the MegaApi's operation.
16816          *
16817          * The MegaApiLock usual use is to request it already locked, and the caller must destroy it
16818          * when its sequence of operations are complete, which will allow the MegaApi to continue again.
16819          * However explicit lock and unlock calls can also be made on it, which are protected from
16820          * making more than one lock, and the destructor will make sure the lock is released.
16821          *
16822          * You take ownership of the returned value, and you must delete it when the sequence is complete.
16823          */
16824         MegaApiLock* getMegaApiLock(bool lockNow);
16825 
16826  private:
16827         MegaApiImpl *pImpl;
16828         friend class MegaApiImpl;
16829 };
16830 
16831 
16832 class MegaHashSignatureImpl;
16833 
16834 /**
16835  * @brief Class to check a digital signatures
16836  *
16837  * The typical usage of this class:
16838  * - Construct the object using a public key
16839  * - Add data using MegaHashSignature::add (it can be called many times to add more data)
16840  * - Call MegaHashSignature::check to know if the data matches a signature
16841  * - Call MegaHashSignature::init and reuse the object if needed
16842  */
16843 class MegaHashSignature
16844 {
16845 public:
16846     /**
16847      * @brief Initialize the object with a public key to check digital signatures
16848      * @param base64Key Base64-encode public key.
16849      *
16850      * This is the public key used to distribute MEGAsync updates:
16851      * "EACTzXPE8fdMhm6LizLe1FxV2DncybVh2cXpW3momTb8tpzRNT833r1RfySz5uHe8gdoXN1W0eM5Bk8X-LefygYYDS9RyXrRZ8qXrr9ITJ4r8ATnFIEThO5vqaCpGWTVi5pOPI5FUTJuhghVKTyAels2SpYT5CmfSQIkMKv7YVldaV7A-kY060GfrNg4--ETyIzhvaSZ_jyw-gmzYl_dwfT9kSzrrWy1vQG8JPNjKVPC4MCTZJx9SNvp1fVi77hhgT-Mc5PLcDIfjustlJkDBHtmGEjyaDnaWQf49rGq94q23mLc56MSjKpjOR1TtpsCY31d1Oy2fEXFgghM0R-1UkKswVuWhEEd8nO2PimJOl4u9ZJ2PWtJL1Ro0Hlw9OemJ12klIAxtGV-61Z60XoErbqThwWT5Uu3D2gjK9e6rL9dufSoqjC7UA2C0h7KNtfUcUHw0UWzahlR8XBNFXaLWx9Z8fRtA_a4seZcr0AhIA7JdQG5i8tOZo966KcFnkU77pfQTSprnJhCfEmYbWm9EZA122LJBWq2UrSQQN3pKc9goNaaNxy5PYU1yXyiAfMVsBDmDonhRWQh2XhdV-FWJ3rOGMe25zOwV4z1XkNBuW4T1JF2FgqGR6_q74B2ccFC8vrNGvlTEcs3MSxTI_EKLXQvBYy7hxG8EPUkrMVCaWzzTQAFEQ"
16852      */
16853     MegaHashSignature(const char *base64Key);
16854     ~MegaHashSignature();
16855 
16856     /**
16857      * @brief Reinitialize the object
16858      */
16859     void init();
16860 
16861     /**
16862      * @brief Add data to calculate the signature
16863      * @param data Byte buffer with the data
16864      * @param size Size of the buffer
16865      */
16866     void add(const char *data, unsigned size);
16867 
16868     /**
16869      * @brief Check if the introduced data matches a signature
16870      * @param base64Signature Base64-encoded digital signature
16871      * @return true if the signature is correct, otherwise false
16872      */
16873     bool checkSignature(const char *base64Signature);
16874 
16875 private:
16876 	MegaHashSignatureImpl *pImpl;
16877 };
16878 
16879 /**
16880  * @brief Details about a MEGA balance
16881  */
16882 class MegaAccountBalance
16883 {
16884 public:
16885     virtual ~MegaAccountBalance();
16886 
16887     /**
16888      * @brief Get the amount of the balance
16889      * @return Amount
16890      */
16891     virtual double getAmount() const;
16892 
16893     /**
16894      * @brief Get the currency of the amount
16895      *
16896      * You take the ownership of the returned value
16897      *
16898      * @return Currency of the amount
16899      */
16900     virtual char *getCurrency() const;
16901 };
16902 
16903 /**
16904  * @brief Details about a MEGA session
16905  */
16906 class MegaAccountSession
16907 {
16908 public:
16909     virtual ~MegaAccountSession();
16910 
16911     /**
16912      * @brief Get the creation date of the session
16913      *
16914      * In seconds since the Epoch
16915      *
16916      * @return Creation date of the session
16917      */
16918     virtual int64_t getCreationTimestamp() const;
16919 
16920     /**
16921      * @brief Get the timestamp of the most recent usage of the session
16922      * @return Timestamp of the most recent usage of the session (in seconds since the Epoch)
16923      */
16924     virtual int64_t getMostRecentUsage() const;
16925 
16926     /**
16927      * @brief Get the User-Agent of the client that created the session
16928      *
16929      * You take the ownership of the returned value
16930      *
16931      * @return User-Agent of the creator of the session
16932      */
16933     virtual char *getUserAgent() const;
16934 
16935     /**
16936      * @brief Get the IP address of the client that created the session
16937      *
16938      * You take the ownership of the returned value
16939      *
16940      * @return IP address of the creator of the session
16941      */
16942     virtual char *getIP() const;
16943 
16944     /**
16945      * @brief Get the country of the client that created the session
16946      *
16947      * You take the ownership of the returned value
16948      *
16949      * @return Country of the creator of the session
16950      */
16951     virtual char *getCountry() const;
16952 
16953     /**
16954      * @brief Retuns true if the session is the current one
16955      * @return True if the session is the current one. Otherwise false.
16956      */
16957     virtual bool isCurrent() const;
16958 
16959     /**
16960      * @brief Get the state of the session
16961      * @return True if the session is alive, false otherwise
16962      */
16963     virtual bool isAlive() const;
16964 
16965     /**
16966      * @brief Get the handle of the session
16967      * @return Handle of the session
16968      */
16969     virtual MegaHandle getHandle() const;
16970 };
16971 
16972 /**
16973  * @brief Details about a MEGA purchase
16974  */
16975 class MegaAccountPurchase
16976 {
16977 public:
16978     virtual ~MegaAccountPurchase();
16979 
16980     /**
16981      * @brief Get the timestamp of the purchase
16982      * @return Timestamp of the purchase (in seconds since the Epoch)
16983      */
16984     virtual int64_t getTimestamp() const;
16985 
16986     /**
16987      * @brief Get the handle of the purchase
16988      *
16989      * You take the ownership of the returned value
16990      *
16991      * @return Handle of the purchase
16992      */
16993     virtual char *getHandle() const;
16994 
16995     /**
16996      * @brief Get the currency of the purchase
16997      *
16998      * You take the ownership of the returned value
16999      *
17000      * @return Currency of the purchase
17001      */
17002     virtual char* getCurrency() const;
17003 
17004     /**
17005      * @brief Get the amount of the purchase
17006      * @return Amount of the purchase
17007      */
17008     virtual double getAmount() const;
17009 
17010     /**
17011      * @brief Get the method of the purchase
17012      *
17013      * These are the valid methods:
17014      * - MegaApi::PAYMENT_METHOD_BALANCE = 0,
17015      * - MegaApi::PAYMENT_METHOD_PAYPAL = 1,
17016      * - MegaApi::PAYMENT_METHOD_ITUNES = 2,
17017      * - MegaApi::PAYMENT_METHOD_GOOGLE_WALLET = 3,
17018      * - MegaApi::PAYMENT_METHOD_BITCOIN = 4,
17019      * - MegaApi::PAYMENT_METHOD_UNIONPAY = 5,
17020      * - MegaApi::PAYMENT_METHOD_FORTUMO = 6,
17021      * - MegaApi::PAYMENT_METHOD_CREDIT_CARD = 8
17022      * - MegaApi::PAYMENT_METHOD_CENTILI = 9
17023      * - MegaApi::PAYMENT_METHOD_WINDOWS_STORE = 13
17024      *
17025      * @return Method of the purchase
17026      */
17027     virtual int getMethod() const;
17028 };
17029 
17030 /**
17031  * @brief Details about a MEGA transaction
17032  */
17033 class MegaAccountTransaction
17034 {
17035 public:
17036     virtual ~MegaAccountTransaction();
17037 
17038     /**
17039      * @brief Get the timestamp of the transaction
17040      * @return Timestamp of the transaction (in seconds since the Epoch)
17041      */
17042     virtual int64_t getTimestamp() const;
17043 
17044     /**
17045      * @brief Get the handle of the transaction
17046      *
17047      * You take the ownership of the returned value
17048      *
17049      * @return Handle of the transaction
17050      */
17051     virtual char *getHandle() const;
17052 
17053     /**
17054      * @brief Get the currency of the transaction
17055      *
17056      * You take the ownership of the returned value
17057      *
17058      * @return Currency of the transaction
17059      */
17060     virtual char* getCurrency() const;
17061 
17062     /**
17063      * @brief Get the amount of the transaction
17064      * @return Amount of the transaction
17065      */
17066     virtual double getAmount() const;
17067 };
17068 
17069 /**
17070  * @brief Details about a MEGA account
17071  */
17072 class MegaAccountDetails
17073 {
17074 public:
17075     enum
17076     {
17077         ACCOUNT_TYPE_FREE = 0,
17078         ACCOUNT_TYPE_PROI = 1,
17079         ACCOUNT_TYPE_PROII = 2,
17080         ACCOUNT_TYPE_PROIII = 3,
17081         ACCOUNT_TYPE_LITE = 4,
17082         ACCOUNT_TYPE_BUSINESS = 100
17083     };
17084 
17085     enum
17086     {
17087         SUBSCRIPTION_STATUS_NONE = 0,
17088         SUBSCRIPTION_STATUS_VALID = 1,
17089         SUBSCRIPTION_STATUS_INVALID = 2
17090     };
17091 
17092     virtual ~MegaAccountDetails();
17093     /**
17094      * @brief Get the PRO level of the MEGA account
17095      * @return PRO level of the MEGA account.
17096      * Valid values are:
17097      * - MegaAccountDetails::ACCOUNT_TYPE_FREE = 0
17098      * - MegaAccountDetails::ACCOUNT_TYPE_PROI = 1
17099      * - MegaAccountDetails::ACCOUNT_TYPE_PROII = 2
17100      * - MegaAccountDetails::ACCOUNT_TYPE_PROIII = 3
17101      * - MegaAccountDetails::ACCOUNT_TYPE_LITE = 4
17102      * - MegaAccountDetails::ACCOUNT_TYPE_BUSINESS = 100
17103      */
17104     virtual int getProLevel();
17105 
17106     /**
17107      * @brief Get the expiration time for the current PRO status
17108      * @return Expiration time for the current PRO status (in seconds since the Epoch)
17109      */
17110     virtual int64_t getProExpiration();
17111 
17112     /**
17113      * @brief Check if there is a valid subscription
17114      *
17115      * If this function returns MegaAccountDetails::SUBSCRIPTION_STATUS_VALID,
17116      * the PRO account will be automatically renewed.
17117      * See MegaAccountDetails::getSubscriptionRenewTime
17118      *
17119      * @return Information about about the subscription status
17120      *
17121      * Valid return values are:
17122      * - MegaAccountDetails::SUBSCRIPTION_STATUS_NONE = 0
17123      * There isn't any active subscription
17124      *
17125      * - MegaAccountDetails::SUBSCRIPTION_STATUS_VALID = 1
17126      * There is an active subscription
17127      *
17128      * - MegaAccountDetails::SUBSCRIPTION_STATUS_INVALID = 2
17129      * A subscription exists, but it uses a payment gateway that is no longer valid
17130      *
17131      */
17132     virtual int getSubscriptionStatus();
17133 
17134     /**
17135      * @brief Get the time when the the PRO account will be renewed
17136      * @return Renewal time (in seconds since the Epoch)
17137      */
17138     virtual int64_t getSubscriptionRenewTime();
17139 
17140     /**
17141      * @brief Get the subscryption method
17142      *
17143      * You take the ownership of the returned value
17144      *
17145      * @return Subscription method. For example "Credit Card".
17146      */
17147     virtual char* getSubscriptionMethod();
17148 
17149     /**
17150      * @brief Get the subscription cycle
17151      *
17152      * The return value will show if the subscription will be montly or yearly renewed.
17153      * Example return values: "1 M", "1 Y".
17154      *
17155      * @return Subscription cycle
17156      */
17157     virtual char* getSubscriptionCycle();
17158 
17159     /**
17160      * @brief Get the maximum storage for the account (in bytes)
17161      * @return Maximum storage for the account (in bytes)
17162      */
17163     virtual long long getStorageMax();
17164 
17165     /**
17166      * @brief Get the used storage
17167      * @return Used storage (in bytes)
17168      */
17169     virtual long long getStorageUsed();
17170 
17171     /**
17172      * @brief Get the used storage by versions
17173      * @return Used storage by versions (in bytes)
17174      */
17175     virtual long long getVersionStorageUsed();
17176 
17177     /**
17178      * @brief Get the maximum available bandwidth for the account
17179      * @return Maximum available bandwidth (in bytes)
17180      */
17181     virtual long long getTransferMax();
17182 
17183     /**
17184      * @brief Get the used bandwidth for own user allowance
17185      * @see: MegaAccountDetails::getTransferUsed
17186      * @return Used bandwidth (in bytes)
17187      */
17188     virtual long long getTransferOwnUsed();
17189 
17190     /**
17191      * @brief Get the used bandwidth served to other users
17192      * @see: MegaAccountDetails::getTransferUsed
17193      * @return Used bandwidth (in bytes)
17194      */
17195     virtual long long getTransferSrvUsed();
17196 
17197     /**
17198      * @brief Get the used bandwidth allowance including own, free and served to other users
17199      * @see: MegaAccountDetails::getTransferOwnUsed, MegaAccountDetails::getTemporalBandwidth, MegaAccountDetails::getTransferSrvUsed
17200      * @return Used bandwidth (in bytes)
17201      */
17202     virtual long long getTransferUsed();
17203 
17204     /**
17205      * @brief Returns the number of nodes with account usage info
17206      *
17207      * You can get information about each node using MegaAccountDetails::getStorageUsed,
17208      * MegaAccountDetails::getNumFiles, MegaAccountDetails::getNumFolders
17209      *
17210      * This function can return:
17211      * - 0 (no info about any node)
17212      * - 3 (info about the root node, the inbox node and the rubbish node)
17213      * Use MegaApi::getRootNode MegaApi::getInboxNode and MegaApi::getRubbishNode to get those nodes.
17214      *
17215      * - >3 (info about root, inbox, rubbish and incoming shares)
17216      * Use MegaApi::getInShares to get the incoming shares
17217      *
17218      * @return Number of items with account usage info
17219      */
17220     virtual int getNumUsageItems();
17221 
17222     /**
17223      * @brief Get the used storage in for a node
17224      *
17225      * Only root nodes are supported.
17226      *
17227      * @param handle Handle of the node to check
17228      * @return Used storage (in bytes)
17229      * @see MegaApi::getRootNode, MegaApi::getRubbishNode, MegaApi::getInboxNode
17230      */
17231     virtual long long getStorageUsed(MegaHandle handle);
17232 
17233     /**
17234      * @brief Get the number of files in a node
17235      *
17236      * Only root nodes are supported.
17237      *
17238      * @param handle Handle of the node to check
17239      * @return Number of files in the node
17240      * @see MegaApi::getRootNode, MegaApi::getRubbishNode, MegaApi::getInboxNode
17241      */
17242     virtual long long getNumFiles(MegaHandle handle);
17243 
17244     /**
17245      * @brief Get the number of folders in a node
17246      *
17247      * Only root nodes are supported.
17248      *
17249      * @param handle Handle of the node to check
17250      * @return Number of folders in the node
17251      * @see MegaApi::getRootNode, MegaApi::getRubbishNode, MegaApi::getInboxNode
17252      */
17253     virtual long long getNumFolders(MegaHandle handle);
17254 
17255     /**
17256      * @brief Get the used storage by versions in for a node
17257      *
17258      * Only root nodes are supported.
17259      *
17260      * @param handle Handle of the node to check
17261      * @return Used storage by versions (in bytes)
17262      * @see MegaApi::getRootNode, MegaApi::getRubbishNode, MegaApi::getInboxNode
17263      */
17264     virtual long long getVersionStorageUsed(MegaHandle handle);
17265 
17266     /**
17267      * @brief Get the number of versioned files in a node
17268      *
17269      * Only root nodes are supported.
17270      *
17271      * @param handle Handle of the node to check
17272      * @return Number of versioned files in the node
17273      * @see MegaApi::getRootNode, MegaApi::getRubbishNode, MegaApi::getInboxNode
17274      */
17275     virtual long long getNumVersionFiles(MegaHandle handle);
17276 
17277     /**
17278      * @brief Creates a copy of this MegaAccountDetails object.
17279      *
17280      * The resulting object is fully independent of the source MegaAccountDetails,
17281      * it contains a copy of all internal attributes, so it will be valid after
17282      * the original object is deleted.
17283      *
17284      * You are the owner of the returned object
17285      *
17286      * @return Copy of the MegaAccountDetails object
17287      */
17288     virtual MegaAccountDetails* copy();
17289 
17290     /**
17291      * @brief Get the number of MegaAccountBalance objects associated with the account
17292      *
17293      * You can use MegaAccountDetails::getBalance to get those objects.
17294      *
17295      * @return Number of MegaAccountBalance objects
17296      */
17297     virtual int getNumBalances() const;
17298 
17299     /**
17300      * @brief Returns the MegaAccountBalance object associated with an index
17301      *
17302      * You take the ownership of the returned value
17303      *
17304      * @param i Index of the object
17305      * @return MegaAccountBalance object
17306      */
17307     virtual MegaAccountBalance* getBalance(int i) const;
17308 
17309     /**
17310      * @brief Get the number of MegaAccountSession objects associated with the account
17311      *
17312      * You can use MegaAccountDetails::getSession to get those objects.
17313      *
17314      * @return Number of MegaAccountSession objects
17315      */
17316     virtual int getNumSessions() const;
17317 
17318     /**
17319      * @brief Returns the MegaAccountSession object associated with an index
17320      *
17321      * You take the ownership of the returned value
17322      *
17323      * @param i Index of the object
17324      * @return MegaAccountSession object
17325      */
17326     virtual MegaAccountSession* getSession(int i) const;
17327 
17328     /**
17329      * @brief Get the number of MegaAccountPurchase objects associated with the account
17330      *
17331      * You can use MegaAccountDetails::getPurchase to get those objects.
17332      *
17333      * @return Number of MegaAccountPurchase objects
17334      */
17335     virtual int getNumPurchases() const;
17336 
17337     /**
17338      * @brief Returns the MegaAccountPurchase object associated with an index
17339      *
17340      * You take the ownership of the returned value
17341      *
17342      * @param i Index of the object
17343      * @return MegaAccountPurchase object
17344      */
17345     virtual MegaAccountPurchase* getPurchase(int i) const;
17346 
17347     /**
17348      * @brief Get the number of MegaAccountTransaction objects associated with the account
17349      *
17350      * You can use MegaAccountDetails::getTransaction to get those objects.
17351      *
17352      * @return Number of MegaAccountTransaction objects
17353      */
17354     virtual int getNumTransactions() const;
17355 
17356     /**
17357      * @brief Returns the MegaAccountTransaction object associated with an index
17358      *
17359      * You take the ownership of the returned value
17360      *
17361      * @param i Index of the object
17362      * @return MegaAccountTransaction object
17363      */
17364     virtual MegaAccountTransaction* getTransaction(int i) const;
17365 
17366     /**
17367      * @brief Get the number of hours that are taken into account to calculate the free bandwidth quota
17368      *
17369      * The number of bytes transferred in that time is provided using MegaAccountDetails::getTemporalBandwidth
17370      *
17371      * @return Number of hours taken into account to calculate the free bandwidth quota
17372      */
17373     virtual int getTemporalBandwidthInterval();
17374 
17375     /**
17376      * @brief Get the number of bytes that were recently transferred using free allowance
17377      *
17378      * The time interval in which those bytes were transferred
17379      * is provided (in hours) using MegaAccountDetails::getTemporalBandwidthInterval
17380      *
17381      * @see: MegaAccountDetails::getTransferUsed
17382      * @return Number of bytes that were recently transferred
17383      */
17384     virtual long long getTemporalBandwidth();
17385 
17386     /**
17387      * @brief Check if the temporal bandwidth usage is valid after an overquota error
17388      * @return True if the temporal bandwidth is valid, otherwise false
17389      */
17390     virtual bool isTemporalBandwidthValid();
17391 };
17392 
17393 /**
17394  * @brief Details about pricing plans
17395  *
17396  * Use MegaApi::getPricing to get the pricing plans to upgrade MEGA accounts
17397  */
17398 class MegaPricing
17399 {
17400 public:
17401     virtual ~MegaPricing();
17402 
17403     /**
17404      * @brief Get the number of available products to upgrade the account
17405      * @return Number of available products
17406      */
17407     virtual int getNumProducts();
17408 
17409     /**
17410      * @brief Get the handle of a product
17411      * @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
17412      * @return Handle of the product
17413      * @see MegaApi::getPaymentId
17414      */
17415     virtual MegaHandle getHandle(int productIndex);
17416 
17417     /**
17418      * @brief Get the PRO level associated with the product
17419      * @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
17420      * @return PRO level associated with the product:
17421      * Valid values are:
17422      * - MegaAccountDetails::ACCOUNT_TYPE_FREE = 0
17423      * - MegaAccountDetails::ACCOUNT_TYPE_PROI = 1
17424      * - MegaAccountDetails::ACCOUNT_TYPE_PROII = 2
17425      * - MegaAccountDetails::ACCOUNT_TYPE_PROIII = 3
17426      * - MegaAccountDetails::ACCOUNT_TYPE_LITE = 4
17427      * - MegaAccountDetails::ACCOUNT_TYPE_BUSINESS = 100
17428      */
17429     virtual int getProLevel(int productIndex);
17430 
17431     /**
17432      * @brief Get the number of GB of storage associated with the product
17433      * @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
17434      * @note business plans have unlimited storage
17435      * @return number of GB of storage, zero if index is invalid, or -1
17436      * if pricing plan is a business plan
17437      */
17438     virtual int getGBStorage(int productIndex);
17439 
17440     /**
17441      * @brief Get the number of GB of bandwidth associated with the product
17442      * @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
17443      * @note business plans have unlimited bandwidth
17444      * @return number of GB of bandwidth, zero if index is invalid, or -1,
17445      * if pricing plan is a business plan
17446      */
17447     virtual int getGBTransfer(int productIndex);
17448 
17449     /**
17450      * @brief Get the duration of the product (in months)
17451      * @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
17452      * @return Duration of the product (in months)
17453      */
17454     virtual int getMonths(int productIndex);
17455 
17456     /**
17457      * @brief Get the price of the product (in cents)
17458      * @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
17459      * @return Price of the product (in cents)
17460      */
17461     virtual int getAmount(int productIndex);
17462 
17463     /**
17464      * @brief Get the currency associated with MegaPricing::getAmount
17465      *
17466      * The SDK retains the ownership of the returned value. It will be valid until
17467      * the MegaPricing object is deleted.
17468      *
17469      * @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
17470      * @return Currency associated with MegaPricing::getAmount
17471      */
17472     virtual const char* getCurrency(int productIndex);
17473 
17474     /**
17475      * @brief Get a description of the product
17476      *
17477      * The SDK retains the ownership of the returned value. It will be valid until
17478      * the MegaPricing object is deleted.
17479      *
17480      * @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
17481      * @return Description of the product
17482      */
17483     virtual const char* getDescription(int productIndex);
17484 
17485     /**
17486      * @brief getIosID Get the iOS ID of the product
17487      *
17488      * The SDK retains the ownership of the returned value. It will be valid until
17489      * the MegaPricing object is deleted.
17490      *
17491      * @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
17492      * @return iOS ID of the product, NULL if index is invalid or an empty string
17493      * if pricing plan is a business plan.
17494      */
17495     virtual const char* getIosID(int productIndex);
17496 
17497     /**
17498      * @brief Get the Android ID of the product
17499      *
17500      * The SDK retains the ownership of the returned value. It will be valid until
17501      * the MegaPricing object is deleted.
17502      *
17503      * @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
17504      * @return Android ID of the product, NULL if index is invalid or an empty string
17505      * if pricing plan is a business plan.
17506      */
17507     virtual const char* getAndroidID(int productIndex);
17508 
17509     /**
17510      * @brief Returns if the pricing plan is a business plan
17511      * @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
17512      * @return true if the pricing plan is a business plan, otherwise return false
17513      */
17514     virtual bool isBusinessType(int productIndex);
17515 
17516     /**
17517      * @brief Get the monthly price of the product (in cents)
17518      * @param productIndex Product index (from 0 to MegaPricing::getNumProducts)
17519      * @return Monthly price of the product (in cents)
17520      */
17521     virtual int getAmountMonth(int productIndex);
17522 
17523     /**
17524      * @brief Creates a copy of this MegaPricing object.
17525      *
17526      * The resulting object is fully independent of the source MegaPricing,
17527      * it contains a copy of all internal attributes, so it will be valid after
17528      * the original object is deleted.
17529      *
17530      * You are the owner of the returned object
17531      *
17532      * @return Copy of the MegaPricing object
17533      */
17534     virtual MegaPricing *copy();
17535 };
17536 
17537 /**
17538  * @brief The MegaAchievementsDetails class
17539  *
17540  * There are several MEGA Achievements that a user can unlock, resulting in a
17541  * temporary extension of the storage and/or transfer quota during a period of
17542  * time.
17543  *
17544  * Currently there are 4 different classes of MEGA Achievements:
17545  *
17546  *  - Welcome: Create your free account and get 35 GB of complimentary storage space,
17547  *      valid for 30 days.
17548  *
17549  *  - Invite: Invite as many friends or coworkers as you want. For every signup under the
17550  *      invited email address, you will receive 10 GB of complimentary storage plus 20 GB
17551  *      of transfer quota, both valid for 365 days, provided that the new user installs
17552  *      either MEGAsync or a mobile app and starts using MEGA.
17553  *
17554  *  - Desktop install: When you install MEGAsync you get 20 GB of complimentary storage
17555  *      space plus 40 GB of transfer quota, both valid for 180 days.
17556  *
17557  *  - Mobile install: When you install our mobile app you get 15 GB of complimentary
17558  *      storage space plus 30 GB transfer quota, both valid for 180 days.
17559  *
17560  * When the user unlocks one of the achievements above, it unlocks an "Award". The award
17561  * includes a timestamps to indicate when it was unlocked, plus an expiration timestamp.
17562  * Afterwards, the award will not be active. Additionally, each award results in a "Reward".
17563  * The reward is linked to the corresponding award and includes the storage and transfer
17564  * quota obtained thanks to the unlocked award.
17565  *
17566  * @note It may take 2-3 days for achievements to show on the account after they have been completed.
17567  */
17568 class MegaAchievementsDetails
17569 {
17570 public:
17571 
17572     enum {
17573         MEGA_ACHIEVEMENT_WELCOME            = 1,
17574         MEGA_ACHIEVEMENT_INVITE             = 3,
17575         MEGA_ACHIEVEMENT_DESKTOP_INSTALL    = 4,
17576         MEGA_ACHIEVEMENT_MOBILE_INSTALL     = 5,
17577         MEGA_ACHIEVEMENT_ADD_PHONE          = 9
17578     };
17579 
17580     virtual ~MegaAchievementsDetails();
17581 
17582     /**
17583      * @brief Get the base storage value for this account
17584      * @return The base storage value, in bytes
17585      */
17586     virtual long long getBaseStorage();
17587 
17588     /**
17589      * @brief Get the storage granted by a MEGA achievement class
17590      *
17591      * The following classes are valid:
17592      *  - MEGA_ACHIEVEMENT_WELCOME = 1
17593      *  - MEGA_ACHIEVEMENT_INVITE = 3
17594      *  - MEGA_ACHIEVEMENT_DESKTOP_INSTALL = 4
17595      *  - MEGA_ACHIEVEMENT_MOBILE_INSTALL = 5
17596      *  - MEGA_ACHIEVEMENT_ADD_PHONE = 9
17597      *
17598      * @param class_id Id of the MEGA achievement
17599      * @return Storage granted by this MEGA achievement class, in bytes
17600      */
17601     virtual long long getClassStorage(int class_id);
17602 
17603     /**
17604      * @brief Get the transfer quota granted by a MEGA achievement class
17605      *
17606      * The following classes are valid:
17607      *  - MEGA_ACHIEVEMENT_WELCOME = 1
17608      *  - MEGA_ACHIEVEMENT_INVITE = 3
17609      *  - MEGA_ACHIEVEMENT_DESKTOP_INSTALL = 4
17610      *  - MEGA_ACHIEVEMENT_MOBILE_INSTALL = 5
17611      *  - MEGA_ACHIEVEMENT_ADD_PHONE = 9
17612      *
17613      * @param class_id Id of the MEGA achievement
17614      * @return Transfer quota granted by this MEGA achievement class, in bytes
17615      */
17616     virtual long long getClassTransfer(int class_id);
17617 
17618     /**
17619      * @brief Get the duration of storage/transfer quota granted by a MEGA achievement class
17620      *
17621      * The following classes are valid:
17622      *  - MEGA_ACHIEVEMENT_WELCOME = 1
17623      *  - MEGA_ACHIEVEMENT_INVITE = 3
17624      *  - MEGA_ACHIEVEMENT_DESKTOP_INSTALL = 4
17625      *  - MEGA_ACHIEVEMENT_MOBILE_INSTALL = 5
17626      *  - MEGA_ACHIEVEMENT_ADD_PHONE = 9
17627      *
17628      * The storage and transfer quota resulting from a MEGA achievement may expire after
17629      * certain number of days. In example, the "Welcome" reward lasts for 30 days and afterwards
17630      * the granted storage and transfer quota is revoked.
17631      *
17632      * @param class_id Id of the MEGA achievement
17633      * @return Number of days for the storage/transfer quota granted by this MEGA achievement class
17634      */
17635     virtual int getClassExpire(int class_id);
17636 
17637     /**
17638      * @brief Get the number of unlocked awards for this account
17639      * @return Number of unlocked awards
17640      */
17641     virtual unsigned int getAwardsCount();
17642 
17643     /**
17644      * @brief Get the MEGA achievement class of the award
17645      * @param index Position of the award in the list of unlocked awards
17646      * @return The achievement class associated to the award in position \c index
17647      */
17648     virtual int getAwardClass(unsigned int index);
17649 
17650     /**
17651      * @brief Get the id of the award
17652      * @param index Position of the award in the list of unlocked awards
17653      * @return The id of the award in position \c index
17654      */
17655     virtual int getAwardId(unsigned int index);
17656 
17657     /**
17658      * @brief Get the timestamp of the award (when it was unlocked)
17659      * @param index Position of the award in the list of unlocked awards
17660      * @return The timestamp of the award (when it was unlocked) in position \c index
17661      */
17662     virtual int64_t getAwardTimestamp(unsigned int index);
17663 
17664     /**
17665      * @brief Get the expiration timestamp of the award
17666      *
17667      * After this moment, the storage and transfer quota granted as result of the award
17668      * will not be valid anymore.
17669      *
17670      * @note The expiration time may not be the \c getAwardTimestamp plus the number of days
17671      * returned by \c getClassExpire, since the award can be unlocked but not yet granted. It
17672      * typically takes 2 days from unlocking the award until the user is actually rewarded.
17673      *
17674      * @param index Position of the award in the list of unlocked awards
17675      * @return The expiration timestamp of the award in position \c index
17676      */
17677     virtual int64_t getAwardExpirationTs(unsigned int index);
17678 
17679     /**
17680      * @brief Get the list of referred emails for the award
17681      *
17682      * This function is specific for the achievements of class MEGA_ACHIEVEMENT_INVITE.
17683      *
17684      * You take ownership of the returned value.
17685      *
17686      * @param index Position of the award in the list of unlocked awards
17687      * @return The list of invited emails for the award in position \c index
17688      */
17689     virtual MegaStringList* getAwardEmails(unsigned int index);
17690 
17691     /**
17692      * @brief Get the number of active rewards for this account
17693      * @return Number of active rewards
17694      */
17695     virtual int getRewardsCount();
17696 
17697     /**
17698      * @brief Get the id of the award associated with the reward
17699      * @param index Position of the reward in the list of active rewards
17700      * @return The id of the award associated with the reward
17701      */
17702     virtual int getRewardAwardId(unsigned int index);
17703 
17704     /**
17705      * @brief Get the storage rewarded by the award
17706      * @param index Position of the reward in the list of active rewards
17707      * @return The storage rewarded by the award
17708      */
17709     virtual long long getRewardStorage(unsigned int index);
17710 
17711     /**
17712      * @brief Get the transfer quota rewarded by the award
17713      * @param index Position of the reward in the list of active rewards
17714      * @return The transfer quota rewarded by the award
17715      */
17716     virtual long long getRewardTransfer(unsigned int index);
17717 
17718     /**
17719      * @brief Get the storage rewarded by the award_id
17720      * @param award_id The id of the award
17721      * @return The storage rewarded by the award_id
17722      */
17723     virtual long long getRewardStorageByAwardId(int award_id);
17724 
17725     /**
17726      * @brief Get the transfer rewarded by the award_id
17727      * @param award_id The id of the award
17728      * @return The transfer rewarded by the award_id
17729      */
17730     virtual long long getRewardTransferByAwardId(int award_id);
17731 
17732     /**
17733      * @brief Get the duration of the reward
17734      * @param index Position of the reward in the list of active rewards
17735      * @return The duration of the reward, in days
17736      */
17737     virtual int getRewardExpire(unsigned int index);
17738 
17739     /**
17740      * @brief Creates a copy of this MegaAchievementsDetails object.
17741      *
17742      * The resulting object is fully independent of the source MegaAchievementsDetails,
17743      * it contains a copy of all internal attributes, so it will be valid after
17744      * the original object is deleted.
17745      *
17746      * You are the owner of the returned object
17747      *
17748      * @return Copy of the MegaAchievementsDetails object
17749      */
17750     virtual MegaAchievementsDetails *copy();
17751 
17752     /**
17753      * @brief Returns the actual storage achieved by this account
17754      *
17755      * This function considers all the storage granted to the logged in
17756      * account as result of the unlocked achievements. It does not consider
17757      * the expired achievements nor the permanent base storage.
17758      *
17759      * @return The achieved storage for this account
17760      */
17761     virtual long long currentStorage();
17762 
17763     /**
17764      * @brief Returns the actual transfer quota achieved by this account
17765      *
17766      * This function considers all the transfer quota granted to the logged
17767      * in account as result of the unlocked achievements. It does not consider
17768      * the expired achievements.
17769      *
17770      * @return The achieved transfer quota for this account
17771      */
17772     virtual long long currentTransfer();
17773 
17774     /**
17775      * @brief Returns the actual achieved storage due to referrals
17776      *
17777      * This function considers all the storage granted to the logged in account
17778      * as result of the successful invitations (referrals). It does not consider
17779      * the expired achievements.
17780      *
17781      * @return The achieved storage by this account as result of referrals
17782      */
17783     virtual long long currentStorageReferrals();
17784 
17785     /**
17786      * @brief Returns the actual achieved transfer quota due to referrals
17787      *
17788      * This function considers all the transfer quota granted to the logged
17789      * in account as result of the successful invitations (referrals). It
17790      * does not consider the expired achievements.
17791      *
17792      * @return The transfer achieved quota by this account as result of referrals
17793      */
17794     virtual long long currentTransferReferrals();
17795 };
17796 
17797 class MegaCancelToken
17798 {
17799 protected:
17800     MegaCancelToken();
17801 
17802 public:
17803 
17804     /**
17805      * @brief Creates an object which can be passed as parameter for some MegaApi methods in order to
17806      * request the cancellation of the processing associated to the function. @see MegaApi::search
17807      *
17808      * You take ownership of the returned value.
17809      *
17810      * @return A pointer to an object that allows to cancel the processing of some functions.
17811      */
17812     static MegaCancelToken* createInstance();
17813 
17814     virtual ~MegaCancelToken();
17815 
17816     /**
17817      * @brief Allows to set the value of the flag
17818      * @param newValue True to force the cancelation of the processing. False to reset.
17819      */
17820     virtual void cancel(bool newValue = true);
17821 
17822     /**
17823      * @brief Returns the state of the flag
17824      * @return The state of the flag
17825      */
17826     virtual bool isCancelled() const;
17827 };
17828 
17829 }
17830 
17831 #endif //MEGAAPI_H
17832