@rbaileysr/zephyr-managed-api 1.0.0

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.
Files changed (56) hide show
  1. package/README.md +618 -0
  2. package/dist/error-strategy.d.ts +69 -0
  3. package/dist/error-strategy.d.ts.map +1 -0
  4. package/dist/error-strategy.js +125 -0
  5. package/dist/groups/All.d.ts +90 -0
  6. package/dist/groups/All.d.ts.map +1 -0
  7. package/dist/groups/All.js +236 -0
  8. package/dist/groups/Automation.d.ts +75 -0
  9. package/dist/groups/Automation.d.ts.map +1 -0
  10. package/dist/groups/Automation.js +133 -0
  11. package/dist/groups/Environment.d.ts +73 -0
  12. package/dist/groups/Environment.d.ts.map +1 -0
  13. package/dist/groups/Environment.js +93 -0
  14. package/dist/groups/Folder.d.ts +55 -0
  15. package/dist/groups/Folder.d.ts.map +1 -0
  16. package/dist/groups/Folder.js +68 -0
  17. package/dist/groups/IssueLink.d.ts +59 -0
  18. package/dist/groups/IssueLink.d.ts.map +1 -0
  19. package/dist/groups/IssueLink.js +70 -0
  20. package/dist/groups/Link.d.ts +23 -0
  21. package/dist/groups/Link.d.ts.map +1 -0
  22. package/dist/groups/Link.js +34 -0
  23. package/dist/groups/Priority.d.ts +77 -0
  24. package/dist/groups/Priority.d.ts.map +1 -0
  25. package/dist/groups/Priority.js +97 -0
  26. package/dist/groups/Project.d.ts +36 -0
  27. package/dist/groups/Project.d.ts.map +1 -0
  28. package/dist/groups/Project.js +42 -0
  29. package/dist/groups/Status.d.ts +82 -0
  30. package/dist/groups/Status.d.ts.map +1 -0
  31. package/dist/groups/Status.js +102 -0
  32. package/dist/groups/TestCase.d.ts +254 -0
  33. package/dist/groups/TestCase.d.ts.map +1 -0
  34. package/dist/groups/TestCase.js +327 -0
  35. package/dist/groups/TestCycle.d.ts +127 -0
  36. package/dist/groups/TestCycle.d.ts.map +1 -0
  37. package/dist/groups/TestCycle.js +166 -0
  38. package/dist/groups/TestExecution.d.ts +176 -0
  39. package/dist/groups/TestExecution.d.ts.map +1 -0
  40. package/dist/groups/TestExecution.js +239 -0
  41. package/dist/groups/TestPlan.d.ts +103 -0
  42. package/dist/groups/TestPlan.d.ts.map +1 -0
  43. package/dist/groups/TestPlan.js +137 -0
  44. package/dist/index.d.ts +119 -0
  45. package/dist/index.d.ts.map +1 -0
  46. package/dist/index.js +124 -0
  47. package/dist/types.d.ts +1353 -0
  48. package/dist/types.d.ts.map +1 -0
  49. package/dist/types.js +7 -0
  50. package/dist/utils-api-call.d.ts +22 -0
  51. package/dist/utils-api-call.d.ts.map +1 -0
  52. package/dist/utils-api-call.js +80 -0
  53. package/dist/utils.d.ts +144 -0
  54. package/dist/utils.d.ts.map +1 -0
  55. package/dist/utils.js +432 -0
  56. package/package.json +54 -0
