@pescheckit/pescheck-client-js 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +220 -0
  2. package/dist/ApiClient.js +730 -0
  3. package/dist/api/AuthenticationApi.js +159 -0
  4. package/dist/api/ChecksApi.js +120 -0
  5. package/dist/api/DivisionsApi.js +257 -0
  6. package/dist/api/OAuthApi.js +153 -0
  7. package/dist/api/ProfilesApi.js +301 -0
  8. package/dist/api/ScreeningsApi.js +213 -0
  9. package/dist/api/WebhooksApi.js +210 -0
  10. package/dist/index.js +314 -0
  11. package/dist/model/CustomTokenObtainPair.js +127 -0
  12. package/dist/model/DivisionReadOnly.js +266 -0
  13. package/dist/model/DivisionWrite.js +246 -0
  14. package/dist/model/JWTGeneration.js +155 -0
  15. package/dist/model/JWTResponse.js +184 -0
  16. package/dist/model/OAuthApplication.js +221 -0
  17. package/dist/model/OAuthApplicationResponse.js +252 -0
  18. package/dist/model/PaginatedDivisionReadOnlyList.js +168 -0
  19. package/dist/model/PaginatedV2ProfileListItemList.js +168 -0
  20. package/dist/model/PaginatedV2ScreeningListItemList.js +168 -0
  21. package/dist/model/PatchedDivisionWrite.js +209 -0
  22. package/dist/model/PatchedV2ProfilePartialUpdate.js +102 -0
  23. package/dist/model/TokenRefresh.js +124 -0
  24. package/dist/model/V2Candidate.js +1474 -0
  25. package/dist/model/V2CheckField.js +168 -0
  26. package/dist/model/V2CheckInfo.js +316 -0
  27. package/dist/model/V2Document.js +302 -0
  28. package/dist/model/V2DocumentContent.js +126 -0
  29. package/dist/model/V2Money.js +126 -0
  30. package/dist/model/V2ProfileCheck.js +222 -0
  31. package/dist/model/V2ProfileCheckEntry.js +311 -0
  32. package/dist/model/V2ProfileCreate.js +158 -0
  33. package/dist/model/V2ProfileDetail.js +258 -0
  34. package/dist/model/V2ProfileListItem.js +182 -0
  35. package/dist/model/V2ProfileUpdate.js +159 -0
  36. package/dist/model/V2ProfileUpdateCheck.js +254 -0
  37. package/dist/model/V2ScreeningCheck.js +243 -0
  38. package/dist/model/V2ScreeningCheckEntry.js +338 -0
  39. package/dist/model/V2ScreeningCheckListItem.js +260 -0
  40. package/dist/model/V2ScreeningCreate.js +158 -0
  41. package/dist/model/V2ScreeningDetail.js +240 -0
  42. package/dist/model/V2ScreeningDetailProfile.js +101 -0
  43. package/dist/model/V2ScreeningListItem.js +237 -0
  44. package/dist/model/VerifyWebhook.js +114 -0
  45. package/dist/model/Webhook.js +221 -0
  46. package/dist/model/WebhookResponse.js +215 -0
  47. package/package.json +54 -0
