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

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

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

import com.jcabi.github.Coordinates;
import com.jcabi.github.RtGithub;
import com.jcabi.github.wire.RetryCarefulWire;

/**
 * {@link GitHub} implementation.
 */
class GitHubImpl implements GitHub {

    private final RtGithub connector;

    /**
     * Constructor which does not authenticate.
     */
    GitHubImpl() {
        connector = new RtGithub(new RtGithub().entry().through(RetryCarefulWire.class, 50));
    }

    /**
     * Constructor which authenticates via OAuth.
     *
     * @param token The OAuth token.
     * @see OAuth
     */
    GitHubImpl(final String token) {
        connector = new RtGithub(new RtGithub(token).entry().through(RetryCarefulWire.class, 50));
    }

    /**
     * Constructor which authenticates via username and password.
     *
     * @param username GitHub username
     * @param password GitHub password
     */
    GitHubImpl(final String username, final String password) {
        connector = new RtGithub(new RtGithub(username, password).entry().through(RetryCarefulWire.class, 50));
    }

    @Override
    public GHRepo getRepo(final String repoOwner, final String repoName) {
        return new GHRepoImpl(connector.repos().get(new Coordinates.Simple(repoOwner, repoName)));
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy