@rbaileysr/zephyr-managed-api 1.3.0 → 1.3.2

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 (46) hide show
  1. package/README.md +101 -18
  2. package/dist/README.md +101 -18
  3. package/dist/groups/All.d.ts.map +1 -1
  4. package/dist/groups/Automation.d.ts +4 -4
  5. package/dist/groups/Automation.js +4 -4
  6. package/dist/groups/Environment.d.ts +4 -4
  7. package/dist/groups/Environment.js +4 -4
  8. package/dist/groups/Folder.d.ts +3 -3
  9. package/dist/groups/Folder.js +3 -3
  10. package/dist/groups/IssueLink.d.ts +4 -4
  11. package/dist/groups/IssueLink.js +4 -4
  12. package/dist/groups/Link.d.ts +1 -1
  13. package/dist/groups/Link.js +1 -1
  14. package/dist/groups/Priority.d.ts +4 -4
  15. package/dist/groups/Priority.js +4 -4
  16. package/dist/groups/Private/PrivateConfig.d.ts +35 -0
  17. package/dist/groups/Private/PrivateConfig.d.ts.map +1 -0
  18. package/dist/groups/Private/PrivateConfig.js +17 -0
  19. package/dist/groups/Private/PrivateDataSets.d.ts +66 -0
  20. package/dist/groups/Private/PrivateDataSets.d.ts.map +1 -0
  21. package/dist/groups/Private/PrivateDataSets.js +198 -0
  22. package/dist/groups/Private/PrivateIterations.d.ts +46 -0
  23. package/dist/groups/Private/PrivateIterations.d.ts.map +1 -0
  24. package/dist/groups/Private/PrivateIterations.js +134 -0
  25. package/dist/groups/Private/PrivateLabels.d.ts +46 -0
  26. package/dist/groups/Private/PrivateLabels.d.ts.map +1 -0
  27. package/dist/groups/Private/PrivateLabels.js +134 -0
  28. package/dist/groups/Private.d.ts +3 -3
  29. package/dist/groups/Private.d.ts.map +1 -1
  30. package/dist/groups/Private.js +2 -2
  31. package/dist/groups/Project.d.ts +2 -2
  32. package/dist/groups/Project.js +2 -2
  33. package/dist/groups/Status.d.ts +4 -4
  34. package/dist/groups/Status.js +4 -4
  35. package/dist/groups/TestCase.d.ts +14 -14
  36. package/dist/groups/TestCase.js +14 -14
  37. package/dist/groups/TestCycle.d.ts +7 -7
  38. package/dist/groups/TestCycle.js +7 -7
  39. package/dist/groups/TestExecution.d.ts +10 -10
  40. package/dist/groups/TestExecution.js +10 -10
  41. package/dist/groups/TestPlan.d.ts +6 -6
  42. package/dist/groups/TestPlan.js +6 -6
  43. package/dist/package.json +1 -1
  44. package/dist/types.d.ts +127 -0
  45. package/dist/types.d.ts.map +1 -1
  46. package/package.json +1 -1
@@ -21,7 +21,7 @@ export declare class PriorityGroup {
21
21
  * @param options.startAt - Zero-indexed starting position (must be multiple of maxResults)
22
22
  * @returns Paginated list of priorities with metadata (total, isLast, etc.)
23
23
  *
24
- * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/listPriorities Official API Documentation}
24
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/#tag/Priorities/operation/listPriorities Official API Documentation}
25
25
  */
26
26
  listPriorities(options: ListPrioritiesOptions): Promise<PriorityList>;
27
27
  /**
@@ -33,7 +33,7 @@ export declare class PriorityGroup {
33
33
  * @param options.priorityId - The priority ID
34
34
  * @returns Priority object with all fields
35
35
  *
36
- * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/getPriority Official API Documentation}
36
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/#tag/Priorities/operation/getPriority Official API Documentation}
37
37
  */
38
38
  getPriority(options: GetPriorityOptions): Promise<Priority>;
39
39
  /**
@@ -52,7 +52,7 @@ export declare class PriorityGroup {
52
52
  * @param request.body.color - Priority color (optional)
53
53
  * @returns Created priority object
54
54
  *
55
- * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/createPriority Official API Documentation}
55
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/#tag/Priorities/operation/createPriority Official API Documentation}
56
56
  */
