@rbaileysr/zephyr-managed-api 1.3.3 → 1.3.5
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 +73 -53
- package/dist/README.md +73 -53
- package/dist/groups/All.d.ts.map +1 -1
- package/dist/groups/Private/PrivateAttachments.d.ts +2 -2
- package/dist/groups/Private/PrivateAttachments.js +2 -2
- package/dist/groups/Private/PrivateComments.d.ts +1 -1
- package/dist/groups/Private/PrivateComments.js +1 -1
- package/dist/groups/Private/PrivateConfig.d.ts +47 -0
- package/dist/groups/Private/PrivateConfig.d.ts.map +1 -1
- package/dist/groups/Private/PrivateConfig.js +100 -0
- package/dist/groups/Private/PrivateVersionControl.d.ts +66 -5
- package/dist/groups/Private/PrivateVersionControl.d.ts.map +1 -1
- package/dist/groups/Private/PrivateVersionControl.js +259 -4
- package/dist/groups/TestCase.d.ts +1 -1
- package/dist/groups/TestCase.js +1 -1
- package/dist/package.json +1 -1
- package/dist/types.d.ts +82 -22
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,14 +16,14 @@ npm install @rbaileysr/zephyr-managed-api
|
|
|
16
16
|
In ScriptRunner Connect a Managed API is constructed for you, but if you need to construct it manually, here's how you can do it:
|
|
17
17
|
|
|
18
18
|
**Using API Connection (recommended for ScriptRunner Connect):**
|
|
19
|
-
```typescript
|
|
19
|
+
```typescript
|
|
20
20
|
import { createZephyrApi } from '@rbaileysr/zephyr-managed-api';
|
|
21
|
-
import ZephyrApiConnection from '../api/zephyr';
|
|
21
|
+
import ZephyrApiConnection from '../api/zephyr';
|
|
22
22
|
|
|
23
|
-
// Base URL is configured in the Generic Connector
|
|
23
|
+
// Base URL is configured in the Generic Connector
|
|
24
24
|
const api = createZephyrApi(ZephyrApiConnection);
|
|
25
|
-
```
|
|
26
|
-
|
|
25
|
+
```
|
|
26
|
+
|
|
27
27
|
**Using OAuth Token:**
|
|
28
28
|
```typescript
|
|
29
29
|
import { createZephyrApi } from '@rbaileysr/zephyr-managed-api';
|
|
@@ -133,52 +133,28 @@ const apiEU = createZephyrApi(
|
|
|
133
133
|
- Authentication
|
|
134
134
|
- **getContextJwt** - Get Jira Context JWT token (required for all private API calls)
|
|
135
135
|
- Comments
|
|
136
|
-
- **
|
|
137
|
-
- **
|
|
138
|
-
- **
|
|
139
|
-
- **createTestCaseComment** - Create a comment on a test case
|
|
140
|
-
- **createTestCycleComment** - Create a comment on a test cycle
|
|
141
|
-
- **createTestPlanComment** - Create a comment on a test plan
|
|
136
|
+
- **Test Case**: `getTestCaseComments`, `createTestCaseComment`
|
|
137
|
+
- **Test Cycle**: `getTestCycleComments`, `createTestCycleComment`
|
|
138
|
+
- **Test Plan**: `getTestPlanComments`, `createTestPlanComment`
|
|
142
139
|
- Config
|
|
143
|
-
- **CustomFields
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
- **
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
- **Iterations**
|
|
150
|
-
- **getIterations** - Get all iterations for a project
|
|
151
|
-
- **createIteration** - Create a new iteration
|
|
152
|
-
- **DataSets**
|
|
153
|
-
- **getDataSets** - Get all data sets for a project
|
|
154
|
-
- **createDataSet** - Create a new data set
|
|
155
|
-
- **updateDataSet** - Update a data set (add items/options)
|
|
140
|
+
- **CustomFields**: `createCustomField`, `getCustomFields`
|
|
141
|
+
- **Labels**: `getLabels`, `createLabel`
|
|
142
|
+
- **Iterations**: `getIterations`, `createIteration`
|
|
143
|
+
- **DataSets**: `getDataSets`, `createDataSet`, `updateDataSet`
|
|
144
|
+
- **archiveConfig** - Archive an Environment or Iteration
|
|
145
|
+
- **unarchiveConfig** - Unarchive an Environment or Iteration
|
|
156
146
|
- Versions
|
|
157
147
|
- **createTestCaseVersion** - Create a new test case version
|
|
158
148
|
- Attachments
|
|
159
|
-
- **
|
|
160
|
-
- **
|
|
161
|
-
- **
|
|
162
|
-
- **
|
|
163
|
-
- **
|
|
164
|
-
- **
|
|
165
|
-
- **getTestCycleAttachments** - Get all attachments for a test cycle
|
|
166
|
-
- **downloadTestCycleAttachment** - Download an attachment from a test cycle
|
|
167
|
-
- **createTestCycleAttachment** - Upload an attachment to a test cycle
|
|
168
|
-
- **getTestPlanAttachments** - Get all attachments for a test plan
|
|
169
|
-
- **downloadTestPlanAttachment** - Download an attachment from a test plan
|
|
170
|
-
- **createTestPlanAttachment** - Upload an attachment to a test plan
|
|
171
|
-
- **getTestExecutionAttachments** - Get all attachments for a test execution
|
|
172
|
-
- **downloadTestExecutionAttachment** - Download an attachment from a test execution
|
|
173
|
-
- **createTestExecutionAttachment** - Upload an attachment to a test execution
|
|
174
|
-
- **getTestExecutionStepAttachments** - Get all attachments for a test execution step
|
|
175
|
-
- **downloadTestExecutionStepAttachment** - Download an attachment from a test execution step
|
|
176
|
-
- **createTestExecutionStepAttachment** - Upload an attachment to a test execution step
|
|
149
|
+
- **Test Case**: `getTestCaseAttachments`, `downloadAttachment`, `createTestCaseAttachment`
|
|
150
|
+
- **Test Step**: `getTestStepAttachments`, `downloadTestStepAttachment`, `createTestStepAttachment`
|
|
151
|
+
- **Test Cycle**: `getTestCycleAttachments`, `downloadTestCycleAttachment`, `createTestCycleAttachment`
|
|
152
|
+
- **Test Plan**: `getTestPlanAttachments`, `downloadTestPlanAttachment`, `createTestPlanAttachment`
|
|
153
|
+
- **Test Execution**: `getTestExecutionAttachments`, `downloadTestExecutionAttachment`, `createTestExecutionAttachment`
|
|
154
|
+
- **Test Execution Step**: `getTestExecutionStepAttachments`, `downloadTestExecutionStepAttachment`, `createTestExecutionStepAttachment`
|
|
177
155
|
- VersionControl
|
|
178
|
-
- **
|
|
179
|
-
- **
|
|
180
|
-
- **getTestCaseTestScript** - Get test script for a test case (with version support)
|
|
181
|
-
- **getTestCaseTestSteps** - Get test steps for a test case (with version support)
|
|
156
|
+
- **Test Case (version-specific)**: `getTestCaseIssueLinks`, `getTestCaseWebLinks`, `getTestCaseTestScript`, `getTestCaseTestSteps`
|
|
157
|
+
- **Test Execution Step**: `getTestExecutionStepIssueLinks`, `createTestExecutionStepIssueLink`
|
|
182
158
|
|
|
183
159
|
## Private API Authentication
|
|
184
160
|
|
|
@@ -282,6 +258,24 @@ const dataSets = await api.Private.Config.DataSets.getDataSets(credentials, {
|
|
|
282
258
|
});
|
|
283
259
|
```
|
|
284
260
|
|
|
261
|
+
### Example: Archive and Unarchive Config Items
|
|
262
|
+
|
|
263
|
+
```typescript
|
|
264
|
+
// Archive an environment
|
|
265
|
+
const archivedEnv = await api.Private.Config.archiveConfig(credentials, {
|
|
266
|
+
type: 'Environment',
|
|
267
|
+
id: 10873400,
|
|
268
|
+
projectId: 10233
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
// Unarchive an iteration
|
|
272
|
+
const unarchivedIteration = await api.Private.Config.unarchiveConfig(credentials, {
|
|
273
|
+
type: 'Iteration',
|
|
274
|
+
id: 10909775,
|
|
275
|
+
projectId: 10233
|
|
276
|
+
});
|
|
277
|
+
```
|
|
278
|
+
|
|
285
279
|
### Example: Create Test Case Version
|
|
286
280
|
|
|
287
281
|
```typescript
|
|
@@ -301,7 +295,7 @@ const newVersion = await api.Private.Versions.createTestCaseVersion(
|
|
|
301
295
|
// Upload an attachment to a test case
|
|
302
296
|
const file = new Blob(['file content'], { type: 'text/plain' });
|
|
303
297
|
|
|
304
|
-
const attachment = await api.Private.Attachments.
|
|
298
|
+
const attachment = await api.Private.Attachments.createTestCaseAttachment(
|
|
305
299
|
credentials,
|
|
306
300
|
{
|
|
307
301
|
testCaseKey: 'PROJ-T1',
|
|
@@ -319,32 +313,49 @@ const attachment = await api.Private.Attachments.createAttachment(
|
|
|
319
313
|
// Get issue links for current version
|
|
320
314
|
const issueLinks = await api.Private.VersionControl.getTestCaseIssueLinks(credentials, {
|
|
321
315
|
testCaseKey: 'PROJ-T1',
|
|
322
|
-
|
|
316
|
+
projectId: 10233
|
|
323
317
|
});
|
|
324
318
|
|
|
325
319
|
// Get web links for version 2 (previous version)
|
|
326
320
|
const webLinks = await api.Private.VersionControl.getTestCaseWebLinks(credentials, {
|
|
327
321
|
testCaseKey: 'PROJ-T1',
|
|
328
|
-
|
|
322
|
+
projectId: 10233,
|
|
329
323
|
version: 2
|
|
330
324
|
});
|
|
331
325
|
|
|
332
326
|
// Get test script for version 3
|
|
333
327
|
const testScript = await api.Private.VersionControl.getTestCaseTestScript(credentials, {
|
|
334
328
|
testCaseKey: 'PROJ-T1',
|
|
335
|
-
|
|
329
|
+
projectId: 10233,
|
|
336
330
|
version: 3
|
|
337
331
|
});
|
|
338
332
|
|
|
339
|
-
// Get test steps for version
|
|
333
|
+
// Get test steps for version 4 (current version, if there are 4 versions total)
|
|
340
334
|
const testSteps = await api.Private.VersionControl.getTestCaseTestSteps(credentials, {
|
|
341
335
|
testCaseKey: 'PROJ-T1',
|
|
342
336
|
projectId: 10233,
|
|
343
|
-
version:
|
|
337
|
+
version: 4
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
// Get issue links for a test execution step (useful for migration)
|
|
341
|
+
const stepIssueLinks = await api.Private.VersionControl.getTestExecutionStepIssueLinks(credentials, {
|
|
342
|
+
testExecutionKey: 'PROJ-E1',
|
|
343
|
+
stepIndex: 0,
|
|
344
|
+
projectId: 10233
|
|
345
|
+
});
|
|
346
|
+
// Returns: [{ id: 169099471, issueId: '66019', type: 'BLOCKS' }, ...]
|
|
347
|
+
|
|
348
|
+
// Create an issue link for a test execution step
|
|
349
|
+
const stepLink = await api.Private.VersionControl.createTestExecutionStepIssueLink(credentials, {
|
|
350
|
+
testExecutionKey: 'PROJ-E1',
|
|
351
|
+
stepIndex: 0,
|
|
352
|
+
issueId: 66019,
|
|
353
|
+
type: 'RELATED',
|
|
354
|
+
projectId: 10233
|
|
344
355
|
});
|
|
345
356
|
```
|
|
346
357
|
|
|
347
|
-
**Note:** Version numbers are
|
|
358
|
+
**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.
|
|
348
359
|
|
|
349
360
|
**Important Notes:**
|
|
350
361
|
- Private API methods require a `PrivateApiCredentials` object with `userEmail`, `apiToken`, and `jiraInstanceUrl`
|
|
@@ -358,6 +369,15 @@ Feel free to drop ideas, suggestions or improvements into our [Community hub](ht
|
|
|
358
369
|
|
|
359
370
|
## Changelog
|
|
360
371
|
|
|
372
|
+
### 1.3.5
|
|
373
|
+
|
|
374
|
+
- **Changed**: Minor fix to interface for created test step
|
|
375
|
+
|
|
376
|
+
### 1.3.4
|
|
377
|
+
|
|
378
|
+
- **Added**: `getTestExecutionStepIssueLinks()` - Get issue links for a test execution step (for migration purposes)
|
|
379
|
+
- **Added**: `createTestExecutionStepIssueLink()` - Create an issue link for a test execution step
|
|
380
|
+
|
|
361
381
|
### 1.3.3
|
|
362
382
|
|
|
363
383
|
- **Added**: New VersionControl sub-group under Private API for version-specific operations
|
package/dist/README.md
CHANGED
|
@@ -16,14 +16,14 @@ npm install @rbaileysr/zephyr-managed-api
|
|
|
16
16
|
In ScriptRunner Connect a Managed API is constructed for you, but if you need to construct it manually, here's how you can do it:
|
|
17
17
|
|
|
18
18
|
**Using API Connection (recommended for ScriptRunner Connect):**
|
|
19
|
-
```typescript
|
|
19
|
+
```typescript
|
|
20
20
|
import { createZephyrApi } from '@rbaileysr/zephyr-managed-api';
|
|
21
|
-
import ZephyrApiConnection from '../api/zephyr';
|
|
21
|
+
import ZephyrApiConnection from '../api/zephyr';
|
|
22
22
|
|
|
23
|
-
// Base URL is configured in the Generic Connector
|
|
23
|
+
// Base URL is configured in the Generic Connector
|
|
24
24
|
const api = createZephyrApi(ZephyrApiConnection);
|
|
25
|
-
```
|
|
26
|
-
|
|
25
|
+
```
|
|
26
|
+
|
|
27
27
|
**Using OAuth Token:**
|
|
28
28
|
```typescript
|
|
29
29
|
import { createZephyrApi } from '@rbaileysr/zephyr-managed-api';
|
|
@@ -133,52 +133,28 @@ const apiEU = createZephyrApi(
|
|
|
133
133
|
- Authentication
|
|
134
134
|
- **getContextJwt** - Get Jira Context JWT token (required for all private API calls)
|
|
135
135
|
- Comments
|
|
136
|
-
- **
|
|
137
|
-
- **
|
|
138
|
-
- **
|
|
139
|
-
- **createTestCaseComment** - Create a comment on a test case
|
|
140
|
-
- **createTestCycleComment** - Create a comment on a test cycle
|
|
141
|
-
- **createTestPlanComment** - Create a comment on a test plan
|
|
136
|
+
- **Test Case**: `getTestCaseComments`, `createTestCaseComment`
|
|
137
|
+
- **Test Cycle**: `getTestCycleComments`, `createTestCycleComment`
|
|
138
|
+
- **Test Plan**: `getTestPlanComments`, `createTestPlanComment`
|
|
142
139
|
- Config
|
|
143
|
-
- **CustomFields
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
- **
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
- **Iterations**
|
|
150
|
-
- **getIterations** - Get all iterations for a project
|
|
151
|
-
- **createIteration** - Create a new iteration
|
|
152
|
-
- **DataSets**
|
|
153
|
-
- **getDataSets** - Get all data sets for a project
|
|
154
|
-
- **createDataSet** - Create a new data set
|
|
155
|
-
- **updateDataSet** - Update a data set (add items/options)
|
|
140
|
+
- **CustomFields**: `createCustomField`, `getCustomFields`
|
|
141
|
+
- **Labels**: `getLabels`, `createLabel`
|
|
142
|
+
- **Iterations**: `getIterations`, `createIteration`
|
|
143
|
+
- **DataSets**: `getDataSets`, `createDataSet`, `updateDataSet`
|
|
144
|
+
- **archiveConfig** - Archive an Environment or Iteration
|
|
145
|
+
- **unarchiveConfig** - Unarchive an Environment or Iteration
|
|
156
146
|
- Versions
|
|
157
147
|
- **createTestCaseVersion** - Create a new test case version
|
|
158
148
|
- Attachments
|
|
159
|
-
- **
|
|
160
|
-
- **
|
|
161
|
-
- **
|
|
162
|
-
- **
|
|
163
|
-
- **
|
|
164
|
-
- **
|
|
165
|
-
- **getTestCycleAttachments** - Get all attachments for a test cycle
|
|
166
|
-
- **downloadTestCycleAttachment** - Download an attachment from a test cycle
|
|
167
|
-
- **createTestCycleAttachment** - Upload an attachment to a test cycle
|
|
168
|
-
- **getTestPlanAttachments** - Get all attachments for a test plan
|
|
169
|
-
- **downloadTestPlanAttachment** - Download an attachment from a test plan
|
|
170
|
-
- **createTestPlanAttachment** - Upload an attachment to a test plan
|
|
171
|
-
- **getTestExecutionAttachments** - Get all attachments for a test execution
|
|
172
|
-
- **downloadTestExecutionAttachment** - Download an attachment from a test execution
|
|
173
|
-
- **createTestExecutionAttachment** - Upload an attachment to a test execution
|
|
174
|
-
- **getTestExecutionStepAttachments** - Get all attachments for a test execution step
|
|
175
|
-
- **downloadTestExecutionStepAttachment** - Download an attachment from a test execution step
|
|
176
|
-
- **createTestExecutionStepAttachment** - Upload an attachment to a test execution step
|
|
149
|
+
- **Test Case**: `getTestCaseAttachments`, `downloadAttachment`, `createTestCaseAttachment`
|
|
150
|
+
- **Test Step**: `getTestStepAttachments`, `downloadTestStepAttachment`, `createTestStepAttachment`
|
|
151
|
+
- **Test Cycle**: `getTestCycleAttachments`, `downloadTestCycleAttachment`, `createTestCycleAttachment`
|
|
152
|
+
- **Test Plan**: `getTestPlanAttachments`, `downloadTestPlanAttachment`, `createTestPlanAttachment`
|
|
153
|
+
- **Test Execution**: `getTestExecutionAttachments`, `downloadTestExecutionAttachment`, `createTestExecutionAttachment`
|
|
154
|
+
- **Test Execution Step**: `getTestExecutionStepAttachments`, `downloadTestExecutionStepAttachment`, `createTestExecutionStepAttachment`
|
|
177
155
|
- VersionControl
|
|
178
|
-
- **
|
|
179
|
-
- **
|
|
180
|
-
- **getTestCaseTestScript** - Get test script for a test case (with version support)
|
|
181
|
-
- **getTestCaseTestSteps** - Get test steps for a test case (with version support)
|
|
156
|
+
- **Test Case (version-specific)**: `getTestCaseIssueLinks`, `getTestCaseWebLinks`, `getTestCaseTestScript`, `getTestCaseTestSteps`
|
|
157
|
+
- **Test Execution Step**: `getTestExecutionStepIssueLinks`, `createTestExecutionStepIssueLink`
|
|
182
158
|
|
|
183
159
|
## Private API Authentication
|
|
184
160
|
|
|
@@ -282,6 +258,24 @@ const dataSets = await api.Private.Config.DataSets.getDataSets(credentials, {
|
|
|
282
258
|
});
|
|
283
259
|
```
|
|
284
260
|
|
|
261
|
+
### Example: Archive and Unarchive Config Items
|
|
262
|
+
|
|
263
|
+
```typescript
|
|
264
|
+
// Archive an environment
|
|
265
|
+
const archivedEnv = await api.Private.Config.archiveConfig(credentials, {
|
|
266
|
+
type: 'Environment',
|
|
267
|
+
id: 10873400,
|
|
268
|
+
projectId: 10233
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
// Unarchive an iteration
|
|
272
|
+
const unarchivedIteration = await api.Private.Config.unarchiveConfig(credentials, {
|
|
273
|
+
type: 'Iteration',
|
|
274
|
+
id: 10909775,
|
|
275
|
+
projectId: 10233
|
|
276
|
+
});
|
|
277
|
+
```
|
|
278
|
+
|
|
285
279
|
### Example: Create Test Case Version
|
|
286
280
|
|
|
287
281
|
```typescript
|
|
@@ -301,7 +295,7 @@ const newVersion = await api.Private.Versions.createTestCaseVersion(
|
|
|
301
295
|
// Upload an attachment to a test case
|
|
302
296
|
const file = new Blob(['file content'], { type: 'text/plain' });
|
|
303
297
|
|
|
304
|
-
const attachment = await api.Private.Attachments.
|
|
298
|
+
const attachment = await api.Private.Attachments.createTestCaseAttachment(
|
|
305
299
|
credentials,
|
|
306
300
|
{
|
|
307
301
|
testCaseKey: 'PROJ-T1',
|
|
@@ -319,32 +313,49 @@ const attachment = await api.Private.Attachments.createAttachment(
|
|
|
319
313
|
// Get issue links for current version
|
|
320
314
|
const issueLinks = await api.Private.VersionControl.getTestCaseIssueLinks(credentials, {
|
|
321
315
|
testCaseKey: 'PROJ-T1',
|
|
322
|
-
|
|
316
|
+
projectId: 10233
|
|
323
317
|
});
|
|
324
318
|
|
|
325
319
|
// Get web links for version 2 (previous version)
|
|
326
320
|
const webLinks = await api.Private.VersionControl.getTestCaseWebLinks(credentials, {
|
|
327
321
|
testCaseKey: 'PROJ-T1',
|
|
328
|
-
|
|
322
|
+
projectId: 10233,
|
|
329
323
|
version: 2
|
|
330
324
|
});
|
|
331
325
|
|
|
332
326
|
// Get test script for version 3
|
|
333
327
|
const testScript = await api.Private.VersionControl.getTestCaseTestScript(credentials, {
|
|
334
328
|
testCaseKey: 'PROJ-T1',
|
|
335
|
-
|
|
329
|
+
projectId: 10233,
|
|
336
330
|
version: 3
|
|
337
331
|
});
|
|
338
332
|
|
|
339
|
-
// Get test steps for version
|
|
333
|
+
// Get test steps for version 4 (current version, if there are 4 versions total)
|
|
340
334
|
const testSteps = await api.Private.VersionControl.getTestCaseTestSteps(credentials, {
|
|
341
335
|
testCaseKey: 'PROJ-T1',
|
|
342
336
|
projectId: 10233,
|
|
343
|
-
version:
|
|
337
|
+
version: 4
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
// Get issue links for a test execution step (useful for migration)
|
|
341
|
+
const stepIssueLinks = await api.Private.VersionControl.getTestExecutionStepIssueLinks(credentials, {
|
|
342
|
+
testExecutionKey: 'PROJ-E1',
|
|
343
|
+
stepIndex: 0,
|
|
344
|
+
projectId: 10233
|
|
345
|
+
});
|
|
346
|
+
// Returns: [{ id: 169099471, issueId: '66019', type: 'BLOCKS' }, ...]
|
|
347
|
+
|
|
348
|
+
// Create an issue link for a test execution step
|
|
349
|
+
const stepLink = await api.Private.VersionControl.createTestExecutionStepIssueLink(credentials, {
|
|
350
|
+
testExecutionKey: 'PROJ-E1',
|
|
351
|
+
stepIndex: 0,
|
|
352
|
+
issueId: 66019,
|
|
353
|
+
type: 'RELATED',
|
|
354
|
+
projectId: 10233
|
|
344
355
|
});
|
|
345
356
|
```
|
|
346
357
|
|
|
347
|
-
**Note:** Version numbers are
|
|
358
|
+
**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.
|
|
348
359
|
|
|
349
360
|
**Important Notes:**
|
|
350
361
|
- Private API methods require a `PrivateApiCredentials` object with `userEmail`, `apiToken`, and `jiraInstanceUrl`
|
|
@@ -358,6 +369,15 @@ Feel free to drop ideas, suggestions or improvements into our [Community hub](ht
|
|
|
358
369
|
|
|
359
370
|
## Changelog
|
|
360
371
|
|
|
372
|
+
### 1.3.5
|
|
373
|
+
|
|
374
|
+
- **Changed**: Minor fix to interface for created test step
|
|
375
|
+
|
|
376
|
+
### 1.3.4
|
|
377
|
+
|
|
378
|
+
- **Added**: `getTestExecutionStepIssueLinks()` - Get issue links for a test execution step (for migration purposes)
|
|
379
|
+
- **Added**: `createTestExecutionStepIssueLink()` - Create an issue link for a test execution step
|
|
380
|
+
|
|
361
381
|
### 1.3.3
|
|
362
382
|
|
|
363
383
|
- **Added**: New VersionControl sub-group under Private API for version-specific operations
|
package/dist/groups/All.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"All.d.ts","sourceRoot":"","sources":["../../groups/All.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAcpD,qBAAa,QAAQ;IACpB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgB;IACzC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAiB;IAC3C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAqB;IACnD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgB;IACzC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;IACrC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAe;IACvC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;IACrC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgB;IACzC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAmB;IAC/C,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAY;IACjC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAiB;IAC3C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAkB;gBAEjC,aAAa,EAAE,mBAAmB;IAgB9C,IAAI,aAAa,oGAEhB;IAED,IAAI,4BAA4B,+GAE/B;IAED,IAAI,WAAW,2MAEd;IAED,IAAI,cAAc,4GAEjB;IAED,IAAI,cAAc,yEAEjB;IAED,IAAI,gBAAgB,0EAEnB;IAED,IAAI,uBAAuB,gHAE1B;IAED,IAAI,qBAAqB,8GAExB;IAED,IAAI,oBAAoB,qHAEvB;IAED,IAAI,kBAAkB,oGAErB;IAED,IAAI,qBAAqB,oEAExB;IAED,IAAI,wBAAwB,iHAE3B;IAED,IAAI,oBAAoB;
|
|
1
|
+
{"version":3,"file":"All.d.ts","sourceRoot":"","sources":["../../groups/All.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAcpD,qBAAa,QAAQ;IACpB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgB;IACzC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAiB;IAC3C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAqB;IACnD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgB;IACzC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;IACrC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAe;IACvC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;IACrC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgB;IACzC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAmB;IAC/C,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAY;IACjC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAiB;IAC3C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAkB;gBAEjC,aAAa,EAAE,mBAAmB;IAgB9C,IAAI,aAAa,oGAEhB;IAED,IAAI,4BAA4B,+GAE/B;IAED,IAAI,WAAW,2MAEd;IAED,IAAI,cAAc,4GAEjB;IAED,IAAI,cAAc,yEAEjB;IAED,IAAI,gBAAgB,0EAEnB;IAED,IAAI,uBAAuB,gHAE1B;IAED,IAAI,qBAAqB,8GAExB;IAED,IAAI,oBAAoB,qHAEvB;IAED,IAAI,kBAAkB,oGAErB;IAED,IAAI,qBAAqB,oEAExB;IAED,IAAI,wBAAwB,iHAE3B;IAED,IAAI,oBAAoB;kBAuN2hO,CAAC;eAAiB,CAAC;oDArNrkO;IAED,IAAI,uBAAuB,gHAE1B;IAGD,IAAI,cAAc,sGAEjB;IAED,IAAI,YAAY,+FAEf;IAED,IAAI,eAAe,6GAElB;IAED,IAAI,eAAe,0EAElB;IAED,IAAI,iBAAiB,yFAEpB;IAED,IAAI,wBAAwB,iHAE3B;IAED,IAAI,sBAAsB,+GAEzB;IAGD,IAAI,kBAAkB,8GAErB;IAED,IAAI,yBAAyB,gIAE5B;IAED,IAAI,gBAAgB,uGAEnB;IAED,IAAI,mBAAmB,4GAEtB;IAED,IAAI,mBAAmB,8EAEtB;IAED,IAAI,sBAAsB,iGAEzB;IAED,IAAI,4BAA4B,qHAE/B;IAED,IAAI,yBAAyB,6HAE5B;IAED,IAAI,yBAAyB,oFAE5B;IAED,IAAI,uBAAuB,qGAE1B;IAGD,IAAI,aAAa,oGAEhB;IAED,IAAI,WAAW,6FAEd;IAED,IAAI,cAAc,4GAEjB;IAED,IAAI,uBAAuB,gHAE1B;IAED,IAAI,qBAAqB,8GAExB;IAED,IAAI,2BAA2B,oHAE9B;IAGD,IAAI,WAAW,+FAEd;IAED,IAAI,SAAS,yFAEZ;IAED,IAAI,YAAY,4FAEf;IAGD,IAAI,YAAY,kGAEf;IAED,IAAI,UAAU,2FAEb;IAGD,IAAI,YAAY,gGAEf;IAED,IAAI,SAAS,yFAEZ;IAED,IAAI,YAAY,4FAEf;IAED,IAAI,YAAY,4FAEf;IAGD,IAAI,cAAc,oGAEjB;IAED,IAAI,WAAW,6FAEd;IAED,IAAI,cAAc,gGAEjB;IAED,IAAI,cAAc,gGAEjB;IAGD,IAAI,gBAAgB,yGAEnB;IAED,IAAI,cAAc,mGAEjB;IAED,IAAI,iBAAiB,sGAEpB;IAED,IAAI,iBAAiB,sGAEpB;IAGD,IAAI,UAAU,qEAEb;IAGD,IAAI,qBAAqB,wHAExB;IAED,IAAI,sBAAsB,+GAEzB;IAED,IAAI,qBAAqB,6GAExB;IAED,IAAI,sBAAsB,mHAEzB;IAGD,IAAI,sBAAsB,yHAEzB;IAED,IAAI,wBAAwB,2HAE3B;IAED,IAAI,qBAAqB,wHAExB;IAED,IAAI,oBAAoB,+EAEvB;CACD"}
|
|
@@ -25,7 +25,7 @@ export declare class PrivateAttachments extends PrivateBase {
|
|
|
25
25
|
* @param request - Get attachments request
|
|
26
26
|
* @param request.testCaseKey - Test case key (e.g., 'PROJ-T1'). The numeric ID will be looked up automatically if Zephyr Connector is available.
|
|
27
27
|
* @param request.projectId - Jira project ID (numeric, not the project key)
|
|
28
|
-
* @param request.version - Optional version number (
|
|
28
|
+
* @param request.version - Optional version number (absolute, 1-based: 1 = first version ever created, 2 = second version, etc. The highest number is the current/latest version). If not provided, uses the latest version.
|
|
29
29
|
* @returns Test case attachments response with array of attachment details
|
|
30
30
|
* @throws {BadRequestError} If the request is invalid
|
|
31
31
|
* @throws {UnauthorizedError} If authentication fails
|
|
@@ -51,7 +51,7 @@ export declare class PrivateAttachments extends PrivateBase {
|
|
|
51
51
|
* @param request.testCaseKey - Test case key (e.g., 'PROJ-T1'). The numeric ID will be looked up automatically if Zephyr Connector is available.
|
|
52
52
|
* @param request.projectId - Jira project ID (numeric, not the project key)
|
|
53
53
|
* @param request.attachmentId - Attachment ID (UUID string, e.g., 'c3f14125-638f-47f9-9211-12a9777c09e7')
|
|
54
|
-
* @param request.version - Optional version number (
|
|
54
|
+
* @param request.version - Optional version number (absolute, 1-based: 1 = first version ever created, 2 = second version, etc. The highest number is the current/latest version). If not provided, uses the latest version.
|
|
55
55
|
* @returns Blob containing the attachment file data
|
|
56
56
|
* @throws {BadRequestError} If the request is invalid
|
|
57
57
|
* @throws {UnauthorizedError} If authentication fails
|
|
@@ -20,7 +20,7 @@ export class PrivateAttachments extends PrivateBase {
|
|
|
20
20
|
* @param request - Get attachments request
|
|
21
21
|
* @param request.testCaseKey - Test case key (e.g., 'PROJ-T1'). The numeric ID will be looked up automatically if Zephyr Connector is available.
|
|
22
22
|
* @param request.projectId - Jira project ID (numeric, not the project key)
|
|
23
|
-
* @param request.version - Optional version number (
|
|
23
|
+
* @param request.version - Optional version number (absolute, 1-based: 1 = first version ever created, 2 = second version, etc. The highest number is the current/latest version). If not provided, uses the latest version.
|
|
24
24
|
* @returns Test case attachments response with array of attachment details
|
|
25
25
|
* @throws {BadRequestError} If the request is invalid
|
|
26
26
|
* @throws {UnauthorizedError} If authentication fails
|
|
@@ -114,7 +114,7 @@ export class PrivateAttachments extends PrivateBase {
|
|
|
114
114
|
* @param request.testCaseKey - Test case key (e.g., 'PROJ-T1'). The numeric ID will be looked up automatically if Zephyr Connector is available.
|
|
115
115
|
* @param request.projectId - Jira project ID (numeric, not the project key)
|
|
116
116
|
* @param request.attachmentId - Attachment ID (UUID string, e.g., 'c3f14125-638f-47f9-9211-12a9777c09e7')
|
|
117
|
-
* @param request.version - Optional version number (
|
|
117
|
+
* @param request.version - Optional version number (absolute, 1-based: 1 = first version ever created, 2 = second version, etc. The highest number is the current/latest version). If not provided, uses the latest version.
|
|
118
118
|
* @returns Blob containing the attachment file data
|
|
119
119
|
* @throws {BadRequestError} If the request is invalid
|
|
120
120
|
* @throws {UnauthorizedError} If authentication fails
|
|
@@ -24,7 +24,7 @@ export declare class PrivateComments extends PrivateBase {
|
|
|
24
24
|
* @param request - Get comments request
|
|
25
25
|
* @param request.testCaseKey - Test case key (e.g., 'PROJ-T1'). The numeric ID will be looked up automatically if Zephyr Connector is available.
|
|
26
26
|
* @param request.projectId - Jira project ID (numeric, not the project key)
|
|
27
|
-
* @param request.version - Optional version number (
|
|
27
|
+
* @param request.version - Optional version number (absolute, 1-based: 1 = first version ever created, 2 = second version, etc. The highest number is the current/latest version). If not provided, uses the latest version.
|
|
28
28
|
* @returns Array of comments
|
|
29
29
|
* @throws {BadRequestError} If the request is invalid
|
|
30
30
|
* @throws {UnauthorizedError} If authentication fails
|
|
@@ -19,7 +19,7 @@ export class PrivateComments extends PrivateBase {
|
|
|
19
19
|
* @param request - Get comments request
|
|
20
20
|
* @param request.testCaseKey - Test case key (e.g., 'PROJ-T1'). The numeric ID will be looked up automatically if Zephyr Connector is available.
|
|
21
21
|
* @param request.projectId - Jira project ID (numeric, not the project key)
|
|
22
|
-
* @param request.version - Optional version number (
|
|
22
|
+
* @param request.version - Optional version number (absolute, 1-based: 1 = first version ever created, 2 = second version, etc. The highest number is the current/latest version). If not provided, uses the latest version.
|
|
23
23
|
* @returns Array of comments
|
|
24
24
|
* @throws {BadRequestError} If the request is invalid
|
|
25
25
|
* @throws {UnauthorizedError} If authentication fails
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* ⚠️ WARNING: These methods use private APIs that are not officially supported.
|
|
9
9
|
*/
|
|
10
|
+
import type { PrivateApiCredentials, ArchiveConfigRequest, ArchiveConfigResponse } from '../../types';
|
|
10
11
|
import type { ZephyrApiConnection } from '../../index';
|
|
11
12
|
import { PrivateBase } from './PrivateBase';
|
|
12
13
|
import { PrivateCustomFields } from './PrivateCustomFields';
|
|
@@ -31,5 +32,51 @@ export declare class PrivateConfig extends PrivateBase {
|
|
|
31
32
|
*/
|
|
32
33
|
readonly DataSets: PrivateDataSets;
|
|
33
34
|
constructor(apiConnection?: ZephyrApiConnection);
|
|
35
|
+
/**
|
|
36
|
+
* Archive a config item (Environment or Iteration) using private API
|
|
37
|
+
*
|
|
38
|
+
* Archives an Environment or Iteration by setting its `isArchived` flag to `true`.
|
|
39
|
+
*
|
|
40
|
+
* ⚠️ WARNING: This uses a private Zephyr API endpoint that is not officially supported.
|
|
41
|
+
* The endpoint may change or be removed at any time without notice.
|
|
42
|
+
*
|
|
43
|
+
* @param credentials - Private API credentials
|
|
44
|
+
* @param request - Archive config request
|
|
45
|
+
* @param request.type - Type of config item: 'Environment' or 'Iteration'
|
|
46
|
+
* @param request.id - Numeric ID of the environment or iteration to archive
|
|
47
|
+
* @param request.projectId - Jira project ID (numeric, not the project key)
|
|
48
|
+
* @returns Archive response with the ID of the archived item
|
|
49
|
+
* @throws {BadRequestError} If the request is invalid
|
|
50
|
+
* @throws {UnauthorizedError} If authentication fails
|
|
51
|
+
* @throws {ForbiddenError} If the user doesn't have permission
|
|
52
|
+
* @throws {NotFoundError} If the environment or iteration is not found
|
|
53
|
+
* @throws {ServerError} If the server returns an error
|
|
54
|
+
*/
|
|
55
|
+
archiveConfig(credentials: PrivateApiCredentials, request: ArchiveConfigRequest): Promise<ArchiveConfigResponse>;
|
|
56
|
+
/**
|
|
57
|
+
* Unarchive a config item (Environment or Iteration) using private API
|
|
58
|
+
*
|
|
59
|
+
* Unarchives an Environment or Iteration by setting its `isArchived` flag to `false`.
|
|
60
|
+
*
|
|
61
|
+
* ⚠️ WARNING: This uses a private Zephyr API endpoint that is not officially supported.
|
|
62
|
+
* The endpoint may change or be removed at any time without notice.
|
|
63
|
+
*
|
|
64
|
+
* @param credentials - Private API credentials
|
|
65
|
+
* @param request - Archive config request (same interface as archive, but sets isArchived to false)
|
|
66
|
+
* @param request.type - Type of config item: 'Environment' or 'Iteration'
|
|
67
|
+
* @param request.id - Numeric ID of the environment or iteration to unarchive
|
|
68
|
+
* @param request.projectId - Jira project ID (numeric, not the project key)
|
|
69
|
+
* @returns Archive response with the ID of the unarchived item
|
|
70
|
+
* @throws {BadRequestError} If the request is invalid
|
|
71
|
+
* @throws {UnauthorizedError} If authentication fails
|
|
72
|
+
* @throws {ForbiddenError} If the user doesn't have permission
|
|
73
|
+
* @throws {NotFoundError} If the environment or iteration is not found
|
|
74
|
+
* @throws {ServerError} If the server returns an error
|
|
75
|
+
*/
|
|
76
|
+
unarchiveConfig(credentials: PrivateApiCredentials, request: ArchiveConfigRequest): Promise<ArchiveConfigResponse>;
|
|
77
|
+
/**
|
|
78
|
+
* Internal method to update archive status
|
|
79
|
+
*/
|
|
80
|
+
private updateArchiveStatus;
|
|
34
81
|
}
|
|
35
82
|
//# sourceMappingURL=PrivateConfig.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrivateConfig.d.ts","sourceRoot":"","sources":["../../../groups/Private/PrivateConfig.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"PrivateConfig.d.ts","sourceRoot":"","sources":["../../../groups/Private/PrivateConfig.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;GAKG;AAEH,OAAO,KAAK,EACX,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EAErB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAUpD,qBAAa,aAAc,SAAQ,WAAW;IAC7C;;OAEG;IACH,SAAgB,YAAY,EAAE,mBAAmB,CAAC;IAElD;;OAEG;IACH,SAAgB,MAAM,EAAE,aAAa,CAAC;IAEtC;;OAEG;IACH,SAAgB,UAAU,EAAE,iBAAiB,CAAC;IAE9C;;OAEG;IACH,SAAgB,QAAQ,EAAE,eAAe,CAAC;gBAE9B,aAAa,CAAC,EAAE,mBAAmB;IAQ/C;;;;;;;;;;;;;;;;;;;OAmBG;IACG,aAAa,CAClB,WAAW,EAAE,qBAAqB,EAClC,OAAO,EAAE,oBAAoB,GAC3B,OAAO,CAAC,qBAAqB,CAAC;IAIjC;;;;;;;;;;;;;;;;;;;OAmBG;IACG,eAAe,CACpB,WAAW,EAAE,qBAAqB,EAClC,OAAO,EAAE,oBAAoB,GAC3B,OAAO,CAAC,qBAAqB,CAAC;IAIjC;;OAEG;YACW,mBAAmB;CAuEjC"}
|
|
@@ -6,6 +6,7 @@ import { PrivateCustomFields } from './PrivateCustomFields';
|
|
|
6
6
|
import { PrivateLabels } from './PrivateLabels';
|
|
7
7
|
import { PrivateIterations } from './PrivateIterations';
|
|
8
8
|
import { PrivateDataSets } from './PrivateDataSets';
|
|
9
|
+
import { BadRequestError, UnauthorizedError, ForbiddenError, NotFoundError, ServerError, UnexpectedError, } from '../../utils';
|
|
9
10
|
export class PrivateConfig extends PrivateBase {
|
|
10
11
|
constructor(apiConnection) {
|
|
11
12
|
super(apiConnection);
|
|
@@ -14,4 +15,103 @@ export class PrivateConfig extends PrivateBase {
|
|
|
14
15
|
this.Iterations = new PrivateIterations(apiConnection);
|
|
15
16
|
this.DataSets = new PrivateDataSets(apiConnection);
|
|
16
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Archive a config item (Environment or Iteration) using private API
|
|
20
|
+
*
|
|
21
|
+
* Archives an Environment or Iteration by setting its `isArchived` flag to `true`.
|
|
22
|
+
*
|
|
23
|
+
* ⚠️ WARNING: This uses a private Zephyr API endpoint that is not officially supported.
|
|
24
|
+
* The endpoint may change or be removed at any time without notice.
|
|
25
|
+
*
|
|
26
|
+
* @param credentials - Private API credentials
|
|
27
|
+
* @param request - Archive config request
|
|
28
|
+
* @param request.type - Type of config item: 'Environment' or 'Iteration'
|
|
29
|
+
* @param request.id - Numeric ID of the environment or iteration to archive
|
|
30
|
+
* @param request.projectId - Jira project ID (numeric, not the project key)
|
|
31
|
+
* @returns Archive response with the ID of the archived item
|
|
32
|
+
* @throws {BadRequestError} If the request is invalid
|
|
33
|
+
* @throws {UnauthorizedError} If authentication fails
|
|
34
|
+
* @throws {ForbiddenError} If the user doesn't have permission
|
|
35
|
+
* @throws {NotFoundError} If the environment or iteration is not found
|
|
36
|
+
* @throws {ServerError} If the server returns an error
|
|
37
|
+
*/
|
|
38
|
+
async archiveConfig(credentials, request) {
|
|
39
|
+
return this.updateArchiveStatus(credentials, request, true);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Unarchive a config item (Environment or Iteration) using private API
|
|
43
|
+
*
|
|
44
|
+
* Unarchives an Environment or Iteration by setting its `isArchived` flag to `false`.
|
|
45
|
+
*
|
|
46
|
+
* ⚠️ WARNING: This uses a private Zephyr API endpoint that is not officially supported.
|
|
47
|
+
* The endpoint may change or be removed at any time without notice.
|
|
48
|
+
*
|
|
49
|
+
* @param credentials - Private API credentials
|
|
50
|
+
* @param request - Archive config request (same interface as archive, but sets isArchived to false)
|
|
51
|
+
* @param request.type - Type of config item: 'Environment' or 'Iteration'
|
|
52
|
+
* @param request.id - Numeric ID of the environment or iteration to unarchive
|
|
53
|
+
* @param request.projectId - Jira project ID (numeric, not the project key)
|
|
54
|
+
* @returns Archive response with the ID of the unarchived item
|
|
55
|
+
* @throws {BadRequestError} If the request is invalid
|
|
56
|
+
* @throws {UnauthorizedError} If authentication fails
|
|
57
|
+
* @throws {ForbiddenError} If the user doesn't have permission
|
|
58
|
+
* @throws {NotFoundError} If the environment or iteration is not found
|
|
59
|
+
* @throws {ServerError} If the server returns an error
|
|
60
|
+
*/
|
|
61
|
+
async unarchiveConfig(credentials, request) {
|
|
62
|
+
return this.updateArchiveStatus(credentials, request, false);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Internal method to update archive status
|
|
66
|
+
*/
|
|
67
|
+
async updateArchiveStatus(credentials, request, isArchived) {
|
|
68
|
+
// Get Context JWT
|
|
69
|
+
const contextJwt = await this.getContextJwt(credentials);
|
|
70
|
+
// Determine endpoint based on type
|
|
71
|
+
const endpoint = request.type.toLowerCase(); // 'environment' or 'iteration'
|
|
72
|
+
const url = `${this.privateApiBaseUrl}/${endpoint}/${request.id}`;
|
|
73
|
+
const headers = {
|
|
74
|
+
'Content-Type': 'application/json',
|
|
75
|
+
authorization: `JWT ${contextJwt}`,
|
|
76
|
+
'jira-project-id': String(request.projectId),
|
|
77
|
+
};
|
|
78
|
+
const requestBody = {
|
|
79
|
+
id: request.id,
|
|
80
|
+
isArchived,
|
|
81
|
+
};
|
|
82
|
+
try {
|
|
83
|
+
const response = await fetch(url, {
|
|
84
|
+
method: 'PUT',
|
|
85
|
+
headers,
|
|
86
|
+
body: JSON.stringify(requestBody),
|
|
87
|
+
});
|
|
88
|
+
if (!response.ok) {
|
|
89
|
+
if (response.status === 400) {
|
|
90
|
+
throw new BadRequestError(`Invalid request parameters for ${isArchived ? 'archiving' : 'unarchiving'} ${request.type.toLowerCase()}.`);
|
|
91
|
+
}
|
|
92
|
+
if (response.status === 401) {
|
|
93
|
+
throw new UnauthorizedError('Failed to authenticate. Please check your credentials.');
|
|
94
|
+
}
|
|
95
|
+
if (response.status === 403) {
|
|
96
|
+
throw new ForbiddenError(`Insufficient permissions to ${isArchived ? 'archive' : 'unarchive'} ${request.type.toLowerCase()}.`);
|
|
97
|
+
}
|
|
98
|
+
if (response.status === 404) {
|
|
99
|
+
throw new NotFoundError(`${request.type} with ID '${request.id}' not found.`);
|
|
100
|
+
}
|
|
101
|
+
throw new ServerError(`Failed to ${isArchived ? 'archive' : 'unarchive'} ${request.type.toLowerCase()}. Status: ${response.status}`, response.status, response.statusText);
|
|
102
|
+
}
|
|
103
|
+
return (await response.json());
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
if (error instanceof BadRequestError ||
|
|
107
|
+
error instanceof UnauthorizedError ||
|
|
108
|
+
error instanceof ForbiddenError ||
|
|
109
|
+
error instanceof NotFoundError ||
|
|
110
|
+
error instanceof ServerError ||
|
|
111
|
+
error instanceof UnexpectedError) {
|
|
112
|
+
throw error;
|
|
113
|
+
}
|
|
114
|
+
throw new UnexpectedError(`Unexpected error while ${isArchived ? 'archiving' : 'unarchiving'} ${request.type.toLowerCase()}`, error);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
17
117
|
}
|