help.swgoh.api.SwgohAPISettings Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of swgoh-api-connector Show documentation
Show all versions of swgoh-api-connector Show documentation
A collection of Java helper classes that allow for easy and immediate access to the api.swgoh.help endpoints.
package help.swgoh.api;
import help.swgoh.api.exception.SwgohAPIException;
public class SwgohAPISettings
{
private String username;
private String password;
private SwgohAPI.Language defaultLanguage;
private Boolean defaultEnums;
public String getUsername()
{
return username;
}
public void setUsername( String username )
{
this.username = username;
}
public String getPassword()
{
return password;
}
public void setPassword( String password )
{
this.password = password;
}
public SwgohAPI.Language getDefaultLanguage()
{
return defaultLanguage;
}
public void setDefaultLanguage( SwgohAPI.Language defaultLanguage )
{
this.defaultLanguage = defaultLanguage;
}
public Boolean getDefaultEnums()
{
return defaultEnums;
}
public void setDefaultEnums( Boolean defaultEnums )
{
this.defaultEnums = defaultEnums;
}
public void validate()
{
if ( username == null || "".equals( username ) )
{
throw new SwgohAPIException( "username is required." );
}
if ( password == null || "".equals( password ) )
{
throw new SwgohAPIException( "password is required." );
}
try
{
SwgohAPIClient.API.login( username, password );
}
catch ( Exception exception )
{
throw new SwgohAPIException( "username and/or password are invalid.", exception );
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy