Skip to content

Commit

Permalink
addGeneration function
Browse files Browse the repository at this point in the history
  • Loading branch information
chriscdn committed Dec 4, 2020
1 parent 68ac1f6 commit dd4e2c1
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 25 deletions.
23 changes: 18 additions & 5 deletions lib/index.cjs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/index.cjs.js.map

Large diffs are not rendered by default.

23 changes: 18 additions & 5 deletions lib/index.es.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/index.es.js.map

Large diffs are not rendered by default.

22 changes: 17 additions & 5 deletions lib/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/index.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/index.min.js.map

Large diffs are not rendered by default.

23 changes: 18 additions & 5 deletions src/handlers/nodes.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
const FormDataFactory = require('./form-data-factory')

const SubTypes = {
FOLDER: 0,
DOCUMENT: 144
Folder: 0,
Generation: 2,
Document: 144
}

module.exports = session => ({
Expand All @@ -17,7 +18,7 @@ module.exports = session => ({

const formData = FormDataFactory.createFormData()

formData.append('type', SubTypes.DOCUMENT)
formData.append('type', SubTypes.Document)
formData.append('parent_id', parent_id)

if (process.node) {
Expand Down Expand Up @@ -72,14 +73,26 @@ module.exports = session => ({
},

addFolder(parent_id, name, params = {}) {
return this.addItem(SubTypes.FOLDER, parent_id, name, params)
return this.addItem(SubTypes.Folder, parent_id, name, params)
},

children(dataid, params = {}) {
addGeneration(parent_id, name, original_id, version_number, params = {}) {
return this.addItem(SubTypes.Generation, parent_id, name, {
original_id,
version_number,
...params
})
},

nodes(dataid, params = {}) {
// https://developer.opentext.com/webaccess/#url=%2Fawd%2Fresources%2Fapis%2Fcs-rest-api-for-cs-16-s%23!%2Fnodes%2FgetSubnodes_get_15&tab=501
return session.get(`api/v2/nodes/${dataid}/nodes`, { params })
},

children(dataid, params = {}) {
return this.nodes(dataid, params)
},

delete(dataid) {
return session.delete(`api/v1/nodes/${dataid}`)
},
Expand Down

0 comments on commit dd4e2c1

Please sign in to comment.