box-view-cli
Advanced tools
Comparing version 0.6.0 to 0.7.0-annotations
@@ -6,3 +6,4 @@ var open = require('open'), | ||
module.exports = function (prog) { | ||
function requestSession(cmd) { | ||
function validateParams(cmd) { | ||
var params = {}; | ||
@@ -22,3 +23,20 @@ | ||
} | ||
if (cmd.annotations) { | ||
params['is_annotatable'] = true; | ||
if (!cmd.authorName) { | ||
throw new Error('--author-name is required when annotations are enabled'); | ||
} | ||
if (!cmd.authorId) { | ||
throw new Error('--author-id is required when annotations are enabled'); | ||
} | ||
params['author_name'] = cmd.authorName || 'Test User'; | ||
params['author_external_id'] = cmd.authorId || 1; | ||
} | ||
return params; | ||
} | ||
function requestSession(cmd) { | ||
var params = validateParams(cmd); | ||
if (cmd.documentId) { | ||
@@ -53,2 +71,5 @@ debug('session requested with document id "%s"', cmd.documentId); | ||
['-T, --disable-text', 'disable text selection'], | ||
['-a, --annotations', 'enable annotations'], | ||
['-N, --author-name [authorName]', 'annotation author name'], | ||
['-A, --author-id [authorId]', 'annotation author id'], | ||
['-o, --open', 'open the viewing session URL on success'] | ||
@@ -55,0 +76,0 @@ ], |
{ | ||
"name": "box-view-cli", | ||
"version": "0.6.0", | ||
"version": "0.7.0-annotations", | ||
"description": "A CLI for Box View API", | ||
@@ -5,0 +5,0 @@ "author": "Cameron Lakenen <lakenen@box.com>", |
22874
469