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

help.swgoh.api.SwgohAPISettings Maven / Gradle / Ivy

Go to download

A collection of Java helper classes that allow for easy and immediate access to the api.swgoh.help endpoints.

There is a newer version: 4.3.0
Show newest version
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