Search in sources :

Example 1 with AccessToken

use of io.micronaut.starter.api.create.github.client.oauth.AccessToken in project micronaut-starter by micronaut-projects.

the class GitHubCreateService method creatApp.

protected GitHubRepository creatApp(@NonNull ApplicationType type, @NonNull String name, @Nullable List<String> features, @Nullable BuildTool buildTool, @Nullable TestFramework testFramework, @Nullable Language lang, @Nullable JdkVersion javaVersion, @NonNull String code, @NonNull String state, @Nullable String userAgent) {
    AccessToken accessToken = getGitHubAccessToken(code, state);
    String authToken = TOKEN_PREFIX + accessToken.getAccessToken();
    GitHubUser gitHubUser = getGitHubUser(authToken);
    GeneratorContext generatorContext = createProjectGeneratorContext(type, name, features, buildTool, testFramework, lang, javaVersion, userAgent);
    String repoName = generatorContext.getProject().getName();
    String repoDescription = String.format("Micronaut %s Application", generatorContext.getProject().getNaturalName());
    GitHubRepository githubRepository = createGitHubRepository(authToken, repoName, repoDescription, gitHubUser);
    pushToGithubRepository(generatorContext, gitHubUser, githubRepository, accessToken);
    return githubRepository;
}
Also used : GitHubUser(io.micronaut.starter.api.create.github.client.v3.GitHubUser) AccessToken(io.micronaut.starter.api.create.github.client.oauth.AccessToken) GeneratorContext(io.micronaut.starter.application.generator.GeneratorContext) GitHubRepository(io.micronaut.starter.api.create.github.client.v3.GitHubRepository)

Aggregations

AccessToken (io.micronaut.starter.api.create.github.client.oauth.AccessToken)1 GitHubRepository (io.micronaut.starter.api.create.github.client.v3.GitHubRepository)1 GitHubUser (io.micronaut.starter.api.create.github.client.v3.GitHubUser)1 GeneratorContext (io.micronaut.starter.application.generator.GeneratorContext)1