57
57
  createPriority(request: CreatePriorityRequest): Promise<Priority>;
58
58
  /**
@@ -73,7 +73,7 @@ export declare class PriorityGroup {
73
73
  * @param request.body.color - Priority color (optional)
74
74
  * @returns Updated priority object
75
75
  *
76
- * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/updatePriority Official API Documentation}
76
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/#tag/Priorities/operation/updatePriority Official API Documentation}
77
77
  */
78
78
  updatePriority(request: UpdatePriorityRequest): Promise<Priority>;
79
79
  }
@@ -17,7 +17,7 @@ export class PriorityGroup {
17
17
  * @param options.startAt - Zero-indexed starting position (must be multiple of maxResults)
18
18
  * @returns Paginated list of priorities with metadata (total, isLast, etc.)
19
19
  *
20
- * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/listPriorities Official API Documentation}
20
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/#tag/Priorities/operation/listPriorities Official API Documentation}
21
21
  */
22
22
  async listPriorities(options) {
23
23
  const queryString = buildQueryString(options);
@@ -33,7 +33,7 @@ export class PriorityGroup {
33
33
  * @param options.priorityId - The priority ID
34
34
  * @returns Priority object with all fields
35
35
  *
36
- * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/getPriority Official API Documentation}
36
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/#tag/Priorities/operation/getPriority Official API Documentation}
37
37
  */
38
38
  async getPriority(options) {
39
39
  const response = await this.api.fetch(`/priorities/${options.priorityId}`);
@@ -55,7 +55,7 @@ export class PriorityGroup {
55
55
  * @param request.body.color - Priority color (optional)
56
56
  * @returns Created priority object
57
57
  *
58
- * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/createPriority Official API Documentation}
58
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/#tag/Priorities/operation/createPriority Official API Documentation}
59
59
  */
60
60
  async createPriority(request) {
61
61
  const response = await this.api.fetch('/priorities', {
@@ -83,7 +83,7 @@ export class PriorityGroup {
83
83
  * @param request.body.color - Priority color (optional)
84
84
  * @returns Updated priority object
85
85
  *
86
- * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/v2/#operation/updatePriority Official API Documentation}
86
+ * @see {@link https://support.smartbear.com/zephyr-scale-cloud/api-docs/#tag/Priorities/operation/updatePriority Official API Documentation}
87
87
  */
88
88
  async updatePriority(request) {
89
89
  const response = await this.api.fetch(`/priorities/${request.priorityId}`, {
@@ -0,0 +1,35 @@
1
+ /*!
2
+ * Copyright Adaptavist 2025 (c) All rights reserved
3
+ */
4
+ /**
5
+ * Private API Config sub-group
6
+ * Handles configuration-related operations: Custom Fields, Labels, Iterations, and DataSets
7
+ *
8
+ * ⚠️ WARNING: These methods use private APIs that are not officially supported.
9
+ */
10
+ import type { ZephyrApiConnection } from '../../index';
11
+ import { PrivateBase } from './PrivateBase';
12
+ import { PrivateCustomFields } from './PrivateCustomFields';
13
+ import { PrivateLabels } from './PrivateLabels';
14
+ import { PrivateIterations } from './PrivateIterations';
15
+ import { PrivateDataSets } from './PrivateDataSets';
16
+ export declare class PrivateConfig extends PrivateBase {
17
+ /**
18
+ * CustomFields sub-group - Create and get custom fields
19
+ */
20
+ readonly CustomFields: PrivateCustomFields;
21
+ /**
22
+ * Labels sub-group - Create and get labels
23
+ */
24
+ readonly Labels: PrivateLabels;
25
+ /**
26
+ * Iterations sub-group - Create and get iterations
27
+ */
28
+ readonly Iterations: PrivateIterations;
29
+ /**
30
+ * DataSets sub-group - Create, get, and update data sets
31
+ */
32
+ readonly DataSets: PrivateDataSets;
33
+ constructor(apiConnection?: ZephyrApiConnection);
34
+ }
35
+ //# sourceMappingURL=PrivateConfig.d.ts.map
@@ -0,0 +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;AAEpD,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;CAO/C"}
@@ -0,0 +1,17 @@
1
+ /*!
2
+ * Copyright Adaptavist 2025 (c) All rights reserved
3
+ */
4
+ import { PrivateBase } from './PrivateBase';
5
+ import { PrivateCustomFields } from './PrivateCustomFields';
6
+ import { PrivateLabels } from './PrivateLabels';
7
+ import { PrivateIterations } from './PrivateIterations';
8
+ import { PrivateDataSets } from './PrivateDataSets';
9
+ export class PrivateConfig extends PrivateBase {
10
+ constructor(apiConnection) {
11
+ super(apiConnection);
12
+ this.CustomFields = new PrivateCustomFields(apiConnection);
13
+ this.Labels = new PrivateLabels(apiConnection);
14
+ this.Iterations = new PrivateIterations(apiConnection);
15
+ this.DataSets = new PrivateDataSets(apiConnection);
16
+ }
17
+ }
@@ -0,0 +1,66 @@
1
+ /*!
2
+ * Copyright Adaptavist 2025 (c) All rights reserved
3
+ */
4
+ /**
5
+ * Private API DataSets sub-group
6
+ * Handles data set creation, retrieval, and updating
7
+ *
8
+ * ⚠️ WARNING: These methods use private APIs that are not officially supported.
9
+ */
10
+ import type { PrivateApiCredentials, CreateDataSetRequest, CreateDataSetResponse, UpdateDataSetRequest, UpdateDataSetResponse, GetDataSetsRequest, PrivateDataSet } from '../../types';
11
+ import { PrivateBase } from './PrivateBase';
12
+ import type { ZephyrApiConnection } from '../../index';
13
+ export declare class PrivateDataSets extends PrivateBase {
14
+ constructor(apiConnection?: ZephyrApiConnection);
15
+ /**
16
+ * Get all data sets for a project using private API
17
+ *
18
+ * ⚠️ WARNING: This uses a private Zephyr API endpoint that is not officially supported.
19
+ * The endpoint may change or be removed at any time without notice.
20
+ *
21
+ * @param credentials - Private API credentials
22
+ * @param request - Get data sets request
23
+ * @returns Array of data sets
24
+ * @throws {BadRequestError} If the request is invalid
25
+ * @throws {UnauthorizedError} If authentication fails
26
+ * @throws {ForbiddenError} If the user doesn't have permission
27
+ * @throws {ServerError} If the server returns an error
28
+ */
29
+ getDataSets(credentials: PrivateApiCredentials, request: GetDataSetsRequest): Promise<PrivateDataSet[]>;
30
+ /**
31
+ * Create a data set using private API
32
+ *
33
+ * Note: Data sets are created empty. Use updateDataSet to add items/options.
34
+ *
35
+ * ⚠️ WARNING: This uses a private Zephyr API endpoint that is not officially supported.
36
+ * The endpoint may change or be removed at any time without notice.
37
+ *
38
+ * @param credentials - Private API credentials
39
+ * @param request - Create data set request
40
+ * @returns Created data set response
41
+ * @throws {BadRequestError} If the request is invalid
42
+ * @throws {UnauthorizedError} If authentication fails
43
+ * @throws {ForbiddenError} If the user doesn't have permission
44
+ * @throws {ServerError} If the server returns an error
45
+ */
46
+ createDataSet(credentials: PrivateApiCredentials, request: CreateDataSetRequest): Promise<CreateDataSetResponse>;
47
+ /**
48
+ * Update a data set using private API
49
+ *
50
+ * Use this method to add items/options to an existing data set.
51
+ * The request should include all existing items plus any new items to add.
52
+ *
53
+ * ⚠️ WARNING: This uses a private Zephyr API endpoint that is not officially supported.
54
+ * The endpoint may change or be removed at any time without notice.
55
+ *
56
+ * @param credentials - Private API credentials
57
+ * @param request - Update data set request (must include id field)
58
+ * @returns Updated data set response
59
+ * @throws {BadRequestError} If the request is invalid
60
+ * @throws {UnauthorizedError} If authentication fails
61
+ * @throws {ForbiddenError} If the user doesn't have permission
62
+ * @throws {ServerError} If the server returns an error
63
+ */
64
+ updateDataSet(credentials: PrivateApiCredentials, request: UpdateDataSetRequest): Promise<UpdateDataSetResponse>;
65
+ }
66
+ //# sourceMappingURL=PrivateDataSets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrivateDataSets.d.ts","sourceRoot":"","sources":["../../../groups/Private/PrivateDataSets.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;GAKG;AAEH,OAAO,KAAK,EACX,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,EACd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAS5C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,qBAAa,eAAgB,SAAQ,WAAW;gBACnC,aAAa,CAAC,EAAE,mBAAmB;IAI/C;;;;;;;;;;;;;OAaG;IACG,WAAW,CAAC,WAAW,EAAE,qBAAqB,EAAE,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAsD7G;;;;;;;;;;;;;;;OAeG;IACG,aAAa,CAClB,WAAW,EAAE,qBAAqB,EAClC,OAAO,EAAE,oBAAoB,GAC3B,OAAO,CAAC,qBAAqB,CAAC;IA+DjC;;;;;;;;;;;;;;;;OAgBG;IACG,aAAa,CAClB,WAAW,EAAE,qBAAqB,EAClC,OAAO,EAAE,oBAAoB,GAC3B,OAAO,CAAC,qBAAqB,CAAC;CAsDjC"}
@@ -0,0 +1,198 @@
1
+ /*!
2
+ * Copyright Adaptavist 2025 (c) All rights reserved
3
+ */
4
+ import { PrivateBase } from './PrivateBase';
5
+ import { BadRequestError, UnauthorizedError, ForbiddenError, NotFoundError, ServerError, UnexpectedError, } from '../../utils';
6
+ export class PrivateDataSets extends PrivateBase {
7
+ constructor(apiConnection) {
8
+ super(apiConnection);
9
+ }
10
+ /**
11
+ * Get all data sets for a project using private API
12
+ *
13
+ * ⚠️ WARNING: This uses a private Zephyr API endpoint that is not officially supported.
14
+ * The endpoint may change or be removed at any time without notice.
15
+ *
16
+ * @param credentials - Private API credentials
17
+ * @param request - Get data sets request
18
+ * @returns Array of data sets
19
+ * @throws {BadRequestError} If the request is invalid
20
+ * @throws {UnauthorizedError} If authentication fails
21
+ * @throws {ForbiddenError} If the user doesn't have permission
22
+ * @throws {ServerError} If the server returns an error
23
+ */
24
+ async getDataSets(credentials, request) {
25
+ // Get Context JWT
26
+ const contextJwt = await this.getContextJwt(credentials);
27
+ const url = `${this.privateApiBaseUrl}/dataset?projectId=${request.projectId}`;
28
+ const headers = {
29
+ accept: 'application/json',
30
+ authorization: `JWT ${contextJwt}`,
31
+ 'jira-project-id': String(request.projectId),
32
+ };
33
+ try {
34
+ const response = await fetch(url, {
35
+ method: 'GET',
36
+ headers,
37
+ });
38
+ if (!response.ok) {
39
+ if (response.status === 400) {
40
+ const errorText = await response.text().catch(() => 'Bad Request');
41
+ throw new BadRequestError(`Failed to get data sets: ${errorText}`, response.statusText);
42
+ }
43
+ if (response.status === 401) {
44
+ throw new UnauthorizedError('Authentication failed. Please check your credentials.');
45
+ }
46
+ if (response.status === 403) {
47
+ throw new ForbiddenError('You do not have permission to get data sets in this project.');
48
+ }
49
+ if (response.status === 404) {
50
+ throw new NotFoundError('Project not found.');
51
+ }
52
+ throw new ServerError(`Failed to get data sets. Status: ${response.status}`, response.status, response.statusText);
53
+ }
54
+ const dataSets = await response.json();
55
+ return dataSets;
56
+ }
57
+ catch (error) {
58
+ if (error instanceof BadRequestError ||
59
+ error instanceof UnauthorizedError ||
60
+ error instanceof ForbiddenError ||
61
+ error instanceof NotFoundError ||
62
+ error instanceof ServerError) {
63
+ throw error;
64
+ }
65
+ throw new UnexpectedError('Failed to get data sets due to an unexpected error', error);
66
+ }
67
+ }
68
+ /**
69
+ * Create a data set using private API
70
+ *
71
+ * Note: Data sets are created empty. Use updateDataSet to add items/options.
72
+ *
73
+ * ⚠️ WARNING: This uses a private Zephyr API endpoint that is not officially supported.
74
+ * The endpoint may change or be removed at any time without notice.
75
+ *
76
+ * @param credentials - Private API credentials
77
+ * @param request - Create data set request
78
+ * @returns Created data set response
79
+ * @throws {BadRequestError} If the request is invalid
80
+ * @throws {UnauthorizedError} If authentication fails
81
+ * @throws {ForbiddenError} If the user doesn't have permission
82
+ * @throws {ServerError} If the server returns an error
83
+ */
84
+ async createDataSet(credentials, request) {
85
+ // Get Context JWT
86
+ const contextJwt = await this.getContextJwt(credentials);
87
+ const url = `${this.privateApiBaseUrl}/dataset`;
88
+ const headers = {
89
+ 'Content-Type': 'application/json',
90
+ authorization: `JWT ${contextJwt}`,
91
+ 'jira-project-id': String(request.projectId),
92
+ };
93
+ try {
94
+ // Hardcode color, index, and items as they're not used by the API
95
+ const requestBody = {
96
+ ...request,
97
+ color: '#FFFFFF',
98
+ index: 0,
99
+ items: [],
100
+ };
101
+ const response = await fetch(url, {
102
+ method: 'POST',
103
+ headers,
104
+ body: JSON.stringify(requestBody),
105
+ });
106
+ if (!response.ok) {
107
+ if (response.status === 400) {
108
+ const errorText = await response.text().catch(() => 'Bad Request');
109
+ throw new BadRequestError(`Failed to create data set: ${errorText}`, response.statusText);
110
+ }
111
+ if (response.status === 401) {
112
+ throw new UnauthorizedError('Authentication failed. Please check your credentials.');
113
+ }
114
+ if (response.status === 403) {
115
+ throw new ForbiddenError('You do not have permission to create data sets in this project.');
116
+ }
117
+ if (response.status === 404) {
118
+ throw new NotFoundError('Project not found.');
119
+ }
120
+ throw new ServerError(`Failed to create data set. Status: ${response.status}`, response.status, response.statusText);
121
+ }
122
+ const result = await response.json();
123
+ return result;
124
+ }
125
+ catch (error) {
126
+ if (error instanceof BadRequestError ||
127
+ error instanceof UnauthorizedError ||
128
+ error instanceof ForbiddenError ||
129
+ error instanceof NotFoundError ||
130
+ error instanceof ServerError) {
131
+ throw error;
132
+ }
133
+ throw new UnexpectedError('Failed to create data set due to an unexpected error', error);
134
+ }
135
+ }
136
+ /**
137
+ * Update a data set using private API
138
+ *
139
+ * Use this method to add items/options to an existing data set.
140
+ * The request should include all existing items plus any new items to add.
141
+ *
142
+ * ⚠️ WARNING: This uses a private Zephyr API endpoint that is not officially supported.
143
+ * The endpoint may change or be removed at any time without notice.
144
+ *
145
+ * @param credentials - Private API credentials
146
+ * @param request - Update data set request (must include id field)
147
+ * @returns Updated data set response
148
+ * @throws {BadRequestError} If the request is invalid
149
+ * @throws {UnauthorizedError} If authentication fails
150
+ * @throws {ForbiddenError} If the user doesn't have permission
151
+ * @throws {ServerError} If the server returns an error
152
+ */
153
+ async updateDataSet(credentials, request) {
154
+ // Get Context JWT
155
+ const contextJwt = await this.getContextJwt(credentials);
156
+ const url = `${this.privateApiBaseUrl}/dataset/${request.id}`;
157
+ const headers = {
158
+ 'Content-Type': 'application/json',
159
+ authorization: `JWT ${contextJwt}`,
160
+ 'jira-project-id': String(request.projectId),
161
+ };
162
+ try {
163
+ const response = await fetch(url, {
164
+ method: 'PUT',
165
+ headers,
166
+ body: JSON.stringify(request),
167
+ });
168
+ if (!response.ok) {
169
+ if (response.status === 400) {
170
+ const errorText = await response.text().catch(() => 'Bad Request');
171
+ throw new BadRequestError(`Failed to update data set: ${errorText}`, response.statusText);
172
+ }
173
+ if (response.status === 401) {
174
+ throw new UnauthorizedError('Authentication failed. Please check your credentials.');
175
+ }
176
+ if (response.status === 403) {
177
+ throw new ForbiddenError('You do not have permission to update data sets in this project.');
178
+ }
179
+ if (response.status === 404) {
180
+ throw new NotFoundError('Data set not found.');
181
+ }
182
+ throw new ServerError(`Failed to update data set. Status: ${response.status}`, response.status, response.statusText);
183
+ }
184
+ const result = await response.json();
185
+ return result;
186
+ }
187
+ catch (error) {
188
+ if (error instanceof BadRequestError ||
189
+ error instanceof UnauthorizedError ||
190
+ error instanceof ForbiddenError ||
191
+ error instanceof NotFoundError ||
192
+ error instanceof ServerError) {
193
+ throw error;
194
+ }
195
+ throw new UnexpectedError('Failed to update data set due to an unexpected error', error);
196
+ }
197
+ }
198
+ }
@@ -0,0 +1,46 @@
1
+ /*!
2
+ * Copyright Adaptavist 2025 (c) All rights reserved
3
+ */
4
+ /**
5
+ * Private API Iterations sub-group
6
+ * Handles iteration creation and retrieval
7
+ *
8
+ * ⚠️ WARNING: These methods use private APIs that are not officially supported.
9
+ */
10
+ import type { PrivateApiCredentials, CreateIterationRequest, CreateIterationResponse, GetIterationsRequest, PrivateIteration } from '../../types';
11
+ import { PrivateBase } from './PrivateBase';
12
+ import type { ZephyrApiConnection } from '../../index';
13
+ export declare class PrivateIterations extends PrivateBase {
14
+ constructor(apiConnection?: ZephyrApiConnection);
15
+ /**
16
+ * Get all iterations for a project using private API
17
+ *
18
+ * ⚠️ WARNING: This uses a private Zephyr API endpoint that is not officially supported.
19
+ * The endpoint may change or be removed at any time without notice.
20
+ *
21
+ * @param credentials - Private API credentials
22
+ * @param request - Get iterations request
23
+ * @returns Array of iterations
24
+ * @throws {BadRequestError} If the request is invalid
25
+ * @throws {UnauthorizedError} If authentication fails
26
+ * @throws {ForbiddenError} If the user doesn't have permission
27
+ * @throws {ServerError} If the server returns an error
28
+ */
29
+ getIterations(credentials: PrivateApiCredentials, request: GetIterationsRequest): Promise<PrivateIteration[]>;
30
+ /**
31
+ * Create an iteration using private API
32
+ *
33
+ * ⚠️ WARNING: This uses a private Zephyr API endpoint that is not officially supported.
34
+ * The endpoint may change or be removed at any time without notice.
35
+ *
36
+ * @param credentials - Private API credentials
37
+ * @param request - Create iteration request
38
+ * @returns Created iteration response with ID
39
+ * @throws {BadRequestError} If the request is invalid
40
+ * @throws {UnauthorizedError} If authentication fails
41
+ * @throws {ForbiddenError} If the user doesn't have permission
42
+ * @throws {ServerError} If the server returns an error
43
+ */
44
+ createIteration(credentials: PrivateApiCredentials, request: CreateIterationRequest): Promise<CreateIterationResponse>;
45
+ }
46
+ //# sourceMappingURL=PrivateIterations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrivateIterations.d.ts","sourceRoot":"","sources":["../../../groups/Private/PrivateIterations.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;GAKG;AAEH,OAAO,KAAK,EACX,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,oBAAoB,EACpB,gBAAgB,EAChB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAS5C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,qBAAa,iBAAkB,SAAQ,WAAW;gBACrC,aAAa,CAAC,EAAE,mBAAmB;IAI/C;;;;;;;;;;;;;OAaG;IACG,aAAa,CAAC,WAAW,EAAE,qBAAqB,EAAE,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAsDnH;;;;;;;;;;;;;OAaG;IACG,eAAe,CACpB,WAAW,EAAE,qBAAqB,EAClC,OAAO,EAAE,sBAAsB,GAC7B,OAAO,CAAC,uBAAuB,CAAC;CA8DnC"}
@@ -0,0 +1,134 @@
1
+ /*!
2
+ * Copyright Adaptavist 2025 (c) All rights reserved
3
+ */
4
+ import { PrivateBase } from './PrivateBase';
5
+ import { BadRequestError, UnauthorizedError, ForbiddenError, NotFoundError, ServerError, UnexpectedError, } from '../../utils';
6
+ export class PrivateIterations extends PrivateBase {
7
+ constructor(apiConnection) {
8
+ super(apiConnection);
9
+ }
10
+ /**
11
+ * Get all iterations for a project using private API
12
+ *
13
+ * ⚠️ WARNING: This uses a private Zephyr API endpoint that is not officially supported.
14
+ * The endpoint may change or be removed at any time without notice.
15
+ *
16
+ * @param credentials - Private API credentials
17
+ * @param request - Get iterations request
18
+ * @returns Array of iterations
19
+ * @throws {BadRequestError} If the request is invalid
20
+ * @throws {UnauthorizedError} If authentication fails
21
+ * @throws {ForbiddenError} If the user doesn't have permission
22
+ * @throws {ServerError} If the server returns an error
23
+ */
24
+ async getIterations(credentials, request) {
25
+ // Get Context JWT
26
+ const contextJwt = await this.getContextJwt(credentials);
27
+ const url = `${this.privateApiBaseUrl}/iteration?projectId=${request.projectId}`;
28
+ const headers = {
29
+ accept: 'application/json',
30
+ authorization: `JWT ${contextJwt}`,
31
+ 'jira-project-id': String(request.projectId),
32
+ };
33
+ try {
34
+ const response = await fetch(url, {
35
+ method: 'GET',
36
+ headers,
37
+ });
38
+ if (!response.ok) {
39
+ if (response.status === 400) {
40
+ const errorText = await response.text().catch(() => 'Bad Request');
41
+ throw new BadRequestError(`Failed to get iterations: ${errorText}`, response.statusText);
42
+ }
43
+ if (response.status === 401) {
44
+ throw new UnauthorizedError('Authentication failed. Please check your credentials.');
45
+ }
46
+ if (response.status === 403) {
47
+ throw new ForbiddenError('You do not have permission to get iterations in this project.');
48
+ }
49
+ if (response.status === 404) {
50
+ throw new NotFoundError('Project not found.');
51
+ }
52
+ throw new ServerError(`Failed to get iterations. Status: ${response.status}`, response.status, response.statusText);
53
+ }
54
+ const iterations = await response.json();
55
+ return iterations;
56
+ }
57
+ catch (error) {
58
+ if (error instanceof BadRequestError ||
59
+ error instanceof UnauthorizedError ||
60
+ error instanceof ForbiddenError ||
61
+ error instanceof NotFoundError ||
62
+ error instanceof ServerError) {
63
+ throw error;
64
+ }
65
+ throw new UnexpectedError('Failed to get iterations due to an unexpected error', error);
66
+ }
67
+ }
68
+ /**
69
+ * Create an iteration using private API
70
+ *
71
+ * ⚠️ WARNING: This uses a private Zephyr API endpoint that is not officially supported.
72
+ * The endpoint may change or be removed at any time without notice.
73
+ *
74
+ * @param credentials - Private API credentials
75
+ * @param request - Create iteration request
76
+ * @returns Created iteration response with ID
77
+ * @throws {BadRequestError} If the request is invalid
78
+ * @throws {UnauthorizedError} If authentication fails
79
+ * @throws {ForbiddenError} If the user doesn't have permission
80
+ * @throws {ServerError} If the server returns an error
81
+ */
82
+ async createIteration(credentials, request) {
83
+ // Get Context JWT
84
+ const contextJwt = await this.getContextJwt(credentials);
85
+ const url = `${this.privateApiBaseUrl}/iteration`;
86
+ const headers = {
87
+ 'Content-Type': 'application/json',
88
+ authorization: `JWT ${contextJwt}`,
89
+ 'jira-project-id': String(request.projectId),
90
+ };
91
+ try {
92
+ // Hardcode color, index, and items as they're not used by the API
93
+ const requestBody = {
94
+ ...request,
95
+ color: '#FFFFFF',
96
+ index: 0,
97
+ items: [],
98
+ };
99
+ const response = await fetch(url, {
100
+ method: 'POST',
101
+ headers,
102
+ body: JSON.stringify(requestBody),
103
+ });
104
+ if (!response.ok) {
105
+ if (response.status === 400) {
106
+ const errorText = await response.text().catch(() => 'Bad Request');
107
+ throw new BadRequestError(`Failed to create iteration: ${errorText}`, response.statusText);
108
+ }
109
+ if (response.status === 401) {
110
+ throw new UnauthorizedError('Authentication failed. Please check your credentials.');
111
+ }
112
+ if (response.status === 403) {
113
+ throw new ForbiddenError('You do not have permission to create iterations in this project.');
114
+ }
115
+ if (response.status === 404) {
116
+ throw new NotFoundError('Project not found.');
117
+ }
118
+ throw new ServerError(`Failed to create iteration. Status: ${response.status}`, response.status, response.statusText);
119
+ }
120
+ const result = await response.json();
121
+ return result;
122
+ }
123
+ catch (error) {
124
+ if (error instanceof BadRequestError ||
125
+ error instanceof UnauthorizedError ||
126
+ error instanceof ForbiddenError ||
127
+ error instanceof NotFoundError ||
128
+ error instanceof ServerError) {
129
+ throw error;
130
+ }
131
+ throw new UnexpectedError('Failed to create iteration due to an unexpected error', error);
132
+ }
133
+ }
134
+ }
@@ -0,0 +1,46 @@
1
+ /*!
2
+ * Copyright Adaptavist 2025 (c) All rights reserved
3
+ */
4
+ /**
5
+ * Private API Labels sub-group
6
+ * Handles label creation and retrieval
7
+ *
8
+ * ⚠️ WARNING: These methods use private APIs that are not officially supported.
9
+ */
10
+ import type { PrivateApiCredentials, CreateLabelRequest, GetLabelsRequest, PrivateLabel } from '../../types';
11
+ import { PrivateBase } from './PrivateBase';
12
+ import type { ZephyrApiConnection } from '../../index';
13
+ export declare class PrivateLabels extends PrivateBase {
14
+ constructor(apiConnection?: ZephyrApiConnection);
15
+ /**
16
+ * Get all labels for a project using private API
17
+ *
18
+ * ⚠️ WARNING: This uses a private Zephyr API endpoint that is not officially supported.
19
+ * The endpoint may change or be removed at any time without notice.
20
+ *
21
+ * @param credentials - Private API credentials
22
+ * @param request - Get labels request
23
+ * @returns Array of labels
24
+ * @throws {BadRequestError} If the request is invalid
25
+ * @throws {UnauthorizedError} If authentication fails
26
+ * @throws {ForbiddenError} If the user doesn't have permission
27
+ * @throws {ServerError} If the server returns an error
28
+ */
29
+ getLabels(credentials: PrivateApiCredentials, request: GetLabelsRequest): Promise<PrivateLabel[]>;
30
+ /**
31
+ * Create a label using private API
32
+ *
33
+ * ⚠️ WARNING: This uses a private Zephyr API endpoint that is not officially supported.
34
+ * The endpoint may change or be removed at any time without notice.
35
+ *
36
+ * @param credentials - Private API credentials
37
+ * @param request - Create label request
38
+ * @returns Empty response (no content)
39
+ * @throws {BadRequestError} If the request is invalid
40
+ * @throws {UnauthorizedError} If authentication fails
41
+ * @throws {ForbiddenError} If the user doesn't have permission
42
+ * @throws {ServerError} If the server returns an error
43
+ */
44
+ createLabel(credentials: PrivateApiCredentials, request: CreateLabelRequest): Promise<void>;
45
+ }
46
+ //# sourceMappingURL=PrivateLabels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrivateLabels.d.ts","sourceRoot":"","sources":["../../../groups/Private/PrivateLabels.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;GAKG;AAEH,OAAO,KAAK,EACX,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAS5C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,qBAAa,aAAc,SAAQ,WAAW;gBACjC,aAAa,CAAC,EAAE,mBAAmB;IAI/C;;;;;;;;;;;;;OAaG;IACG,SAAS,CAAC,WAAW,EAAE,qBAAqB,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAsDvG;;;;;;;;;;;;;OAaG;IACG,WAAW,CAAC,WAAW,EAAE,qBAAqB,EAAE,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;CA8DjG"}