Skip to content

Commit b8cbd75

Browse files
Use "private readonly" modifier on constructor args
1 parent c575ede commit b8cbd75

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

extensions/ql-vscode/src/codeql-cli/releases-api-consumer.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import { GithubRateLimitedError, GithubApiError } from "./github-api-error";
99
*/
1010
export class ReleasesApiConsumer {
1111
constructor(
12-
ownerName: string,
13-
repoName: string,
12+
private readonly ownerName: string,
13+
private readonly repoName: string,
1414
personalAccessToken?: string,
1515
) {
1616
// Specify version of the GitHub API
@@ -19,9 +19,6 @@ export class ReleasesApiConsumer {
1919
if (personalAccessToken) {
2020
this._defaultHeaders["authorization"] = `token ${personalAccessToken}`;
2121
}
22-
23-
this._ownerName = ownerName;
24-
this._repoName = repoName;
2522
}
2623

2724
public async getLatestRelease(
@@ -30,7 +27,7 @@ export class ReleasesApiConsumer {
3027
includePrerelease = false,
3128
additionalCompatibilityCheck?: (release: GithubRelease) => boolean,
3229
): Promise<Release> {
33-
const apiPath = `/repos/${this._ownerName}/${this._repoName}/releases`;
30+
const apiPath = `/repos/${this.ownerName}/${this.repoName}/releases`;
3431
const allReleases: GithubRelease[] = await (
3532
await this.makeApiCall(apiPath)
3633
).json();
@@ -88,7 +85,7 @@ export class ReleasesApiConsumer {
8885
public async streamBinaryContentOfAsset(
8986
asset: ReleaseAsset,
9087
): Promise<fetch.Response> {
91-
const apiPath = `/repos/${this._ownerName}/${this._repoName}/releases/assets/${asset.id}`;
88+
const apiPath = `/repos/${this.ownerName}/${this.repoName}/releases/assets/${asset.id}`;
9289

9390
return await this.makeApiCall(apiPath, {
9491
accept: "application/octet-stream",
@@ -157,8 +154,6 @@ export class ReleasesApiConsumer {
157154
}
158155

159156
private readonly _defaultHeaders: { [key: string]: string } = {};
160-
private readonly _ownerName: string;
161-
private readonly _repoName: string;
162157

163158
private static readonly _apiBase = "https://api.github.com";
164159
private static readonly _maxRedirects = 20;

0 commit comments

Comments
 (0)