File tree Expand file tree Collapse file tree 3 files changed +25
-19
lines changed
Expand file tree Collapse file tree 3 files changed +25
-19
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " appmixer.box" ,
3- "version" : " 1.0.0 " ,
3+ "version" : " 1.0.1 " ,
44 "changelog" : {
5- "1.0.0 " : [
5+ "1.0.1 " : [
66 " Initial version"
77 ]
88 }
Original file line number Diff line number Diff line change @@ -10,22 +10,29 @@ module.exports = {
1010 throw new context . CancelError ( 'Name is required!' ) ;
1111 }
1212
13- // https://developer.box.com/reference/post-folders/
14- const { data } = await context . httpRequest ( {
15- method : 'POST' ,
16- url : 'https://api.box.com/2.0/folders' ,
17- headers : {
18- 'Authorization' : `Bearer ${ context . auth . accessToken } ` ,
19- 'Content-Type' : 'application/json'
20- } ,
21- data : {
22- name,
23- parent : {
24- id : parentId
13+ try {
14+ // https://developer.box.com/reference/post-folders/
15+ const { data } = await context . httpRequest ( {
16+ method : 'POST' ,
17+ url : 'https://api.box.com/2.0/folders' ,
18+ headers : {
19+ 'Authorization' : `Bearer ${ context . auth . accessToken } ` ,
20+ 'Content-Type' : 'application/json'
21+ } ,
22+ data : {
23+ name,
24+ parent : {
25+ id : parentId
26+ }
2527 }
26- }
27- } ) ;
28+ } ) ;
2829
29- return context . sendJson ( data , 'out' ) ;
30+ return context . sendJson ( data , 'out' ) ;
31+ } catch ( error ) {
32+ if ( error . status === 409 ) {
33+ throw new context . CancelError ( 'Folder already exists' ) ;
34+ }
35+ throw error ;
36+ }
3037 }
3138} ;
Original file line number Diff line number Diff line change 4040 "default" : " array"
4141 },
4242 "exactMatch" : {
43- "type" : " boolean" ,
44- "default" : false
43+ "type" : " boolean"
4544 }
4645 },
4746 "required" : [
You can’t perform that action at this time.
0 commit comments