-
Notifications
You must be signed in to change notification settings - Fork 1
/
v1.js
86 lines (83 loc) · 3.46 KB
/
v1.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
const OsduBaseService = require('../base');
/**
* Class that provides named access to OSDU V1 Legal endpoints
* - [Service Documentation]{@link https://community.opengroup.org/osdu/platform/security-and-compliance/legal/-/blob/master/docs/tutorial/ComplianceService.md}
* - [API Documentation]{@link https://community.opengroup.org/osdu/platform/security-and-compliance/legal/-/blob/master/docs/api/compliance_openapi.yaml}
* @class
* @category Services
* @subcategory Legal
*/
class OsduV1LegalService extends OsduBaseService {
/**
* @constructor
* @param {BaseOsduClient} osdu_client - An implementation of the OSDU client class to broker communication with the OSDU API
* @param {string} data_partition - The data partition against which requests will be made
*/
constructor(osdu_client, data_partition) {
super(osdu_client, data_partition);
}
// TODO: Define response types
/**
* Get all supported legal tags in the given data partition
* @returns {Object} The API Response
*/
async listLegalTags() {
return await this._client.get(`/api/legal/v1/legaltags`, this._dataPartition);
}
/**
* Get requested legal tags in the given data partition
* @param {string[]} names - The list of tag names you wish to retrieve
* @returns {Object} The API Response
*/
async getLegalTags(names) {
return await this._client.post(`/api/legal/v1/legaltags:batchRetrieve`, { names }, this._dataPartition);
}
/**
* Validate requested legal tags in the given data partition
* @param {string[]} names - The list of tag names you wish to validate
* @returns {Object} The API Response
*/
async validateLegalTags(names) {
return await this._client.post(`/api/legal/v1/legaltags:validate`, { names }, this._dataPartition);
}
/**
* Retrieve a specific legal tag in the given data partition
* @param {string} name - The name of the tag you wish to retrieve
* @returns {Object} The API Response
*/
async getLegalTag(name) {
return await this._client.get(`/api/legal/v1/legaltags/${name}`, this._dataPartition);
}
/**
* List the allowed legal tag properties and values in the given data partition
* @returns {Object} The API Response
*/
async getLegalTagProperties() {
return await this._client.get(`/api/legal/v1/legaltags:properties`, this._dataPartition);
}
/**
* Create a new legal tag in the given data partition
* @param {Object} tagData - The JSON representation of the tag you wish to create
* @returns {Object} The API Response
*/
async createLegalTag(tagData) {
return await this._client.get(`/api/legal/v1/legaltags`, tagData, this._dataPartition);
}
/**
* Update an existing legal tag in the given data partition
* @param {Object} tagData - The JSON representation of the tag you wish to update
* @returns {Object} The API Response
*/
async updateLegalTag(tagData) {
return await this._client.put(`/api/legal/v1/legaltags`, tagData, this._dataPartition);
}
/**
* Delete an existing legal tag in the given data partition
* @param {string} tagData - The name of the tag you wish to delete
* @returns {Object} The API Response
*/
async deleteLegalTag(name) {
return await this._client.delete(`/api/legal/v1/legaltags/${name}`, this._dataPartition);
}
}
module.exports = OsduV1LegalService;