Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Needing help using Mega.nz SDK for scripting #2631

Open
Naveeey opened this issue Jan 26, 2023 · 0 comments
Open

Needing help using Mega.nz SDK for scripting #2631

Naveeey opened this issue Jan 26, 2023 · 0 comments

Comments

@Naveeey
Copy link

Naveeey commented Jan 26, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant