This repository was archived by the owner on Mar 10, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +51
-10
lines changed
Expand file tree Collapse file tree 5 files changed +51
-10
lines changed Original file line number Diff line number Diff line change 22
33const promisify = require ( 'promisify-es6' )
44
5+ const transform = function ( res , callback ) {
6+ callback ( null , {
7+ id : res . Id ,
8+ name : res . Name
9+ } )
10+ }
11+
512module . exports = ( send ) => {
613 return promisify ( ( args , opts , callback ) => {
714 if ( typeof ( opts ) === 'function' ) {
815 callback = opts
916 opts = { }
1017 }
11- send ( {
18+
19+ send . andTransform ( {
1220 path : 'key/gen' ,
1321 args : args ,
1422 qs : opts
15- } , callback )
23+ } , transform , callback )
1624 } )
1725}
Original file line number Diff line number Diff line change 22
33const promisify = require ( 'promisify-es6' )
44
5+ const transform = function ( res , callback ) {
6+ callback ( null , {
7+ id : res . Id ,
8+ name : res . Name
9+ } )
10+ }
11+
512module . exports = ( send ) => {
613 return promisify ( ( name , pem , password , callback ) => {
7- send ( {
14+ send . andTransform ( {
815 path : 'key/import' ,
916 args : name ,
1017 qs : {
1118 pem : pem ,
1219 password : password
1320 }
14- } , callback )
21+ } , transform , callback )
1522 } )
1623}
Original file line number Diff line number Diff line change 22
33const promisify = require ( 'promisify-es6' )
44
5+ const transform = function ( res , callback ) {
6+ callback ( null , res . Keys . map ( key => {
7+ return {
8+ id : key . Id ,
9+ name : key . Name
10+ }
11+ } ) )
12+ }
13+
514module . exports = ( send ) => {
615 return promisify ( ( opts , callback ) => {
716 if ( typeof ( opts ) === 'function' ) {
817 callback = opts
918 opts = { }
1019 }
11- send ( {
20+
21+ send . andTransform ( {
1222 path : 'key/list' ,
1323 qs : opts
14- } , callback )
24+ } , transform , callback )
1525 } )
1626}
Original file line number Diff line number Diff line change 22
33const promisify = require ( 'promisify-es6' )
44
5+ const transform = function ( res , callback ) {
6+ callback ( null , {
7+ id : res . Id ,
8+ was : res . Was ,
9+ now : res . Now ,
10+ overwrite : res . Overwrite
11+ } )
12+ }
13+
514module . exports = ( send ) => {
615 return promisify ( ( oldName , newName , callback ) => {
7- send ( {
16+ send . andTransform ( {
817 path : 'key/rename' ,
918 args : [ oldName , newName ]
10- } , callback )
19+ } , transform , callback )
1120 } )
1221}
Original file line number Diff line number Diff line change 22
33const promisify = require ( 'promisify-es6' )
44
5+ const transform = function ( res , callback ) {
6+ callback ( null , {
7+ id : res . Keys [ 0 ] . Id ,
8+ name : res . Keys [ 0 ] . Name
9+ } )
10+ }
11+
512module . exports = ( send ) => {
613 return promisify ( ( args , callback ) => {
7- send ( {
14+ send . andTransform ( {
815 path : 'key/rm' ,
916 args : args
10- } , callback )
17+ } , transform , callback )
1118 } )
1219}
You can’t perform that action at this time.
0 commit comments