-
Notifications
You must be signed in to change notification settings - Fork 10
/
data-elements.js
87 lines (74 loc) · 3.08 KB
/
data-elements.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
87
/*
Copyright 2019 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/
// DataElements
// https://developer.adobelaunch.com/api/data_elements
// Create a DataElement
// https://developer.adobelaunch.com/api/data_elements/create/
export function createDataElement(propertyId, dataElement) {
return this.post(`/properties/${propertyId}/data_elements`, {
data: dataElement
});
}
// Delete a DataElement
// https://developer.adobelaunch.com/api/data_elements/delete/
export function deleteDataElement(dataElementId) {
return this.delete(`/data_elements/${dataElementId}`);
}
// Get a DataElement
// https://developer.adobelaunch.com/api/data_elements/fetch/
export function getDataElement(dataElementId) {
return this.get(`/data_elements/${dataElementId}`);
}
// Get the Extension
// https://developer.adobelaunch.com/api/data_elements/extension/
export function getExtensionForDataElement(dataElementId) {
return this.get(`/data_elements/${dataElementId}/extension`);
}
// Get the Property
// https://developer.adobelaunch.com/api/data_elements/property/
export function getPropertyForDataElement(dataElementId) {
return this.get(`/data_elements/${dataElementId}/property`);
}
// Get the origin
// https://developer.adobelaunch.com/api/data_elements/origin/
export function getOriginForDataElement(dataElementId) {
return this.get(`/data_elements/${dataElementId}/origin`);
}
// List DataElements for a Property
// https://developer.adobelaunch.com/api/data_elements/list/
export function listDataElementsForProperty(propertyId, queryParams) {
return this.get(`/properties/${propertyId}/data_elements`, queryParams);
}
// List the Libraries for a DataElement
// https://developer.adobelaunch.com/api/data_elements/libraries/
export function listLibrariesForDataElement(dataElementId, queryParams) {
return this.get(`/data_elements/${dataElementId}/libraries`, queryParams);
}
// List the revisions for a DataElement
// https://developer.adobelaunch.com/api/data_elements/revisions/
export function listRevisionsForDataElement(dataElementId) {
return this.get(`/data_elements/${dataElementId}/revisions`);
}
// Revise
// https://developer.adobelaunch.com/api/data_elements/revise/
export function reviseDataElement(dataElementId) {
return this.patch(
`/data_elements/${dataElementId}`,
this.createReviseBody('data_elements', dataElementId)
);
}
// Update a DataElement
// https://developer.adobelaunch.com/api/data_elements/update/
export function updateDataElement(dataElementPatch) {
return this.patch(`/data_elements/${dataElementPatch.id}`, {
data: dataElementPatch
});
}