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

com.sudicode.fb2gh.github.GHFactory Maven / Gradle / Ivy

The newest version!
package com.sudicode.fb2gh.github;

/**
 * Factory used to interact with GitHub.
 */
public final class GHFactory {

    /**
     * This is a factory class which is not designed for instantiation.
     */
    private GHFactory() {
        throw new AssertionError("Cannot instantiate.");
    }

    /**
     * Construct a new {@link GitHub} without authentication.
     *
     * @return The {@link GitHub}
     */
    public static GitHub newGitHub() {
        return new GitHubImpl();
    }

    /**
     * Construct a new {@link GitHub}, authenticating via OAuth.
     *
     * @param token The OAuth token.
     * @return The {@link GitHub}
     * @see OAuth
     */
    public static GitHub newGitHub(final String token) {
        return new GitHubImpl(token);
    }

    /**
     * Construct a new {@link GitHub}, authenticating via username and password.
     * 

* (Note: This method will not work with two-factor authentication. Accounts protected * by 2FA must use {@link GHFactory#newGitHub(String)} instead.) *

* * @param username GitHub username * @param password GitHub password * @return The {@link GitHub} */ public static GitHub newGitHub(final String username, final String password) { return new GitHubImpl(username, password); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy