diff --git a/src/clients/pull-request-client.ts b/src/clients/pull-request-client.ts index ddbd5c2..e803930 100644 --- a/src/clients/pull-request-client.ts +++ b/src/clients/pull-request-client.ts @@ -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 { await this.ensureInitialized(); try { @@ -69,7 +69,7 @@ export class PullRequestClient extends BaseClient { try { const params: Record = {}; 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 = {}; 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 = {}; 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)}`); }