client getGitTags, still calls /pull-requests/

Signed-off-by: mo <mcassidy@hchb.com>
This commit is contained in:
mo
2022-04-29 07:50:03 -05:00
parent 00939d3b38
commit b2d04967ba
3 changed files with 21 additions and 3 deletions
@@ -39,7 +39,6 @@ export interface AzureDevOpsApi {
): Promise<{ items: RepoBuild[] }>;
getGitTags(
// TODO: Keep iterating down this rabbit hole on the client once the service has caught up
projectName: string,
repoName: string,
options?: PullRequestOptions,
@@ -29,7 +29,6 @@ import { DiscoveryApi, IdentityApi } from '@backstage/core-plugin-api';
import { AzureDevOpsApi } from './AzureDevOpsApi';
import { ResponseError } from '@backstage/errors';
// TODO: See red squiggly below
export class AzureDevOpsClient implements AzureDevOpsApi {
private readonly discoveryApi: DiscoveryApi;
private readonly identityApi: IdentityApi;
@@ -59,6 +58,26 @@ export class AzureDevOpsClient implements AzureDevOpsApi {
return { items };
}
public async getGitTags(
projectName: string,
repoName: string,
options?: PullRequestOptions,
): Promise<{ items: PullRequest[] }> {
const queryString = new URLSearchParams();
if (options?.top) {
queryString.append('top', options.top.toString());
}
if (options?.status) {
queryString.append('status', options.status.toString());
}
const urlSegment = `pull-requests/${encodeURIComponent(
projectName,
)}/${encodeURIComponent(repoName)}?${queryString}`;
const items = await this.get<PullRequest[]>(urlSegment);
return { items };
}
public async getPullRequests(
projectName: string,
repoName: string,
+1 -1
View File
@@ -48,7 +48,7 @@ export function useGitTags(
const { project, repo } = useProjectRepoFromEntity(entity);
const { value, loading, error } = useAsync(() => {
return api.getPullRequests(project, repo, options);
return api.getGitTags(project, repo, options);
}, [api, project, repo, top, status]);
return {