sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Needing help using Mega.nz SDK for scripting

Open Naveeey opened this issue 2 years ago • 0 comments
trafficstars

Im not really familiar with c++ , so i have been using chatgpt to help me make a script that will get a temporary link of a folder that last 1 hour, so this is what i got:

#include "C:\Users\Uros\Downloads\sdk-master\sdk-master\include\megaapi.h" #include

int main(int argc, char argv[]) { // Initialize the MegaApi object mega::MegaApi megaApi = new mega::MegaApi(NULL, "APIKEY");

// Login to your account
megaApi->login("MAIL", "PASS");
megaApi->fetchNodes();

// Get a handle for the folder you want to share
mega::MegaNode *folderNode = megaApi->getNodeByPath("FOLDERPATH");
if(folderNode==NULL)
{
    std::cout<<"Folder not found"<<std::endl;
    return 1;
}

// Get a public link for the folder
megaApi->getPublicLinks(folderNode);
mega::MegaStringMap *links = megaApi->getPublicLinks(folderNode);
std::string exportLink = links->get("0");

// Print the link
std::cout << "Public Link for the folder: " << exportLink << std::endl;

// Clean up
delete megaApi;
return 0;

}

I have been getting this error on line 22 and 23 : invalid conversion from 'mega::MegaNode*' to 'int' [-fpermissive]| If anyone can help me , or just give me anyother way to automate getting temporary links from Mega , would be awesome

Naveeey avatar Jan 26 '23 16:01 Naveeey