Created
January 8, 2018 06:38
-
-
Save kailashyogeshwar85/8307ac143cfe20a6480dc3d08a0a6e3f to your computer and use it in GitHub Desktop.
Usage of mock input
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// My authentication.js | |
module.exports = { | |
label : 'Connect to Customauth', | |
mock_input: {}, | |
input: { | |
type: "object", | |
properties: { | |
access_token: { | |
type: 'string', | |
minLength: 1, | |
label: 'API KEY', | |
displayTitle:'API KEY' | |
} | |
} | |
}, | |
validate : function (input, output){ | |
// auth data will be available in input.auth | |
// var username = input.auth.username | |
// var password = input.auth.password | |
output(null,"success"); | |
} | |
} | |
// my action hello.js it will output hello with name specified | |
module.exports = { | |
name: "hello", | |
label: "Hello", | |
description: "this action will greet hello", | |
input:{ | |
title: 'Hello', | |
type: 'object', | |
properties: { | |
name: { | |
type: 'string', | |
minLength: 1, | |
title: 'Name', | |
label: 'Name' | |
} | |
} | |
}, | |
output: { | |
title: 'output', | |
displayTitle: 'output', | |
type: 'object', | |
properties: { | |
'message': { | |
"type": "string" | |
}, | |
"auth": { | |
type: "object", | |
properties: {} | |
} | |
} | |
}, | |
mock_input:{ auth: { access_token: "access_token" }, name: "kailash yogeshwar"}, | |
execute: function(input, output){ | |
// to access auth info use input.auth , eg: input.auth.username | |
// and to return output use output callback like this output(null, { 'notice' : 'successful'}) | |
// your code here | |
output(null, { auth: input.auth, message : 'hello ' + input.name }); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment