-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathapi.js
More file actions
40 lines (36 loc) · 753 Bytes
/
api.js
File metadata and controls
40 lines (36 loc) · 753 Bytes
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
const axios = require("axios").create({
baseURL: "https://cc-libraries.adobe.io/api/v1/libraries/",
headers: {
"x-api-key": process.env.API_KEY,
Authorization: `Bearer ${process.env.ACCESS_TOKEN}`,
}
});
module.exports = {
createLibrary: async name => {
const options = {
method: "post",
url: "/",
data: {
name
}
};
return axios(options);
},
updateLibrary: async (libraryId, name) => {
const options = {
method: "put",
url: `${libraryId}/metadata`,
data: {
name
}
};
return axios(options);
},
deleteLibrary: async libraryId => {
const options = {
method: "delete",
url: libraryId
};
return axios(options);
}
};