fix: correct start pagination guard, task count uses size, narrow state type in PullRequestClient

This commit is contained in:
2026-05-20 19:09:52 +02:00
parent a0ab910137
commit 5bfef6aa35

View File

@@ -30,7 +30,7 @@ export class PullRequestClient extends BaseClient {
async listPullRequests(
workspace: string,
repoSlug: string,
options?: { state?: string; author?: string; reviewer?: string; since?: string },
options?: { state?: 'OPEN' | 'MERGED' | 'DECLINED' | 'SUPERSEDED'; author?: string; reviewer?: string; since?: string },
): Promise<any[]> {
await this.ensureInitialized();
try {
@@ -69,7 +69,7 @@ export class PullRequestClient extends BaseClient {
try {
const params: Record<string, any> = {};
if (options?.limit) params.limit = options.limit;
if (options?.start) params.start = options.start;
if (options?.start !== undefined) params.start = options.start;
const response = await this.axiosInstance.get(
`/repositories/${workspace}/${repoSlug}/pullrequests/${prId}/activity`,
{ params },
@@ -88,7 +88,7 @@ export class PullRequestClient extends BaseClient {
try {
const params: Record<string, any> = {};
if (options?.limit) params.limit = options.limit;
if (options?.start) params.start = options.start;
if (options?.start !== undefined) params.start = options.start;
const prResponse = await this.axiosInstance.get(
`/repositories/${workspace}/${repoSlug}/pullrequests/${prId}`,
);
@@ -115,7 +115,7 @@ export class PullRequestClient extends BaseClient {
try {
const params: Record<string, any> = {};
if (options?.limit) params.limit = options.limit;
if (options?.start) params.start = options.start;
if (options?.start !== undefined) params.start = options.start;
const response = await this.axiosInstance.get(
`/repositories/${workspace}/${repoSlug}/pullrequests/${prId}/commits`,
{ params },
@@ -243,7 +243,7 @@ export class PullRequestClient extends BaseClient {
const response = await this.axiosInstance.get(
`/repositories/${workspace}/${repoSlug}/pullrequests/${prId}/tasks`,
);
return { count: response.data.values?.length || 0 };
return { count: response.data.size ?? response.data.values?.length ?? 0 };
} catch (error) {
throw new Error(`Failed to get task count: ${this.formatError(error)}`);
}