Procházet zdrojové kódy

Allows providing multiple repos when searching issues/prs

main
Eric Amodio před 1 rokem
rodič
revize
3328e3cc9f
5 změnil soubory, kde provedl 28 přidání a 16 odebrání
  1. +18
    -6
      src/plus/integrations/providerIntegration.ts
  2. +2
    -2
      src/plus/integrations/providers/azureDevOps.ts
  3. +2
    -2
      src/plus/integrations/providers/bitbucket.ts
  4. +4
    -4
      src/plus/integrations/providers/github.ts
  5. +2
    -2
      src/plus/integrations/providers/gitlab.ts

+ 18
- 6
src/plus/integrations/providerIntegration.ts Zobrazit soubor

@ -760,12 +760,17 @@ export abstract class ProviderIntegration
}
}
async searchMyIssues(repo?: RepositoryDescriptor): Promise<SearchedIssue[] | undefined>;
async searchMyIssues(repos: RepositoryDescriptor[]): Promise<SearchedIssue[] | undefined>;
@debug()
async searchMyIssues(repo?: RepositoryDescriptor): Promise<SearchedIssue[] | undefined> {
async searchMyIssues(repos?: RepositoryDescriptor | RepositoryDescriptor[]): Promise<SearchedIssue[] | undefined> {
const scope = getLogScope();
try {
const issues = await this.searchProviderMyIssues(this._session!, repo);
const issues = await this.searchProviderMyIssues(
this._session!,
repos != null ? (Array.isArray(repos) ? repos : [repos]) : undefined,
);
this.resetRequestExceptionCount();
return issues;
} catch (ex) {
@ -775,15 +780,22 @@ export abstract class ProviderIntegration
protected abstract searchProviderMyIssues(
session: AuthenticationSession,
repo?: RepositoryDescriptor,
repos?: RepositoryDescriptor[],
): Promise<SearchedIssue[] | undefined>;
async searchMyPullRequests(repo?: RepositoryDescriptor): Promise<SearchedPullRequest[] | undefined>;
async searchMyPullRequests(repos: RepositoryDescriptor[]): Promise<SearchedPullRequest[] | undefined>;
@debug()
async searchMyPullRequests(repo?: RepositoryDescriptor): Promise<SearchedPullRequest[] | undefined> {
async searchMyPullRequests(
repos?: RepositoryDescriptor | RepositoryDescriptor[],
): Promise<SearchedPullRequest[] | undefined> {
const scope = getLogScope();
try {
const pullRequests = await this.searchProviderMyPullRequests(this._session!, repo);
const pullRequests = await this.searchProviderMyPullRequests(
this._session!,
repos != null ? (Array.isArray(repos) ? repos : [repos]) : undefined,
);
this.resetRequestExceptionCount();
return pullRequests;
} catch (ex) {
@ -793,7 +805,7 @@ export abstract class ProviderIntegration
protected abstract searchProviderMyPullRequests(
session: AuthenticationSession,
repo?: RepositoryDescriptor,
repos?: RepositoryDescriptor[],
): Promise<SearchedPullRequest[] | undefined>;
@gate()

+ 2
- 2
src/plus/integrations/providers/azureDevOps.ts Zobrazit soubor

@ -115,14 +115,14 @@ export class AzureDevOpsIntegration extends ProviderIntegration
protected override async searchProviderMyPullRequests(
_session: AuthenticationSession,
_repo?: AzureRepositoryDescriptor,
_repos?: AzureRepositoryDescriptor[],
): Promise<SearchedPullRequest[] | undefined> {
return Promise.resolve(undefined);
}
protected override async searchProviderMyIssues(
_session: AuthenticationSession,
_repo?: AzureRepositoryDescriptor,
_repos?: AzureRepositoryDescriptor[],
): Promise<SearchedIssue[] | undefined> {
return Promise.resolve(undefined);
}

+ 2
- 2
src/plus/integrations/providers/bitbucket.ts Zobrazit soubor

@ -96,14 +96,14 @@ export class BitbucketIntegration extends ProviderIntegration
protected override async searchProviderMyPullRequests(
_session: AuthenticationSession,
_repo?: BitbucketRepositoryDescriptor,
_repos?: BitbucketRepositoryDescriptor[],
): Promise<SearchedPullRequest[] | undefined> {
return Promise.resolve(undefined);
}
protected override async searchProviderMyIssues(
_session: AuthenticationSession,
_repo?: BitbucketRepositoryDescriptor,
_repos?: BitbucketRepositoryDescriptor[],
): Promise<SearchedIssue[] | undefined> {
return Promise.resolve(undefined);
}

+ 4
- 4
src/plus/integrations/providers/github.ts Zobrazit soubor

@ -144,20 +144,20 @@ export class GitHubIntegration extends ProviderIntegration
protected override async searchProviderMyPullRequests(
{ accessToken }: AuthenticationSession,
repo?: GitHubRepositoryDescriptor,
repos?: GitHubRepositoryDescriptor[],
): Promise<SearchedPullRequest[] | undefined> {
return (await this.container.github)?.searchMyPullRequests(this, accessToken, {
repos: repo != null ? [`${repo.owner}/${repo.name}`] : undefined,
repos: repos?.map(r => `${r.owner}/${r.name}`),
baseUrl: this.apiBaseUrl,
});
}
protected override async searchProviderMyIssues(
{ accessToken }: AuthenticationSession,
repo?: GitHubRepositoryDescriptor,
repos?: GitHubRepositoryDescriptor[],
): Promise<SearchedIssue[] | undefined> {
return (await this.container.github)?.searchMyIssues(this, accessToken, {
repos: repo != null ? [`${repo.owner}/${repo.name}`] : undefined,
repos: repos?.map(r => `${r.owner}/${r.name}`),
baseUrl: this.apiBaseUrl,
});
}

+ 2
- 2
src/plus/integrations/providers/gitlab.ts Zobrazit soubor

@ -144,14 +144,14 @@ export class GitLabIntegration extends ProviderIntegration
protected override searchProviderMyPullRequests(
_session: AuthenticationSession,
_repo?: GitLabRepositoryDescriptor,
_repo?: GitLabRepositoryDescriptor[],
): Promise<SearchedPullRequest[] | undefined> {
return Promise.resolve(undefined);
}
protected override searchProviderMyIssues(
_session: AuthenticationSession,
_repo?: GitLabRepositoryDescriptor,
_repos?: GitLabRepositoryDescriptor[],
): Promise<SearchedIssue[] | undefined> {
return Promise.resolve(undefined);
}

Načítá se…
Zrušit
Uložit