@@ -0,0 +1,237 @@
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 _V2Candidate = _interopRequireDefault(require("./V2Candidate"));
9
+ var _V2ScreeningCheckListItem = _interopRequireDefault(require("./V2ScreeningCheckListItem"));
10
+ var _V2ScreeningDetailProfile = _interopRequireDefault(require("./V2ScreeningDetailProfile"));
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
12
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
13
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
14
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
15
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
16
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
17
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
18
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
19
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
20
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
21
+ * Pescheck API
22
+ * Official client library for the Pescheck API (v2), generated from the OpenAPI specification. Authenticate with OAuth2 client credentials and use the checks, profiles, screenings, webhooks and divisions endpoints. See https://github.com/pescheckit/pescheck-clients for installation and usage.
23
+ *
24
+ * The version of the OpenAPI document: 2.0.0
25
+ *
26
+ *
27
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
28
+ * https://openapi-generator.tech
29
+ * Do not edit the class manually.
30
+ *
31
+ */
32
+ /**
33
+ * The V2ScreeningListItem model module.
34
+ * @module model/V2ScreeningListItem
35
+ * @version 0.0.5
36
+ */
37
+ var V2ScreeningListItem = /*#__PURE__*/function () {
38
+ /**
39
+ * Constructs a new <code>V2ScreeningListItem</code>.
40
+ * List shape for GET /screenings/. Same candidate as detail; the only thing we slim here is per-check info (status only), since config/input/output are heavy and rarely needed at list time.
41
+ * @alias module:model/V2ScreeningListItem
42
+ * @param id {String}
43
+ * @param profile {module:model/V2ScreeningDetailProfile}
44
+ * @param candidate {module:model/V2Candidate}
45
+ * @param checks {Array.<module:model/V2ScreeningCheckListItem>}
46
+ * @param candidateWizardUrl {String}
47
+ * @param dashboardUrl {String}
48
+ * @param createdAt {Date}
49
+ * @param updatedAt {Date}
50
+ */
51
+ function V2ScreeningListItem(id, profile, candidate, checks, candidateWizardUrl, dashboardUrl, createdAt, updatedAt) {
52
+ _classCallCheck(this, V2ScreeningListItem);
53
+ V2ScreeningListItem.initialize(this, id, profile, candidate, checks, candidateWizardUrl, dashboardUrl, createdAt, updatedAt);
54
+ }
55
+
56
+ /**
57
+ * Initializes the fields of this object.
58
+ * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
59
+ * Only for internal use.
60
+ */
61
+ return _createClass(V2ScreeningListItem, null, [{
62
+ key: "initialize",
63
+ value: function initialize(obj, id, profile, candidate, checks, candidateWizardUrl, dashboardUrl, createdAt, updatedAt) {
64
+ obj['id'] = id;
65
+ obj['profile'] = profile;
66
+ obj['candidate'] = candidate;
67
+ obj['checks'] = checks;
68
+ obj['candidate_wizard_url'] = candidateWizardUrl;
69
+ obj['dashboard_url'] = dashboardUrl;
70
+ obj['created_at'] = createdAt;
71
+ obj['updated_at'] = updatedAt;
72
+ }
73
+
74
+ /**
75
+ * Constructs a <code>V2ScreeningListItem</code> from a plain JavaScript object, optionally creating a new instance.
76
+ * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
77
+ * @param {Object} data The plain JavaScript object bearing properties of interest.
78
+ * @param {module:model/V2ScreeningListItem} obj Optional instance to populate.
79
+ * @return {module:model/V2ScreeningListItem} The populated <code>V2ScreeningListItem</code> instance.
80
+ */
81
+ }, {
82
+ key: "constructFromObject",
83
+ value: function constructFromObject(data, obj) {
84
+ if (data) {
85
+ obj = obj || new V2ScreeningListItem();
86
+ if (data.hasOwnProperty('id')) {
87
+ obj['id'] = _ApiClient["default"].convertToType(data['id'], 'String');
88
+ }
89
+ if (data.hasOwnProperty('status')) {
90
+ obj['status'] = _ApiClient["default"].convertToType(data['status'], 'String');
91
+ }
92
+ if (data.hasOwnProperty('profile')) {
93
+ obj['profile'] = _V2ScreeningDetailProfile["default"].constructFromObject(data['profile']);
94
+ }
95
+ if (data.hasOwnProperty('candidate')) {
96
+ obj['candidate'] = _ApiClient["default"].convertToType(data['candidate'], _V2Candidate["default"]);
97
+ }
98
+ if (data.hasOwnProperty('checks')) {
99
+ obj['checks'] = _ApiClient["default"].convertToType(data['checks'], [_V2ScreeningCheckListItem["default"]]);
100
+ }
101
+ if (data.hasOwnProperty('candidate_wizard_url')) {
102
+ obj['candidate_wizard_url'] = _ApiClient["default"].convertToType(data['candidate_wizard_url'], 'String');
103
+ }
104
+ if (data.hasOwnProperty('dashboard_url')) {
105
+ obj['dashboard_url'] = _ApiClient["default"].convertToType(data['dashboard_url'], 'String');
106
+ }
107
+ if (data.hasOwnProperty('created_at')) {
108
+ obj['created_at'] = _ApiClient["default"].convertToType(data['created_at'], 'Date');
109
+ }
110
+ if (data.hasOwnProperty('updated_at')) {
111
+ obj['updated_at'] = _ApiClient["default"].convertToType(data['updated_at'], 'Date');
112
+ }
113
+ }
114
+ return obj;
115
+ }
116
+
117
+ /**
118
+ * Validates the JSON data with respect to <code>V2ScreeningListItem</code>.
119
+ * @param {Object} data The plain JavaScript object bearing properties of interest.
120
+ * @return {boolean} to indicate whether the JSON data is valid with respect to <code>V2ScreeningListItem</code>.
121
+ */
122
+ }, {
123
+ key: "validateJSON",
124
+ value: function validateJSON(data) {
125
+ // check to make sure all required properties are present in the JSON string
126
+ var _iterator = _createForOfIteratorHelper(V2ScreeningListItem.RequiredProperties),
127
+ _step;
128
+ try {
129
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
130
+ var property = _step.value;
131
+ if (!data.hasOwnProperty(property)) {
132
+ throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
133
+ }
134
+ }
135
+ // ensure the json data is a string
136
+ } catch (err) {
137
+ _iterator.e(err);
138
+ } finally {
139
+ _iterator.f();
140
+ }
141
+ if (data['id'] && !(typeof data['id'] === 'string' || data['id'] instanceof String)) {
142
+ throw new Error("Expected the field `id` to be a primitive type in the JSON string but got " + data['id']);
143
+ }
144
+ // ensure the json data is a string
145
+ if (data['status'] && !(typeof data['status'] === 'string' || data['status'] instanceof String)) {
146
+ throw new Error("Expected the field `status` to be a primitive type in the JSON string but got " + data['status']);
147
+ }
148
+ // validate the optional field `profile`
149
+ if (data['profile']) {
150
+ // data not null
151
+ _V2ScreeningDetailProfile["default"].validateJSON(data['profile']);
152
+ }
153
+ // validate the optional field `candidate`
154
+ if (data['candidate']) {
155
+ // data not null
156
+ _V2Candidate["default"].validateJSON(data['candidate']);
157
+ }
158
+ if (data['checks']) {
159
+ // data not null
160
+ // ensure the json data is an array
161
+ if (!Array.isArray(data['checks'])) {
162
+ throw new Error("Expected the field `checks` to be an array in the JSON data but got " + data['checks']);
163
+ }
164
+ // validate the optional field `checks` (array)
165
+ var _iterator2 = _createForOfIteratorHelper(data['checks']),
166
+ _step2;
167
+ try {
168
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
169
+ var item = _step2.value;
170
+ _V2ScreeningCheckListItem["default"].validateJSON(item);
171
+ }
172
+ } catch (err) {
173
+ _iterator2.e(err);
174
+ } finally {
175
+ _iterator2.f();
176
+ }
177
+ ;
178
+ }
179
+ // ensure the json data is a string
180
+ if (data['candidate_wizard_url'] && !(typeof data['candidate_wizard_url'] === 'string' || data['candidate_wizard_url'] instanceof String)) {
181
+ throw new Error("Expected the field `candidate_wizard_url` to be a primitive type in the JSON string but got " + data['candidate_wizard_url']);
182
+ }
183
+ // ensure the json data is a string
184
+ if (data['dashboard_url'] && !(typeof data['dashboard_url'] === 'string' || data['dashboard_url'] instanceof String)) {
185
+ throw new Error("Expected the field `dashboard_url` to be a primitive type in the JSON string but got " + data['dashboard_url']);
186
+ }
187
+ return true;
188
+ }
189
+ }]);
190
+ }();
191
+ V2ScreeningListItem.RequiredProperties = ["id", "profile", "candidate", "checks", "candidate_wizard_url", "dashboard_url", "created_at", "updated_at"];
192
+
193
+ /**
194
+ * @member {String} id
195
+ */
196
+ V2ScreeningListItem.prototype['id'] = undefined;
197
+
198
+ /**
199
+ * @member {String} status
200
+ */
201
+ V2ScreeningListItem.prototype['status'] = undefined;
202
+
203
+ /**
204
+ * @member {module:model/V2ScreeningDetailProfile} profile
205
+ */
206
+ V2ScreeningListItem.prototype['profile'] = undefined;
207
+
208
+ /**
209
+ * @member {module:model/V2Candidate} candidate
210
+ */
211
+ V2ScreeningListItem.prototype['candidate'] = undefined;
212
+
213
+ /**
214
+ * @member {Array.<module:model/V2ScreeningCheckListItem>} checks
215
+ */
216
+ V2ScreeningListItem.prototype['checks'] = undefined;
217
+
218
+ /**
219
+ * @member {String} candidate_wizard_url
220
+ */
221
+ V2ScreeningListItem.prototype['candidate_wizard_url'] = undefined;
222
+
223
+ /**
224
+ * @member {String} dashboard_url
225
+ */
226
+ V2ScreeningListItem.prototype['dashboard_url'] = undefined;
227
+
228
+ /**
229
+ * @member {Date} created_at
230
+ */
231
+ V2ScreeningListItem.prototype['created_at'] = undefined;
232
+
233
+ /**
234
+ * @member {Date} updated_at
235
+ */
236
+ V2ScreeningListItem.prototype['updated_at'] = undefined;
237
+ var _default = exports["default"] = V2ScreeningListItem;
@@ -0,0 +1,114 @@
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
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
10
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
11
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
12
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
13
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
14
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
15
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
16
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
17
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
18
+ * Pescheck API
19
+ * Official client library for the Pescheck API (v2), generated from the OpenAPI specification. Authenticate with OAuth2 client credentials and use the checks, profiles, screenings, webhooks and divisions endpoints. See https://github.com/pescheckit/pescheck-clients for installation and usage.
20
+ *
21
+ * The version of the OpenAPI document: 2.0.0
22
+ *
23
+ *
24
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
25
+ * https://openapi-generator.tech
26
+ * Do not edit the class manually.
27
+ *
28
+ */
29
+ /**
30
+ * The VerifyWebhook model module.
31
+ * @module model/VerifyWebhook
32
+ * @version 0.0.5
33
+ */
34
+ var VerifyWebhook = /*#__PURE__*/function () {
35
+ /**
36
+ * Constructs a new <code>VerifyWebhook</code>.
37
+ * Body shape for POST /webhooks/{id}/verify/. The verification code is the one sent to the webhook URL when the webhook was created; the receiver POSTs it back here to confirm ownership.
38
+ * @alias module:model/VerifyWebhook
39
+ * @param verificationCode {String} The verification code delivered to the webhook URL on creation.
40
+ */
41
+ function VerifyWebhook(verificationCode) {
42
+ _classCallCheck(this, VerifyWebhook);
43
+ VerifyWebhook.initialize(this, verificationCode);
44
+ }
45
+
46
+ /**
47
+ * Initializes the fields of this object.
48
+ * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
49
+ * Only for internal use.
50
+ */
51
+ return _createClass(VerifyWebhook, null, [{
52
+ key: "initialize",
53
+ value: function initialize(obj, verificationCode) {
54
+ obj['verification_code'] = verificationCode;
55
+ }
56
+
57
+ /**
58
+ * Constructs a <code>VerifyWebhook</code> from a plain JavaScript object, optionally creating a new instance.
59
+ * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
60
+ * @param {Object} data The plain JavaScript object bearing properties of interest.
61
+ * @param {module:model/VerifyWebhook} obj Optional instance to populate.
62
+ * @return {module:model/VerifyWebhook} The populated <code>VerifyWebhook</code> instance.
63
+ */
64
+ }, {
65
+ key: "constructFromObject",
66
+ value: function constructFromObject(data, obj) {
67
+ if (data) {
68
+ obj = obj || new VerifyWebhook();
69
+ if (data.hasOwnProperty('verification_code')) {
70
+ obj['verification_code'] = _ApiClient["default"].convertToType(data['verification_code'], 'String');
71
+ }
72
+ }
73
+ return obj;
74
+ }
75
+
76
+ /**
77
+ * Validates the JSON data with respect to <code>VerifyWebhook</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>VerifyWebhook</code>.
80
+ */
81
+ }, {
82
+ key: "validateJSON",
83
+ value: function validateJSON(data) {
84
+ // check to make sure all required properties are present in the JSON string
85
+ var _iterator = _createForOfIteratorHelper(VerifyWebhook.RequiredProperties),
86
+ _step;
87
+ try {
88
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
89
+ var property = _step.value;
90
+ if (!data.hasOwnProperty(property)) {
91
+ throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
92
+ }
93
+ }
94
+ // ensure the json data is a string
95
+ } catch (err) {
96
+ _iterator.e(err);
97
+ } finally {
98
+ _iterator.f();
99
+ }
100
+ if (data['verification_code'] && !(typeof data['verification_code'] === 'string' || data['verification_code'] instanceof String)) {
101
+ throw new Error("Expected the field `verification_code` to be a primitive type in the JSON string but got " + data['verification_code']);
102
+ }
103
+ return true;
104
+ }
105
+ }]);
106
+ }();
107
+ VerifyWebhook.RequiredProperties = ["verification_code"];
108
+
109
+ /**
110
+ * The verification code delivered to the webhook URL on creation.
111
+ * @member {String} verification_code
112
+ */
113
+ VerifyWebhook.prototype['verification_code'] = undefined;
114
+ var _default = exports["default"] = VerifyWebhook;
@@ -0,0 +1,221 @@
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
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
10
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
11
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
12
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
13
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
14
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
15
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
16
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
17
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
18
+ * Pescheck API
19
+ * Official client library for the Pescheck API (v2), generated from the OpenAPI specification. Authenticate with OAuth2 client credentials and use the checks, profiles, screenings, webhooks and divisions endpoints. See https://github.com/pescheckit/pescheck-clients for installation and usage.
20
+ *
21
+ * The version of the OpenAPI document: 2.0.0
22
+ *
23
+ *
24
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
25
+ * https://openapi-generator.tech
26
+ * Do not edit the class manually.
27
+ *
28
+ */
29
+ /**
30
+ * The Webhook model module.
31
+ * @module model/Webhook
32
+ * @version 0.0.5
33
+ */
34
+ var Webhook = /*#__PURE__*/function () {
35
+ /**
36
+ * Constructs a new <code>Webhook</code>.
37
+ * Serializer for webhook creation/update requests
38
+ * @alias module:model/Webhook
39
+ * @param name {String} Descriptive name for this webhook
40
+ * @param url {String} HTTPS URL where webhook events will be sent
41
+ * @param events {Array.<module:model/Webhook.EventsEnum>} List of events to subscribe to. Valid events: check.status_changed, screening.status_changed, screening.archived, package.created, package.updated, profile.created, profile.updated, division.created, division.updated
42
+ */
43
+ function Webhook(name, url, events) {
44
+ _classCallCheck(this, Webhook);
45
+ Webhook.initialize(this, name, url, events);
46
+ }
47
+
48
+ /**
49
+ * Initializes the fields of this object.
50
+ * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
51
+ * Only for internal use.
52
+ */
53
+ return _createClass(Webhook, null, [{
54
+ key: "initialize",
55
+ value: function initialize(obj, name, url, events) {
56
+ obj['name'] = name;
57
+ obj['url'] = url;
58
+ obj['events'] = events;
59
+ obj['active'] = true;
60
+ }
61
+
62
+ /**
63
+ * Constructs a <code>Webhook</code> from a plain JavaScript object, optionally creating a new instance.
64
+ * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
65
+ * @param {Object} data The plain JavaScript object bearing properties of interest.
66
+ * @param {module:model/Webhook} obj Optional instance to populate.
67
+ * @return {module:model/Webhook} The populated <code>Webhook</code> instance.
68
+ */
69
+ }, {
70
+ key: "constructFromObject",
71
+ value: function constructFromObject(data, obj) {
72
+ if (data) {
73
+ obj = obj || new Webhook();
74
+ if (data.hasOwnProperty('name')) {
75
+ obj['name'] = _ApiClient["default"].convertToType(data['name'], 'String');
76
+ }
77
+ if (data.hasOwnProperty('url')) {
78
+ obj['url'] = _ApiClient["default"].convertToType(data['url'], 'String');
79
+ }
80
+ if (data.hasOwnProperty('events')) {
81
+ obj['events'] = _ApiClient["default"].convertToType(data['events'], ['String']);
82
+ }
83
+ if (data.hasOwnProperty('active')) {
84
+ obj['active'] = _ApiClient["default"].convertToType(data['active'], 'Boolean');
85
+ }
86
+ if (data.hasOwnProperty('division_id')) {
87
+ obj['division_id'] = _ApiClient["default"].convertToType(data['division_id'], 'String');
88
+ }
89
+ }
90
+ return obj;
91
+ }
92
+
93
+ /**
94
+ * Validates the JSON data with respect to <code>Webhook</code>.
95
+ * @param {Object} data The plain JavaScript object bearing properties of interest.
96
+ * @return {boolean} to indicate whether the JSON data is valid with respect to <code>Webhook</code>.
97
+ */
98
+ }, {
99
+ key: "validateJSON",
100
+ value: function validateJSON(data) {
101
+ // check to make sure all required properties are present in the JSON string
102
+ var _iterator = _createForOfIteratorHelper(Webhook.RequiredProperties),
103
+ _step;
104
+ try {
105
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
106
+ var property = _step.value;
107
+ if (!data.hasOwnProperty(property)) {
108
+ throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
109
+ }
110
+ }
111
+ // ensure the json data is a string
112
+ } catch (err) {
113
+ _iterator.e(err);
114
+ } finally {
115
+ _iterator.f();
116
+ }
117
+ if (data['name'] && !(typeof data['name'] === 'string' || data['name'] instanceof String)) {
118
+ throw new Error("Expected the field `name` to be a primitive type in the JSON string but got " + data['name']);
119
+ }
120
+ // ensure the json data is a string
121
+ if (data['url'] && !(typeof data['url'] === 'string' || data['url'] instanceof String)) {
122
+ throw new Error("Expected the field `url` to be a primitive type in the JSON string but got " + data['url']);
123
+ }
124
+ // ensure the json data is an array
125
+ if (!Array.isArray(data['events'])) {
126
+ throw new Error("Expected the field `events` to be an array in the JSON data but got " + data['events']);
127
+ }
128
+ // ensure the json data is a string
129
+ if (data['division_id'] && !(typeof data['division_id'] === 'string' || data['division_id'] instanceof String)) {
130
+ throw new Error("Expected the field `division_id` to be a primitive type in the JSON string but got " + data['division_id']);
131
+ }
132
+ return true;
133
+ }
134
+ }]);
135
+ }();
136
+ Webhook.RequiredProperties = ["name", "url", "events"];
137
+
138
+ /**
139
+ * Descriptive name for this webhook
140
+ * @member {String} name
141
+ */
142
+ Webhook.prototype['name'] = undefined;
143
+
144
+ /**
145
+ * HTTPS URL where webhook events will be sent
146
+ * @member {String} url
147
+ */
148
+ Webhook.prototype['url'] = undefined;
149
+
150
+ /**
151
+ * List of events to subscribe to. Valid events: check.status_changed, screening.status_changed, screening.archived, package.created, package.updated, profile.created, profile.updated, division.created, division.updated
152
+ * @member {Array.<module:model/Webhook.EventsEnum>} events
153
+ */
154
+ Webhook.prototype['events'] = undefined;
155
+
156
+ /**
157
+ * Whether the webhook is active
158
+ * @member {Boolean} active
159
+ * @default true
160
+ */
161
+ Webhook.prototype['active'] = true;
162
+
163
+ /**
164
+ * Division ID to create webhook for (optional)
165
+ * @member {String} division_id
166
+ */
167
+ Webhook.prototype['division_id'] = undefined;
168
+
169
+ /**
170
+ * Allowed values for the <code>events</code> property.
171
+ * @enum {String}
172
+ * @readonly
173
+ */
174
+ Webhook['EventsEnum'] = {
175
+ /**
176
+ * value: "check.status_changed"
177
+ * @const
178
+ */
179
+ "check.status_changed": "check.status_changed",
180
+ /**
181
+ * value: "screening.status_changed"
182
+ * @const
183
+ */
184
+ "screening.status_changed": "screening.status_changed",
185
+ /**
186
+ * value: "screening.archived"
187
+ * @const
188
+ */
189
+ "screening.archived": "screening.archived",
190
+ /**
191
+ * value: "package.created"
192
+ * @const
193
+ */
194
+ "package.created": "package.created",
195
+ /**
196
+ * value: "package.updated"
197
+ * @const
198
+ */
199
+ "package.updated": "package.updated",
200
+ /**
201
+ * value: "profile.created"
202
+ * @const
203
+ */
204
+ "profile.created": "profile.created",
205
+ /**
206
+ * value: "profile.updated"
207
+ * @const
208
+ */
209
+ "profile.updated": "profile.updated",
210
+ /**
211
+ * value: "division.created"
212
+ * @const
213
+ */
214
+ "division.created": "division.created",
215
+ /**
216
+ * value: "division.updated"
217
+ * @const
218
+ */
219
+ "division.updated": "division.updated"
220
+ };
221
+ var _default = exports["default"] = Webhook;