@@ -0,0 +1,239 @@
1
+ /**
2
+ * Test Execution API group
3
+ * Handles test execution-related operations
4
+ */
5
+ import { buildQueryString, parseResponse, buildRequestBody } from '../utils';
6
+ export class TestExecutionGroup {
7
+ constructor(api) {
8
+ this.api = api;
9
+ }
10
+ /**
11
+ * List all test executions
12
+ *
13
+ * Retrieves a paginated list of all test executions. Query parameters can be used to filter by project, test cycle, test case, dates, and more.
14
+ *
15
+ * @param options - Optional query parameters for filtering and pagination
16
+ * @param options.projectKey - Filter test executions by Jira project key
17
+ * @param options.testCycle - Filter by test cycle key
18
+ * @param options.testCase - Filter by test case key
19
+ * @param options.actualEndDateAfter - Filter for 'Actual End Date' after the given time (ISO 8601 format)
20
+ * @param options.actualEndDateBefore - Filter for 'Actual End Date' before the given time (ISO 8601 format)
21
+ * @param options.includeStepLinks - If true, execution step issue links will be included in the response
22
+ * @param options.jiraProjectVersionId - Filter by Jira Project Version ID
23
+ * @param options.maxResults - Maximum number of results to return (default: 10, max: 1000)
24
+ * @param options.startAt - Zero-indexed starting position (must be multiple of maxResults)
25
+ * @returns Paginated list of test executions with metadata (total, isLast, etc.)
26
+ *
27
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/listTestExecutions Official API Documentation}
28
+ */
29
+ async listTestExecutions(options) {
30
+ const queryString = buildQueryString(options);
31
+ const response = await this.api.fetch(`/testexecutions${queryString}`);
32
+ return parseResponse(response);
33
+ }
34
+ /**
35
+ * List all test executions (NextGen - cursor-based pagination)
36
+ *
37
+ * Retrieves test executions using cursor-based pagination. Use this endpoint for retrieving large volumes of test executions
38
+ * as it provides better performance than offset-based pagination.
39
+ *
40
+ * @param options - Optional query parameters for filtering and pagination
41
+ * @param options.projectKey - Filter test executions by Jira project key
42
+ * @param options.testCycle - Filter by test cycle key
43
+ * @param options.testCase - Filter by test case key
44
+ * @param options.actualEndDateAfter - Filter for 'Actual End Date' after the given time (ISO 8601 format)
45
+ * @param options.actualEndDateBefore - Filter for 'Actual End Date' before the given time (ISO 8601 format)
46
+ * @param options.limit - Maximum number of results to return per page (default: 100)
47
+ * @param options.startAtId - Starting ID for cursor-based pagination (use null for first page)
48
+ * @returns Cursor-paginated list of test executions with nextStartAtId for pagination
49
+ *
50
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/listTestExecutionsNextgen Official API Documentation}
51
+ */
52
+ async listTestExecutionsNextgen(options) {
53
+ const queryString = buildQueryString(options);
54
+ const response = await this.api.fetch(`/testexecutions/nextgen${queryString}`);
55
+ return parseResponse(response);
56
+ }
57
+ /**
58
+ * Get a specific test execution
59
+ *
60
+ * Retrieves detailed information about a specific test execution by its ID or key.
61
+ *
62
+ * @param options - Get test execution options
63
+ * @param options.testExecutionIdOrKey - The test execution ID or key
64
+ * @param options.includeStepLinks - If true, execution step issue links will be included in the response
65
+ * @returns Test execution object with all fields
66
+ *
67
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/getTestExecution Official API Documentation}
68
+ */
69
+ async getTestExecution(options) {
70
+ const params = [];
71
+ if (options.includeStepLinks !== undefined) {
72
+ params.push(`includeStepLinks=${options.includeStepLinks}`);
73
+ }
74
+ const queryString = params.length > 0 ? `?${params.join('&')}` : '';
75
+ const response = await this.api.fetch(`/testexecutions/${options.testExecutionIdOrKey}${queryString}`);
76
+ return parseResponse(response);
77
+ }
78
+ /**
79
+ * Create a new test execution
80
+ *
81
+ * Creates a new test execution for a test case within a test cycle. Required fields include projectKey, testCaseKey, testCycleKey, and statusName.
82
+ * Optional fields include environmentName, actualEndDate, executionTime, executedById, assignedToId, comment, and customFields.
83
+ *
84
+ * @param request - Create test execution request
85
+ * @param request.body - Test execution data
86
+ * @param request.body.projectKey - Jira project key (required)
87
+ * @param request.body.testCaseKey - Test case key (required)
88
+ * @param request.body.testCycleKey - Test cycle key (required)
89
+ * @param request.body.statusName - Status name (required)
90
+ * @param request.body.environmentName - Environment name (optional)
91
+ * @param request.body.actualEndDate - Actual end date in ISO 8601 format (optional)
92
+ * @param request.body.executionTime - Actual test execution time in milliseconds (optional)
93
+ * @param request.body.executedById - Account ID of user who executed the test (optional)
94
+ * @param request.body.assignedToId - Account ID of user assigned to the test (optional)
95
+ * @param request.body.comment - Comment added against overall test case execution (optional)
96
+ * @param request.body.customFields - Custom field values (optional)
97
+ * @returns Created test execution with id and self link
98
+ *
99
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/createTestExecution Official API Documentation}
100
+ */
101
+ async createTestExecution(request) {
102
+ const response = await this.api.fetch('/testexecutions', {
103
+ method: 'POST',
104
+ headers: { 'Content-Type': 'application/json' },
105
+ body: buildRequestBody(request.body),
106
+ });
107
+ return parseResponse(response);
108
+ }
109
+ /**
110
+ * Update a test execution
111
+ *
112
+ * Updates an existing test execution. All fields are optional. Note that test executions may become immutable if there's a more recent execution for the same test case.
113
+ *
114
+ * @param request - Update test execution request
115
+ * @param request.testExecutionIdOrKey - The test execution ID or key to update
116
+ * @param request.body - Test execution data to update (all fields optional)
117
+ * @param request.body.statusName - Status name (optional)
118
+ * @param request.body.environmentName - Environment name (optional)
119
+ * @param request.body.actualEndDate - Actual end date in ISO 8601 format (optional)
120
+ * @param request.body.executionTime - Actual test execution time in milliseconds (optional)
121
+ * @param request.body.executedById - Account ID of user who executed the test (optional)
122
+ * @param request.body.assignedToId - Account ID of user assigned to the test (optional)
123
+ * @param request.body.comment - Comment added against overall test case execution (optional)
124
+ * @returns Promise that resolves when update is complete
125
+ *
126
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/updateTestExecution Official API Documentation}
127
+ */
128
+ async updateTestExecution(request) {
129
+ const response = await this.api.fetch(`/testexecutions/${request.testExecutionIdOrKey}`, {
130
+ method: 'PUT',
131
+ headers: { 'Content-Type': 'application/json' },
132
+ body: buildRequestBody(request.body),
133
+ });
134
+ if (!response.ok) {
135
+ await parseResponse(response);
136
+ }
137
+ }
138
+ /**
139
+ * Get test steps for a test execution
140
+ *
141
+ * Retrieves the test steps associated with a test execution. Provides a paged response.
142
+ *
143
+ * @param options - Get test steps options
144
+ * @param options.testExecutionIdOrKey - The test execution ID or key
145
+ * @param options.maxResults - Maximum number of results to return (default: 50)
146
+ * @param options.startAt - Zero-indexed starting position (must be multiple of maxResults)
147
+ * @param options.testDataRowNumber - Filter by test data row number (optional)
148
+ * @returns Paginated list of test execution steps
149
+ *
150
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/getTestExecutionTestSteps Official API Documentation}
151
+ */
152
+ async getTestExecutionTestSteps(options) {
153
+ const queryString = buildQueryString({
154
+ maxResults: options.maxResults,
155
+ startAt: options.startAt,
156
+ testDataRowNumber: options.testDataRowNumber,
157
+ });
158
+ const response = await this.api.fetch(`/testexecutions/${options.testExecutionIdOrKey}/teststeps${queryString}`);
159
+ return parseResponse(response);
160
+ }
161
+ /**
162
+ * Update test steps for a test execution
163
+ *
164
+ * Updates the test steps for a test execution. The number of steps sent must match the number of steps in the test execution.
165
+ * Update of test execution containing test data is not supported.
166
+ *
167
+ * @param request - Update test steps request
168
+ * @param request.testExecutionIdOrKey - The test execution ID or key
169
+ * @param request.body - Test steps data
170
+ * @param request.body.items - Array of test step items with id, statusName, and optional comment
171
+ * @returns Promise that resolves when update is complete
172
+ *
173
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/putTestExecutionTestSteps Official API Documentation}
174
+ */
175
+ async putTestExecutionTestSteps(request) {
176
+ const response = await this.api.fetch(`/testexecutions/${request.testExecutionIdOrKey}/teststeps`, {
177
+ method: 'PUT',
178
+ headers: { 'Content-Type': 'application/json' },
179
+ body: buildRequestBody(request.body),
180
+ });
181
+ if (!response.ok) {
182
+ await parseResponse(response);
183
+ }
184
+ }
185
+ /**
186
+ * Sync test execution with content of test case script
187
+ *
188
+ * Synchronizes the test execution steps with the content of the test case script. This updates the test execution
189
+ * to match any changes made to the test case's test script or test steps.
190
+ *
191
+ * @param request - Sync test execution script request
192
+ * @param request.testExecutionIdOrKey - The test execution ID or key
193
+ * @returns Link object with id and self link
194
+ *
195
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/syncTestExecutionScript Official API Documentation}
196
+ */
197
+ async syncTestExecutionScript(request) {
198
+ const response = await this.api.fetch(`/testexecutions/${request.testExecutionIdOrKey}/teststeps/sync`, {
199
+ method: 'POST',
200
+ });
201
+ return parseResponse(response);
202
+ }
203
+ /**
204
+ * Get links for a test execution
205
+ *
206
+ * Retrieves all links associated with a test execution, including issue links.
207
+ *
208
+ * @param testExecutionIdOrKey - The test execution ID or key
209
+ * @returns List of links including issues array
210
+ *
211
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/listTestExecutionLinks Official API Documentation}
212
+ */
213
+ async listTestExecutionLinks(testExecutionIdOrKey) {
214
+ const response = await this.api.fetch(`/testexecutions/${testExecutionIdOrKey}/links`);
215
+ return parseResponse(response);
216
+ }
217
+ /**
218
+ * Create a link between a test execution and a Jira issue
219
+ *
220
+ * Creates a link between a test execution and a Jira issue. The link type can be COVERAGE, BLOCKS, or RELATED.
221
+ *
222
+ * @param request - Create issue link request
223
+ * @param request.testExecutionIdOrKey - The test execution ID or key
224
+ * @param request.body - Link data
225
+ * @param request.body.issueId - Jira issue ID (required)
226
+ * @param request.body.type - Link type: 'COVERAGE', 'BLOCKS', or 'RELATED' (optional, defaults to 'COVERAGE')
227
+ * @returns Created link resource with id and self link
228
+ *
229
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/createTestExecutionIssueLink Official API Documentation}
230
+ */
231
+ async createTestExecutionIssueLink(request) {
232
+ const response = await this.api.fetch(`/testexecutions/${request.testExecutionIdOrKey}/links/issues`, {
233
+ method: 'POST',
234
+ headers: { 'Content-Type': 'application/json' },
235
+ body: buildRequestBody(request.body),
236
+ });
237
+ return parseResponse(response);
238
+ }
239
+ }
@@ -0,0 +1,103 @@
1
+ /**
2
+ * Test Plan API group
3
+ * Handles test plan-related operations
4
+ */
5
+ import type { TestPlan, TestPlanList, ListTestPlansOptions, GetTestPlanOptions, CreateTestPlanRequest, CreateTestPlanIssueLinkRequest, CreateTestPlanWebLinkRequest, CreateTestPlanTestCycleLinkRequest, KeyedCreatedResource, CreatedResource } from '../types';
6
+ import type { ZephyrApiConnection } from '../index';
7
+ export declare class TestPlanGroup {
8
+ private api;
9
+ constructor(api: ZephyrApiConnection);
10
+ /**
11
+ * List all test plans
12
+ *
13
+ * Retrieves a paginated list of all test plans. Query parameters can be used to filter by project.
14
+ *
15
+ * @param options - Optional query parameters for filtering and pagination
16
+ * @param options.projectKey - Filter test plans by Jira project key
17
+ * @param options.maxResults - Maximum number of results to return (default: 10, max: 1000)
18
+ * @param options.startAt - Zero-indexed starting position (must be multiple of maxResults)
19
+ * @returns Paginated list of test plans with metadata (total, isLast, etc.)
20
+ *
21
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/listTestPlans Official API Documentation}
22
+ */
23
+ listTestPlans(options?: ListTestPlansOptions): Promise<TestPlanList>;
24
+ /**
25
+ * Get a specific test plan
26
+ *
27
+ * Retrieves detailed information about a specific test plan by its ID or key (e.g., 'PROJ-P1').
28
+ *
29
+ * @param options - Get test plan options
30
+ * @param options.testPlanIdOrKey - The test plan ID or key (e.g., 'PROJ-P1')
31
+ * @returns Test plan object with all fields
32
+ *
33
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/getTestPlan Official API Documentation}
34
+ */
35
+ getTestPlan(options: GetTestPlanOptions): Promise<TestPlan>;
36
+ /**
37
+ * Create a new test plan
38
+ *
39
+ * Creates a new test plan in the specified project. Required fields include projectKey and name.
40
+ * Optional fields include objective, folderId, statusName, ownerId, labels, and customFields.
41
+ *
42
+ * @param request - Create test plan request
43
+ * @param request.body - Test plan data
44
+ * @param request.body.projectKey - Jira project key (required)
45
+ * @param request.body.name - Test plan name (required)
46
+ * @param request.body.objective - Test plan objective (optional)
47
+ * @param request.body.folderId - Folder ID (optional)
48
+ * @param request.body.statusName - Status name (optional)
49
+ * @param request.body.ownerId - Owner account ID (optional)
50
+ * @param request.body.labels - Array of labels (optional)
51
+ * @param request.body.customFields - Custom field values (optional)
52
+ * @returns Created test plan with key, id, and self link
53
+ *
54
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/createTestPlan Official API Documentation}
55
+ */
56
+ createTestPlan(request: CreateTestPlanRequest): Promise<KeyedCreatedResource>;
57
+ /**
58
+ * Create a link between a test plan and a Jira issue
59
+ *
60
+ * Creates a link between a test plan and a Jira issue. The link type can be COVERAGE, BLOCKS, or RELATED.
61
+ *
62
+ * @param request - Create issue link request
63
+ * @param request.testPlanIdOrKey - The test plan ID or key (e.g., 'PROJ-P1')
64
+ * @param request.body - Link data
65
+ * @param request.body.issueId - Jira issue ID (required)
66
+ * @param request.body.type - Link type: 'COVERAGE', 'BLOCKS', or 'RELATED' (optional, defaults to 'COVERAGE')
67
+ * @returns Created link resource with id and self link
68
+ *
69
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/createTestPlanIssueLink Official API Documentation}
70
+ */
71
+ createTestPlanIssueLink(request: CreateTestPlanIssueLinkRequest): Promise<CreatedResource>;
72
+ /**
73
+ * Create a link between a test plan and a generic URL
74
+ *
75
+ * Creates a web link between a test plan and an external URL. Useful for linking to documentation, requirements, or other resources.
76
+ *
77
+ * @param request - Create web link request
78
+ * @param request.testPlanIdOrKey - The test plan ID or key (e.g., 'PROJ-P1')
79
+ * @param request.body - Web link data
80
+ * @param request.body.url - The URL to link to (required)
81
+ * @param request.body.description - Link description (required)
82
+ * @param request.body.type - Link type: 'COVERAGE', 'BLOCKS', or 'RELATED' (optional, defaults to 'COVERAGE')
83
+ * @returns Created link resource with id and self link
84
+ *
85
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/createTestPlanWebLink Official API Documentation}
86
+ */
87
+ createTestPlanWebLink(request: CreateTestPlanWebLinkRequest): Promise<CreatedResource>;
88
+ /**
89
+ * Create a link between a test plan and a test cycle
90
+ *
91
+ * Creates a link between a test plan and a test cycle. This associates a test cycle with a test plan.
92
+ *
93
+ * @param request - Create test cycle link request
94
+ * @param request.testPlanIdOrKey - The test plan ID or key (e.g., 'PROJ-P1')
95
+ * @param request.body - Link data
96
+ * @param request.body.testCycleIdOrKey - The test cycle ID or key (required)
97
+ * @returns Created link resource with id and self link
98
+ *
99
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/createTestPlanTestCycleLink Official API Documentation}
100
+ */
101
+ createTestPlanTestCycleLink(request: CreateTestPlanTestCycleLinkRequest): Promise<CreatedResource>;
102
+ }
103
+ //# sourceMappingURL=TestPlan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TestPlan.d.ts","sourceRoot":"","sources":["../../groups/TestPlan.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,QAAQ,EACR,YAAY,EACZ,oBAAoB,EACpB,kBAAkB,EAClB,qBAAqB,EACrB,8BAA8B,EAC9B,4BAA4B,EAC5B,kCAAkC,EAClC,oBAAoB,EACpB,eAAe,EACf,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEpD,qBAAa,aAAa;IACb,OAAO,CAAC,GAAG;gBAAH,GAAG,EAAE,mBAAmB;IAE5C;;;;;;;;;;;;OAYG;IACG,aAAa,CAAC,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,YAAY,CAAC;IAM1E;;;;;;;;;;OAUG;IACG,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,QAAQ,CAAC;IAKjE;;;;;;;;;;;;;;;;;;;OAmBG;IACG,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IASnF;;;;;;;;;;;;;OAaG;IACG,uBAAuB,CAC5B,OAAO,EAAE,8BAA8B,GACrC,OAAO,CAAC,eAAe,CAAC;IAY3B;;;;;;;;;;;;;;OAcG;IACG,qBAAqB,CAAC,OAAO,EAAE,4BAA4B,GAAG,OAAO,CAAC,eAAe,CAAC;IAY5F;;;;;;;;;;;;OAYG;IACG,2BAA2B,CAChC,OAAO,EAAE,kCAAkC,GACzC,OAAO,CAAC,eAAe,CAAC;CAW3B"}
@@ -0,0 +1,137 @@
1
+ /**
2
+ * Test Plan API group
3
+ * Handles test plan-related operations
4
+ */
5
+ import { buildQueryString, parseResponse, buildRequestBody } from '../utils';
6
+ export class TestPlanGroup {
7
+ constructor(api) {
8
+ this.api = api;
9
+ }
10
+ /**
11
+ * List all test plans
12
+ *
13
+ * Retrieves a paginated list of all test plans. Query parameters can be used to filter by project.
14
+ *
15
+ * @param options - Optional query parameters for filtering and pagination
16
+ * @param options.projectKey - Filter test plans by Jira project key
17
+ * @param options.maxResults - Maximum number of results to return (default: 10, max: 1000)
18
+ * @param options.startAt - Zero-indexed starting position (must be multiple of maxResults)
19
+ * @returns Paginated list of test plans with metadata (total, isLast, etc.)
20
+ *
21
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/listTestPlans Official API Documentation}
22
+ */
23
+ async listTestPlans(options) {
24
+ const queryString = buildQueryString(options);
25
+ const response = await this.api.fetch(`/testplans${queryString}`);
26
+ return parseResponse(response);
27
+ }
28
+ /**
29
+ * Get a specific test plan
30
+ *
31
+ * Retrieves detailed information about a specific test plan by its ID or key (e.g., 'PROJ-P1').
32
+ *
33
+ * @param options - Get test plan options
34
+ * @param options.testPlanIdOrKey - The test plan ID or key (e.g., 'PROJ-P1')
35
+ * @returns Test plan object with all fields
36
+ *
37
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/getTestPlan Official API Documentation}
38
+ */
39
+ async getTestPlan(options) {
40
+ const response = await this.api.fetch(`/testplans/${options.testPlanIdOrKey}`);
41
+ return parseResponse(response);
42
+ }
43
+ /**
44
+ * Create a new test plan
45
+ *
46
+ * Creates a new test plan in the specified project. Required fields include projectKey and name.
47
+ * Optional fields include objective, folderId, statusName, ownerId, labels, and customFields.
48
+ *
49
+ * @param request - Create test plan request
50
+ * @param request.body - Test plan data
51
+ * @param request.body.projectKey - Jira project key (required)
52
+ * @param request.body.name - Test plan name (required)
53
+ * @param request.body.objective - Test plan objective (optional)
54
+ * @param request.body.folderId - Folder ID (optional)
55
+ * @param request.body.statusName - Status name (optional)
56
+ * @param request.body.ownerId - Owner account ID (optional)
57
+ * @param request.body.labels - Array of labels (optional)
58
+ * @param request.body.customFields - Custom field values (optional)
59
+ * @returns Created test plan with key, id, and self link
60
+ *
61
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/createTestPlan Official API Documentation}
62
+ */
63
+ async createTestPlan(request) {
64
+ const response = await this.api.fetch('/testplans', {
65
+ method: 'POST',
66
+ headers: { 'Content-Type': 'application/json' },
67
+ body: buildRequestBody(request.body),
68
+ });
69
+ return parseResponse(response);
70
+ }
71
+ /**
72
+ * Create a link between a test plan and a Jira issue
73
+ *
74
+ * Creates a link between a test plan and a Jira issue. The link type can be COVERAGE, BLOCKS, or RELATED.
75
+ *
76
+ * @param request - Create issue link request
77
+ * @param request.testPlanIdOrKey - The test plan ID or key (e.g., 'PROJ-P1')
78
+ * @param request.body - Link data
79
+ * @param request.body.issueId - Jira issue ID (required)
80
+ * @param request.body.type - Link type: 'COVERAGE', 'BLOCKS', or 'RELATED' (optional, defaults to 'COVERAGE')
81
+ * @returns Created link resource with id and self link
82
+ *
83
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/createTestPlanIssueLink Official API Documentation}
84
+ */
85
+ async createTestPlanIssueLink(request) {
86
+ const response = await this.api.fetch(`/testplans/${request.testPlanIdOrKey}/links/issues`, {
87
+ method: 'POST',
88
+ headers: { 'Content-Type': 'application/json' },
89
+ body: buildRequestBody(request.body),
90
+ });
91
+ return parseResponse(response);
92
+ }
93
+ /**
94
+ * Create a link between a test plan and a generic URL
95
+ *
96
+ * Creates a web link between a test plan and an external URL. Useful for linking to documentation, requirements, or other resources.
97
+ *
98
+ * @param request - Create web link request
99
+ * @param request.testPlanIdOrKey - The test plan ID or key (e.g., 'PROJ-P1')
100
+ * @param request.body - Web link data
101
+ * @param request.body.url - The URL to link to (required)
102
+ * @param request.body.description - Link description (required)
103
+ * @param request.body.type - Link type: 'COVERAGE', 'BLOCKS', or 'RELATED' (optional, defaults to 'COVERAGE')
104
+ * @returns Created link resource with id and self link
105
+ *
106
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/createTestPlanWebLink Official API Documentation}
107
+ */
108
+ async createTestPlanWebLink(request) {
109
+ const response = await this.api.fetch(`/testplans/${request.testPlanIdOrKey}/links/weblinks`, {
110
+ method: 'POST',
111
+ headers: { 'Content-Type': 'application/json' },
112
+ body: buildRequestBody(request.body),
113
+ });
114
+ return parseResponse(response);
115
+ }
116
+ /**
117
+ * Create a link between a test plan and a test cycle
118
+ *
119
+ * Creates a link between a test plan and a test cycle. This associates a test cycle with a test plan.
120
+ *
121
+ * @param request - Create test cycle link request
122
+ * @param request.testPlanIdOrKey - The test plan ID or key (e.g., 'PROJ-P1')
123
+ * @param request.body - Link data
124
+ * @param request.body.testCycleIdOrKey - The test cycle ID or key (required)
125
+ * @returns Created link resource with id and self link
126
+ *
127
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/createTestPlanTestCycleLink Official API Documentation}
128
+ */
129
+ async createTestPlanTestCycleLink(request) {
130
+ const response = await this.api.fetch(`/testplans/${request.testPlanIdOrKey}/links/testcycles`, {
131
+ method: 'POST',
132
+ headers: { 'Content-Type': 'application/json' },
133
+ body: buildRequestBody(request.body),
134
+ });
135
+ return parseResponse(response);
136
+ }
137
+ }
@@ -0,0 +1,119 @@
1
+ /**
2
+ * Zephyr Managed API
3
+ *
4
+ * A comprehensive Managed API wrapper for Zephyr Cloud REST API v2
5
+ * Provides type-safe, hierarchical access to all Zephyr API endpoints
6
+ *
7
+ * Usage:
8
+ * ```typescript
9
+ * import { createZephyrApi } from './zephyr';
10
+ * import ZephyrApiConnection from '../api/zephyr';
11
+ *
12
+ * // Using API Connection (ScriptRunner Connect)
13
+ * const Zephyr = createZephyrApi(ZephyrApiConnection, 'us');
14
+ *
15
+ * // Using OAuth Token
16
+ * const Zephyr = createZephyrApi('oauth-token-string', 'us');
17
+ *
18
+ * // Use the API
19
+ * const testCase = await Zephyr.TestCase.getTestCase({ testCaseKey: 'PROJ-T1' });
20
+ * ```
21
+ */
22
+ import { TestCaseGroup } from './groups/TestCase';
23
+ import { TestCycleGroup } from './groups/TestCycle';
24
+ import { TestExecutionGroup } from './groups/TestExecution';
25
+ import { TestPlanGroup } from './groups/TestPlan';
26
+ import { FolderGroup } from './groups/Folder';
27
+ import { ProjectGroup } from './groups/Project';
28
+ import { StatusGroup } from './groups/Status';
29
+ import { PriorityGroup } from './groups/Priority';
30
+ import { EnvironmentGroup } from './groups/Environment';
31
+ import { LinkGroup } from './groups/Link';
32
+ import { IssueLinkGroup } from './groups/IssueLink';
33
+ import { AutomationGroup } from './groups/Automation';
34
+ import { AllGroup } from './groups/All';
35
+ /**
36
+ * Type for API connection that provides fetch method
37
+ * Use structural type for maximum compatibility
38
+ */
39
+ export interface ZephyrApiConnection {
40
+ fetch: (path: string, options?: {
41
+ method?: string;
42
+ headers?: Record<string, string> | Headers | Array<[string, string]>;
43
+ body?: string | FormData | Blob | ArrayBuffer | URLSearchParams | null;
44
+ }) => Promise<{
45
+ ok: boolean;
46
+ status: number;
47
+ statusText: string;
48
+ json(): Promise<any>;
49
+ headers: {
50
+ get(name: string): string | null;
51
+ };
52
+ }>;
53
+ connectionId?: string;
54
+ }
55
+ /**
56
+ * Main Zephyr API class
57
+ * Provides hierarchical access to all Zephyr API groups
58
+ */
59
+ export declare class ZephyrApi {
60
+ readonly TestCase: TestCaseGroup;
61
+ readonly TestCycle: TestCycleGroup;
62
+ readonly TestExecution: TestExecutionGroup;
63
+ readonly TestPlan: TestPlanGroup;
64
+ readonly Folder: FolderGroup;
65
+ readonly Project: ProjectGroup;
66
+ readonly Status: StatusGroup;
67
+ readonly Priority: PriorityGroup;
68
+ readonly Environment: EnvironmentGroup;
69
+ readonly Link: LinkGroup;
70
+ readonly IssueLink: IssueLinkGroup;
71
+ readonly Automation: AutomationGroup;
72
+ readonly All: AllGroup;
73
+ /**
74
+ * Access to the underlying API connection for advanced use cases
75
+ */
76
+ readonly fetch: ZephyrApiConnection['fetch'];
77
+ readonly connectionId?: string;
78
+ constructor(apiConnection: ZephyrApiConnection);
79
+ }
80
+ /**
81
+ * Create a Zephyr API instance with the provided API connection (Connector-based)
82
+ *
83
+ * @param apiConnection - The API connection from scripts/api/zephyr
84
+ * @param region - API region ('us' or 'eu'), defaults to 'us'
85
+ * @returns A Zephyr API instance with all resource groups
86
+ *
87
+ * @example
88
+ * ```typescript
89
+ * import { createZephyrApi } from './zephyr';
90
+ * import ZephyrApiConnection from '../api/zephyr';
91
+ *
92
+ * const Zephyr = createZephyrApi(ZephyrApiConnection, 'us');
93
+ * const testCase = await Zephyr.TestCase.getTestCase({ testCaseKey: 'PROJ-T1' });
94
+ * ```
95
+ */
96
+ export declare function createZephyrApi(apiConnection: ZephyrApiConnection, region?: 'us' | 'eu'): ZephyrApi;
97
+ /**
98
+ * Create a Zephyr API instance with OAuth token
99
+ *
100
+ * @param oauthToken - The OAuth token string
101
+ * @param region - API region ('us' or 'eu'), defaults to 'us'
102
+ * @param baseUrl - Optional custom base URL (overrides region)
103
+ * @returns A Zephyr API instance with all resource groups
104
+ *
105
+ * @example
106
+ * ```typescript
107
+ * import { createZephyrApi } from './zephyr';
108
+ *
109
+ * // OAuth token authentication
110
+ * const Zephyr = createZephyrApi('oauth-token-string', 'us');
111
+ * const testCase = await Zephyr.TestCase.getTestCase({ testCaseKey: 'PROJ-T1' });
112
+ * ```
113
+ */
114
+ export declare function createZephyrApi(oauthToken: string, region?: 'us' | 'eu', baseUrl?: string): ZephyrApi;
115
+ export * from './types';
116
+ export * from './error-strategy';
117
+ export { getAllPages, getAllPagesCursor } from './utils';
118
+ export { HttpError, BadRequestError, UnauthorizedError, ForbiddenError, NotFoundError, TooManyRequestsError, ServerError, UnexpectedError, } from './utils';
119
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EA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