All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.eliux.mega.cmd.MegaCmdSignup Maven / Gradle / Ivy

Go to download

Java client library that works on top of MEGAcmd to provide access to the services of Mega.nz

There is a newer version: 1.6.2
Show newest version
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";
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy