Inline the createOctokit method

It's now only used from one place and inlining it doesn't make
getOctokit too long to be unclear.
This commit is contained in:
Robert
2022-12-21 14:49:26 +00:00
parent 551f76cc4e
commit abc025cb39

View File

@@ -47,7 +47,16 @@ export class Credentials {
return new Credentials(new Octokit.Octokit({ auth: overrideToken, retry }));
}
private async createOctokit(): Promise<Octokit.Octokit> {
/**
* Creates or returns an instance of Octokit.
*
* @returns An instance of Octokit.
*/
async getOctokit(): Promise<Octokit.Octokit> {
if (this.octokit) {
return this.octokit;
}
const session = await vscode.authentication.getSession(
GITHUB_AUTH_PROVIDER_ID,
SCOPES,
@@ -59,16 +68,4 @@ export class Credentials {
retry,
});
}
/**
* Creates or returns an instance of Octokit.
*
* @returns An instance of Octokit.
*/
async getOctokit(): Promise<Octokit.Octokit> {
if (this.octokit) {
return this.octokit;
}
return await this.createOctokit();
}
}