@@ -219,13 +219,31 @@ export class JobService extends FolderScopedService implements JobServiceModel {
219219 /**
220220 * Stops one or more jobs by their UUID keys.
221221 *
222- * Resolves job UUID keys to integer IDs, then calls the StopJobs OData action .
223- * Keys are resolved in chunks of 50 to avoid URL length limits.
222+ * Resolves the provided job UUID keys to integer IDs, then sends a stop request to the Orchestrator .
223+ * Keys are processed in chunks of 50 to avoid URL length limits. Throws if any keys cannot be resolved .
224224 *
225- * @param jobKeys - Array of job UUID keys to stop
226- * @param folderId - The folder ID where the jobs reside (required by the API)
227- * @param options - Optional stop options including strategy
228- * @returns Promise resolving to an OperationResponse with the resolved job IDs
225+ * @param jobKeys - Array of job UUID keys to stop (e.g., from {@link JobGetResponse}.key)
226+ * @param folderId - The folder ID where the jobs reside (required)
227+ * @param options - Optional {@link JobStopOptions} including stop strategy
228+ * @returns Promise resolving to an {@link OperationResponse}<{@link JobStopData}> with the resolved job IDs
229+ *
230+ * @example
231+ * ```typescript
232+ * // Stop a single job with default soft stop
233+ * const result = await jobs.stop([<jobKey>], <folderId>);
234+ * ```
235+ *
236+ * @example
237+ * ```typescript
238+ * import { StopStrategy } from '@uipath/uipath-typescript/jobs';
239+ *
240+ * // Force-kill multiple jobs
241+ * const result = await jobs.stop(
242+ * [<jobKey1>, <jobKey2>],
243+ * <folderId>,
244+ * { strategy: StopStrategy.Kill }
245+ * );
246+ * ```
229247 */
230248 @track ( 'Jobs.Stop' )
231249 async stop (
@@ -308,7 +326,7 @@ export class JobService extends FolderScopedService implements JobServiceModel {
308326 const response = await this . get < CollectionResponse < { Key : string ; Id : number } > > (
309327 JOB_ENDPOINTS . GET_ALL ,
310328 {
311- params : { $filter : filter , $select : 'Id,Key' } ,
329+ params : { $filter : filter , $select : 'Id,Key' , $top : chunk . length } ,
312330 headers,
313331 }
314332 ) ;
@@ -320,7 +338,7 @@ export class JobService extends FolderScopedService implements JobServiceModel {
320338
321339 const missingKeys = uniqueKeys . filter ( ( key ) => ! keyToIdMap . has ( key ) ) ;
322340 if ( missingKeys . length > 0 ) {
323- throw new Error ( `Jobs not found for keys: ${ missingKeys . join ( ', ' ) } ` ) ;
341+ throw new ValidationError ( { message : `Jobs not found for keys: ${ missingKeys . join ( ', ' ) } ` } ) ;
324342 }
325343
326344 return jobKeys . map ( ( key ) => keyToIdMap . get ( key ) ! ) ;
0 commit comments