@rbaileysr/zephyr-managed-api 1.3.7 → 1.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -155,9 +155,11 @@ const apiEU = createZephyrApi(
155
155
  - VersionControl
156
156
  - **Test Case (version-specific)**: `getTestCaseIssueLinks`, `getTestCaseWebLinks`, `getTestCaseTestScript`, `getTestCaseTestSteps`
157
157
  - **Test Execution Step**: `getTestExecutionStepIssueLinks`, `createTestExecutionStepIssueLink`
158
- - IterationData (supplements public API with iteration data)
158
+ - ExtendedData (supplements public API with extended data: iterations and versions)
159
159
  - **Test Cycle**: `getTestCycleIteration`, `updateTestCycleIteration`
160
- - **Test Execution**: `getTestExecutionIteration`, `updateTestExecutionIteration`
160
+ - **Test Execution**: `getTestExecutionIteration`, `updateTestExecutionIteration`, `getTestExecutionVersion`, `updateTestExecutionVersion`
161
+ - TestCaseArchiving (access archived test cases and archiving operations)
162
+ - **Test Case**: `getArchivedTestCases`, `archiveTestCases`, `unarchiveTestCases`
161
163
 
162
164
  ## Private API Authentication
163
165
 
@@ -393,9 +395,9 @@ const stepLink = await api.Private.VersionControl.createTestExecutionStepIssueLi
393
395
  });
394
396
  ```
395
397
 
396
- ### Example: Get and Set Iteration Data (Supplements Public API)
398
+ ### Example: Get and Set Extended Data (Supplements Public API)
397
399
 
398
- The public API does not support getting or setting iterations for Test Cycles and Test Executions. Use the `IterationData` sub-group to supplement public API calls with iteration data.
400
+ The public API does not support getting or setting iterations for Test Cycles and Test Executions, or Jira version IDs (release versions) for Test Executions. Use the `ExtendedData` sub-group to supplement public API calls with this additional data.
399
401
 
400
402
  ```typescript
401
403
  // === Test Cycle Iteration ===
@@ -407,14 +409,14 @@ const testCycle = await api.TestCycle.createTestCycle({
407
409
  });
408
410
 
409
411
  // Set iteration using private API (supplements createTestCycle)
