瀏覽代碼

Allows providing multiple repos when searching issues/prs

main
Eric Amodio 1 年之前
父節點
當前提交
3328e3cc9f
共有 5 個文件被更改,包括 28 次插入16 次删除
  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 查看文件

@ -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 查看文件

@ -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 查看文件

@ -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 查看文件

@ -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 查看文件

@ -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);
}

Loading…
取消
儲存