io.github.eliux.mega.cmd.MegaCmdSignup Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of megacmd4j Show documentation
Show all versions of megacmd4j Show documentation
Java client library that works on top of MEGAcmd to provide access to the services of Mega.nz
package io.github.eliux.mega.cmd;
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
public class MegaCmdSignup extends AbstractMegaCmdRunnerWithParams {
private final String username;
private final String password;
private Optional name;
public MegaCmdSignup(String username, String password) {
super();
this.username = username;
this.password = password;
this.name = Optional.empty();
}
@Override
List cmdParams() {
final List cmdParams = new LinkedList<>();
cmdParams.add(username);
cmdParams.add(password);
name.ifPresent(n -> cmdParams.add(
String.format("--name=%s", n)
));
return cmdParams;
}
public Optional getName() {
return name;
}
public MegaCmdSignup setName(String name){
this.name = Optional.of(name);
return this;
}
@Override
public String getCmd() {
return "signup";
}
}