fix: correct start pagination guard, task count uses size, narrow state type in PullRequestClient
This commit is contained in:
@@ -30,7 +30,7 @@ export class PullRequestClient extends BaseClient {
|
|||||||
async listPullRequests(
|
async listPullRequests(
|
||||||
workspace: string,
|
workspace: string,
|
||||||
repoSlug: 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[]> {
|
): Promise<any[]> {
|
||||||
await this.ensureInitialized();
|
await this.ensureInitialized();
|
||||||
try {
|
try {
|
||||||
@@ -69,7 +69,7 @@ export class PullRequestClient extends BaseClient {
|
|||||||
try {
|
try {
|
||||||
const params: Record<string, any> = {};
|
const params: Record<string, any> = {};
|
||||||
if (options?.limit) params.limit = options.limit;
|
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(
|
const response = await this.axiosInstance.get(
|
||||||
`/repositories/${workspace}/${repoSlug}/pullrequests/${prId}/activity`,
|
`/repositories/${workspace}/${repoSlug}/pullrequests/${prId}/activity`,
|
||||||
{ params },
|
{ params },
|
||||||
@@ -88,7 +88,7 @@ export class PullRequestClient extends BaseClient {
|
|||||||
try {
|
try {
|
||||||
const params: Record<string, any> = {};
|
const params: Record<string, any> = {};
|
||||||
if (options?.limit) params.limit = options.limit;
|
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(
|
const prResponse = await this.axiosInstance.get(
|
||||||
`/repositories/${workspace}/${repoSlug}/pullrequests/${prId}`,
|
`/repositories/${workspace}/${repoSlug}/pullrequests/${prId}`,
|
||||||
);
|
);
|
||||||
@@ -115,7 +115,7 @@ export class PullRequestClient extends BaseClient {
|
|||||||
try {
|
try {
|
||||||
const params: Record<string, any> = {};
|
const params: Record<string, any> = {};
|
||||||
if (options?.limit) params.limit = options.limit;
|
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(
|
const response = await this.axiosInstance.get(
|
||||||
`/repositories/${workspace}/${repoSlug}/pullrequests/${prId}/commits`,
|
`/repositories/${workspace}/${repoSlug}/pullrequests/${prId}/commits`,
|
||||||
{ params },
|
{ params },
|
||||||
@@ -243,7 +243,7 @@ export class PullRequestClient extends BaseClient {
|
|||||||
const response = await this.axiosInstance.get(
|
const response = await this.axiosInstance.get(
|
||||||
`/repositories/${workspace}/${repoSlug}/pullrequests/${prId}/tasks`,
|
`/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) {
|
} catch (error) {
|
||||||
throw new Error(`Failed to get task count: ${this.formatError(error)}`);
|
throw new Error(`Failed to get task count: ${this.formatError(error)}`);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user