@ibm-cloud/ibm_dph_services 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dph/v1.js ADDED
@@ -0,0 +1,1677 @@
1
+ "use strict";
2
+ /**
3
+ * (C) Copyright IBM Corp. 2024.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ var __extends = (this && this.__extends) || (function () {
18
+ var extendStatics = function (d, b) {
19
+ extendStatics = Object.setPrototypeOf ||
20
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
21
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
22
+ return extendStatics(d, b);
23
+ };
24
+ return function (d, b) {
25
+ if (typeof b !== "function" && b !== null)
26
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
27
+ extendStatics(d, b);
28
+ function __() { this.constructor = d; }
29
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
30
+ };
31
+ })();
32
+ var __assign = (this && this.__assign) || function () {
33
+ __assign = Object.assign || function(t) {
34
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
35
+ s = arguments[i];
36
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
37
+ t[p] = s[p];
38
+ }
39
+ return t;
40
+ };
41
+ return __assign.apply(this, arguments);
42
+ };
43
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
44
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
45
+ return new (P || (P = Promise))(function (resolve, reject) {
46
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
47
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
48
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
49
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
50
+ });
51
+ };
52
+ var __generator = (this && this.__generator) || function (thisArg, body) {
53
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
54
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
55
+ function verb(n) { return function (v) { return step([n, v]); }; }
56
+ function step(op) {
57
+ if (f) throw new TypeError("Generator is already executing.");
58
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
59
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
60
+ if (y = 0, t) op = [op[0] & 2, t.value];
61
+ switch (op[0]) {
62
+ case 0: case 1: t = op; break;
63
+ case 4: _.label++; return { value: op[1], done: false };
64
+ case 5: _.label++; y = op[1]; op = [0]; continue;
65
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
66
+ default:
67
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
68
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
69
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
70
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
71
+ if (t[2]) _.ops.pop();
72
+ _.trys.pop(); continue;
73
+ }
74
+ op = body.call(thisArg, _);
75
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
76
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
77
+ }
78
+ };
79
+ /**
80
+ * IBM OpenAPI SDK Code Generator Version: 3.92.0-af5c89a5-20240617-153232
81
+ */
82
+ /* eslint-disable max-classes-per-file */
83
+ /* eslint-disable no-await-in-loop */
84
+ var extend = require("extend");
85
+ var ibm_cloud_sdk_core_1 = require("ibm-cloud-sdk-core");
86
+ var common_1 = require("../lib/common");
87
+ var commonConstants = require('../lib/common.constants');
88
+ var SERVICE_NAME = commonConstants.SERVICE_NAME, CONTENT_TYPE_JSON = commonConstants.CONTENT_TYPE_JSON, CONTENT_TYPE_PATCH_JSON = commonConstants.CONTENT_TYPE_PATCH_JSON, SERVICE_VERSION = commonConstants.SERVICE_VERSION, INITIALIZE = commonConstants.INITIALIZE, URL_GET_INITIALIZE_STATUS = commonConstants.URL_GET_INITIALIZE_STATUS, HTTP_GET = commonConstants.HTTP_GET, GET_INITIALIZE_STATUS = commonConstants.GET_INITIALIZE_STATUS, URL_CREATE_DATA_PRODUCT = commonConstants.URL_CREATE_DATA_PRODUCT, CREATE_DATA_PRODUCT = commonConstants.CREATE_DATA_PRODUCT, HTTP_POST = commonConstants.HTTP_POST, GET_SERVICEID_CREDENTIALS = commonConstants.GET_SERVICEID_CREDENTIALS, URL_GET_SERVICEID_CREDENTIALS = commonConstants.URL_GET_SERVICEID_CREDENTIALS, URL_INITIALIZE = commonConstants.URL_INITIALIZE, MANAGE_APIKEYS = commonConstants.MANAGE_APIKEYS, URL_MANAGE_APIKEYS = commonConstants.URL_MANAGE_APIKEYS, LIST_DATA_PRODUCTS = commonConstants.LIST_DATA_PRODUCTS, URL_LIST_DATA_PRODUCTS = commonConstants.URL_LIST_DATA_PRODUCTS, GET_DATA_PRODUCT = commonConstants.GET_DATA_PRODUCT, URL_GET_DATA_PRODUCT = commonConstants.URL_GET_DATA_PRODUCT, COMPLETE_DRAFT_CONTRACT_TERMS_DOCUMENT = commonConstants.COMPLETE_DRAFT_CONTRACT_TERMS_DOCUMENT, URL_COMPLETE_DRAFT_CONTRACT_TERMS_DOCUMENT = commonConstants.URL_COMPLETE_DRAFT_CONTRACT_TERMS_DOCUMENT, LIST_DATA_PRODUCT_DRAFTS = commonConstants.LIST_DATA_PRODUCT_DRAFTS, URL_LIST_DATA_PRODUCT_DRAFTS = commonConstants.URL_LIST_DATA_PRODUCT_DRAFTS, CREATE_DATA_PRODUCT_DRAFT = commonConstants.CREATE_DATA_PRODUCT_DRAFT, URL_CREATE_DATA_PRODUCT_DRAFT = commonConstants.URL_CREATE_DATA_PRODUCT_DRAFT, CREATE_DRAFT_CONTRACT_TERMS_DOCUMENT = commonConstants.CREATE_DRAFT_CONTRACT_TERMS_DOCUMENT, URL_CREATE_DRAFT_CONTRACT_TERMS_DOCUMENT = commonConstants.URL_CREATE_DRAFT_CONTRACT_TERMS_DOCUMENT, GET_DATA_PRODUCT_DRAFT = commonConstants.GET_DATA_PRODUCT_DRAFT, URL_GET_DATA_PRODUCT_DRAFT = commonConstants.URL_GET_DATA_PRODUCT_DRAFT, DLETE_DATA_PRODUCT_DRAFT = commonConstants.DLETE_DATA_PRODUCT_DRAFT, URL_DELETE_DATA_PRODUCT_DRAFT = commonConstants.URL_DELETE_DATA_PRODUCT_DRAFT, HTTP_DELETE = commonConstants.HTTP_DELETE, UPDATE_DATA_PRODUCT_DRAFT = commonConstants.UPDATE_DATA_PRODUCT_DRAFT, URL_UPDATE_DATA_PRODUCT_DRAFT = commonConstants.URL_UPDATE_DATA_PRODUCT_DRAFT, HTTP_PATCH = commonConstants.HTTP_PATCH, GET_DRAFT_CONTRACT_TERMS_DOCUMENT = commonConstants.GET_DRAFT_CONTRACT_TERMS_DOCUMENT, URL_GET_DRAFT_CONTRACT_TERMS_DOCUMENT = commonConstants.URL_GET_DRAFT_CONTRACT_TERMS_DOCUMENT, DELETE_DRAFT_CONTRACT_TERMS_DOCUMENT = commonConstants.DELETE_DRAFT_CONTRACT_TERMS_DOCUMENT, URL_DELETE_DRAFT_CONTRACT_TERMS_DOCUMENT = commonConstants.URL_DELETE_DRAFT_CONTRACT_TERMS_DOCUMENT, UPDATE_DRAFT_CONTRACT_TERMS_DOCUMENT = commonConstants.UPDATE_DRAFT_CONTRACT_TERMS_DOCUMENT, URL_UPDATE_DRAFT_CONTRACT_TERMS_DOCUMENT = commonConstants.URL_UPDATE_DRAFT_CONTRACT_TERMS_DOCUMENT, PUBLISH_DATA_PRODUCT_DRAFT = commonConstants.PUBLISH_DATA_PRODUCT_DRAFT, URL_PUBLISH_DATA_PRODUCT_DRAFT = commonConstants.URL_PUBLISH_DATA_PRODUCT_DRAFT, GET_DATA_PRODUCT_RELEASE = commonConstants.GET_DATA_PRODUCT_RELEASE, URL_GET_DATA_PRODUCT_RELEASE = commonConstants.URL_GET_DATA_PRODUCT_RELEASE, UPDATE_DATA_PRODUCT_RELEASE = commonConstants.UPDATE_DATA_PRODUCT_RELEASE, URL_UPDATE_DATA_PRODUCT_RELEASE = commonConstants.URL_UPDATE_DATA_PRODUCT_RELEASE, GET_RELEASE_CONTRACT_TERMS_DOCUMENT = commonConstants.GET_RELEASE_CONTRACT_TERMS_DOCUMENT, URL_GET_RELEASE_CONTRACT_TERMS_DOCUMENT = commonConstants.URL_GET_RELEASE_CONTRACT_TERMS_DOCUMENT, LIST_DATA_PRODUCT_RELEASES = commonConstants.LIST_DATA_PRODUCT_RELEASES, URL_LIST_DATA_PRODUCT_RELEASES = commonConstants.URL_LIST_DATA_PRODUCT_RELEASES, RETIRE_DATA_PRODUCT_RELEASE = commonConstants.RETIRE_DATA_PRODUCT_RELEASE, URL_RETIRE_DATA_PRODUCT_RELEASE = commonConstants.URL_RETIRE_DATA_PRODUCT_RELEASE;
89
+ /**
90
+ * Data Product Hub API Service
91
+ *
92
+ * API Version: 1.0.1
93
+ */
94
+ var DphV1 = /** @class */ (function (_super) {
95
+ __extends(DphV1, _super);
96
+ /**
97
+ * Construct a DphV1 object.
98
+ *
99
+ * @param {Object} options - Options for the service.
100
+ * @param {string} [options.serviceUrl] - The base URL for the service
101
+ * @param {OutgoingHttpHeaders} [options.headers] - Default headers that shall be included with every request to the service.
102
+ * @param {Authenticator} options.authenticator - The Authenticator object used to authenticate requests to the service
103
+ * @constructor
104
+ * @returns {DphV1}
105
+ */
106
+ function DphV1(options) {
107
+ var _this = this;
108
+ options = options || {};
109
+ _this = _super.call(this, options) || this;
110
+ if (options.serviceUrl) {
111
+ _this.setServiceUrl(options.serviceUrl);
112
+ }
113
+ return _this;
114
+ }
115
+ /*************************
116
+ * Factory method
117
+ ************************/
118
+ /**
119
+ * Constructs an instance of DphV1 with passed in options and external configuration.
120
+ *
121
+ * @param {UserOptions} [options] - The parameters to send to the service.
122
+ * @param {string} [options.serviceName] - The name of the service to configure
123
+ * @param {Authenticator} [options.authenticator] - The Authenticator object used to authenticate requests to the service
124
+ * @param {string} [options.serviceUrl] - The base URL for the service
125
+ * @returns {DphV1}
126
+ */
127
+ DphV1.newInstance = function (options) {
128
+ options = options || {};
129
+ if (!options.serviceName) {
130
+ options.serviceName = SERVICE_NAME;
131
+ }
132
+ if (!options.authenticator) {
133
+ options.authenticator = (0, ibm_cloud_sdk_core_1.getAuthenticatorFromEnvironment)(options.serviceName);
134
+ }
135
+ var service = new DphV1(options);
136
+ service.configureService(options.serviceName);
137
+ if (options.serviceUrl) {
138
+ service.setServiceUrl(options.serviceUrl);
139
+ }
140
+ return service;
141
+ };
142
+ /*************************
143
+ * configuration
144
+ ************************/
145
+ /**
146
+ * Get resource initialization status.
147
+ *
148
+ * Use this API to get the status of resource initialization in Data Product Hub.<br/><br/>If the data product catalog
149
+ * exists but has never been initialized, the status will be "not_started".<br/><br/>If the data product catalog
150
+ * exists and has been or is being initialized, the response will contain the status of the last or current
151
+ * initialization. If the initialization failed, the "errors" and "trace" fields will contain the error(s) encountered
152
+ * during the initialization, including the ID to trace the error(s).<br/><br/>If the data product catalog doesn't
153
+ * exist, an HTTP 404 response is returned.
154
+ *
155
+ * @param {Object} [params] - The parameters to send to the service.
156
+ * @param {string} [params.containerId] - Container ID of the data product catalog. If not supplied, the data product
157
+ * catalog is looked up by using the uid of the default data product catalog.
158
+ * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
159
+ * @returns {Promise<DphV1.Response<DphV1.InitializeResource>>}
160
+ */
161
+ DphV1.prototype.getInitializeStatus = function (params) {
162
+ var _params = __assign({}, params);
163
+ var _requiredParams = [];
164
+ var _validParams = ['containerId', 'headers'];
165
+ var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
166
+ if (_validationErrors) {
167
+ return Promise.reject(_validationErrors);
168
+ }
169
+ var query = {
170
+ 'container.id': _params.containerId,
171
+ };
172
+ var sdkHeaders = (0, common_1.getSdkHeaders)(SERVICE_NAME, SERVICE_VERSION, GET_INITIALIZE_STATUS);
173
+ var parameters = {
174
+ options: {
175
+ url: URL_GET_INITIALIZE_STATUS,
176
+ method: HTTP_GET,
177
+ qs: query,
178
+ },
179
+ defaultOptions: extend(true, {}, this.baseOptions, {
180
+ headers: extend(true, sdkHeaders, {
181
+ 'Accept': CONTENT_TYPE_JSON,
182
+ }, _params.headers),
183
+ }),
184
+ };
185
+ return this.createRequest(parameters);
186
+ };
187
+ /**
188
+ * Get service id credentials.
189
+ *
190
+ * Use this API to get the information of service id credentials in Data Product Hub.
191
+ *
192
+ * @param {Object} [params] - The parameters to send to the service.
193
+ * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
194
+ * @returns {Promise<DphV1.Response<DphV1.ServiceIdCredentials>>}
195
+ */
196
+ DphV1.prototype.getServiceIdCredentials = function (params) {
197
+ var _params = __assign({}, params);
198
+ var _requiredParams = [];
199
+ var _validParams = ['headers'];
200
+ var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
201
+ if (_validationErrors) {
202
+ return Promise.reject(_validationErrors);
203
+ }
204
+ var sdkHeaders = (0, common_1.getSdkHeaders)(SERVICE_NAME, SERVICE_VERSION, GET_SERVICEID_CREDENTIALS);
205
+ var parameters = {
206
+ options: {
207
+ url: URL_GET_SERVICEID_CREDENTIALS,
208
+ method: HTTP_GET,
209
+ },
210
+ defaultOptions: extend(true, {}, this.baseOptions, {
211
+ headers: extend(true, sdkHeaders, {
212
+ 'Accept': CONTENT_TYPE_JSON,
213
+ }, _params.headers),
214
+ }),
215
+ };
216
+ return this.createRequest(parameters);
217
+ };
218
+ /**
219
+ * Initialize resources.
220
+ *
221
+ * Use this API to initialize default assets for data product hub. <br/><br/>You can initialize:
222
+ * <br/><ul><li>`delivery_methods` - Methods through which data product parts can be delivered to consumers of the
223
+ * data product hub</li><li>`domains_multi_industry` - Taxonomy of domains and use cases applicable to multiple
224
+ * industries</li><li>`data_product_samples` - Sample data products used to illustrate capabilities of the data
225
+ * product hub</li><li>`workflows` - Workflows to enable restricted data products</li><li>`project` - A default
226
+ * project for exporting data assets to files</li></ul><br/><br/>If a resource depends on resources that are not
227
+ * specified in the request, these dependent resources will be automatically initialized. E.g., initializing
228
+ * `data_product_samples` will also initialize `domains_multi_industry` and `delivery_methods` even if they are not
229
+ * specified in the request because it depends on them.<br/><br/>If initializing the data product hub for the first
230
+ * time, do not specify a container. The default data product catalog will be created.<br/>For first time
231
+ * initialization, it is recommended that at least `delivery_methods` and `domains_multi_industry` is included in the
232
+ * initialize operation.<br/><br/>If the data product hub has already been initialized, you may call this API again to
233
+ * initialize new resources, such as new delivery methods. In this case, specify the default data product catalog
234
+ * container information.
235
+ *
236
+ * @param {Object} [params] - The parameters to send to the service.
237
+ * @param {ContainerReference} [params.container] - Container reference.
238
+ * @param {string[]} [params.include] - List of configuration options to (re-)initialize.
239
+ * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
240
+ * @returns {Promise<DphV1.Response<DphV1.InitializeResource>>}
241
+ */
242
+ DphV1.prototype.initialize = function (params) {
243
+ var _params = __assign({}, params);
244
+ var _requiredParams = [];
245
+ var _validParams = ['container', 'include', 'headers'];
246
+ var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
247
+ if (_validationErrors) {
248
+ return Promise.reject(_validationErrors);
249
+ }
250
+ var body = {
251
+ 'container': _params.container,
252
+ 'include': _params.include,
253
+ };
254
+ var sdkHeaders = (0, common_1.getSdkHeaders)(SERVICE_NAME, SERVICE_VERSION, INITIALIZE);
255
+ var parameters = {
256
+ options: {
257
+ url: URL_INITIALIZE,
258
+ method: HTTP_POST,
259
+ body: body,
260
+ },
261
+ defaultOptions: extend(true, {}, this.baseOptions, {
262
+ headers: extend(true, sdkHeaders, {
263
+ 'Accept': CONTENT_TYPE_JSON,
264
+ 'Content-Type': CONTENT_TYPE_JSON,
265
+ }, _params.headers),
266
+ }),
267
+ };
268
+ return this.createRequest(parameters);
269
+ };
270
+ /**
271
+ * Rotate credentials for a Data Product Hub instance.
272
+ *
273
+ * Use this API to rotate credentials for a Data Product Hub instance.
274
+ *
275
+ * @param {Object} [params] - The parameters to send to the service.
276
+ * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
277
+ * @returns {Promise<DphV1.Response<DphV1.EmptyObject>>}
278
+ */
279
+ DphV1.prototype.manageApiKeys = function (params) {
280
+ var _params = __assign({}, params);
281
+ var _requiredParams = [];
282
+ var _validParams = ['headers'];
283
+ var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
284
+ if (_validationErrors) {
285
+ return Promise.reject(_validationErrors);
286
+ }
287
+ var sdkHeaders = (0, common_1.getSdkHeaders)(SERVICE_NAME, SERVICE_VERSION, MANAGE_APIKEYS);
288
+ var parameters = {
289
+ options: {
290
+ url: URL_MANAGE_APIKEYS,
291
+ method: HTTP_POST,
292
+ },
293
+ defaultOptions: extend(true, {}, this.baseOptions, {
294
+ headers: extend(true, sdkHeaders, {}, _params.headers),
295
+ }),
296
+ };
297
+ return this.createRequest(parameters);
298
+ };
299
+ /*************************
300
+ * dataProducts
301
+ ************************/
302
+ /**
303
+ * Retrieve a list of data products.
304
+ *
305
+ * @param {Object} [params] - The parameters to send to the service.
306
+ * @param {number} [params.limit] - Limit the number of data products in the results. The maximum limit is 200.
307
+ * @param {string} [params.start] - Start token for pagination.
308
+ * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
309
+ * @returns {Promise<DphV1.Response<DphV1.DataProductSummaryCollection>>}
310
+ */
311
+ DphV1.prototype.listDataProducts = function (params) {
312
+ var _params = __assign({}, params);
313
+ var _requiredParams = [];
314
+ var _validParams = ['limit', 'start', 'headers'];
315
+ var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
316
+ if (_validationErrors) {
317
+ return Promise.reject(_validationErrors);
318
+ }
319
+ var query = {
320
+ 'limit': _params.limit,
321
+ 'start': _params.start,
322
+ };
323
+ var sdkHeaders = (0, common_1.getSdkHeaders)(SERVICE_NAME, SERVICE_VERSION, LIST_DATA_PRODUCTS);
324
+ var parameters = {
325
+ options: {
326
+ url: URL_LIST_DATA_PRODUCTS,
327
+ method: HTTP_GET,
328
+ qs: query,
329
+ },
330
+ defaultOptions: extend(true, {}, this.baseOptions, {
331
+ headers: extend(true, sdkHeaders, {
332
+ 'Accept': CONTENT_TYPE_JSON,
333
+ }, _params.headers),
334
+ }),
335
+ };
336
+ return this.createRequest(parameters);
337
+ };
338
+ /**
339
+ * Create a new data product.
340
+ *
341
+ * Use this API to create a new data product.<br/><br/>Provide the initial draft of the data
342
+ * product.<br/><br/>Required fields:<br/><br/>- name<br/>- container<br/><br/>If `version` is not specified, the
343
+ * default version **1.0.0** will be used.<br/><br/>The `domain` is optional.
344
+ *
345
+ * @param {Object} params - The parameters to send to the service.
346
+ * @param {DataProductVersionPrototype[]} params.drafts - Collection of data products drafts to add to data product.
347
+ * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
348
+ * @returns {Promise<DphV1.Response<DphV1.DataProduct>>}
349
+ */
350
+ DphV1.prototype.createDataProduct = function (params) {
351
+ var _params = __assign({}, params);
352
+ var _requiredParams = ['drafts'];
353
+ var _validParams = ['drafts', 'headers'];
354
+ var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
355
+ if (_validationErrors) {
356
+ return Promise.reject(_validationErrors);
357
+ }
358
+ var body = {
359
+ 'drafts': _params.drafts,
360
+ };
361
+ var sdkHeaders = (0, common_1.getSdkHeaders)(SERVICE_NAME, SERVICE_VERSION, CREATE_DATA_PRODUCT);
362
+ var parameters = {
363
+ options: {
364
+ url: URL_CREATE_DATA_PRODUCT,
365
+ method: HTTP_POST,
366
+ body: body,
367
+ },
368
+ defaultOptions: extend(true, {}, this.baseOptions, {
369
+ headers: extend(true, sdkHeaders, {
370
+ 'Accept': CONTENT_TYPE_JSON,
371
+ 'Content-Type': CONTENT_TYPE_JSON,
372
+ }, _params.headers),
373
+ }),
374
+ };
375
+ return this.createRequest(parameters);
376
+ };
377
+ /**
378
+ * Retrieve a data product identified by id.
379
+ *
380
+ * @param {Object} params - The parameters to send to the service.
381
+ * @param {string} params.dataProductId - Data product ID.
382
+ * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
383
+ * @returns {Promise<DphV1.Response<DphV1.DataProduct>>}
384
+ */
385
+ DphV1.prototype.getDataProduct = function (params) {
386
+ var _params = __assign({}, params);
387
+ var _requiredParams = ['dataProductId'];
388
+ var _validParams = ['dataProductId', 'headers'];
389
+ var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
390
+ if (_validationErrors) {
391
+ return Promise.reject(_validationErrors);
392
+ }
393
+ var path = {
394
+ 'data_product_id': _params.dataProductId,
395
+ };
396
+ var sdkHeaders = (0, common_1.getSdkHeaders)(SERVICE_NAME, SERVICE_VERSION, GET_DATA_PRODUCT);
397
+ var parameters = {
398
+ options: {
399
+ url: URL_GET_DATA_PRODUCT,
400
+ method: HTTP_GET,
401
+ path: path,
402
+ },
403
+ defaultOptions: extend(true, {}, this.baseOptions, {
404
+ headers: extend(true, sdkHeaders, {
405
+ 'Accept': CONTENT_TYPE_JSON,
406
+ }, _params.headers),
407
+ }),
408
+ };
409
+ return this.createRequest(parameters);
410
+ };
411
+ /*************************
412
+ * dataProductDrafts
413
+ ************************/
414
+ /**
415
+ * Complete a contract document upload operation.
416
+ *
417
+ * After uploading a file to the provided signed URL, call this endpoint to mark the upload as complete. After the
418
+ * upload operation is marked as complete, the file is available to download.
419
+ * - After the upload is marked as complete, the returned URL is displayed in the "url" field. The signed URL is used
420
+ * to download the document.
421
+ * - Calling complete on referential documents results in an error.
422
+ * - Calling complete on attachment documents for which the file has not been uploaded will result in an error.
423
+ *
424
+ * @param {Object} params - The parameters to send to the service.
425
+ * @param {string} params.dataProductId - Data product ID. Use '-' to skip specifying the data product ID explicitly.
426
+ * @param {string} params.draftId - Data product draft id.
427
+ * @param {string} params.contractTermsId - Contract terms id.
428
+ * @param {string} params.documentId - Document id.
429
+ * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
430
+ * @returns {Promise<DphV1.Response<DphV1.ContractTermsDocument>>}
431
+ */
432
+ DphV1.prototype.completeDraftContractTermsDocument = function (params) {
433
+ var _params = __assign({}, params);
434
+ var _requiredParams = ['dataProductId', 'draftId', 'contractTermsId', 'documentId'];
435
+ var _validParams = ['dataProductId', 'draftId', 'contractTermsId', 'documentId', 'headers'];
436
+ var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
437
+ if (_validationErrors) {
438
+ return Promise.reject(_validationErrors);
439
+ }
440
+ var path = {
441
+ 'data_product_id': _params.dataProductId,
442
+ 'draft_id': _params.draftId,
443
+ 'contract_terms_id': _params.contractTermsId,
444
+ 'document_id': _params.documentId,
445
+ };
446
+ var sdkHeaders = (0, common_1.getSdkHeaders)(SERVICE_NAME, SERVICE_VERSION, COMPLETE_DRAFT_CONTRACT_TERMS_DOCUMENT);
447
+ var parameters = {
448
+ options: {
449
+ url: URL_COMPLETE_DRAFT_CONTRACT_TERMS_DOCUMENT,
450
+ method: HTTP_POST,
451
+ path: path,
452
+ },
453
+ defaultOptions: extend(true, {}, this.baseOptions, {
454
+ headers: extend(true, sdkHeaders, {
455
+ 'Accept': CONTENT_TYPE_JSON,
456
+ }, _params.headers),
457
+ }),
458
+ };
459
+ return this.createRequest(parameters);
460
+ };
461
+ /**
462
+ * Retrieve a list of data product drafts.
463
+ *
464
+ * @param {Object} params - The parameters to send to the service.
465
+ * @param {string} params.dataProductId - Data product ID. Use '-' to skip specifying the data product ID explicitly.
466
+ * @param {string} [params.assetContainerId] - Filter the list of data product drafts by container id.
467
+ * @param {string} [params.version] - Filter the list of data product drafts by version number.
468
+ * @param {number} [params.limit] - Limit the number of data product drafts in the results. The maximum limit is 200.
469
+ * @param {string} [params.start] - Start token for pagination.
470
+ * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
471
+ * @returns {Promise<DphV1.Response<DphV1.DataProductDraftCollection>>}
472
+ */
473
+ DphV1.prototype.listDataProductDrafts = function (params) {
474
+ var _params = __assign({}, params);
475
+ var _requiredParams = ['dataProductId'];
476
+ var _validParams = [
477
+ 'dataProductId',
478
+ 'assetContainerId',
479
+ 'version',
480
+ 'limit',
481
+ 'start',
482
+ 'headers',
483
+ ];
484
+ var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
485
+ if (_validationErrors) {
486
+ return Promise.reject(_validationErrors);
487
+ }
488
+ var query = {
489
+ 'asset.container.id': _params.assetContainerId,
490
+ 'version': _params.version,
491
+ 'limit': _params.limit,
492
+ 'start': _params.start,
493
+ };
494
+ var path = {
495
+ 'data_product_id': _params.dataProductId,
496
+ };
497
+ var sdkHeaders = (0, common_1.getSdkHeaders)(SERVICE_NAME, SERVICE_VERSION, LIST_DATA_PRODUCT_DRAFTS);
498
+ var parameters = {
499
+ options: {
500
+ url: URL_LIST_DATA_PRODUCT_DRAFTS,
501
+ method: HTTP_GET,
502
+ qs: query,
503
+ path: path,
504
+ },
505
+ defaultOptions: extend(true, {}, this.baseOptions, {
506
+ headers: extend(true, sdkHeaders, {
507
+ 'Accept': CONTENT_TYPE_JSON,
508
+ }, _params.headers),
509
+ }),
510
+ };
511
+ return this.createRequest(parameters);
512
+ };
513
+ /**
514
+ * Create a new draft of an existing data product.
515
+ *
516
+ * @param {Object} params - The parameters to send to the service.
517
+ * @param {string} params.dataProductId - Data product ID.
518
+ * @param {AssetPrototype} params.asset - New asset input properties.
519
+ * @param {string} [params.version] - The data product version number.
520
+ * @param {string} [params.state] - The state of the data product version. If not specified, the data product version
521
+ * will be created in `draft` state.
522
+ * @param {DataProductIdentity} [params.dataProduct] - Data product identifier.
523
+ * @param {string} [params.name] - The name that refers to the new data product version. If this is a new data
524
+ * product, this value must be specified. If this is a new version of an existing data product, the name will default
525
+ * to the name of the previous data product version. A name can contain letters, numbers, understores, dashes, spaces
526
+ * or periods. A name must contain at least one non-space character.
527
+ * @param {string} [params.description] - Description of the data product version. If this is a new version of an
528
+ * existing data product, the description will default to the description of the previous version of the data product.
529
+ * @param {string[]} [params.tags] - Tags on the data product.
530
+ * @param {UseCase[]} [params.useCases] - A list of use cases associated with the data product version.
531
+ * @param {string[]} [params.types] - Types of parts on the data product.
532
+ * @param {DataProductContractTerms[]} [params.contractTerms] - Contract terms binding various aspects of the data
533
+ * product.
534
+ * @param {boolean} [params.isRestricted] - Indicates whether the data product is restricted or not. A restricted data
535
+ * product indicates that orders of the data product requires explicit approval before data is delivered.
536
+ * @param {Domain} [params.domain] - Domain that the data product version belongs to. If this is the first version of
537
+ * a data product, this field is required. If this is a new version of an existing data product, the domain will
538
+ * default to the domain of the previous version of the data product.
539
+ * @param {DataProductPart[]} [params.partsOut] - The outgoing parts of this data product version to be delivered to
540
+ * consumers. If this is the first version of a data product, this field defaults to an empty list. If this is a new
541
+ * version of an existing data product, the data product parts will default to the parts list from the previous
542
+ * version of the data product.
543
+ * @param {DataProductWorkflows} [params.workflows] - The workflows associated with the data product version.
544
+ * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
545
+ * @returns {Promise<DphV1.Response<DphV1.DataProductVersion>>}
546
+ */
547
+ DphV1.prototype.createDataProductDraft = function (params) {
548
+ var _params = __assign({}, params);
549
+ var _requiredParams = ['dataProductId', 'asset'];
550
+ var _validParams = [
551
+ 'dataProductId',
552
+ 'asset',
553
+ 'version',
554
+ 'state',
555
+ 'dataProduct',
556
+ 'name',
557
+ 'description',
558
+ 'tags',
559
+ 'useCases',
560
+ 'types',
561
+ 'contractTerms',
562
+ 'isRestricted',
563
+ 'domain',
564
+ 'partsOut',
565
+ 'workflows',
566
+ 'headers',
567
+ ];
568
+ var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
569
+ if (_validationErrors) {
570
+ return Promise.reject(_validationErrors);
571
+ }
572
+ var body = {
573
+ 'asset': _params.asset,
574
+ 'version': _params.version,
575
+ 'state': _params.state,
576
+ 'data_product': _params.dataProduct,
577
+ 'name': _params.name,
578
+ 'description': _params.description,
579
+ 'tags': _params.tags,
580
+ 'use_cases': _params.useCases,
581
+ 'types': _params.types,
582
+ 'contract_terms': _params.contractTerms,
583
+ 'is_restricted': _params.isRestricted,
584
+ 'domain': _params.domain,
585
+ 'parts_out': _params.partsOut,
586
+ 'workflows': _params.workflows,
587
+ };
588
+ var path = {
589
+ 'data_product_id': _params.dataProductId,
590
+ };
591
+ var sdkHeaders = (0, common_1.getSdkHeaders)(SERVICE_NAME, SERVICE_VERSION, CREATE_DATA_PRODUCT_DRAFT);
592
+ var parameters = {
593
+ options: {
594
+ url: URL_CREATE_DATA_PRODUCT_DRAFT,
595
+ method: HTTP_POST,
596
+ body: body,
597
+ path: path,
598
+ },
599
+ defaultOptions: extend(true, {}, this.baseOptions, {
600
+ headers: extend(true, sdkHeaders, {
601
+ 'Accept': CONTENT_TYPE_JSON,
602
+ 'Content-Type': CONTENT_TYPE_JSON,
603
+ }, _params.headers),
604
+ }),
605
+ };
606
+ return this.createRequest(parameters);
607
+ };
608
+ /**
609
+ * Upload a contract document to the data product draft contract terms.
610
+ *
611
+ * - If the request object contains a "url" parameter, a referential document is created to store the provided url.
612
+ * - If the request object does not contain a "url" parameter, an attachment document is created, and a signed url
613
+ * will be returned in an "upload_url" parameter. The data product producer can upload the document using the provided
614
+ * "upload_url". After the upload is completed, call "complete_contract_terms_document" for the given document needs
615
+ * to be called to mark the upload as completed. After completion of the upload, "get_contract_terms_document" for the
616
+ * given document returns a signed "url" parameter that can be used to download the attachment document.
617
+ *
618
+ * @param {Object} params - The parameters to send to the service.
619
+ * @param {string} params.dataProductId - Data product ID. Use '-' to skip specifying the data product ID explicitly.
620
+ * @param {string} params.draftId - Data product draft id.
621
+ * @param {string} params.contractTermsId - Contract terms id.
622
+ * @param {string} params.type - Type of the contract document.
623
+ * @param {string} params.name - Name of the contract document.
624
+ * @param {string} params.id - Id uniquely identifying this document within the contract terms instance.
625
+ * @param {string} [params.url] - URL that can be used to retrieve the contract document.
626
+ * @param {ContractTermsDocumentAttachment} [params.attachment] - Attachment associated witht the document.
627
+ * @param {string} [params.uploadUrl] - URL which can be used to upload document file.
628
+ * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
629
+ * @returns {Promise<DphV1.Response<DphV1.ContractTermsDocument>>}
630
+ */
631
+ DphV1.prototype.createDraftContractTermsDocument = function (params) {
632
+ var _params = __assign({}, params);
633
+ var _requiredParams = ['dataProductId', 'draftId', 'contractTermsId', 'type', 'name', 'id'];
634
+ var _validParams = [
635
+ 'dataProductId',
636
+ 'draftId',
637
+ 'contractTermsId',
638
+ 'type',
639
+ 'name',
640
+ 'id',
641
+ 'url',
642
+ 'attachment',
643
+ 'uploadUrl',
644
+ 'headers',
645
+ ];
646
+ var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
647
+ if (_validationErrors) {
648
+ return Promise.reject(_validationErrors);
649
+ }
650
+ var body = {
651
+ 'type': _params.type,
652
+ 'name': _params.name,
653
+ 'id': _params.id,
654
+ 'url': _params.url,
655
+ 'attachment': _params.attachment,
656
+ 'upload_url': _params.uploadUrl,
657
+ };
658
+ var path = {
659
+ 'data_product_id': _params.dataProductId,
660
+ 'draft_id': _params.draftId,
661
+ 'contract_terms_id': _params.contractTermsId,
662
+ };
663
+ var sdkHeaders = (0, common_1.getSdkHeaders)(SERVICE_NAME, SERVICE_VERSION, CREATE_DRAFT_CONTRACT_TERMS_DOCUMENT);
664
+ var parameters = {
665
+ options: {
666
+ url: URL_CREATE_DRAFT_CONTRACT_TERMS_DOCUMENT,
667
+ method: HTTP_POST,
668
+ body: body,
669
+ path: path,
670
+ },
671
+ defaultOptions: extend(true, {}, this.baseOptions, {
672
+ headers: extend(true, sdkHeaders, {
673
+ 'Accept': CONTENT_TYPE_JSON,
674
+ 'Content-Type': CONTENT_TYPE_JSON,
675
+ }, _params.headers),
676
+ }),
677
+ };
678
+ return this.createRequest(parameters);
679
+ };
680
+ /**
681
+ * Get a draft of an existing data product.
682
+ *
683
+ * @param {Object} params - The parameters to send to the service.
684
+ * @param {string} params.dataProductId - Data product ID. Use '-' to skip specifying the data product ID explicitly.
685
+ * @param {string} params.draftId - Data product draft id.
686
+ * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
687
+ * @returns {Promise<DphV1.Response<DphV1.DataProductVersion>>}
688
+ */
689
+ DphV1.prototype.getDataProductDraft = function (params) {
690
+ var _params = __assign({}, params);
691
+ var _requiredParams = ['dataProductId', 'draftId'];
692
+ var _validParams = ['dataProductId', 'draftId', 'headers'];
693
+ var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
694
+ if (_validationErrors) {
695
+ return Promise.reject(_validationErrors);
696
+ }
697
+ var path = {
698
+ 'data_product_id': _params.dataProductId,
699
+ 'draft_id': _params.draftId,
700
+ };
701
+ var sdkHeaders = (0, common_1.getSdkHeaders)(SERVICE_NAME, SERVICE_VERSION, GET_DATA_PRODUCT_DRAFT);
702
+ var parameters = {
703
+ options: {
704
+ url: URL_GET_DATA_PRODUCT_DRAFT,
705
+ method: HTTP_GET,
706
+ path: path,
707
+ },
708
+ defaultOptions: extend(true, {}, this.baseOptions, {
709
+ headers: extend(true, sdkHeaders, {
710
+ 'Accept': CONTENT_TYPE_JSON,
711
+ }, _params.headers),
712
+ }),
713
+ };
714
+ return this.createRequest(parameters);
715
+ };
716
+ /**
717
+ * Delete a data product draft identified by ID.
718
+ *
719
+ * @param {Object} params - The parameters to send to the service.
720
+ * @param {string} params.dataProductId - Data product ID. Use '-' to skip specifying the data product ID explicitly.
721
+ * @param {string} params.draftId - Data product draft id.
722
+ * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
723
+ * @returns {Promise<DphV1.Response<DphV1.EmptyObject>>}
724
+ */
725
+ DphV1.prototype.deleteDataProductDraft = function (params) {
726
+ var _params = __assign({}, params);
727
+ var _requiredParams = ['dataProductId', 'draftId'];
728
+ var _validParams = ['dataProductId', 'draftId', 'headers'];
729
+ var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
730
+ if (_validationErrors) {
731
+ return Promise.reject(_validationErrors);
732
+ }
733
+ var path = {
734
+ 'data_product_id': _params.dataProductId,
735
+ 'draft_id': _params.draftId,
736
+ };
737
+ var sdkHeaders = (0, common_1.getSdkHeaders)(SERVICE_NAME, SERVICE_VERSION, DLETE_DATA_PRODUCT_DRAFT);
738
+ var parameters = {
739
+ options: {
740
+ url: URL_DELETE_DATA_PRODUCT_DRAFT,
741
+ method: HTTP_DELETE,
742
+ path: path,
743
+ },
744
+ defaultOptions: extend(true, {}, this.baseOptions, {
745
+ headers: extend(true, sdkHeaders, {}, _params.headers),
746
+ }),
747
+ };
748
+ return this.createRequest(parameters);
749
+ };
750
+ /**
751
+ * Update the data product draft identified by ID.
752
+ *
753
+ * Use this API to update the properties of a data product draft identified by a valid ID.<br/><br/>Specify patch
754
+ * operations using http://jsonpatch.com/ syntax.<br/><br/>Supported patch operations include:<br/><br/>- Update the
755
+ * properties of a data product<br/><br/>- Add/Remove parts from a data product (up to 20 parts)<br/><br/>- Add/Remove
756
+ * use cases from a data product<br/><br/>- Update the data product state<br/><br/>.
757
+ *
758
+ * @param {Object} params - The parameters to send to the service.
759
+ * @param {string} params.dataProductId - Data product ID. Use '-' to skip specifying the data product ID explicitly.
760
+ * @param {string} params.draftId - Data product draft id.
761
+ * @param {JsonPatchOperation[]} params.jsonPatchInstructions - A set of patch operations as defined in RFC 6902. See
762
+ * http://jsonpatch.com/ for more information.
763
+ * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
764
+ * @returns {Promise<DphV1.Response<DphV1.DataProductVersion>>}
765
+ */
766
+ DphV1.prototype.updateDataProductDraft = function (params) {
767
+ var _params = __assign({}, params);
768
+ var _requiredParams = ['dataProductId', 'draftId', 'jsonPatchInstructions'];
769
+ var _validParams = ['dataProductId', 'draftId', 'jsonPatchInstructions', 'headers'];
770
+ var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
771
+ if (_validationErrors) {
772
+ return Promise.reject(_validationErrors);
773
+ }
774
+ var body = _params.jsonPatchInstructions;
775
+ var path = {
776
+ 'data_product_id': _params.dataProductId,
777
+ 'draft_id': _params.draftId,
778
+ };
779
+ var sdkHeaders = (0, common_1.getSdkHeaders)(SERVICE_NAME, SERVICE_VERSION, UPDATE_DATA_PRODUCT_DRAFT);
780
+ var parameters = {
781
+ options: {
782
+ url: URL_UPDATE_DATA_PRODUCT_DRAFT,
783
+ method: HTTP_PATCH,
784
+ body: body,
785
+ path: path,
786
+ },
787
+ defaultOptions: extend(true, {}, this.baseOptions, {
788
+ headers: extend(true, sdkHeaders, {
789
+ 'Accept': CONTENT_TYPE_JSON,
790
+ 'Content-Type': CONTENT_TYPE_PATCH_JSON,
791
+ }, _params.headers),
792
+ }),
793
+ };
794
+ return this.createRequest(parameters);
795
+ };
796
+ /**
797
+ * Get a contract document.
798
+ *
799
+ * If a document has a completed attachment, the response contains the `url` which can be used to download the
800
+ * attachment. If a document does not have a completed attachment, the response contains the `url` which was submitted
801
+ * at document creation. If a document has an attachment that is incomplete, an error is returned to prompt the user
802
+ * to upload the document file and complete it.
803
+ *
804
+ * @param {Object} params - The parameters to send to the service.
805
+ * @param {string} params.dataProductId - Data product ID. Use '-' to skip specifying the data product ID explicitly.
806
+ * @param {string} params.draftId - Data product draft id.
807
+ * @param {string} params.contractTermsId - Contract terms id.
808
+ * @param {string} params.documentId - Document id.
809
+ * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
810
+ * @returns {Promise<DphV1.Response<DphV1.ContractTermsDocument>>}
811
+ */
812
+ DphV1.prototype.getDraftContractTermsDocument = function (params) {
813
+ var _params = __assign({}, params);
814
+ var _requiredParams = ['dataProductId', 'draftId', 'contractTermsId', 'documentId'];
815
+ var _validParams = ['dataProductId', 'draftId', 'contractTermsId', 'documentId', 'headers'];
816
+ var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
817
+ if (_validationErrors) {
818
+ return Promise.reject(_validationErrors);
819
+ }
820
+ var path = {
821
+ 'data_product_id': _params.dataProductId,
822
+ 'draft_id': _params.draftId,
823
+ 'contract_terms_id': _params.contractTermsId,
824
+ 'document_id': _params.documentId,
825
+ };
826
+ var sdkHeaders = (0, common_1.getSdkHeaders)(SERVICE_NAME, SERVICE_VERSION, GET_DRAFT_CONTRACT_TERMS_DOCUMENT);
827
+ var parameters = {
828
+ options: {
829
+ url: URL_GET_DRAFT_CONTRACT_TERMS_DOCUMENT,
830
+ method: HTTP_GET,
831
+ path: path,
832
+ },
833
+ defaultOptions: extend(true, {}, this.baseOptions, {
834
+ headers: extend(true, sdkHeaders, {
835
+ 'Accept': CONTENT_TYPE_JSON,
836
+ }, _params.headers),
837
+ }),
838
+ };
839
+ return this.createRequest(parameters);
840
+ };
841
+ /**
842
+ * Delete a contract document.
843
+ *
844
+ * Contract documents can only be deleted for data product versions that are in DRAFT state.
845
+ *
846
+ * @param {Object} params - The parameters to send to the service.
847
+ * @param {string} params.dataProductId - Data product ID. Use '-' to skip specifying the data product ID explicitly.
848
+ * @param {string} params.draftId - Data product draft id.
849
+ * @param {string} params.contractTermsId - Contract terms id.
850
+ * @param {string} params.documentId - Document id.
851
+ * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
852
+ * @returns {Promise<DphV1.Response<DphV1.EmptyObject>>}
853
+ */
854
+ DphV1.prototype.deleteDraftContractTermsDocument = function (params) {
855
+ var _params = __assign({}, params);
856
+ var _requiredParams = ['dataProductId', 'draftId', 'contractTermsId', 'documentId'];
857
+ var _validParams = ['dataProductId', 'draftId', 'contractTermsId', 'documentId', 'headers'];
858
+ var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
859
+ if (_validationErrors) {
860
+ return Promise.reject(_validationErrors);
861
+ }
862
+ var path = {
863
+ 'data_product_id': _params.dataProductId,
864
+ 'draft_id': _params.draftId,
865
+ 'contract_terms_id': _params.contractTermsId,
866
+ 'document_id': _params.documentId,
867
+ };
868
+ var sdkHeaders = (0, common_1.getSdkHeaders)(SERVICE_NAME, SERVICE_VERSION, DELETE_DRAFT_CONTRACT_TERMS_DOCUMENT);
869
+ var parameters = {
870
+ options: {
871
+ url: URL_DELETE_DRAFT_CONTRACT_TERMS_DOCUMENT,
872
+ method: HTTP_DELETE,
873
+ path: path,
874
+ },
875
+ defaultOptions: extend(true, {}, this.baseOptions, {
876
+ headers: extend(true, sdkHeaders, {}, _params.headers),
877
+ }),
878
+ };
879
+ return this.createRequest(parameters);
880
+ };
881
+ /**
882
+ * Update a contract document.
883
+ *
884
+ * Specify patch operations using http://jsonpatch.com/ syntax.
885
+ *
886
+ * Supported patch operations include:
887
+ * - Update the url of document if it does not have an attachment.
888
+ * - Update the type of the document.
889
+ * <br/><br/>Contract terms documents can only be updated if the associated data product version is in DRAFT state.
890
+ *
891
+ * @param {Object} params - The parameters to send to the service.
892
+ * @param {string} params.dataProductId - Data product ID. Use '-' to skip specifying the data product ID explicitly.
893
+ * @param {string} params.draftId - Data product draft id.
894
+ * @param {string} params.contractTermsId - Contract terms id.
895
+ * @param {string} params.documentId - Document id.
896
+ * @param {JsonPatchOperation[]} params.jsonPatchInstructions - A set of patch operations as defined in RFC 6902. See
897
+ * http://jsonpatch.com/ for more information.
898
+ * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
899
+ * @returns {Promise<DphV1.Response<DphV1.ContractTermsDocument>>}
900
+ */
901
+ DphV1.prototype.updateDraftContractTermsDocument = function (params) {
902
+ var _params = __assign({}, params);
903
+ var _requiredParams = [
904
+ 'dataProductId',
905
+ 'draftId',
906
+ 'contractTermsId',
907
+ 'documentId',
908
+ 'jsonPatchInstructions',
909
+ ];
910
+ var _validParams = [
911
+ 'dataProductId',
912
+ 'draftId',
913
+ 'contractTermsId',
914
+ 'documentId',
915
+ 'jsonPatchInstructions',
916
+ 'headers',
917
+ ];
918
+ var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
919
+ if (_validationErrors) {
920
+ return Promise.reject(_validationErrors);
921
+ }
922
+ var body = _params.jsonPatchInstructions;
923
+ var path = {
924
+ 'data_product_id': _params.dataProductId,
925
+ 'draft_id': _params.draftId,
926
+ 'contract_terms_id': _params.contractTermsId,
927
+ 'document_id': _params.documentId,
928
+ };
929
+ var sdkHeaders = (0, common_1.getSdkHeaders)(SERVICE_NAME, SERVICE_VERSION, UPDATE_DRAFT_CONTRACT_TERMS_DOCUMENT);
930
+ var parameters = {
931
+ options: {
932
+ url: URL_UPDATE_DRAFT_CONTRACT_TERMS_DOCUMENT,
933
+ method: HTTP_PATCH,
934
+ body: body,
935
+ path: path,
936
+ },
937
+ defaultOptions: extend(true, {}, this.baseOptions, {
938
+ headers: extend(true, sdkHeaders, {
939
+ 'Accept': CONTENT_TYPE_JSON,
940
+ 'Content-Type': CONTENT_TYPE_PATCH_JSON,
941
+ }, _params.headers),
942
+ }),
943
+ };
944
+ return this.createRequest(parameters);
945
+ };
946
+ /**
947
+ * Publish a draft of an existing data product.
948
+ *
949
+ * @param {Object} params - The parameters to send to the service.
950
+ * @param {string} params.dataProductId - Data product ID. Use '-' to skip specifying the data product ID explicitly.
951
+ * @param {string} params.draftId - Data product draft id.
952
+ * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
953
+ * @returns {Promise<DphV1.Response<DphV1.DataProductVersion>>}
954
+ */
955
+ DphV1.prototype.publishDataProductDraft = function (params) {
956
+ var _params = __assign({}, params);
957
+ var _requiredParams = ['dataProductId', 'draftId'];
958
+ var _validParams = ['dataProductId', 'draftId', 'headers'];
959
+ var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
960
+ if (_validationErrors) {
961
+ return Promise.reject(_validationErrors);
962
+ }
963
+ var path = {
964
+ 'data_product_id': _params.dataProductId,
965
+ 'draft_id': _params.draftId,
966
+ };
967
+ var sdkHeaders = (0, common_1.getSdkHeaders)(SERVICE_NAME, SERVICE_VERSION, PUBLISH_DATA_PRODUCT_DRAFT);
968
+ var parameters = {
969
+ options: {
970
+ url: URL_PUBLISH_DATA_PRODUCT_DRAFT,
971
+ method: HTTP_POST,
972
+ path: path,
973
+ },
974
+ defaultOptions: extend(true, {}, this.baseOptions, {
975
+ headers: extend(true, sdkHeaders, {
976
+ 'Accept': CONTENT_TYPE_JSON,
977
+ }, _params.headers),
978
+ }),
979
+ };
980
+ return this.createRequest(parameters);
981
+ };
982
+ /*************************
983
+ * dataProductReleases
984
+ ************************/
985
+ /**
986
+ * Get a release of an existing data product.
987
+ *
988
+ * @param {Object} params - The parameters to send to the service.
989
+ * @param {string} params.dataProductId - Data product ID. Use '-' to skip specifying the data product ID explicitly.
990
+ * @param {string} params.releaseId - Data product release id.
991
+ * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
992
+ * @returns {Promise<DphV1.Response<DphV1.DataProductVersion>>}
993
+ */
994
+ DphV1.prototype.getDataProductRelease = function (params) {
995
+ var _params = __assign({}, params);
996
+ var _requiredParams = ['dataProductId', 'releaseId'];
997
+ var _validParams = ['dataProductId', 'releaseId', 'headers'];
998
+ var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
999
+ if (_validationErrors) {
1000
+ return Promise.reject(_validationErrors);
1001
+ }
1002
+ var path = {
1003
+ 'data_product_id': _params.dataProductId,
1004
+ 'release_id': _params.releaseId,
1005
+ };
1006
+ var sdkHeaders = (0, common_1.getSdkHeaders)(SERVICE_NAME, SERVICE_VERSION, GET_DATA_PRODUCT_RELEASE);
1007
+ var parameters = {
1008
+ options: {
1009
+ url: URL_GET_DATA_PRODUCT_RELEASE,
1010
+ method: HTTP_GET,
1011
+ path: path,
1012
+ },
1013
+ defaultOptions: extend(true, {}, this.baseOptions, {
1014
+ headers: extend(true, sdkHeaders, {
1015
+ 'Accept': CONTENT_TYPE_JSON,
1016
+ }, _params.headers),
1017
+ }),
1018
+ };
1019
+ return this.createRequest(parameters);
1020
+ };
1021
+ /**
1022
+ * Update the data product release identified by ID.
1023
+ *
1024
+ * Use this API to update the properties of a data product release identified by a valid ID.<br/><br/>Specify patch
1025
+ * operations using http://jsonpatch.com/ syntax.<br/><br/>Supported patch operations include:<br/><br/>- Update the
1026
+ * properties of a data product<br/><br/>- Add/remove parts from a data product (up to 20 parts)<br/><br/>- Add/remove
1027
+ * use cases from a data product<br/><br/>.
1028
+ *
1029
+ * @param {Object} params - The parameters to send to the service.
1030
+ * @param {string} params.dataProductId - Data product ID. Use '-' to skip specifying the data product ID explicitly.
1031
+ * @param {string} params.releaseId - Data product release id.
1032
+ * @param {JsonPatchOperation[]} params.jsonPatchInstructions - A set of patch operations as defined in RFC 6902. See
1033
+ * http://jsonpatch.com/ for more information.
1034
+ * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
1035
+ * @returns {Promise<DphV1.Response<DphV1.DataProductVersion>>}
1036
+ */
1037
+ DphV1.prototype.updateDataProductRelease = function (params) {
1038
+ var _params = __assign({}, params);
1039
+ var _requiredParams = ['dataProductId', 'releaseId', 'jsonPatchInstructions'];
1040
+ var _validParams = ['dataProductId', 'releaseId', 'jsonPatchInstructions', 'headers'];
1041
+ var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
1042
+ if (_validationErrors) {
1043
+ return Promise.reject(_validationErrors);
1044
+ }
1045
+ var body = _params.jsonPatchInstructions;
1046
+ var path = {
1047
+ 'data_product_id': _params.dataProductId,
1048
+ 'release_id': _params.releaseId,
1049
+ };
1050
+ var sdkHeaders = (0, common_1.getSdkHeaders)(SERVICE_NAME, SERVICE_VERSION, UPDATE_DATA_PRODUCT_RELEASE);
1051
+ var parameters = {
1052
+ options: {
1053
+ url: URL_UPDATE_DATA_PRODUCT_RELEASE,
1054
+ method: HTTP_PATCH,
1055
+ body: body,
1056
+ path: path,
1057
+ },
1058
+ defaultOptions: extend(true, {}, this.baseOptions, {
1059
+ headers: extend(true, sdkHeaders, {
1060
+ 'Accept': CONTENT_TYPE_JSON,
1061
+ 'Content-Type': CONTENT_TYPE_PATCH_JSON,
1062
+ }, _params.headers),
1063
+ }),
1064
+ };
1065
+ return this.createRequest(parameters);
1066
+ };
1067
+ /**
1068
+ * Get a contract document.
1069
+ *
1070
+ * If the document has a completed attachment, the response contains the `url` to download the attachment.<br/><br/>
1071
+ * If the document does not have an attachment, the response contains the `url` which was submitted at document
1072
+ * creation.<br/><br/> If the document has an incomplete attachment, an error is returned to prompt the user to upload
1073
+ * the document file to complete the attachment.
1074
+ *
1075
+ * @param {Object} params - The parameters to send to the service.
1076
+ * @param {string} params.dataProductId - Data product ID. Use '-' to skip specifying the data product ID explicitly.
1077
+ * @param {string} params.releaseId - Data product release id.
1078
+ * @param {string} params.contractTermsId - Contract terms id.
1079
+ * @param {string} params.documentId - Document id.
1080
+ * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
1081
+ * @returns {Promise<DphV1.Response<DphV1.ContractTermsDocument>>}
1082
+ */
1083
+ DphV1.prototype.getReleaseContractTermsDocument = function (params) {
1084
+ var _params = __assign({}, params);
1085
+ var _requiredParams = ['dataProductId', 'releaseId', 'contractTermsId', 'documentId'];
1086
+ var _validParams = ['dataProductId', 'releaseId', 'contractTermsId', 'documentId', 'headers'];
1087
+ var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
1088
+ if (_validationErrors) {
1089
+ return Promise.reject(_validationErrors);
1090
+ }
1091
+ var path = {
1092
+ 'data_product_id': _params.dataProductId,
1093
+ 'release_id': _params.releaseId,
1094
+ 'contract_terms_id': _params.contractTermsId,
1095
+ 'document_id': _params.documentId,
1096
+ };
1097
+ var sdkHeaders = (0, common_1.getSdkHeaders)(SERVICE_NAME, SERVICE_VERSION, GET_RELEASE_CONTRACT_TERMS_DOCUMENT);
1098
+ var parameters = {
1099
+ options: {
1100
+ url: URL_GET_RELEASE_CONTRACT_TERMS_DOCUMENT,
1101
+ method: HTTP_GET,
1102
+ path: path,
1103
+ },
1104
+ defaultOptions: extend(true, {}, this.baseOptions, {
1105
+ headers: extend(true, sdkHeaders, {
1106
+ 'Accept': CONTENT_TYPE_JSON,
1107
+ }, _params.headers),
1108
+ }),
1109
+ };
1110
+ return this.createRequest(parameters);
1111
+ };
1112
+ /**
1113
+ * Retrieve a list of data product releases.
1114
+ *
1115
+ * @param {Object} params - The parameters to send to the service.
1116
+ * @param {string} params.dataProductId - Data product ID. Use '-' to skip specifying the data product ID explicitly.
1117
+ * @param {string} [params.assetContainerId] - Filter the list of data product releases by container id.
1118
+ * @param {string[]} [params.state] - Filter the list of data product versions by state. States are: available and
1119
+ * retired. Default is "available","retired".
1120
+ * @param {string} [params.version] - Filter the list of data product releases by version number.
1121
+ * @param {number} [params.limit] - Limit the number of data product releases in the results. The maximum is 200.
1122
+ * @param {string} [params.start] - Start token for pagination.
1123
+ * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
1124
+ * @returns {Promise<DphV1.Response<DphV1.DataProductReleaseCollection>>}
1125
+ */
1126
+ DphV1.prototype.listDataProductReleases = function (params) {
1127
+ var _params = __assign({}, params);
1128
+ var _requiredParams = ['dataProductId'];
1129
+ var _validParams = [
1130
+ 'dataProductId',
1131
+ 'assetContainerId',
1132
+ 'state',
1133
+ 'version',
1134
+ 'limit',
1135
+ 'start',
1136
+ 'headers',
1137
+ ];
1138
+ var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
1139
+ if (_validationErrors) {
1140
+ return Promise.reject(_validationErrors);
1141
+ }
1142
+ var query = {
1143
+ 'asset.container.id': _params.assetContainerId,
1144
+ 'state': _params.state,
1145
+ 'version': _params.version,
1146
+ 'limit': _params.limit,
1147
+ 'start': _params.start,
1148
+ };
1149
+ var path = {
1150
+ 'data_product_id': _params.dataProductId,
1151
+ };
1152
+ var sdkHeaders = (0, common_1.getSdkHeaders)(SERVICE_NAME, SERVICE_VERSION, LIST_DATA_PRODUCT_RELEASES);
1153
+ var parameters = {
1154
+ options: {
1155
+ url: URL_LIST_DATA_PRODUCT_RELEASES,
1156
+ method: HTTP_GET,
1157
+ qs: query,
1158
+ path: path,
1159
+ },
1160
+ defaultOptions: extend(true, {}, this.baseOptions, {
1161
+ headers: extend(true, sdkHeaders, {
1162
+ 'Accept': CONTENT_TYPE_JSON,
1163
+ }, _params.headers),
1164
+ }),
1165
+ };
1166
+ return this.createRequest(parameters);
1167
+ };
1168
+ /**
1169
+ * Retire a release of an existing data product.
1170
+ *
1171
+ * @param {Object} params - The parameters to send to the service.
1172
+ * @param {string} params.dataProductId - Data product ID. Use '-' to skip specifying the data product ID explicitly.
1173
+ * @param {string} params.releaseId - Data product release id.
1174
+ * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
1175
+ * @returns {Promise<DphV1.Response<DphV1.DataProductVersion>>}
1176
+ */
1177
+ DphV1.prototype.retireDataProductRelease = function (params) {
1178
+ var _params = __assign({}, params);
1179
+ var _requiredParams = ['dataProductId', 'releaseId'];
1180
+ var _validParams = ['dataProductId', 'releaseId', 'headers'];
1181
+ var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
1182
+ if (_validationErrors) {
1183
+ return Promise.reject(_validationErrors);
1184
+ }
1185
+ var path = {
1186
+ 'data_product_id': _params.dataProductId,
1187
+ 'release_id': _params.releaseId,
1188
+ };
1189
+ var sdkHeaders = (0, common_1.getSdkHeaders)(SERVICE_NAME, SERVICE_VERSION, LIST_DATA_PRODUCT_RELEASES);
1190
+ var parameters = {
1191
+ options: {
1192
+ url: URL_RETIRE_DATA_PRODUCT_RELEASE,
1193
+ method: HTTP_POST,
1194
+ path: path,
1195
+ },
1196
+ defaultOptions: extend(true, {}, this.baseOptions, {
1197
+ headers: extend(true, sdkHeaders, {
1198
+ 'Accept': CONTENT_TYPE_JSON,
1199
+ }, _params.headers),
1200
+ }),
1201
+ };
1202
+ return this.createRequest(parameters);
1203
+ };
1204
+ DphV1.DEFAULT_SERVICE_NAME = SERVICE_NAME;
1205
+ return DphV1;
1206
+ }(ibm_cloud_sdk_core_1.BaseService));
1207
+ /*************************
1208
+ * interfaces
1209
+ ************************/
1210
+ (function (DphV1) {
1211
+ /** Constants for the `initialize` operation. */
1212
+ var InitializeConstants;
1213
+ (function (InitializeConstants) {
1214
+ /** Include */
1215
+ var Include;
1216
+ (function (Include) {
1217
+ Include["DELIVERY_METHODS"] = "delivery_methods";
1218
+ Include["DOMAINS_MULTI_INDUSTRY"] = "domains_multi_industry";
1219
+ Include["DATA_PRODUCT_SAMPLES"] = "data_product_samples";
1220
+ Include["WORKFLOWS"] = "workflows";
1221
+ Include["PROJECT"] = "project";
1222
+ })(Include = InitializeConstants.Include || (InitializeConstants.Include = {}));
1223
+ })(InitializeConstants = DphV1.InitializeConstants || (DphV1.InitializeConstants = {}));
1224
+ /** Constants for the `createDataProductDraft` operation. */
1225
+ var CreateDataProductDraftConstants;
1226
+ (function (CreateDataProductDraftConstants) {
1227
+ /** The state of the data product version. If not specified, the data product version will be created in `draft` state. */
1228
+ var State;
1229
+ (function (State) {
1230
+ State["DRAFT"] = "draft";
1231
+ State["AVAILABLE"] = "available";
1232
+ State["RETIRED"] = "retired";
1233
+ })(State = CreateDataProductDraftConstants.State || (CreateDataProductDraftConstants.State = {}));
1234
+ /** Types */
1235
+ var Types;
1236
+ (function (Types) {
1237
+ Types["DATA"] = "data";
1238
+ Types["CODE"] = "code";
1239
+ })(Types = CreateDataProductDraftConstants.Types || (CreateDataProductDraftConstants.Types = {}));
1240
+ })(CreateDataProductDraftConstants = DphV1.CreateDataProductDraftConstants || (DphV1.CreateDataProductDraftConstants = {}));
1241
+ /** Constants for the `createDraftContractTermsDocument` operation. */
1242
+ var CreateDraftContractTermsDocumentConstants;
1243
+ (function (CreateDraftContractTermsDocumentConstants) {
1244
+ /** Type of the contract document. */
1245
+ var Type;
1246
+ (function (Type) {
1247
+ Type["TERMS_AND_CONDITIONS"] = "terms_and_conditions";
1248
+ Type["SLA"] = "sla";
1249
+ })(Type = CreateDraftContractTermsDocumentConstants.Type || (CreateDraftContractTermsDocumentConstants.Type = {}));
1250
+ })(CreateDraftContractTermsDocumentConstants = DphV1.CreateDraftContractTermsDocumentConstants || (DphV1.CreateDraftContractTermsDocumentConstants = {}));
1251
+ /** Constants for the `listDataProductReleases` operation. */
1252
+ var ListDataProductReleasesConstants;
1253
+ (function (ListDataProductReleasesConstants) {
1254
+ /** Filter the list of data product versions by state. States are: available and retired. Default is "available","retired". */
1255
+ var State;
1256
+ (function (State) {
1257
+ State["AVAILABLE"] = "available";
1258
+ State["RETIRED"] = "retired";
1259
+ })(State = ListDataProductReleasesConstants.State || (ListDataProductReleasesConstants.State = {}));
1260
+ })(ListDataProductReleasesConstants = DphV1.ListDataProductReleasesConstants || (DphV1.ListDataProductReleasesConstants = {}));
1261
+ var ContainerReference;
1262
+ (function (ContainerReference) {
1263
+ var Constants;
1264
+ (function (Constants) {
1265
+ /** Container type. */
1266
+ var Type;
1267
+ (function (Type) {
1268
+ Type["CATALOG"] = "catalog";
1269
+ Type["PROJECT"] = "project";
1270
+ })(Type = Constants.Type || (Constants.Type = {}));
1271
+ })(Constants = ContainerReference.Constants || (ContainerReference.Constants = {}));
1272
+ })(ContainerReference = DphV1.ContainerReference || (DphV1.ContainerReference = {}));
1273
+ var ContractTermsDocument;
1274
+ (function (ContractTermsDocument) {
1275
+ var Constants;
1276
+ (function (Constants) {
1277
+ /** Type of the contract document. */
1278
+ var Type;
1279
+ (function (Type) {
1280
+ Type["TERMS_AND_CONDITIONS"] = "terms_and_conditions";
1281
+ Type["SLA"] = "sla";
1282
+ })(Type = Constants.Type || (Constants.Type = {}));
1283
+ })(Constants = ContractTermsDocument.Constants || (ContractTermsDocument.Constants = {}));
1284
+ })(ContractTermsDocument = DphV1.ContractTermsDocument || (DphV1.ContractTermsDocument = {}));
1285
+ var DataProductVersion;
1286
+ (function (DataProductVersion) {
1287
+ var Constants;
1288
+ (function (Constants) {
1289
+ /** The state of the data product version. */
1290
+ var State;
1291
+ (function (State) {
1292
+ State["DRAFT"] = "draft";
1293
+ State["AVAILABLE"] = "available";
1294
+ State["RETIRED"] = "retired";
1295
+ })(State = Constants.State || (Constants.State = {}));
1296
+ /** Types of parts on the data product. */
1297
+ var Types;
1298
+ (function (Types) {
1299
+ Types["DATA"] = "data";
1300
+ Types["CODE"] = "code";
1301
+ })(Types = Constants.Types || (Constants.Types = {}));
1302
+ })(Constants = DataProductVersion.Constants || (DataProductVersion.Constants = {}));
1303
+ })(DataProductVersion = DphV1.DataProductVersion || (DphV1.DataProductVersion = {}));
1304
+ var DataProductVersionPrototype;
1305
+ (function (DataProductVersionPrototype) {
1306
+ var Constants;
1307
+ (function (Constants) {
1308
+ /** The state of the data product version. If not specified, the data product version will be created in `draft` state. */
1309
+ var State;
1310
+ (function (State) {
1311
+ State["DRAFT"] = "draft";
1312
+ State["AVAILABLE"] = "available";
1313
+ State["RETIRED"] = "retired";
1314
+ })(State = Constants.State || (Constants.State = {}));
1315
+ /** Types of parts on the data product. */
1316
+ var Types;
1317
+ (function (Types) {
1318
+ Types["DATA"] = "data";
1319
+ Types["CODE"] = "code";
1320
+ })(Types = Constants.Types || (Constants.Types = {}));
1321
+ })(Constants = DataProductVersionPrototype.Constants || (DataProductVersionPrototype.Constants = {}));
1322
+ })(DataProductVersionPrototype = DphV1.DataProductVersionPrototype || (DphV1.DataProductVersionPrototype = {}));
1323
+ var DataProductVersionSummary;
1324
+ (function (DataProductVersionSummary) {
1325
+ var Constants;
1326
+ (function (Constants) {
1327
+ /** The state of the data product version. */
1328
+ var State;
1329
+ (function (State) {
1330
+ State["DRAFT"] = "draft";
1331
+ State["AVAILABLE"] = "available";
1332
+ State["RETIRED"] = "retired";
1333
+ })(State = Constants.State || (Constants.State = {}));
1334
+ /** Types of parts on the data product. */
1335
+ var Types;
1336
+ (function (Types) {
1337
+ Types["DATA"] = "data";
1338
+ Types["CODE"] = "code";
1339
+ })(Types = Constants.Types || (Constants.Types = {}));
1340
+ })(Constants = DataProductVersionSummary.Constants || (DataProductVersionSummary.Constants = {}));
1341
+ })(DataProductVersionSummary = DphV1.DataProductVersionSummary || (DphV1.DataProductVersionSummary = {}));
1342
+ var ErrorModelResource;
1343
+ (function (ErrorModelResource) {
1344
+ var Constants;
1345
+ (function (Constants) {
1346
+ /** Error code. */
1347
+ var Code;
1348
+ (function (Code) {
1349
+ Code["REQUEST_BODY_ERROR"] = "request_body_error";
1350
+ Code["MISSING_REQUIRED_VALUE"] = "missing_required_value";
1351
+ Code["INVALID_PARAMETER"] = "invalid_parameter";
1352
+ Code["DOES_NOT_EXIST"] = "does_not_exist";
1353
+ Code["ALREADY_EXISTS"] = "already_exists";
1354
+ Code["NOT_AUTHENTICATED"] = "not_authenticated";
1355
+ Code["NOT_AUTHORIZED"] = "not_authorized";
1356
+ Code["FORBIDDEN"] = "forbidden";
1357
+ Code["CONFLICT"] = "conflict";
1358
+ Code["CREATE_ERROR"] = "create_error";
1359
+ Code["FETCH_ERROR"] = "fetch_error";
1360
+ Code["UPDATE_ERROR"] = "update_error";
1361
+ Code["DELETE_ERROR"] = "delete_error";
1362
+ Code["DATA_ERROR"] = "data_error";
1363
+ Code["DATABASE_ERROR"] = "database_error";
1364
+ Code["DATABASE_QUERY_ERROR"] = "database_query_error";
1365
+ Code["CONSTRAINT_VIOLATION"] = "constraint_violation";
1366
+ Code["UNABLE_TO_PERFORM"] = "unable_to_perform";
1367
+ Code["TOO_MANY_REQUESTS"] = "too_many_requests";
1368
+ Code["DEPENDENT_SERVICE_ERROR"] = "dependent_service_error";
1369
+ Code["CONFIGURATION_ERROR"] = "configuration_error";
1370
+ Code["UNEXPECTED_EXCEPTION"] = "unexpected_exception";
1371
+ Code["GOVERNANCE_POLICY_DENIAL"] = "governance_policy_denial";
1372
+ Code["DATABASE_USAGE_LIMITS"] = "database_usage_limits";
1373
+ Code["INACTIVE_USER"] = "inactive_user";
1374
+ Code["ENTITLEMENT_ENFORCEMENT"] = "entitlement_enforcement";
1375
+ Code["DELETED"] = "deleted";
1376
+ Code["NOT_IMPLEMENTED"] = "not_implemented";
1377
+ Code["FEATURE_NOT_ENABLED"] = "feature_not_enabled";
1378
+ })(Code = Constants.Code || (Constants.Code = {}));
1379
+ })(Constants = ErrorModelResource.Constants || (ErrorModelResource.Constants = {}));
1380
+ })(ErrorModelResource = DphV1.ErrorModelResource || (DphV1.ErrorModelResource = {}));
1381
+ var InitializeResource;
1382
+ (function (InitializeResource) {
1383
+ var Constants;
1384
+ (function (Constants) {
1385
+ /** Status of the initialize operation. */
1386
+ var Status;
1387
+ (function (Status) {
1388
+ Status["NOT_STARTED"] = "not_started";
1389
+ Status["IN_PROGRESS"] = "in_progress";
1390
+ Status["SUCCEEDED"] = "succeeded";
1391
+ Status["FAILED"] = "failed";
1392
+ })(Status = Constants.Status || (Constants.Status = {}));
1393
+ })(Constants = InitializeResource.Constants || (InitializeResource.Constants = {}));
1394
+ })(InitializeResource = DphV1.InitializeResource || (DphV1.InitializeResource = {}));
1395
+ var JsonPatchOperation;
1396
+ (function (JsonPatchOperation) {
1397
+ var Constants;
1398
+ (function (Constants) {
1399
+ /** The operation to be performed. */
1400
+ var Op;
1401
+ (function (Op) {
1402
+ Op["ADD"] = "add";
1403
+ Op["REMOVE"] = "remove";
1404
+ Op["REPLACE"] = "replace";
1405
+ Op["MOVE"] = "move";
1406
+ Op["COPY"] = "copy";
1407
+ Op["TEST"] = "test";
1408
+ })(Op = Constants.Op || (Constants.Op = {}));
1409
+ })(Constants = JsonPatchOperation.Constants || (JsonPatchOperation.Constants = {}));
1410
+ })(JsonPatchOperation = DphV1.JsonPatchOperation || (DphV1.JsonPatchOperation = {}));
1411
+ /*************************
1412
+ * pager classes
1413
+ ************************/
1414
+ /**
1415
+ * DataProductsPager can be used to simplify the use of listDataProducts().
1416
+ */
1417
+ var DataProductsPager = /** @class */ (function () {
1418
+ /**
1419
+ * Construct a DataProductsPager object.
1420
+ *
1421
+ * @param {DphV1} client - The service client instance used to invoke listDataProducts()
1422
+ * @param {Object} [params] - The parameters to be passed to listDataProducts()
1423
+ * @constructor
1424
+ * @returns {DataProductsPager}
1425
+ */
1426
+ function DataProductsPager(client, params) {
1427
+ if (params && params.start) {
1428
+ throw new Error("the params.start field should not be set");
1429
+ }
1430
+ this._hasNext = true;
1431
+ this.pageContext = { next: undefined };
1432
+ this.client = client;
1433
+ this.params = JSON.parse(JSON.stringify(params || {}));
1434
+ }
1435
+ /**
1436
+ * Returns true if there are potentially more results to be retrieved by invoking getNext().
1437
+ * @returns {boolean}
1438
+ */
1439
+ DataProductsPager.prototype.hasNext = function () {
1440
+ return this._hasNext;
1441
+ };
1442
+ /**
1443
+ * Returns the next page of results by invoking listDataProducts().
1444
+ * @returns {Promise<DphV1.DataProductSummary[]>}
1445
+ */
1446
+ DataProductsPager.prototype.getNext = function () {
1447
+ return __awaiter(this, void 0, void 0, function () {
1448
+ var response, result, next;
1449
+ return __generator(this, function (_a) {
1450
+ switch (_a.label) {
1451
+ case 0:
1452
+ if (!this.hasNext()) {
1453
+ throw new Error('No more results available');
1454
+ }
1455
+ if (this.pageContext.next) {
1456
+ this.params.start = this.pageContext.next;
1457
+ }
1458
+ return [4 /*yield*/, this.client.listDataProducts(this.params)];
1459
+ case 1:
1460
+ response = _a.sent();
1461
+ result = response.result;
1462
+ if (result && result.next) {
1463
+ next = result.next.start;
1464
+ }
1465
+ this.pageContext.next = next;
1466
+ if (!this.pageContext.next) {
1467
+ this._hasNext = false;
1468
+ }
1469
+ return [2 /*return*/, result.data_products];
1470
+ }
1471
+ });
1472
+ });
1473
+ };
1474
+ /**
1475
+ * Returns all results by invoking listDataProducts() repeatedly until all pages of results have been retrieved.
1476
+ * @returns {Promise<DphV1.DataProductSummary[]>}
1477
+ */
1478
+ DataProductsPager.prototype.getAll = function () {
1479
+ return __awaiter(this, void 0, void 0, function () {
1480
+ var results, nextPage;
1481
+ return __generator(this, function (_a) {
1482
+ switch (_a.label) {
1483
+ case 0:
1484
+ results = [];
1485
+ _a.label = 1;
1486
+ case 1:
1487
+ if (!this.hasNext()) return [3 /*break*/, 3];
1488
+ return [4 /*yield*/, this.getNext()];
1489
+ case 2:
1490
+ nextPage = _a.sent();
1491
+ results.push.apply(results, nextPage);
1492
+ return [3 /*break*/, 1];
1493
+ case 3: return [2 /*return*/, results];
1494
+ }
1495
+ });
1496
+ });
1497
+ };
1498
+ return DataProductsPager;
1499
+ }());
1500
+ DphV1.DataProductsPager = DataProductsPager;
1501
+ /**
1502
+ * DataProductDraftsPager can be used to simplify the use of listDataProductDrafts().
1503
+ */
1504
+ var DataProductDraftsPager = /** @class */ (function () {
1505
+ /**
1506
+ * Construct a DataProductDraftsPager object.
1507
+ *
1508
+ * @param {DphV1} client - The service client instance used to invoke listDataProductDrafts()
1509
+ * @param {Object} params - The parameters to be passed to listDataProductDrafts()
1510
+ * @constructor
1511
+ * @returns {DataProductDraftsPager}
1512
+ */
1513
+ function DataProductDraftsPager(client, params) {
1514
+ if (params && params.start) {
1515
+ throw new Error("the params.start field should not be set");
1516
+ }
1517
+ this._hasNext = true;
1518
+ this.pageContext = { next: undefined };
1519
+ this.client = client;
1520
+ this.params = JSON.parse(JSON.stringify(params || {}));
1521
+ }
1522
+ /**
1523
+ * Returns true if there are potentially more results to be retrieved by invoking getNext().
1524
+ * @returns {boolean}
1525
+ */
1526
+ DataProductDraftsPager.prototype.hasNext = function () {
1527
+ return this._hasNext;
1528
+ };
1529
+ /**
1530
+ * Returns the next page of results by invoking listDataProductDrafts().
1531
+ * @returns {Promise<DphV1.DataProductVersionSummary[]>}
1532
+ */
1533
+ DataProductDraftsPager.prototype.getNext = function () {
1534
+ return __awaiter(this, void 0, void 0, function () {
1535
+ var response, result, next;
1536
+ return __generator(this, function (_a) {
1537
+ switch (_a.label) {
1538
+ case 0:
1539
+ if (!this.hasNext()) {
1540
+ throw new Error('No more results available');
1541
+ }
1542
+ if (this.pageContext.next) {
1543
+ this.params.start = this.pageContext.next;
1544
+ }
1545
+ return [4 /*yield*/, this.client.listDataProductDrafts(this.params)];
1546
+ case 1:
1547
+ response = _a.sent();
1548
+ result = response.result;
1549
+ if (result && result.next) {
1550
+ next = result.next.start;
1551
+ }
1552
+ this.pageContext.next = next;
1553
+ if (!this.pageContext.next) {
1554
+ this._hasNext = false;
1555
+ }
1556
+ return [2 /*return*/, result.drafts];
1557
+ }
1558
+ });
1559
+ });
1560
+ };
1561
+ /**
1562
+ * Returns all results by invoking listDataProductDrafts() repeatedly until all pages of results have been retrieved.
1563
+ * @returns {Promise<DphV1.DataProductVersionSummary[]>}
1564
+ */
1565
+ DataProductDraftsPager.prototype.getAll = function () {
1566
+ return __awaiter(this, void 0, void 0, function () {
1567
+ var results, nextPage;
1568
+ return __generator(this, function (_a) {
1569
+ switch (_a.label) {
1570
+ case 0:
1571
+ results = [];
1572
+ _a.label = 1;
1573
+ case 1:
1574
+ if (!this.hasNext()) return [3 /*break*/, 3];
1575
+ return [4 /*yield*/, this.getNext()];
1576
+ case 2:
1577
+ nextPage = _a.sent();
1578
+ results.push.apply(results, nextPage);
1579
+ return [3 /*break*/, 1];
1580
+ case 3: return [2 /*return*/, results];
1581
+ }
1582
+ });
1583
+ });
1584
+ };
1585
+ return DataProductDraftsPager;
1586
+ }());
1587
+ DphV1.DataProductDraftsPager = DataProductDraftsPager;
1588
+ /**
1589
+ * DataProductReleasesPager can be used to simplify the use of listDataProductReleases().
1590
+ */
1591
+ var DataProductReleasesPager = /** @class */ (function () {
1592
+ /**
1593
+ * Construct a DataProductReleasesPager object.
1594
+ *
1595
+ * @param {DphV1} client - The service client instance used to invoke listDataProductReleases()
1596
+ * @param {Object} params - The parameters to be passed to listDataProductReleases()
1597
+ * @constructor
1598
+ * @returns {DataProductReleasesPager}
1599
+ */
1600
+ function DataProductReleasesPager(client, params) {
1601
+ if (params && params.start) {
1602
+ throw new Error("the params.start field should not be set");
1603
+ }
1604
+ this._hasNext = true;
1605
+ this.pageContext = { next: undefined };
1606
+ this.client = client;
1607
+ this.params = JSON.parse(JSON.stringify(params || {}));
1608
+ }
1609
+ /**
1610
+ * Returns true if there are potentially more results to be retrieved by invoking getNext().
1611
+ * @returns {boolean}
1612
+ */
1613
+ DataProductReleasesPager.prototype.hasNext = function () {
1614
+ return this._hasNext;
1615
+ };
1616
+ /**
1617
+ * Returns the next page of results by invoking listDataProductReleases().
1618
+ * @returns {Promise<DphV1.DataProductVersionSummary[]>}
1619
+ */
1620
+ DataProductReleasesPager.prototype.getNext = function () {
1621
+ return __awaiter(this, void 0, void 0, function () {
1622
+ var response, result, next;
1623
+ return __generator(this, function (_a) {
1624
+ switch (_a.label) {
1625
+ case 0:
1626
+ if (!this.hasNext()) {
1627
+ throw new Error('No more results available');
1628
+ }
1629
+ if (this.pageContext.next) {
1630
+ this.params.start = this.pageContext.next;
1631
+ }
1632
+ return [4 /*yield*/, this.client.listDataProductReleases(this.params)];
1633
+ case 1:
1634
+ response = _a.sent();
1635
+ result = response.result;
1636
+ if (result && result.next) {
1637
+ next = result.next.start;
1638
+ }
1639
+ this.pageContext.next = next;
1640
+ if (!this.pageContext.next) {
1641
+ this._hasNext = false;
1642
+ }
1643
+ return [2 /*return*/, result.releases];
1644
+ }
1645
+ });
1646
+ });
1647
+ };
1648
+ /**
1649
+ * Returns all results by invoking listDataProductReleases() repeatedly until all pages of results have been retrieved.
1650
+ * @returns {Promise<DphV1.DataProductVersionSummary[]>}
1651
+ */
1652
+ DataProductReleasesPager.prototype.getAll = function () {
1653
+ return __awaiter(this, void 0, void 0, function () {
1654
+ var results, nextPage;
1655
+ return __generator(this, function (_a) {
1656
+ switch (_a.label) {
1657
+ case 0:
1658
+ results = [];
1659
+ _a.label = 1;
1660
+ case 1:
1661
+ if (!this.hasNext()) return [3 /*break*/, 3];
1662
+ return [4 /*yield*/, this.getNext()];
1663
+ case 2:
1664
+ nextPage = _a.sent();
1665
+ results.push.apply(results, nextPage);
1666
+ return [3 /*break*/, 1];
1667
+ case 3: return [2 /*return*/, results];
1668
+ }
1669
+ });
1670
+ });
1671
+ };
1672
+ return DataProductReleasesPager;
1673
+ }());
1674
+ DphV1.DataProductReleasesPager = DataProductReleasesPager;
1675
+ })(DphV1 || (DphV1 = {}));
1676
+ module.exports = DphV1;
1677
+ //# sourceMappingURL=v1.js.map