410
- await api.Private.IterationData.updateTestCycleIteration(credentials, {
412
+ await api.Private.ExtendedData.updateTestCycleIteration(credentials, {
411
413
  testCycleKey: testCycle.key,
412
414
  projectId: 10313,
413
415
  iterationId: 10952254
414
416
  });
415
417
 
416
418
  // Get iteration data (supplements getTestCycle)
417
- const testCycleIteration = await api.Private.IterationData.getTestCycleIteration(credentials, {
419
+ const testCycleIteration = await api.Private.ExtendedData.getTestCycleIteration(credentials, {
418
420
  testCycleKey: 'M12-R1',
419
421
  projectId: 10313
420
422
  });
@@ -434,25 +436,113 @@ await api.TestExecution.createTestExecution({
434
436
  // or look it up using listTestExecutions() after creation
435
437
 
436
438
  // Set iteration using private API (supplements createTestExecution)
437
- await api.Private.IterationData.updateTestExecutionIteration(credentials, {
439
+ await api.Private.ExtendedData.updateTestExecutionIteration(credentials, {
438
440
  testExecutionKey: 'M12-E1', // Use known key or look up after creation
439
441
  projectId: 10313,
440
442
  iterationId: 10952254
441
443
  });
442
444
 
443
445
  // Get iteration data (supplements getTestExecution)
444
- const testExecutionIteration = await api.Private.IterationData.getTestExecutionIteration(credentials, {
446
+ const testExecutionIteration = await api.Private.ExtendedData.getTestExecutionIteration(credentials, {
445
447
  testExecutionKey: 'M12-E1',
446
448
  projectId: 10313
447
449
  });
448
450
  console.log('Test Execution Iteration ID:', testExecutionIteration.iterationId); // null if not set
449
451
 
450
452
  // Clear iteration by setting to null
451
- await api.Private.IterationData.updateTestCycleIteration(credentials, {
453
+ await api.Private.ExtendedData.updateTestCycleIteration(credentials, {
452
454
  testCycleKey: 'M12-R1',
453
455
  projectId: 10313,
454
456
  iterationId: null
455
457
  });
458
+
459
+ // === Test Execution Version (Release Version) ===
460
+
461
+ // Create test execution with public API (returns void)
462
+ await api.TestExecution.createTestExecution({
463
+ projectKey: 'M15',
464
+ testCaseKey: 'M15-T3',
465
+ testCycleKey: 'M15-R1',
466
+ statusName: 'Pass'
467
+ });
468
+
469
+ // Note: createTestExecution returns no data, so you need to know the execution key
470
+ // or look it up using listTestExecutions() after creation
471
+
472
+ // Set Jira version ID (release version) using private API (supplements createTestExecution)
473
+ await api.Private.ExtendedData.updateTestExecutionVersion(credentials, {
474
+ testExecutionKey: 'M15-E3', // Use known key or look up after creation
475
+ projectId: 10316,
476
+ jiraVersionId: 10102
477
+ });
478
+
479
+ // Get version data (supplements getTestExecution)
480
+ const testExecutionVersion = await api.Private.ExtendedData.getTestExecutionVersion(credentials, {
481
+ testExecutionKey: 'M15-E3',
482
+ projectId: 10316
483
+ });
484
+ console.log('Jira Version ID:', testExecutionVersion.jiraVersionId); // null if not set
485
+
486
+ // Clear version by setting to null
487
+ await api.Private.ExtendedData.updateTestExecutionVersion(credentials, {
488
+ testExecutionKey: 'M15-E3',
489
+ projectId: 10316,
490
+ jiraVersionId: null
491
+ });
492
+ ```
493
+
494
+ ### Example: Test Case Archiving
495
+
496
+ The public API does not expose the archived flag on test cases. Use the `TestCaseArchiving` sub-group to list archived test cases and perform archiving/unarchiving operations.
497
+
498
+ ```typescript
499
+ // === Get Archived Test Cases ===
500
+
501
+ // Get first page of archived test cases
502
+ const archived = await api.Private.TestCaseArchiving.getArchivedTestCases(credentials, {
503
+ projectId: 10316,
504
+ maxResults: 50,
505
+ startAt: 0
506
+ });
507
+ console.log(`Found ${archived.total} archived test cases`);
508
+ archived.results.forEach(tc => {
509
+ console.log(`- ${tc.key}: ${tc.name}`);
510
+ });
511
+
512
+ // Get archived test cases with custom query filter
513
+ const filtered = await api.Private.TestCaseArchiving.getArchivedTestCases(credentials, {
514
+ projectId: 10316,
515
+ query: "testCase.name CONTAINS 'migration'",
516
+ maxResults: 100
517
+ });
518
+
519
+ // === Archive Test Cases ===
520
+
521
+ // Archive a single test case
522
+ await api.Private.TestCaseArchiving.archiveTestCases(credentials, {
523
+ projectId: 10316,
524
+ testCaseIds: [288004503]
525
+ });
526
+
527
+ // Archive multiple test cases
528
+ await api.Private.TestCaseArchiving.archiveTestCases(credentials, {
529
+ projectId: 10316,
530
+ testCaseIds: [288004503, 288004504, 288004505]
531
+ });
532
+
533
+ // === Unarchive Test Cases ===
534
+
535
+ // Unarchive a single test case
536
+ await api.Private.TestCaseArchiving.unarchiveTestCases(credentials, {
537
+ projectId: 10316,
538
+ testCaseIds: [288004503]
539
+ });
540
+
541
+ // Unarchive multiple test cases
542
+ await api.Private.TestCaseArchiving.unarchiveTestCases(credentials, {
543
+ projectId: 10316,
544
+ testCaseIds: [288004503, 288004504, 288004505]
545
+ });
456
546
  ```
457
547
 
458
548
  **Note:** Version numbers are absolute (1-based: 1 = first version ever created, 2 = second version, etc. The highest number is the current/latest version). Use `listTestCaseVersions()` to find the total number of versions and identify the latest. If `version` is not provided, the latest version is used.
@@ -469,9 +559,19 @@ Feel free to drop ideas, suggestions or improvements into our [Community hub](ht
469
559
 
470
560
  ## Changelog
471
561
 
562
+ ### 1.3.8
563
+
564
+ - **Added**: `getTestExecutionVersion()` - Get Jira version ID (release version) for a test execution (supplements public `getTestExecution()`)
565
+ - **Added**: `updateTestExecutionVersion()` - Set/clear Jira version ID for a test execution (supplements public `createTestExecution()`/`updateTestExecution()`)
566
+ - **Added**: New `TestCaseArchiving` sub-group under Private API for test case archiving operations
567
+ - **Added**: `getArchivedTestCases()` - Get paginated list of archived test cases (supplements public API which doesn't expose archived flag)
568
+ - **Added**: `archiveTestCases()` - Archive one or more test cases (bulk operation)
569
+ - **Added**: `unarchiveTestCases()` - Unarchive one or more test cases (bulk operation)
570
+ - **Changed**: Renamed `IterationData` sub-group to `ExtendedData` to better reflect that it handles both iteration and version data
571
+
472
572
  ### 1.3.7
473
573
 
474
- - **Added**: New `IterationData` sub-group under Private API to supplement public API with iteration data
574
+ - **Added**: New `ExtendedData` sub-group under Private API to supplement public API with extended data (iterations and versions)
475
575
  - **Added**: `getTestCycleIteration()` - Get iteration for a test cycle (supplements public `getTestCycle()`)
476
576
  - **Added**: `updateTestCycleIteration()` - Set/clear iteration for a test cycle (supplements public `createTestCycle()`/`updateTestCycle()`)
477
577
  - **Added**: `getTestExecutionIteration()` - Get iteration for a test execution (supplements public `getTestExecution()`)
package/dist/README.md CHANGED
@@ -155,9 +155,11 @@ const apiEU = createZephyrApi(
155
155
  - VersionControl
156
156
  - **Test Case (version-specific)**: `getTestCaseIssueLinks`, `getTestCaseWebLinks`, `getTestCaseTestScript`, `getTestCaseTestSteps`
157
157
  - **Test Execution Step**: `getTestExecutionStepIssueLinks`, `createTestExecutionStepIssueLink`
158
- - IterationData (supplements public API with iteration data)
158
+ - ExtendedData (supplements public API with extended data: iterations and versions)
159
159
  - **Test Cycle**: `getTestCycleIteration`, `updateTestCycleIteration`
160
- - **Test Execution**: `getTestExecutionIteration`, `updateTestExecutionIteration`
160
+ - **Test Execution**: `getTestExecutionIteration`, `updateTestExecutionIteration`, `getTestExecutionVersion`, `updateTestExecutionVersion`
161
+ - TestCaseArchiving (access archived test cases and archiving operations)
162
+ - **Test Case**: `getArchivedTestCases`, `archiveTestCases`, `unarchiveTestCases`
161
163
 
162
164
  ## Private API Authentication
163
165
 
@@ -393,9 +395,9 @@ const stepLink = await api.Private.VersionControl.createTestExecutionStepIssueLi
393
395
  });
394
396
  ```
395
397
 
396
- ### Example: Get and Set Iteration Data (Supplements Public API)
398
+ ### Example: Get and Set Extended Data (Supplements Public API)
397
399
 
398
- The public API does not support getting or setting iterations for Test Cycles and Test Executions. Use the `IterationData` sub-group to supplement public API calls with iteration data.
400
+ The public API does not support getting or setting iterations for Test Cycles and Test Executions, or Jira version IDs (release versions) for Test Executions. Use the `ExtendedData` sub-group to supplement public API calls with this additional data.
399
401
 
400
402
  ```typescript
401
403
  // === Test Cycle Iteration ===
@@ -407,14 +409,14 @@ const testCycle = await api.TestCycle.createTestCycle({
407
409
  });
408
410
 
409
411
  // Set iteration using private API (supplements createTestCycle)
410
- await api.Private.IterationData.updateTestCycleIteration(credentials, {
412
+ await api.Private.ExtendedData.updateTestCycleIteration(credentials, {
411
413
  testCycleKey: testCycle.key,
412
414
  projectId: 10313,
413
415
  iterationId: 10952254
414
416
  });
415
417
 
416
418
  // Get iteration data (supplements getTestCycle)
417
- const testCycleIteration = await api.Private.IterationData.getTestCycleIteration(credentials, {
419
+ const testCycleIteration = await api.Private.ExtendedData.getTestCycleIteration(credentials, {
418
420
  testCycleKey: 'M12-R1',
419
421
  projectId: 10313
420
422
  });
@@ -434,25 +436,113 @@ await api.TestExecution.createTestExecution({
434
436
  // or look it up using listTestExecutions() after creation
435
437
 
436
438
  // Set iteration using private API (supplements createTestExecution)
437
- await api.Private.IterationData.updateTestExecutionIteration(credentials, {
439
+ await api.Private.ExtendedData.updateTestExecutionIteration(credentials, {
438
440
  testExecutionKey: 'M12-E1', // Use known key or look up after creation
439
441
  projectId: 10313,
440
442
  iterationId: 10952254
441
443
  });
442
444
 
443
445
  // Get iteration data (supplements getTestExecution)
444
- const testExecutionIteration = await api.Private.IterationData.getTestExecutionIteration(credentials, {
446
+ const testExecutionIteration = await api.Private.ExtendedData.getTestExecutionIteration(credentials, {
445
447
  testExecutionKey: 'M12-E1',
446
448
  projectId: 10313
447
449
  });
448
450
  console.log('Test Execution Iteration ID:', testExecutionIteration.iterationId); // null if not set
449
451
 
450
452
  // Clear iteration by setting to null
451
- await api.Private.IterationData.updateTestCycleIteration(credentials, {
453
+ await api.Private.ExtendedData.updateTestCycleIteration(credentials, {
452
454
  testCycleKey: 'M12-R1',
453
455
  projectId: 10313,
454
456
  iterationId: null
455
457
  });
458
+
459
+ // === Test Execution Version (Release Version) ===
460
+
461
+ // Create test execution with public API (returns void)
462
+ await api.TestExecution.createTestExecution({
463
+ projectKey: 'M15',
464
+ testCaseKey: 'M15-T3',
465
+ testCycleKey: 'M15-R1',
466
+ statusName: 'Pass'
467
+ });
468
+
469
+ // Note: createTestExecution returns no data, so you need to know the execution key
470
+ // or look it up using listTestExecutions() after creation
471
+
472
+ // Set Jira version ID (release version) using private API (supplements createTestExecution)
473
+ await api.Private.ExtendedData.updateTestExecutionVersion(credentials, {
474
+ testExecutionKey: 'M15-E3', // Use known key or look up after creation
475
+ projectId: 10316,
476
+ jiraVersionId: 10102
477
+ });
478
+
479
+ // Get version data (supplements getTestExecution)
480
+ const testExecutionVersion = await api.Private.ExtendedData.getTestExecutionVersion(credentials, {
481
+ testExecutionKey: 'M15-E3',
482
+ projectId: 10316
483
+ });
484
+ console.log('Jira Version ID:', testExecutionVersion.jiraVersionId); // null if not set
485
+
486
+ // Clear version by setting to null
487
+ await api.Private.ExtendedData.updateTestExecutionVersion(credentials, {
488
+ testExecutionKey: 'M15-E3',
489
+ projectId: 10316,
490
+ jiraVersionId: null
491
+ });
492
+ ```
493
+
494
+ ### Example: Test Case Archiving
495
+
496
+ The public API does not expose the archived flag on test cases. Use the `TestCaseArchiving` sub-group to list archived test cases and perform archiving/unarchiving operations.
497
+
498
+ ```typescript
499
+ // === Get Archived Test Cases ===
500
+
501
+ // Get first page of archived test cases
502
+ const archived = await api.Private.TestCaseArchiving.getArchivedTestCases(credentials, {
503
+ projectId: 10316,
504
+ maxResults: 50,
505
+ startAt: 0
506
+ });
507
+ console.log(`Found ${archived.total} archived test cases`);
508
+ archived.results.forEach(tc => {
509
+ console.log(`- ${tc.key}: ${tc.name}`);
510
+ });
511
+
512
+ // Get archived test cases with custom query filter
513
+ const filtered = await api.Private.TestCaseArchiving.getArchivedTestCases(credentials, {
514
+ projectId: 10316,
515
+ query: "testCase.name CONTAINS 'migration'",
516
+ maxResults: 100
517
+ });
518
+
519
+ // === Archive Test Cases ===
520
+
521
+ // Archive a single test case
522
+ await api.Private.TestCaseArchiving.archiveTestCases(credentials, {
523
+ projectId: 10316,
524
+ testCaseIds: [288004503]
525
+ });
526
+
527
+ // Archive multiple test cases
528
+ await api.Private.TestCaseArchiving.archiveTestCases(credentials, {
529
+ projectId: 10316,
530
+ testCaseIds: [288004503, 288004504, 288004505]
531
+ });
532
+
533
+ // === Unarchive Test Cases ===
534
+
535
+ // Unarchive a single test case
536
+ await api.Private.TestCaseArchiving.unarchiveTestCases(credentials, {
537
+ projectId: 10316,
538
+ testCaseIds: [288004503]
539
+ });
540
+
541
+ // Unarchive multiple test cases
542
+ await api.Private.TestCaseArchiving.unarchiveTestCases(credentials, {
543
+ projectId: 10316,
544
+ testCaseIds: [288004503, 288004504, 288004505]
545
+ });
456
546
  ```
457
547
 
458
548
  **Note:** Version numbers are absolute (1-based: 1 = first version ever created, 2 = second version, etc. The highest number is the current/latest version). Use `listTestCaseVersions()` to find the total number of versions and identify the latest. If `version` is not provided, the latest version is used.
@@ -469,9 +559,19 @@ Feel free to drop ideas, suggestions or improvements into our [Community hub](ht
469
559
 
470
560
  ## Changelog
471
561
 
562
+ ### 1.3.8
563
+
564
+ - **Added**: `getTestExecutionVersion()` - Get Jira version ID (release version) for a test execution (supplements public `getTestExecution()`)
565
+ - **Added**: `updateTestExecutionVersion()` - Set/clear Jira version ID for a test execution (supplements public `createTestExecution()`/`updateTestExecution()`)
566
+ - **Added**: New `TestCaseArchiving` sub-group under Private API for test case archiving operations
567
+ - **Added**: `getArchivedTestCases()` - Get paginated list of archived test cases (supplements public API which doesn't expose archived flag)
568
+ - **Added**: `archiveTestCases()` - Archive one or more test cases (bulk operation)
569
+ - **Added**: `unarchiveTestCases()` - Unarchive one or more test cases (bulk operation)
570
+ - **Changed**: Renamed `IterationData` sub-group to `ExtendedData` to better reflect that it handles both iteration and version data
571
+
472
572
  ### 1.3.7
473
573
 
474
- - **Added**: New `IterationData` sub-group under Private API to supplement public API with iteration data
574
+ - **Added**: New `ExtendedData` sub-group under Private API to supplement public API with extended data (iterations and versions)
475
575
  - **Added**: `getTestCycleIteration()` - Get iteration for a test cycle (supplements public `getTestCycle()`)
476
576
  - **Added**: `updateTestCycleIteration()` - Set/clear iteration for a test cycle (supplements public `createTestCycle()`/`updateTestCycle()`)
477
577
  - **Added**: `getTestExecutionIteration()` - Get iteration for a test execution (supplements public `getTestExecution()`)
@@ -2,15 +2,15 @@
2
2
  * Copyright Adaptavist 2025 (c) All rights reserved
3
3
  */
4
4
  /**
5
- * Private API Iteration Data sub-group
6
- * Supplements public API with iteration data for Test Cycles and Test Executions
5
+ * Private API Extended Data sub-group
6
+ * Supplements public API with extended data (iterations, versions) for Test Cycles and Test Executions
7
7
  *
8
8
  * ⚠️ WARNING: These methods use private APIs that are not officially supported.
9
9
  */
10
- import type { PrivateApiCredentials, GetTestCycleIterationRequest, TestCycleIterationResponse, UpdateTestCycleIterationRequest, GetTestExecutionIterationRequest, TestExecutionIterationResponse, UpdateTestExecutionIterationRequest } from '../../types';
10
+ import type { PrivateApiCredentials, GetTestCycleIterationRequest, TestCycleIterationResponse, UpdateTestCycleIterationRequest, GetTestExecutionIterationRequest, TestExecutionIterationResponse, UpdateTestExecutionIterationRequest, GetTestExecutionVersionRequest, TestExecutionVersionResponse, UpdateTestExecutionVersionRequest } from '../../types';
11
11
  import type { ZephyrApiConnection } from '../../index';
12
12
  import { PrivateBase } from './PrivateBase';
13
- export declare class PrivateIterationData extends PrivateBase {
13
+ export declare class PrivateExtendedData extends PrivateBase {
14
14
  constructor(apiConnection?: ZephyrApiConnection);
15
15
  /**
16
16
  * Get test cycle iteration using private API
@@ -153,5 +153,77 @@ export declare class PrivateIterationData extends PrivateBase {
153
153
  * ```
154
154
  */
155
155
  updateTestExecutionIteration(credentials: PrivateApiCredentials, request: UpdateTestExecutionIterationRequest): Promise<void>;
156
+ /**
157
+ * Get test execution version using private API
158
+ *
159
+ * Retrieves Jira version ID (release version) for a test execution that is not available in the public API.
160
+ * Use this to supplement the public `getTestExecution()` response with version information.
161
+ *
162
+ * ⚠️ WARNING: This uses a private Zephyr API endpoint that is not officially supported.
163
+ * The endpoint may change or be removed at any time without notice.
164
+ *
165
+ * @param credentials - Private API credentials
166
+ * @param request - Get test execution version request
167
+ * @param request.testExecutionKey - Test execution key (e.g., "M15-E3")
168
+ * @param request.projectId - Jira project ID (numeric, not the project key)
169
+ * @returns Test execution version response with jiraVersionId (null if not set)
170
+ * @throws {BadRequestError} If the request is invalid
171
+ * @throws {UnauthorizedError} If authentication fails
172
+ * @throws {ForbiddenError} If the user doesn't have permission
173
+ * @throws {NotFoundError} If the test execution is not found
174
+ * @throws {ServerError} If the server returns an error
175
+ *
176
+ * @example
177
+ * ```typescript
178
+ * // Get version for a test execution (supplements public getTestExecution)
179
+ * const publicData = await api.TestExecution.getTestExecution({ key: 'M15-E3' });
180
+ * const versionData = await api.Private.IterationData.getTestExecutionVersion(credentials, {
181
+ * testExecutionKey: 'M15-E3',
182
+ * projectId: 10316
183
+ * });
184
+ * console.log('Jira Version ID:', versionData.jiraVersionId);
185
+ * ```
186
+ */
187
+ getTestExecutionVersion(credentials: PrivateApiCredentials, request: GetTestExecutionVersionRequest): Promise<TestExecutionVersionResponse>;
188
+ /**
189
+ * Update test execution version using private API
190
+ *
191
+ * Sets or clears the Jira version ID (release version) for a test execution. Use this to supplement
192
+ * a test execution created via the public API with version data.
193
+ *
194
+ * ⚠️ WARNING: This uses a private Zephyr API endpoint that is not officially supported.
195
+ * The endpoint may change or be removed at any time without notice.
196
+ *
197
+ * @param credentials - Private API credentials
198
+ * @param request - Update test execution version request
199
+ * @param request.testExecutionKey - Test execution key (e.g., "M15-E3")
200
+ * @param request.projectId - Jira project ID (numeric, not the project key)
201
+ * @param request.jiraVersionId - Jira version ID to set, or null to clear
202
+ * @throws {BadRequestError} If the request is invalid
203
+ * @throws {UnauthorizedError} If authentication fails
204
+ * @throws {ForbiddenError} If the user doesn't have permission
205
+ * @throws {NotFoundError} If the test execution is not found
206
+ * @throws {ServerError} If the server returns an error
207
+ *
208
+ * @example
209
+ * ```typescript
210
+ * // Create test execution with public API (returns void), then set version with private API
211
+ * await api.TestExecution.createTestExecution({
212
+ * projectKey: 'M15',
213
+ * testCaseKey: 'M15-T3',
214
+ * testCycleKey: 'M15-R1',
215
+ * statusName: 'Pass'
216
+ * });
217
+ *
218
+ * // Note: createTestExecution returns no data, so use known key or look up after creation
219
+ * // Set version using private API
220
+ * await api.Private.IterationData.updateTestExecutionVersion(credentials, {
221
+ * testExecutionKey: 'M15-E3', // Use known key or look up via listTestExecutions()
222
+ * projectId: 10316,
223
+ * jiraVersionId: 10102
224
+ * });
225
+ * ```
226
+ */
227
+ updateTestExecutionVersion(credentials: PrivateApiCredentials, request: UpdateTestExecutionVersionRequest): Promise<void>;
156
228
  }
157
- //# sourceMappingURL=PrivateIterationData.d.ts.map
229
+ //# sourceMappingURL=PrivateExtendedData.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrivateExtendedData.d.ts","sourceRoot":"","sources":["../../../groups/Private/PrivateExtendedData.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;GAKG;AAEH,OAAO,KAAK,EACX,qBAAqB,EACrB,4BAA4B,EAC5B,0BAA0B,EAC1B,+BAA+B,EAC/B,gCAAgC,EAChC,8BAA8B,EAC9B,mCAAmC,EACnC,8BAA8B,EAC9B,4BAA4B,EAC5B,iCAAiC,EACjC,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAwC5C,qBAAa,mBAAoB,SAAQ,WAAW;gBACvC,aAAa,CAAC,EAAE,mBAAmB;IAQ/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACG,qBAAqB,CAC1B,WAAW,EAAE,qBAAqB,EAClC,OAAO,EAAE,4BAA4B,GACnC,OAAO,CAAC,0BAA0B,CAAC;IAqEtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACG,wBAAwB,CAC7B,WAAW,EAAE,qBAAqB,EAClC,OAAO,EAAE,+BAA+B,GACtC,OAAO,CAAC,IAAI,CAAC;IAgFhB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACG,yBAAyB,CAC9B,WAAW,EAAE,qBAAqB,EAClC,OAAO,EAAE,gCAAgC,GACvC,OAAO,CAAC,8BAA8B,CAAC;IAqE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsCG;IACG,4BAA4B,CACjC,WAAW,EAAE,qBAAqB,EAClC,OAAO,EAAE,mCAAmC,GAC1C,OAAO,CAAC,IAAI,CAAC;IA+EhB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACG,uBAAuB,CAC5B,WAAW,EAAE,qBAAqB,EAClC,OAAO,EAAE,8BAA8B,GACrC,OAAO,CAAC,4BAA4B,CAAC;IAsExC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsCG;IACG,0BAA0B,CAC/B,WAAW,EAAE,qBAAqB,EAClC,OAAO,EAAE,iCAAiC,GACxC,OAAO,CAAC,IAAI,CAAC;CA0EhB"}
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import { PrivateBase } from './PrivateBase';
5
5
  import { BadRequestError, UnauthorizedError, ForbiddenError, NotFoundError, ServerError, UnexpectedError, } from '../../utils';
6
- export class PrivateIterationData extends PrivateBase {
6
+ export class PrivateExtendedData extends PrivateBase {
7
7
  constructor(apiConnection) {
8
8
  super(apiConnection);
9
9
  }
@@ -361,4 +361,183 @@ export class PrivateIterationData extends PrivateBase {
361
361
  throw new UnexpectedError(`Unexpected error while updating test execution iteration for '${request.testExecutionKey}'`, error);
362
362
  }
363
363
  }
364
+ // ============================================================================
365
+ // Test Execution Version Methods
366
+ // ============================================================================
367
+ /**
368
+ * Get test execution version using private API
369
+ *
370
+ * Retrieves Jira version ID (release version) for a test execution that is not available in the public API.
371
+ * Use this to supplement the public `getTestExecution()` response with version information.
372
+ *
373
+ * ⚠️ WARNING: This uses a private Zephyr API endpoint that is not officially supported.
374
+ * The endpoint may change or be removed at any time without notice.
375
+ *
376
+ * @param credentials - Private API credentials
377
+ * @param request - Get test execution version request
378
+ * @param request.testExecutionKey - Test execution key (e.g., "M15-E3")
379
+ * @param request.projectId - Jira project ID (numeric, not the project key)
380
+ * @returns Test execution version response with jiraVersionId (null if not set)
381
+ * @throws {BadRequestError} If the request is invalid
382
+ * @throws {UnauthorizedError} If authentication fails
383
+ * @throws {ForbiddenError} If the user doesn't have permission
384
+ * @throws {NotFoundError} If the test execution is not found
385
+ * @throws {ServerError} If the server returns an error
386
+ *
387
+ * @example
388
+ * ```typescript
389
+ * // Get version for a test execution (supplements public getTestExecution)
390
+ * const publicData = await api.TestExecution.getTestExecution({ key: 'M15-E3' });
391
+ * const versionData = await api.Private.IterationData.getTestExecutionVersion(credentials, {
392
+ * testExecutionKey: 'M15-E3',
393
+ * projectId: 10316
394
+ * });
395
+ * console.log('Jira Version ID:', versionData.jiraVersionId);
396
+ * ```
397
+ */
398
+ async getTestExecutionVersion(credentials, request) {
399
+ // Get Context JWT
400
+ const contextJwt = await this.getContextJwt(credentials);
401
+ // Build URL with minimal fields needed (jiraVersionId is included in the fields)
402
+ const fields = 'id,key,jiraVersionId';
403
+ const url = `${this.privateApiBaseUrl}/testresult/${request.testExecutionKey}?fields=${encodeURIComponent(fields)}&itemId=${request.testExecutionKey}`;
404
+ const headers = {
405
+ accept: 'application/json',
406
+ authorization: `JWT ${contextJwt}`,
407
+ 'jira-project-id': String(request.projectId),
408
+ };
409
+ try {
410
+ const response = await fetch(url, {
411
+ method: 'GET',
412
+ headers,
413
+ });
414
+ if (!response.ok) {
415
+ if (response.status === 400) {
416
+ throw new BadRequestError(`Invalid request parameters for getting test execution version.`);
417
+ }
418
+ if (response.status === 401) {
419
+ throw new UnauthorizedError('Failed to authenticate. Please check your credentials.');
420
+ }
421
+ if (response.status === 403) {
422
+ throw new ForbiddenError('Insufficient permissions to get test execution version.');
423
+ }
424
+ if (response.status === 404) {
425
+ throw new NotFoundError(`Test execution '${request.testExecutionKey}' not found.`);
426
+ }
427
+ throw new ServerError(`Failed to get test execution version. Status: ${response.status}`, response.status, response.statusText);
428
+ }
429
+ const data = (await response.json());
430
+ return {
431
+ id: data.id,
432
+ key: data.key,
433
+ // jiraVersionId is excluded from response if not set, so use null if undefined
434
+ jiraVersionId: data.jiraVersionId ?? null,
435
+ };
436
+ }
437
+ catch (error) {
438
+ if (error instanceof BadRequestError ||
439
+ error instanceof UnauthorizedError ||
440
+ error instanceof ForbiddenError ||
441
+ error instanceof NotFoundError ||
442
+ error instanceof ServerError ||
443
+ error instanceof UnexpectedError) {
444
+ throw error;
445
+ }
446
+ throw new UnexpectedError(`Unexpected error while getting test execution version for '${request.testExecutionKey}'`, error);
447
+ }
448
+ }
449
+ /**
450
+ * Update test execution version using private API
451
+ *
452
+ * Sets or clears the Jira version ID (release version) for a test execution. Use this to supplement
453
+ * a test execution created via the public API with version data.
454
+ *
455
+ * ⚠️ WARNING: This uses a private Zephyr API endpoint that is not officially supported.
456
+ * The endpoint may change or be removed at any time without notice.
457
+ *
458
+ * @param credentials - Private API credentials
459
+ * @param request - Update test execution version request
460
+ * @param request.testExecutionKey - Test execution key (e.g., "M15-E3")
461
+ * @param request.projectId - Jira project ID (numeric, not the project key)
462
+ * @param request.jiraVersionId - Jira version ID to set, or null to clear
463
+ * @throws {BadRequestError} If the request is invalid
464
+ * @throws {UnauthorizedError} If authentication fails
465
+ * @throws {ForbiddenError} If the user doesn't have permission
466
+ * @throws {NotFoundError} If the test execution is not found
467
+ * @throws {ServerError} If the server returns an error
468
+ *
469
+ * @example
470
+ * ```typescript
471
+ * // Create test execution with public API (returns void), then set version with private API
472
+ * await api.TestExecution.createTestExecution({
473
+ * projectKey: 'M15',
474
+ * testCaseKey: 'M15-T3',
475
+ * testCycleKey: 'M15-R1',
476
+ * statusName: 'Pass'
477
+ * });
478
+ *
479
+ * // Note: createTestExecution returns no data, so use known key or look up after creation
480
+ * // Set version using private API
481
+ * await api.Private.IterationData.updateTestExecutionVersion(credentials, {
482
+ * testExecutionKey: 'M15-E3', // Use known key or look up via listTestExecutions()
483
+ * projectId: 10316,
484
+ * jiraVersionId: 10102
485
+ * });
486
+ * ```
487
+ */
488
+ async updateTestExecutionVersion(credentials, request) {
489
+ // Get Context JWT
490
+ const contextJwt = await this.getContextJwt(credentials);
491
+ // First, get the numeric ID for the test execution
492
+ const testExecutionData = await this.getTestExecutionVersion(credentials, {
493
+ testExecutionKey: request.testExecutionKey,
494
+ projectId: request.projectId,
495
+ });
496
+ // Build URL with numeric ID
497
+ const url = `${this.privateApiBaseUrl}/testresult/${testExecutionData.id}`;
498
+ const headers = {
499
+ 'Content-Type': 'application/json',
500
+ accept: 'application/json',
501
+ authorization: `JWT ${contextJwt}`,
502
+ 'jira-project-id': String(request.projectId),
503
+ };
504
+ const requestBody = {
505
+ id: testExecutionData.id,
506
+ jiraVersionId: request.jiraVersionId,
507
+ };
508
+ try {
509
+ const response = await fetch(url, {
510
+ method: 'PUT',
511
+ headers,
512
+ body: JSON.stringify(requestBody),
513
+ });
514
+ if (!response.ok) {
515
+ if (response.status === 400) {
516
+ throw new BadRequestError(`Invalid request parameters for updating test execution version.`);
517
+ }
518
+ if (response.status === 401) {
519
+ throw new UnauthorizedError('Failed to authenticate. Please check your credentials.');
520
+ }
521
+ if (response.status === 403) {
522
+ throw new ForbiddenError('Insufficient permissions to update test execution version.');
523
+ }
524
+ if (response.status === 404) {
525
+ throw new NotFoundError(`Test execution '${request.testExecutionKey}' not found.`);
526
+ }
527
+ throw new ServerError(`Failed to update test execution version. Status: ${response.status}`, response.status, response.statusText);
528
+ }
529
+ // Response is empty on success
530
+ }
531
+ catch (error) {
532
+ if (error instanceof BadRequestError ||
533
+ error instanceof UnauthorizedError ||
534
+ error instanceof ForbiddenError ||
535
+ error instanceof NotFoundError ||
536
+ error instanceof ServerError ||
537
+ error instanceof UnexpectedError) {
538
+ throw error;
539
+ }
540
+ throw new UnexpectedError(`Unexpected error while updating test execution version for '${request.testExecutionKey}'`, error);
541
+ }
542
+ }
364
543
  }