testit-js-commons 5.0.5 → 5.0.7

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 (40) hide show
  1. package/lib/adapters-api/dist/api/CustomAttributesApi.js +201 -0
  2. package/lib/adapters-api/dist/index.js +77 -0
  3. package/lib/adapters-api/dist/model/AutoTestApiResult.js +15 -0
  4. package/lib/adapters-api/dist/model/AutoTestCreateApiModel.js +15 -0
  5. package/lib/adapters-api/dist/model/AutoTestUpdateApiModel.js +30 -4
  6. package/lib/adapters-api/dist/model/CustomAttributeApiResult.js +54 -4
  7. package/lib/adapters-api/dist/model/CustomAttributeOptionPostApiModel.js +98 -0
  8. package/lib/adapters-api/dist/model/CustomAttributeOptionUpdateApiModel.js +124 -0
  9. package/lib/adapters-api/dist/model/CustomAttributeSearchApiModel.js +137 -0
  10. package/lib/adapters-api/dist/model/CustomAttributeSearchApiResult.js +281 -0
  11. package/lib/adapters-api/dist/model/GlobalCustomAttributePostApiModel.js +141 -0
  12. package/lib/adapters-api/dist/model/GlobalCustomAttributeUpdateApiModel.js +129 -0
  13. package/lib/adapters-api/dist/model/LayerApiModel.js +102 -0
  14. package/lib/adapters-api/dist/model/LayerApiResult.js +102 -0
  15. package/lib/adapters-api/dist/model/LayerSource.js +61 -0
  16. package/lib/adapters-api/dist/model/ProjectShortestApiResult.js +138 -0
  17. package/lib/adapters-api/dist/model/ProjectsFilterModel.js +13 -13
  18. package/lib/adapters-api/dist/model/TestResultShortResponse.js +15 -4
  19. package/lib/adapters-api/dist/model/TestResultsFilterApiModel.js +14 -0
  20. package/lib/adapters-api/dist/model/TestRunApiResult.js +45 -4
  21. package/lib/adapters-api/index.d.ts +718 -8
  22. package/lib/common/index.d.ts +1 -0
  23. package/lib/common/index.js +1 -0
  24. package/lib/common/test-layers.d.ts +11 -0
  25. package/lib/common/test-layers.js +13 -0
  26. package/lib/common/types/common.type.d.ts +6 -0
  27. package/lib/services/attachments/attachments.service.d.ts +1 -0
  28. package/lib/services/attachments/attachments.service.js +10 -2
  29. package/lib/services/autotests/autotests.converter.d.ts +6 -2
  30. package/lib/services/autotests/autotests.converter.js +41 -16
  31. package/lib/services/autotests/autotests.converter.test.d.ts +1 -0
  32. package/lib/services/autotests/autotests.converter.test.js +39 -0
  33. package/lib/services/autotests/autotests.service.js +3 -3
  34. package/lib/services/autotests/autotests.type.d.ts +2 -0
  35. package/lib/services/testresults/testresults.converter.d.ts +5 -4
  36. package/lib/services/testresults/testresults.converter.js +8 -0
  37. package/lib/services/testresults/testresults.service.js +18 -1
  38. package/lib/strategy/base.strategy.js +1 -0
  39. package/lib/strategy/zero.strategy.js +1 -1
  40. package/package.json +1 -1
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _ApiClient = _interopRequireDefault(require("../ApiClient"));
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
+ /**
10
+ * API
11
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
12
+ *
13
+ * The version of the OpenAPI document: adapters
14
+ *
15
+ *
16
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
17
+ * https://openapi-generator.tech
18
+ * Do not edit the class manually.
19
+ *
20
+ */
21
+
22
+ /**
23
+ * The CustomAttributeOptionPostApiModel model module.
24
+ * @module model/CustomAttributeOptionPostApiModel
25
+ * @version 1.0.0
26
+ */
27
+ class CustomAttributeOptionPostApiModel {
28
+ /**
29
+ * Constructs a new <code>CustomAttributeOptionPostApiModel</code>.
30
+ * @alias module:model/CustomAttributeOptionPostApiModel
31
+ * @param isDefault {Boolean} Indicates if the attribute option is used by default
32
+ */
33
+ constructor(isDefault) {
34
+ CustomAttributeOptionPostApiModel.initialize(this, isDefault);
35
+ }
36
+
37
+ /**
38
+ * Initializes the fields of this object.
39
+ * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
40
+ * Only for internal use.
41
+ */
42
+ static initialize(obj, isDefault) {
43
+ obj['isDefault'] = isDefault;
44
+ }
45
+
46
+ /**
47
+ * Constructs a <code>CustomAttributeOptionPostApiModel</code> from a plain JavaScript object, optionally creating a new instance.
48
+ * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
49
+ * @param {Object} data The plain JavaScript object bearing properties of interest.
50
+ * @param {module:model/CustomAttributeOptionPostApiModel} obj Optional instance to populate.
51
+ * @return {module:model/CustomAttributeOptionPostApiModel} The populated <code>CustomAttributeOptionPostApiModel</code> instance.
52
+ */
53
+ static constructFromObject(data, obj) {
54
+ if (data) {
55
+ obj = obj || new CustomAttributeOptionPostApiModel();
56
+ if (data.hasOwnProperty('value')) {
57
+ obj['value'] = _ApiClient.default.convertToType(data['value'], 'String');
58
+ }
59
+ if (data.hasOwnProperty('isDefault')) {
60
+ obj['isDefault'] = _ApiClient.default.convertToType(data['isDefault'], 'Boolean');
61
+ }
62
+ }
63
+ return obj;
64
+ }
65
+
66
+ /**
67
+ * Validates the JSON data with respect to <code>CustomAttributeOptionPostApiModel</code>.
68
+ * @param {Object} data The plain JavaScript object bearing properties of interest.
69
+ * @return {boolean} to indicate whether the JSON data is valid with respect to <code>CustomAttributeOptionPostApiModel</code>.
70
+ */
71
+ static validateJSON(data) {
72
+ // check to make sure all required properties are present in the JSON string
73
+ for (const property of CustomAttributeOptionPostApiModel.RequiredProperties) {
74
+ if (!data.hasOwnProperty(property)) {
75
+ throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
76
+ }
77
+ }
78
+ // ensure the json data is a string
79
+ if (data['value'] && !(typeof data['value'] === 'string' || data['value'] instanceof String)) {
80
+ throw new Error("Expected the field `value` to be a primitive type in the JSON string but got " + data['value']);
81
+ }
82
+ return true;
83
+ }
84
+ }
85
+ CustomAttributeOptionPostApiModel.RequiredProperties = ["isDefault"];
86
+
87
+ /**
88
+ * Value of the attribute option
89
+ * @member {String} value
90
+ */
91
+ CustomAttributeOptionPostApiModel.prototype['value'] = undefined;
92
+
93
+ /**
94
+ * Indicates if the attribute option is used by default
95
+ * @member {Boolean} isDefault
96
+ */
97
+ CustomAttributeOptionPostApiModel.prototype['isDefault'] = undefined;
98
+ var _default = exports.default = CustomAttributeOptionPostApiModel;
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _ApiClient = _interopRequireDefault(require("../ApiClient"));
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
+ /**
10
+ * API
11
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
12
+ *
13
+ * The version of the OpenAPI document: adapters
14
+ *
15
+ *
16
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
17
+ * https://openapi-generator.tech
18
+ * Do not edit the class manually.
19
+ *
20
+ */
21
+
22
+ /**
23
+ * The CustomAttributeOptionUpdateApiModel model module.
24
+ * @module model/CustomAttributeOptionUpdateApiModel
25
+ * @version 1.0.0
26
+ */
27
+ class CustomAttributeOptionUpdateApiModel {
28
+ /**
29
+ * Constructs a new <code>CustomAttributeOptionUpdateApiModel</code>.
30
+ * @alias module:model/CustomAttributeOptionUpdateApiModel
31
+ * @param id {String} Unique ID of the attribute option
32
+ * @param isDefault {Boolean} Indicates if the attribute option is used by default
33
+ * @param isDeleted {Boolean} Indicates if the attributes option is deleted
34
+ */
35
+ constructor(id, isDefault, isDeleted) {
36
+ CustomAttributeOptionUpdateApiModel.initialize(this, id, isDefault, isDeleted);
37
+ }
38
+
39
+ /**
40
+ * Initializes the fields of this object.
41
+ * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
42
+ * Only for internal use.
43
+ */
44
+ static initialize(obj, id, isDefault, isDeleted) {
45
+ obj['id'] = id;
46
+ obj['isDefault'] = isDefault;
47
+ obj['isDeleted'] = isDeleted;
48
+ }
49
+
50
+ /**
51
+ * Constructs a <code>CustomAttributeOptionUpdateApiModel</code> from a plain JavaScript object, optionally creating a new instance.
52
+ * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
53
+ * @param {Object} data The plain JavaScript object bearing properties of interest.
54
+ * @param {module:model/CustomAttributeOptionUpdateApiModel} obj Optional instance to populate.
55
+ * @return {module:model/CustomAttributeOptionUpdateApiModel} The populated <code>CustomAttributeOptionUpdateApiModel</code> instance.
56
+ */
57
+ static constructFromObject(data, obj) {
58
+ if (data) {
59
+ obj = obj || new CustomAttributeOptionUpdateApiModel();
60
+ if (data.hasOwnProperty('id')) {
61
+ obj['id'] = _ApiClient.default.convertToType(data['id'], 'String');
62
+ }
63
+ if (data.hasOwnProperty('value')) {
64
+ obj['value'] = _ApiClient.default.convertToType(data['value'], 'String');
65
+ }
66
+ if (data.hasOwnProperty('isDefault')) {
67
+ obj['isDefault'] = _ApiClient.default.convertToType(data['isDefault'], 'Boolean');
68
+ }
69
+ if (data.hasOwnProperty('isDeleted')) {
70
+ obj['isDeleted'] = _ApiClient.default.convertToType(data['isDeleted'], 'Boolean');
71
+ }
72
+ }
73
+ return obj;
74
+ }
75
+
76
+ /**
77
+ * Validates the JSON data with respect to <code>CustomAttributeOptionUpdateApiModel</code>.
78
+ * @param {Object} data The plain JavaScript object bearing properties of interest.
79
+ * @return {boolean} to indicate whether the JSON data is valid with respect to <code>CustomAttributeOptionUpdateApiModel</code>.
80
+ */
81
+ static validateJSON(data) {
82
+ // check to make sure all required properties are present in the JSON string
83
+ for (const property of CustomAttributeOptionUpdateApiModel.RequiredProperties) {
84
+ if (!data.hasOwnProperty(property)) {
85
+ throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
86
+ }
87
+ }
88
+ // ensure the json data is a string
89
+ if (data['id'] && !(typeof data['id'] === 'string' || data['id'] instanceof String)) {
90
+ throw new Error("Expected the field `id` to be a primitive type in the JSON string but got " + data['id']);
91
+ }
92
+ // ensure the json data is a string
93
+ if (data['value'] && !(typeof data['value'] === 'string' || data['value'] instanceof String)) {
94
+ throw new Error("Expected the field `value` to be a primitive type in the JSON string but got " + data['value']);
95
+ }
96
+ return true;
97
+ }
98
+ }
99
+ CustomAttributeOptionUpdateApiModel.RequiredProperties = ["id", "isDefault", "isDeleted"];
100
+
101
+ /**
102
+ * Unique ID of the attribute option
103
+ * @member {String} id
104
+ */
105
+ CustomAttributeOptionUpdateApiModel.prototype['id'] = undefined;
106
+
107
+ /**
108
+ * Value of the attribute option
109
+ * @member {String} value
110
+ */
111
+ CustomAttributeOptionUpdateApiModel.prototype['value'] = undefined;
112
+
113
+ /**
114
+ * Indicates if the attribute option is used by default
115
+ * @member {Boolean} isDefault
116
+ */
117
+ CustomAttributeOptionUpdateApiModel.prototype['isDefault'] = undefined;
118
+
119
+ /**
120
+ * Indicates if the attributes option is deleted
121
+ * @member {Boolean} isDeleted
122
+ */
123
+ CustomAttributeOptionUpdateApiModel.prototype['isDeleted'] = undefined;
124
+ var _default = exports.default = CustomAttributeOptionUpdateApiModel;
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _ApiClient = _interopRequireDefault(require("../ApiClient"));
8
+ var _CustomAttributeType = _interopRequireDefault(require("./CustomAttributeType"));
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+ /**
11
+ * API
12
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
13
+ *
14
+ * The version of the OpenAPI document: adapters
15
+ *
16
+ *
17
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
18
+ * https://openapi-generator.tech
19
+ * Do not edit the class manually.
20
+ *
21
+ */
22
+
23
+ /**
24
+ * The CustomAttributeSearchApiModel model module.
25
+ * @module model/CustomAttributeSearchApiModel
26
+ * @version 1.0.0
27
+ */
28
+ class CustomAttributeSearchApiModel {
29
+ /**
30
+ * Constructs a new <code>CustomAttributeSearchApiModel</code>.
31
+ * @alias module:model/CustomAttributeSearchApiModel
32
+ */
33
+ constructor() {
34
+ CustomAttributeSearchApiModel.initialize(this);
35
+ }
36
+
37
+ /**
38
+ * Initializes the fields of this object.
39
+ * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
40
+ * Only for internal use.
41
+ */
42
+ static initialize(obj) {}
43
+
44
+ /**
45
+ * Constructs a <code>CustomAttributeSearchApiModel</code> from a plain JavaScript object, optionally creating a new instance.
46
+ * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
47
+ * @param {Object} data The plain JavaScript object bearing properties of interest.
48
+ * @param {module:model/CustomAttributeSearchApiModel} obj Optional instance to populate.
49
+ * @return {module:model/CustomAttributeSearchApiModel} The populated <code>CustomAttributeSearchApiModel</code> instance.
50
+ */
51
+ static constructFromObject(data, obj) {
52
+ if (data) {
53
+ obj = obj || new CustomAttributeSearchApiModel();
54
+ if (data.hasOwnProperty('name')) {
55
+ obj['name'] = _ApiClient.default.convertToType(data['name'], 'String');
56
+ }
57
+ if (data.hasOwnProperty('projectIds')) {
58
+ obj['projectIds'] = _ApiClient.default.convertToType(data['projectIds'], ['String']);
59
+ }
60
+ if (data.hasOwnProperty('customAttributeIds')) {
61
+ obj['customAttributeIds'] = _ApiClient.default.convertToType(data['customAttributeIds'], ['String']);
62
+ }
63
+ if (data.hasOwnProperty('customAttributeTypes')) {
64
+ obj['customAttributeTypes'] = _ApiClient.default.convertToType(data['customAttributeTypes'], [_CustomAttributeType.default]);
65
+ }
66
+ if (data.hasOwnProperty('isGlobal')) {
67
+ obj['isGlobal'] = _ApiClient.default.convertToType(data['isGlobal'], 'Boolean');
68
+ }
69
+ if (data.hasOwnProperty('isDeleted')) {
70
+ obj['isDeleted'] = _ApiClient.default.convertToType(data['isDeleted'], 'Boolean');
71
+ }
72
+ }
73
+ return obj;
74
+ }
75
+
76
+ /**
77
+ * Validates the JSON data with respect to <code>CustomAttributeSearchApiModel</code>.
78
+ * @param {Object} data The plain JavaScript object bearing properties of interest.
79
+ * @return {boolean} to indicate whether the JSON data is valid with respect to <code>CustomAttributeSearchApiModel</code>.
80
+ */
81
+ static validateJSON(data) {
82
+ // ensure the json data is a string
83
+ if (data['name'] && !(typeof data['name'] === 'string' || data['name'] instanceof String)) {
84
+ throw new Error("Expected the field `name` to be a primitive type in the JSON string but got " + data['name']);
85
+ }
86
+ // ensure the json data is an array
87
+ if (!Array.isArray(data['projectIds'])) {
88
+ throw new Error("Expected the field `projectIds` to be an array in the JSON data but got " + data['projectIds']);
89
+ }
90
+ // ensure the json data is an array
91
+ if (!Array.isArray(data['customAttributeIds'])) {
92
+ throw new Error("Expected the field `customAttributeIds` to be an array in the JSON data but got " + data['customAttributeIds']);
93
+ }
94
+ // ensure the json data is an array
95
+ if (!Array.isArray(data['customAttributeTypes'])) {
96
+ throw new Error("Expected the field `customAttributeTypes` to be an array in the JSON data but got " + data['customAttributeTypes']);
97
+ }
98
+ return true;
99
+ }
100
+ }
101
+
102
+ /**
103
+ * Name of attribute
104
+ * @member {String} name
105
+ */
106
+ CustomAttributeSearchApiModel.prototype['name'] = undefined;
107
+
108
+ /**
109
+ * Unique IDs of projects where attribute is in use
110
+ * @member {Array.<String>} projectIds
111
+ */
112
+ CustomAttributeSearchApiModel.prototype['projectIds'] = undefined;
113
+
114
+ /**
115
+ * Unique IDs of attributes for search restriction
116
+ * @member {Array.<String>} customAttributeIds
117
+ */
118
+ CustomAttributeSearchApiModel.prototype['customAttributeIds'] = undefined;
119
+
120
+ /**
121
+ * Collection of attribute types
122
+ * @member {Array.<module:model/CustomAttributeType>} customAttributeTypes
123
+ */
124
+ CustomAttributeSearchApiModel.prototype['customAttributeTypes'] = undefined;
125
+
126
+ /**
127
+ * Indicates whether the attribute is available across all projects
128
+ * @member {Boolean} isGlobal
129
+ */
130
+ CustomAttributeSearchApiModel.prototype['isGlobal'] = undefined;
131
+
132
+ /**
133
+ * Indicates whether the attribute is deleted
134
+ * @member {Boolean} isDeleted
135
+ */
136
+ CustomAttributeSearchApiModel.prototype['isDeleted'] = undefined;
137
+ var _default = exports.default = CustomAttributeSearchApiModel;
@@ -0,0 +1,281 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _ApiClient = _interopRequireDefault(require("../ApiClient"));
8
+ var _CustomAttributeOptionApiResult = _interopRequireDefault(require("./CustomAttributeOptionApiResult"));
9
+ var _CustomAttributeType = _interopRequireDefault(require("./CustomAttributeType"));
10
+ var _ProjectShortestApiResult = _interopRequireDefault(require("./ProjectShortestApiResult"));
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ /**
13
+ * API
14
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
15
+ *
16
+ * The version of the OpenAPI document: adapters
17
+ *
18
+ *
19
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
20
+ * https://openapi-generator.tech
21
+ * Do not edit the class manually.
22
+ *
23
+ */
24
+
25
+ /**
26
+ * The CustomAttributeSearchApiResult model module.
27
+ * @module model/CustomAttributeSearchApiResult
28
+ * @version 1.0.0
29
+ */
30
+ class CustomAttributeSearchApiResult {
31
+ /**
32
+ * Constructs a new <code>CustomAttributeSearchApiResult</code>.
33
+ * @alias module:model/CustomAttributeSearchApiResult
34
+ * @param workItemUsage {Array.<module:model/ProjectShortestApiResult>} Projects where attribute is used in work items
35
+ * @param testPlanUsage {Array.<module:model/ProjectShortestApiResult>} Projects where attribute is used in test plans
36
+ * @param id {String} Unique ID of the attribute
37
+ * @param options {Array.<module:model/CustomAttributeOptionApiResult>} Collection of the attribute options Available for attributes of type `options` and `multiple options` only
38
+ * @param type {module:model/CustomAttributeType} Type of the attribute
39
+ * @param isDeleted {Boolean} Indicates if the attribute is deleted
40
+ * @param name {String} Name of the attribute
41
+ * @param isEnabled {Boolean} Indicates if the attribute is enabled
42
+ * @param isRequired {Boolean} Indicates if the attribute value is mandatory to specify
43
+ * @param isGlobal {Boolean} Indicates if the attribute is available across all projects
44
+ * @param isReadOnly {Boolean} Indicates if the attribute is read-only
45
+ * @param isSystem {Boolean} Indicates if the attribute is system
46
+ * @param targets {Array.<String>} Collection of the attribute targets Defines where the attribute can be used (e.g., TestCases, AutoTestCases, TestPlans)
47
+ */
48
+ constructor(workItemUsage, testPlanUsage, id, options, type, isDeleted, name, isEnabled, isRequired, isGlobal, isReadOnly, isSystem, targets) {
49
+ CustomAttributeSearchApiResult.initialize(this, workItemUsage, testPlanUsage, id, options, type, isDeleted, name, isEnabled, isRequired, isGlobal, isReadOnly, isSystem, targets);
50
+ }
51
+
52
+ /**
53
+ * Initializes the fields of this object.
54
+ * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
55
+ * Only for internal use.
56
+ */
57
+ static initialize(obj, workItemUsage, testPlanUsage, id, options, type, isDeleted, name, isEnabled, isRequired, isGlobal, isReadOnly, isSystem, targets) {
58
+ obj['workItemUsage'] = workItemUsage;
59
+ obj['testPlanUsage'] = testPlanUsage;
60
+ obj['id'] = id;
61
+ obj['options'] = options;
62
+ obj['type'] = type;
63
+ obj['isDeleted'] = isDeleted;
64
+ obj['name'] = name;
65
+ obj['isEnabled'] = isEnabled;
66
+ obj['isRequired'] = isRequired;
67
+ obj['isGlobal'] = isGlobal;
68
+ obj['isReadOnly'] = isReadOnly;
69
+ obj['isSystem'] = isSystem;
70
+ obj['targets'] = targets;
71
+ }
72
+
73
+ /**
74
+ * Constructs a <code>CustomAttributeSearchApiResult</code> from a plain JavaScript object, optionally creating a new instance.
75
+ * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
76
+ * @param {Object} data The plain JavaScript object bearing properties of interest.
77
+ * @param {module:model/CustomAttributeSearchApiResult} obj Optional instance to populate.
78
+ * @return {module:model/CustomAttributeSearchApiResult} The populated <code>CustomAttributeSearchApiResult</code> instance.
79
+ */
80
+ static constructFromObject(data, obj) {
81
+ if (data) {
82
+ obj = obj || new CustomAttributeSearchApiResult();
83
+ if (data.hasOwnProperty('workItemUsage')) {
84
+ obj['workItemUsage'] = _ApiClient.default.convertToType(data['workItemUsage'], [_ProjectShortestApiResult.default]);
85
+ }
86
+ if (data.hasOwnProperty('testPlanUsage')) {
87
+ obj['testPlanUsage'] = _ApiClient.default.convertToType(data['testPlanUsage'], [_ProjectShortestApiResult.default]);
88
+ }
89
+ if (data.hasOwnProperty('id')) {
90
+ obj['id'] = _ApiClient.default.convertToType(data['id'], 'String');
91
+ }
92
+ if (data.hasOwnProperty('code')) {
93
+ obj['code'] = _ApiClient.default.convertToType(data['code'], 'String');
94
+ }
95
+ if (data.hasOwnProperty('options')) {
96
+ obj['options'] = _ApiClient.default.convertToType(data['options'], [_CustomAttributeOptionApiResult.default]);
97
+ }
98
+ if (data.hasOwnProperty('type')) {
99
+ obj['type'] = _ApiClient.default.convertToType(data['type'], _CustomAttributeType.default);
100
+ }
101
+ if (data.hasOwnProperty('isDeleted')) {
102
+ obj['isDeleted'] = _ApiClient.default.convertToType(data['isDeleted'], 'Boolean');
103
+ }
104
+ if (data.hasOwnProperty('name')) {
105
+ obj['name'] = _ApiClient.default.convertToType(data['name'], 'String');
106
+ }
107
+ if (data.hasOwnProperty('isEnabled')) {
108
+ obj['isEnabled'] = _ApiClient.default.convertToType(data['isEnabled'], 'Boolean');
109
+ }
110
+ if (data.hasOwnProperty('isRequired')) {
111
+ obj['isRequired'] = _ApiClient.default.convertToType(data['isRequired'], 'Boolean');
112
+ }
113
+ if (data.hasOwnProperty('isGlobal')) {
114
+ obj['isGlobal'] = _ApiClient.default.convertToType(data['isGlobal'], 'Boolean');
115
+ }
116
+ if (data.hasOwnProperty('isReadOnly')) {
117
+ obj['isReadOnly'] = _ApiClient.default.convertToType(data['isReadOnly'], 'Boolean');
118
+ }
119
+ if (data.hasOwnProperty('isSystem')) {
120
+ obj['isSystem'] = _ApiClient.default.convertToType(data['isSystem'], 'Boolean');
121
+ }
122
+ if (data.hasOwnProperty('targets')) {
123
+ obj['targets'] = _ApiClient.default.convertToType(data['targets'], ['String']);
124
+ }
125
+ }
126
+ return obj;
127
+ }
128
+
129
+ /**
130
+ * Validates the JSON data with respect to <code>CustomAttributeSearchApiResult</code>.
131
+ * @param {Object} data The plain JavaScript object bearing properties of interest.
132
+ * @return {boolean} to indicate whether the JSON data is valid with respect to <code>CustomAttributeSearchApiResult</code>.
133
+ */
134
+ static validateJSON(data) {
135
+ // check to make sure all required properties are present in the JSON string
136
+ for (const property of CustomAttributeSearchApiResult.RequiredProperties) {
137
+ if (!data.hasOwnProperty(property)) {
138
+ throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
139
+ }
140
+ }
141
+ if (data['workItemUsage']) {
142
+ // data not null
143
+ // ensure the json data is an array
144
+ if (!Array.isArray(data['workItemUsage'])) {
145
+ throw new Error("Expected the field `workItemUsage` to be an array in the JSON data but got " + data['workItemUsage']);
146
+ }
147
+ // validate the optional field `workItemUsage` (array)
148
+ for (const item of data['workItemUsage']) {
149
+ _ProjectShortestApiResult.default.validateJSON(item);
150
+ }
151
+ ;
152
+ }
153
+ if (data['testPlanUsage']) {
154
+ // data not null
155
+ // ensure the json data is an array
156
+ if (!Array.isArray(data['testPlanUsage'])) {
157
+ throw new Error("Expected the field `testPlanUsage` to be an array in the JSON data but got " + data['testPlanUsage']);
158
+ }
159
+ // validate the optional field `testPlanUsage` (array)
160
+ for (const item of data['testPlanUsage']) {
161
+ _ProjectShortestApiResult.default.validateJSON(item);
162
+ }
163
+ ;
164
+ }
165
+ // ensure the json data is a string
166
+ if (data['id'] && !(typeof data['id'] === 'string' || data['id'] instanceof String)) {
167
+ throw new Error("Expected the field `id` to be a primitive type in the JSON string but got " + data['id']);
168
+ }
169
+ // ensure the json data is a string
170
+ if (data['code'] && !(typeof data['code'] === 'string' || data['code'] instanceof String)) {
171
+ throw new Error("Expected the field `code` to be a primitive type in the JSON string but got " + data['code']);
172
+ }
173
+ if (data['options']) {
174
+ // data not null
175
+ // ensure the json data is an array
176
+ if (!Array.isArray(data['options'])) {
177
+ throw new Error("Expected the field `options` to be an array in the JSON data but got " + data['options']);
178
+ }
179
+ // validate the optional field `options` (array)
180
+ for (const item of data['options']) {
181
+ _CustomAttributeOptionApiResult.default.validateJSON(item);
182
+ }
183
+ ;
184
+ }
185
+ // ensure the json data is a string
186
+ if (data['name'] && !(typeof data['name'] === 'string' || data['name'] instanceof String)) {
187
+ throw new Error("Expected the field `name` to be a primitive type in the JSON string but got " + data['name']);
188
+ }
189
+ // ensure the json data is an array
190
+ if (!Array.isArray(data['targets'])) {
191
+ throw new Error("Expected the field `targets` to be an array in the JSON data but got " + data['targets']);
192
+ }
193
+ return true;
194
+ }
195
+ }
196
+ CustomAttributeSearchApiResult.RequiredProperties = ["workItemUsage", "testPlanUsage", "id", "options", "type", "isDeleted", "name", "isEnabled", "isRequired", "isGlobal", "isReadOnly", "isSystem", "targets"];
197
+
198
+ /**
199
+ * Projects where attribute is used in work items
200
+ * @member {Array.<module:model/ProjectShortestApiResult>} workItemUsage
201
+ */
202
+ CustomAttributeSearchApiResult.prototype['workItemUsage'] = undefined;
203
+
204
+ /**
205
+ * Projects where attribute is used in test plans
206
+ * @member {Array.<module:model/ProjectShortestApiResult>} testPlanUsage
207
+ */
208
+ CustomAttributeSearchApiResult.prototype['testPlanUsage'] = undefined;
209
+
210
+ /**
211
+ * Unique ID of the attribute
212
+ * @member {String} id
213
+ */
214
+ CustomAttributeSearchApiResult.prototype['id'] = undefined;
215
+
216
+ /**
217
+ * Optional code identifier for the attribute
218
+ * @member {String} code
219
+ */
220
+ CustomAttributeSearchApiResult.prototype['code'] = undefined;
221
+
222
+ /**
223
+ * Collection of the attribute options Available for attributes of type `options` and `multiple options` only
224
+ * @member {Array.<module:model/CustomAttributeOptionApiResult>} options
225
+ */
226
+ CustomAttributeSearchApiResult.prototype['options'] = undefined;
227
+
228
+ /**
229
+ * Type of the attribute
230
+ * @member {module:model/CustomAttributeType} type
231
+ */
232
+ CustomAttributeSearchApiResult.prototype['type'] = undefined;
233
+
234
+ /**
235
+ * Indicates if the attribute is deleted
236
+ * @member {Boolean} isDeleted
237
+ */
238
+ CustomAttributeSearchApiResult.prototype['isDeleted'] = undefined;
239
+
240
+ /**
241
+ * Name of the attribute
242
+ * @member {String} name
243
+ */
244
+ CustomAttributeSearchApiResult.prototype['name'] = undefined;
245
+
246
+ /**
247
+ * Indicates if the attribute is enabled
248
+ * @member {Boolean} isEnabled
249
+ */
250
+ CustomAttributeSearchApiResult.prototype['isEnabled'] = undefined;
251
+
252
+ /**
253
+ * Indicates if the attribute value is mandatory to specify
254
+ * @member {Boolean} isRequired
255
+ */
256
+ CustomAttributeSearchApiResult.prototype['isRequired'] = undefined;
257
+
258
+ /**
259
+ * Indicates if the attribute is available across all projects
260
+ * @member {Boolean} isGlobal
261
+ */
262
+ CustomAttributeSearchApiResult.prototype['isGlobal'] = undefined;
263
+
264
+ /**
265
+ * Indicates if the attribute is read-only
266
+ * @member {Boolean} isReadOnly
267
+ */
268
+ CustomAttributeSearchApiResult.prototype['isReadOnly'] = undefined;
269
+
270
+ /**
271
+ * Indicates if the attribute is system
272
+ * @member {Boolean} isSystem
273
+ */
274
+ CustomAttributeSearchApiResult.prototype['isSystem'] = undefined;
275
+
276
+ /**
277
+ * Collection of the attribute targets Defines where the attribute can be used (e.g., TestCases, AutoTestCases, TestPlans)
278
+ * @member {Array.<String>} targets
279
+ */
280
+ CustomAttributeSearchApiResult.prototype['targets'] = undefined;
281
+ var _default = exports.default = CustomAttributeSearchApiResult;