@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,133 @@
1
+ /**
2
+ * Automation API group
3
+ * Handles automation-related operations
4
+ */
5
+ import { parseResponse } from '../utils';
6
+ export class AutomationGroup {
7
+ constructor(api) {
8
+ this.api = api;
9
+ }
10
+ /**
11
+ * Create results using Zephyr's custom results format
12
+ *
13
+ * Creates test execution results using Zephyr's custom results format. The zip file containing custom execution results.
14
+ * The max file size is 10MB. Optionally, you can send a `testCycle` part in your form data to customize the created test cycle.
15
+ *
16
+ * @param request - Create custom executions request
17
+ * @param request.projectKey - Jira project key (required)
18
+ * @param request.autoCreateTestCases - Indicate if test cases should be created if non-existent (optional, default: false)
19
+ * @param request.body - FormData containing the zip file and optional testCycle JSON
20
+ * @param request.body.file - The zip file containing custom execution results (required, max 10MB)
21
+ * @param request.body.testCycle - Test cycle customization data as JSON (optional)
22
+ * @returns Automation result with created test cycle information
23
+ *
24
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/createCustomExecutions Official API Documentation}
25
+ */
26
+ async createCustomExecutions(request) {
27
+ const params = [];
28
+ if (request.projectKey) {
29
+ params.push(`projectKey=${encodeURIComponent(request.projectKey)}`);
30
+ }
31
+ if (request.autoCreateTestCases !== undefined) {
32
+ params.push(`autoCreateTestCases=${request.autoCreateTestCases}`);
33
+ }
34
+ const queryString = params.length > 0 ? `?${params.join('&')}` : '';
35
+ const response = await this.api.fetch(`/automations/executions/custom${queryString}`, {
36
+ method: 'POST',
37
+ body: request.body,
38
+ });
39
+ return parseResponse(response);
40
+ }
41
+ /**
42
+ * Create results using the Cucumber results format
43
+ *
44
+ * Creates test execution results using the Cucumber results format. The zip file containing Cucumber execution results
45
+ * as one or more files. The max file size is 2MB. Optionally, you can send a `testCycle` part in your form data to customize the created test cycle.
46
+ *
47
+ * @param request - Create Cucumber executions request
48
+ * @param request.projectKey - Jira project key (required)
49
+ * @param request.autoCreateTestCases - Indicate if test cases should be created if non-existent (optional, default: false)
50
+ * @param request.body - FormData containing the zip file and optional testCycle JSON
51
+ * @param request.body.file - The zip file containing Cucumber execution results (required, max 2MB)
52
+ * @param request.body.testCycle - Test cycle customization data as JSON (optional)
53
+ * @returns Automation result with created test cycle information
54
+ *
55
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/createCucumberExecutions Official API Documentation}
56
+ */
57
+ async createCucumberExecutions(request) {
58
+ const params = [];
59
+ if (request.projectKey) {
60
+ params.push(`projectKey=${encodeURIComponent(request.projectKey)}`);
61
+ }
62
+ if (request.autoCreateTestCases !== undefined) {
63
+ params.push(`autoCreateTestCases=${request.autoCreateTestCases}`);
64
+ }
65
+ const queryString = params.length > 0 ? `?${params.join('&')}` : '';
66
+ const response = await this.api.fetch(`/automations/executions/cucumber${queryString}`, {
67
+ method: 'POST',
68
+ body: request.body,
69
+ });
70
+ return parseResponse(response);
71
+ }
72
+ /**
73
+ * Create results using the JUnit XML results format
74
+ *
75
+ * Creates test execution results using the JUnit XML results format. The zip or single file containing JUnit execution results.
76
+ * The max file size is 10MB. Optionally, you can send a `testCycle` part in your form data to customize the created test cycle.
77
+ *
78
+ * @param request - Create JUnit executions request
79
+ * @param request.projectKey - Jira project key (required)
80
+ * @param request.autoCreateTestCases - Indicate if test cases should be created if non-existent (optional, default: false)
81
+ * @param request.body - FormData containing the zip/file and optional testCycle JSON
82
+ * @param request.body.file - The zip or single file containing JUnit execution results (required, max 10MB)
83
+ * @param request.body.testCycle - Test cycle customization data as JSON (optional)
84
+ * @returns Automation result with created test cycle information
85
+ *
86
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/createJUnitExecutions Official API Documentation}
87
+ */
88
+ async createJUnitExecutions(request) {
89
+ const params = [];
90
+ if (request.projectKey) {
91
+ params.push(`projectKey=${encodeURIComponent(request.projectKey)}`);
92
+ }
93
+ if (request.autoCreateTestCases !== undefined) {
94
+ params.push(`autoCreateTestCases=${request.autoCreateTestCases}`);
95
+ }
96
+ const queryString = params.length > 0 ? `?${params.join('&')}` : '';
97
+ const response = await this.api.fetch(`/automations/executions/junit${queryString}`, {
98
+ method: 'POST',
99
+ body: request.body,
100
+ });
101
+ return parseResponse(response);
102
+ }
103
+ /**
104
+ * Retrieve a zip file containing Cucumber Feature Files
105
+ *
106
+ * Retrieves a zip file containing Cucumber Feature Files that matches the query passed as parameter.
107
+ * Returns application/zip content type.
108
+ *
109
+ * @param options - Retrieve BDD test cases options
110
+ * @param options.projectKey - Filter by Jira project key (optional)
111
+ * @returns Blob containing the zip file with Cucumber Feature Files
112
+ *
113
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/retrieveBDDTestCases Official API Documentation}
114
+ */
115
+ async retrieveBDDTestCases(options) {
116
+ const params = [];
117
+ if (options.projectKey) {
118
+ params.push(`projectKey=${encodeURIComponent(options.projectKey)}`);
119
+ }
120
+ const queryString = params.length > 0 ? `?${params.join('&')}` : '';
121
+ const response = await this.api.fetch(`/automations/testcases${queryString}`, {
122
+ headers: { Accept: 'application/zip' },
123
+ });
124
+ if (!response.ok) {
125
+ await parseResponse(response);
126
+ }
127
+ return response.json().then(() => {
128
+ // For binary responses, we need to handle differently
129
+ // This is a placeholder - actual implementation may need to use response.blob() or similar
130
+ throw new Error('Binary response handling not yet implemented');
131
+ });
132
+ }
133
+ }
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Environment API group
3
+ * Handles environment-related operations
4
+ */
5
+ import type { Environment, EnvironmentList, ListEnvironmentsOptions, GetEnvironmentOptions, CreateEnvironmentRequest, UpdateEnvironmentRequest } from '../types';
6
+ import type { ZephyrApiConnection } from '../index';
7
+ export declare class EnvironmentGroup {
8
+ private api;
9
+ constructor(api: ZephyrApiConnection);
10
+ /**
11
+ * List all environments
12
+ *
13
+ * Retrieves a paginated list of all environments. Query parameters can be used to filter by project.
14
+ *
15
+ * @param options - Query parameters for filtering and pagination
16
+ * @param options.projectKey - Filter environments 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 environments with metadata (total, isLast, etc.)
20
+ *
21
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/listEnvironments Official API Documentation}
22
+ */
23
+ listEnvironments(options: ListEnvironmentsOptions): Promise<EnvironmentList>;
24
+ /**
25
+ * Get a specific environment
26
+ *
27
+ * Retrieves detailed information about a specific environment by its ID.
28
+ *
29
+ * @param options - Get environment options
30
+ * @param options.environmentId - The environment ID
31
+ * @returns Environment object with all fields
32
+ *
33
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/getEnvironment Official API Documentation}
34
+ */
35
+ getEnvironment(options: GetEnvironmentOptions): Promise<Environment>;
36
+ /**
37
+ * Create a new environment
38
+ *
39
+ * Creates a new environment in the specified project. Required fields include projectKey and name.
40
+ * Optional fields include description and index.
41
+ *
42
+ * @param request - Create environment request
43
+ * @param request.body - Environment data
44
+ * @param request.body.projectKey - Jira project key (required)
45
+ * @param request.body.name - Environment name (required)
46
+ * @param request.body.description - Environment description (optional)
47
+ * @param request.body.index - Display order index (optional)
48
+ * @returns Created environment object
49
+ *
50
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/createEnvironment Official API Documentation}
51
+ */
52
+ createEnvironment(request: CreateEnvironmentRequest): Promise<Environment>;
53
+ /**
54
+ * Update an environment
55
+ *
56
+ * Updates an existing environment. For each non-specified field the value will be cleared.
57
+ * All fields from the existing environment must be included in the request.
58
+ *
59
+ * @param request - Update environment request
60
+ * @param request.environmentId - The environment ID to update
61
+ * @param request.body - Environment data to update (must include all existing fields)
62
+ * @param request.body.id - Environment ID (required)
63
+ * @param request.body.project - Project link (required)
64
+ * @param request.body.name - Environment name (required)
65
+ * @param request.body.index - Display order index (required)
66
+ * @param request.body.description - Environment description (optional)
67
+ * @returns Updated environment object
68
+ *
69
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/updateEnvironment Official API Documentation}
70
+ */
71
+ updateEnvironment(request: UpdateEnvironmentRequest): Promise<Environment>;
72
+ }
73
+ //# sourceMappingURL=Environment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Environment.d.ts","sourceRoot":"","sources":["../../groups/Environment.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,WAAW,EACX,eAAe,EACf,uBAAuB,EACvB,qBAAqB,EACrB,wBAAwB,EACxB,wBAAwB,EACxB,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEpD,qBAAa,gBAAgB;IAChB,OAAO,CAAC,GAAG;gBAAH,GAAG,EAAE,mBAAmB;IAE5C;;;;;;;;;;;;OAYG;IACG,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,eAAe,CAAC;IAMlF;;;;;;;;;;OAUG;IACG,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,WAAW,CAAC;IAK1E;;;;;;;;;;;;;;;OAeG;IACG,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,WAAW,CAAC;IAShF;;;;;;;;;;;;;;;;;OAiBG;IACG,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,WAAW,CAAC;CAQhF"}
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Environment API group
3
+ * Handles environment-related operations
4
+ */
5
+ import { buildQueryString, parseResponse, buildRequestBody } from '../utils';
6
+ export class EnvironmentGroup {
7
+ constructor(api) {
8
+ this.api = api;
9
+ }
10
+ /**
11
+ * List all environments
12
+ *
13
+ * Retrieves a paginated list of all environments. Query parameters can be used to filter by project.
14
+ *
15
+ * @param options - Query parameters for filtering and pagination
16
+ * @param options.projectKey - Filter environments 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 environments with metadata (total, isLast, etc.)
20
+ *
21
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/listEnvironments Official API Documentation}
22
+ */
23
+ async listEnvironments(options) {
24
+ const queryString = buildQueryString(options);
25
+ const response = await this.api.fetch(`/environments${queryString}`);
26
+ return parseResponse(response);
27
+ }
28
+ /**
29
+ * Get a specific environment
30
+ *
31
+ * Retrieves detailed information about a specific environment by its ID.
32
+ *
33
+ * @param options - Get environment options
34
+ * @param options.environmentId - The environment ID
35
+ * @returns Environment object with all fields
36
+ *
37
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/getEnvironment Official API Documentation}
38
+ */
39
+ async getEnvironment(options) {
40
+ const response = await this.api.fetch(`/environments/${options.environmentId}`);
41
+ return parseResponse(response);
42
+ }
43
+ /**
44
+ * Create a new environment
45
+ *
46
+ * Creates a new environment in the specified project. Required fields include projectKey and name.
47
+ * Optional fields include description and index.
48
+ *
49
+ * @param request - Create environment request
50
+ * @param request.body - Environment data
51
+ * @param request.body.projectKey - Jira project key (required)
52
+ * @param request.body.name - Environment name (required)
53
+ * @param request.body.description - Environment description (optional)
54
+ * @param request.body.index - Display order index (optional)
55
+ * @returns Created environment object
56
+ *
57
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/createEnvironment Official API Documentation}
58
+ */
59
+ async createEnvironment(request) {
60
+ const response = await this.api.fetch('/environments', {
61
+ method: 'POST',
62
+ headers: { 'Content-Type': 'application/json' },
63
+ body: buildRequestBody(request.body),
64
+ });
65
+ return parseResponse(response);
66
+ }
67
+ /**
68
+ * Update an environment
69
+ *
70
+ * Updates an existing environment. For each non-specified field the value will be cleared.
71
+ * All fields from the existing environment must be included in the request.
72
+ *
73
+ * @param request - Update environment request
74
+ * @param request.environmentId - The environment ID to update
75
+ * @param request.body - Environment data to update (must include all existing fields)
76
+ * @param request.body.id - Environment ID (required)
77
+ * @param request.body.project - Project link (required)
78
+ * @param request.body.name - Environment name (required)
79
+ * @param request.body.index - Display order index (required)
80
+ * @param request.body.description - Environment description (optional)
81
+ * @returns Updated environment object
82
+ *
83
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/updateEnvironment Official API Documentation}
84
+ */
85
+ async updateEnvironment(request) {
86
+ const response = await this.api.fetch(`/environments/${request.environmentId}`, {
87
+ method: 'PUT',
88
+ headers: { 'Content-Type': 'application/json' },
89
+ body: buildRequestBody(request.body),
90
+ });
91
+ return parseResponse(response);
92
+ }
93
+ }
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Folder API group
3
+ * Handles folder-related operations
4
+ */
5
+ import type { Folder, FolderList, ListFoldersOptions, GetFolderOptions, CreateFolderRequest } from '../types';
6
+ import type { ZephyrApiConnection } from '../index';
7
+ export declare class FolderGroup {
8
+ private api;
9
+ constructor(api: ZephyrApiConnection);
10
+ /**
11
+ * List all folders
12
+ *
13
+ * Retrieves a paginated list of all folders. Query parameters can be used to filter by project and folder type.
14
+ *
15
+ * @param options - Query parameters for filtering and pagination
16
+ * @param options.projectKey - Filter folders by Jira project key
17
+ * @param options.folderType - Filter by folder type: 'TEST_CASE', 'TEST_PLAN', or 'TEST_CYCLE'
18
+ * @param options.maxResults - Maximum number of results to return (default: 10, max: 1000)
19
+ * @param options.startAt - Zero-indexed starting position (must be multiple of maxResults)
20
+ * @returns Paginated list of folders with metadata (total, isLast, etc.)
21
+ *
22
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/listFolders Official API Documentation}
23
+ */
24
+ listFolders(options: ListFoldersOptions): Promise<FolderList>;
25
+ /**
26
+ * Get a specific folder
27
+ *
28
+ * Retrieves detailed information about a specific folder by its ID.
29
+ *
30
+ * @param options - Get folder options
31
+ * @param options.folderId - The folder ID
32
+ * @returns Folder object with all fields
33
+ *
34
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/getFolder Official API Documentation}
35
+ */
36
+ getFolder(options: GetFolderOptions): Promise<Folder>;
37
+ /**
38
+ * Create a new folder
39
+ *
40
+ * Creates a new folder in the specified project. Required fields include projectKey, name, and folderType.
41
+ * Optional fields include parentId (must be null for root folders).
42
+ *
43
+ * @param request - Create folder request
44
+ * @param request.body - Folder data
45
+ * @param request.body.projectKey - Jira project key (required)
46
+ * @param request.body.name - Folder name (required)
47
+ * @param request.body.folderType - Folder type: 'TEST_CASE', 'TEST_PLAN', or 'TEST_CYCLE' (required)
48
+ * @param request.body.parentId - Parent folder ID (optional, must be null for root folders)
49
+ * @returns Created folder object
50
+ *
51
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/createFolder Official API Documentation}
52
+ */
53
+ createFolder(request: CreateFolderRequest): Promise<Folder>;
54
+ }
55
+ //# sourceMappingURL=Folder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Folder.d.ts","sourceRoot":"","sources":["../../groups/Folder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,MAAM,EACN,UAAU,EACV,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEpD,qBAAa,WAAW;IACX,OAAO,CAAC,GAAG;gBAAH,GAAG,EAAE,mBAAmB;IAE5C;;;;;;;;;;;;;OAaG;IACG,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,UAAU,CAAC;IAMnE;;;;;;;;;;OAUG;IACG,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC;IAK3D;;;;;;;;;;;;;;;OAeG;IACG,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC;CAQjE"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Folder API group
3
+ * Handles folder-related operations
4
+ */
5
+ import { buildQueryString, parseResponse, buildRequestBody } from '../utils';
6
+ export class FolderGroup {
7
+ constructor(api) {
8
+ this.api = api;
9
+ }
10
+ /**
11
+ * List all folders
12
+ *
13
+ * Retrieves a paginated list of all folders. Query parameters can be used to filter by project and folder type.
14
+ *
15
+ * @param options - Query parameters for filtering and pagination
16
+ * @param options.projectKey - Filter folders by Jira project key
17
+ * @param options.folderType - Filter by folder type: 'TEST_CASE', 'TEST_PLAN', or 'TEST_CYCLE'
18
+ * @param options.maxResults - Maximum number of results to return (default: 10, max: 1000)
19
+ * @param options.startAt - Zero-indexed starting position (must be multiple of maxResults)
20
+ * @returns Paginated list of folders with metadata (total, isLast, etc.)
21
+ *
22
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/listFolders Official API Documentation}
23
+ */
24
+ async listFolders(options) {
25
+ const queryString = buildQueryString(options);
26
+ const response = await this.api.fetch(`/folders${queryString}`);
27
+ return parseResponse(response);
28
+ }
29
+ /**
30
+ * Get a specific folder
31
+ *
32
+ * Retrieves detailed information about a specific folder by its ID.
33
+ *
34
+ * @param options - Get folder options
35
+ * @param options.folderId - The folder ID
36
+ * @returns Folder object with all fields
37
+ *
38
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/getFolder Official API Documentation}
39
+ */
40
+ async getFolder(options) {
41
+ const response = await this.api.fetch(`/folders/${options.folderId}`);
42
+ return parseResponse(response);
43
+ }
44
+ /**
45
+ * Create a new folder
46
+ *
47
+ * Creates a new folder in the specified project. Required fields include projectKey, name, and folderType.
48
+ * Optional fields include parentId (must be null for root folders).
49
+ *
50
+ * @param request - Create folder request
51
+ * @param request.body - Folder data
52
+ * @param request.body.projectKey - Jira project key (required)
53
+ * @param request.body.name - Folder name (required)
54
+ * @param request.body.folderType - Folder type: 'TEST_CASE', 'TEST_PLAN', or 'TEST_CYCLE' (required)
55
+ * @param request.body.parentId - Parent folder ID (optional, must be null for root folders)
56
+ * @returns Created folder object
57
+ *
58
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/createFolder Official API Documentation}
59
+ */
60
+ async createFolder(request) {
61
+ const response = await this.api.fetch('/folders', {
62
+ method: 'POST',
63
+ headers: { 'Content-Type': 'application/json' },
64
+ body: buildRequestBody(request.body),
65
+ });
66
+ return parseResponse(response);
67
+ }
68
+ }
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Issue Link API group
3
+ * Handles issue link-related operations (read-only)
4
+ */
5
+ import type { GetIssueLinkTestCasesOptions, GetIssueLinkTestCyclesOptions, GetIssueLinkTestPlansOptions, GetIssueLinkExecutionsOptions, TestCaseKeyAndVersionList, TestCycleIdList, TestPlanIdList, TestExecutionIdList } from '../types';
6
+ import type { ZephyrApiConnection } from '../index';
7
+ export declare class IssueLinkGroup {
8
+ private api;
9
+ constructor(api: ZephyrApiConnection);
10
+ /**
11
+ * Get test case keys and versions linked to the given Jira issue
12
+ *
13
+ * Retrieves all test case keys and versions that are linked to the specified Jira issue.
14
+ *
15
+ * @param options - Get issue link test cases options
16
+ * @param options.issueKey - The key of the Jira issue (e.g., 'PROJ-123')
17
+ * @returns List of test case keys and versions linked to the issue
18
+ *
19
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/getIssueLinkTestCases Official API Documentation}
20
+ */
21
+ getIssueLinkTestCases(options: GetIssueLinkTestCasesOptions): Promise<TestCaseKeyAndVersionList>;
22
+ /**
23
+ * Get test cycle IDs linked to the given Jira issue
24
+ *
25
+ * Retrieves all test cycle IDs that are linked to the specified Jira issue.
26
+ *
27
+ * @param options - Get issue link test cycles options
28
+ * @param options.issueKey - The key of the Jira issue (e.g., 'PROJ-123')
29
+ * @returns List of test cycle IDs linked to the issue
30
+ *
31
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/getIssueLinkTestCycles Official API Documentation}
32
+ */
33
+ getIssueLinkTestCycles(options: GetIssueLinkTestCyclesOptions): Promise<TestCycleIdList>;
34
+ /**
35
+ * Get test plan IDs linked to the given Jira issue
36
+ *
37
+ * Retrieves all test plan IDs that are linked to the specified Jira issue.
38
+ *
39
+ * @param options - Get issue link test plans options
40
+ * @param options.issueKey - The key of the Jira issue (e.g., 'PROJ-123')
41
+ * @returns List of test plan IDs linked to the issue
42
+ *
43
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/getIssueLinkTestPlans Official API Documentation}
44
+ */
45
+ getIssueLinkTestPlans(options: GetIssueLinkTestPlansOptions): Promise<TestPlanIdList>;
46
+ /**
47
+ * Get test execution IDs linked to the given Jira issue
48
+ *
49
+ * Retrieves all test execution IDs that are linked to the specified Jira issue.
50
+ *
51
+ * @param options - Get issue link executions options
52
+ * @param options.issueKey - The key of the Jira issue (e.g., 'PROJ-123')
53
+ * @returns List of test execution IDs linked to the issue
54
+ *
55
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/getIssueLinkTestExecutions Official API Documentation}
56
+ */
57
+ getIssueLinkExecutions(options: GetIssueLinkExecutionsOptions): Promise<TestExecutionIdList>;
58
+ }
59
+ //# sourceMappingURL=IssueLink.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IssueLink.d.ts","sourceRoot":"","sources":["../../groups/IssueLink.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,4BAA4B,EAC5B,6BAA6B,EAC7B,4BAA4B,EAC5B,6BAA6B,EAC7B,yBAAyB,EACzB,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEpD,qBAAa,cAAc;IACd,OAAO,CAAC,GAAG;gBAAH,GAAG,EAAE,mBAAmB;IAE5C;;;;;;;;;;OAUG;IACG,qBAAqB,CAC1B,OAAO,EAAE,4BAA4B,GACnC,OAAO,CAAC,yBAAyB,CAAC;IAKrC;;;;;;;;;;OAUG;IACG,sBAAsB,CAAC,OAAO,EAAE,6BAA6B,GAAG,OAAO,CAAC,eAAe,CAAC;IAK9F;;;;;;;;;;OAUG;IACG,qBAAqB,CAAC,OAAO,EAAE,4BAA4B,GAAG,OAAO,CAAC,cAAc,CAAC;IAK3F;;;;;;;;;;OAUG;IACG,sBAAsB,CAC3B,OAAO,EAAE,6BAA6B,GACpC,OAAO,CAAC,mBAAmB,CAAC;CAI/B"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Issue Link API group
3
+ * Handles issue link-related operations (read-only)
4
+ */
5
+ import { parseResponse } from '../utils';
6
+ export class IssueLinkGroup {
7
+ constructor(api) {
8
+ this.api = api;
9
+ }
10
+ /**
11
+ * Get test case keys and versions linked to the given Jira issue
12
+ *
13
+ * Retrieves all test case keys and versions that are linked to the specified Jira issue.
14
+ *
15
+ * @param options - Get issue link test cases options
16
+ * @param options.issueKey - The key of the Jira issue (e.g., 'PROJ-123')
17
+ * @returns List of test case keys and versions linked to the issue
18
+ *
19
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/getIssueLinkTestCases Official API Documentation}
20
+ */
21
+ async getIssueLinkTestCases(options) {
22
+ const response = await this.api.fetch(`/issuelinks/${options.issueKey}/testcases`);
23
+ return parseResponse(response);
24
+ }
25
+ /**
26
+ * Get test cycle IDs linked to the given Jira issue
27
+ *
28
+ * Retrieves all test cycle IDs that are linked to the specified Jira issue.
29
+ *
30
+ * @param options - Get issue link test cycles options
31
+ * @param options.issueKey - The key of the Jira issue (e.g., 'PROJ-123')
32
+ * @returns List of test cycle IDs linked to the issue
33
+ *
34
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/getIssueLinkTestCycles Official API Documentation}
35
+ */
36
+ async getIssueLinkTestCycles(options) {
37
+ const response = await this.api.fetch(`/issuelinks/${options.issueKey}/testcycles`);
38
+ return parseResponse(response);
39
+ }
40
+ /**
41
+ * Get test plan IDs linked to the given Jira issue
42
+ *
43
+ * Retrieves all test plan IDs that are linked to the specified Jira issue.
44
+ *
45
+ * @param options - Get issue link test plans options
46
+ * @param options.issueKey - The key of the Jira issue (e.g., 'PROJ-123')
47
+ * @returns List of test plan IDs linked to the issue
48
+ *
49
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/getIssueLinkTestPlans Official API Documentation}
50
+ */
51
+ async getIssueLinkTestPlans(options) {
52
+ const response = await this.api.fetch(`/issuelinks/${options.issueKey}/testplans`);
53
+ return parseResponse(response);
54
+ }
55
+ /**
56
+ * Get test execution IDs linked to the given Jira issue
57
+ *
58
+ * Retrieves all test execution IDs that are linked to the specified Jira issue.
59
+ *
60
+ * @param options - Get issue link executions options
61
+ * @param options.issueKey - The key of the Jira issue (e.g., 'PROJ-123')
62
+ * @returns List of test execution IDs linked to the issue
63
+ *
64
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/getIssueLinkTestExecutions Official API Documentation}
65
+ */
66
+ async getIssueLinkExecutions(options) {
67
+ const response = await this.api.fetch(`/issuelinks/${options.issueKey}/executions`);
68
+ return parseResponse(response);
69
+ }
70
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Link API group
3
+ * Handles generic link operations
4
+ */
5
+ import type { DeleteLinkOptions } from '../types';
6
+ import type { ZephyrApiConnection } from '../index';
7
+ export declare class LinkGroup {
8
+ private api;
9
+ constructor(api: ZephyrApiConnection);
10
+ /**
11
+ * Delete a link
12
+ *
13
+ * Deletes a link by its ID. This is an idempotent operation - it returns successfully if the link doesn't exist.
14
+ *
15
+ * @param options - Delete link options
16
+ * @param options.linkId - The link ID to delete
17
+ * @returns Promise that resolves when deletion is complete (or if link doesn't exist)
18
+ *
19
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/deleteLink Official API Documentation}
20
+ */
21
+ deleteLink(options: DeleteLinkOptions): Promise<void>;
22
+ }
23
+ //# sourceMappingURL=Link.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../groups/Link.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAElD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEpD,qBAAa,SAAS;IACT,OAAO,CAAC,GAAG;gBAAH,GAAG,EAAE,mBAAmB;IAE5C;;;;;;;;;;OAUG;IACG,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;CAe3D"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Link API group
3
+ * Handles generic link operations
4
+ */
5
+ import { isUnknownObjectError } from '../utils';
6
+ export class LinkGroup {
7
+ constructor(api) {
8
+ this.api = api;
9
+ }
10
+ /**
11
+ * Delete a link
12
+ *
13
+ * Deletes a link by its ID. This is an idempotent operation - it returns successfully if the link doesn't exist.
14
+ *
15
+ * @param options - Delete link options
16
+ * @param options.linkId - The link ID to delete
17
+ * @returns Promise that resolves when deletion is complete (or if link doesn't exist)
18
+ *
19
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/deleteLink Official API Documentation}
20
+ */
21
+ async deleteLink(options) {
22
+ const response = await this.api.fetch(`/links/${options.linkId}`, {
23
+ method: 'DELETE',
24
+ });
25
+ // Check if link doesn't exist (idempotent delete)
26
+ if (await isUnknownObjectError(response)) {
27
+ return; // Link doesn't exist, consider it deleted
28
+ }
29
+ if (!response.ok) {
30
+ await response.json(); // Parse error response
31
+ throw new Error(`Failed to delete link: ${response.status} ${response.statusText}`);
32
+ }
33
+ }
34
+ }