mirror of
https://github.com/Hopiu/webapi-eca.git
synced 2026-03-16 22:10:31 +00:00
Doc update mostly for examples
This commit is contained in:
parent
4b73d9b7c5
commit
ce36359539
9 changed files with 123 additions and 112 deletions
|
|
@ -1,8 +1,10 @@
|
|||
|
||||
###
|
||||
EmailYak ACTION INVOKER
|
||||
------------------------
|
||||
#
|
||||
# Requires user params:
|
||||
|
||||
# - apikey: The user's EmailYak API key
|
||||
###
|
||||
|
||||
|
|
@ -26,10 +28,10 @@ standardCallback = ( funcName ) ->
|
|||
###
|
||||
Send a mail through Emailyak.
|
||||
|
||||
@param sender The email address belonging to your apikey
|
||||
@param receipient The email address for the one that receives the mail
|
||||
@param subject The subject of the mail
|
||||
@param content The content of the mail
|
||||
- sender The email address belonging to your apikey
|
||||
- receipient The email address for the one that receives the mail
|
||||
- subject The subject of the mail
|
||||
- content The content of the mail
|
||||
###
|
||||
exports.sendMail = ( sender, receipient, subject, content ) ->
|
||||
if typeof content isnt "string"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
# Converts text to speech and issues an event into th system on completion
|
||||
#
|
||||
# Requires user-specific parameters:
|
||||
#
|
||||
|
||||
# - emailaccount
|
||||
# - accountid
|
||||
# - loginkey
|
||||
|
|
@ -29,22 +29,22 @@ arrFormats = [
|
|||
"FORMAT_MUWAV" # (8bit Mu-law PCM Wave)
|
||||
]
|
||||
|
||||
# oResponseCodes =
|
||||
# "0": "success"
|
||||
# "-1": "invalid login"
|
||||
# "-2": "account inactive"
|
||||
# "-3": "account unauthorized"
|
||||
# "-4": "invalid or inactive login key"
|
||||
# "-5": "invalid conversion number lookup"
|
||||
# "-6": "content size is too large (only for “Basic” subscribers)"
|
||||
# "-7": "monthly allowance has been exceeded (only for “Basic” subscribers)"
|
||||
# "-10": "invalid TTS Voice ID"
|
||||
# "-11": "invalid TTS Output Format ID"
|
||||
# "-12": "invalid REST request"
|
||||
# "-13": "invalid or unavailable TTS Sample Rate"
|
||||
# "1": "invalid SSML (not a valid XML document)"
|
||||
# "2": "invalid SSML (SSML content must begin with a “speak” tag)"
|
||||
# "3": "invalid SSML (“lexicon” tag is not supported)"
|
||||
# oResponseCodes =
|
||||
# "0": "success"
|
||||
# "-1": "invalid login"
|
||||
# "-2": "account inactive"
|
||||
# "-3": "account unauthorized"
|
||||
# "-4": "invalid or inactive login key"
|
||||
# "-5": "invalid conversion number lookup"
|
||||
# "-6": "content size is too large (only for “Basic” subscribers)"
|
||||
# "-7": "monthly allowance has been exceeded (only for “Basic” subscribers)"
|
||||
# "-10": "invalid TTS Voice ID"
|
||||
# "-11": "invalid TTS Output Format ID"
|
||||
# "-12": "invalid REST request"
|
||||
# "-13": "invalid or unavailable TTS Sample Rate"
|
||||
# "1": "invalid SSML (not a valid XML document)"
|
||||
# "2": "invalid SSML (SSML content must begin with a “speak” tag)"
|
||||
# "3": "invalid SSML (“lexicon” tag is not supported)"
|
||||
|
||||
parseAnswer = ( body ) ->
|
||||
arrSelectors = body.match /(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|[>"']))+.)["']?/g
|
||||
|
|
@ -55,6 +55,7 @@ parseAnswer = ( body ) ->
|
|||
oAnswer
|
||||
|
||||
# Function arguments:
|
||||
|
||||
# - text: the text to be translated into voice
|
||||
# - idVoice: index of the voice used for conversion from the arrVoices array.
|
||||
# - idAudioFormat: index of the voice used for conversion from the arrVoices array.
|
||||
|
|
|
|||
|
|
@ -31,11 +31,11 @@ standardCallback = ( funcName ) ->
|
|||
###
|
||||
Call the ProBinder service with the given parameters.
|
||||
|
||||
@param {Object} args the required function arguments object
|
||||
@param {Object} [args.data] the data to be posted
|
||||
@param {String} args.service the required service identifier to be appended to the url
|
||||
@param {String} args.method the required method identifier to be appended to the url
|
||||
@param {function} [args.callback] the function to receive the request answer
|
||||
- {Object} args the required function arguments object
|
||||
- {Object} [args.data] the data to be posted
|
||||
- {String} args.service the required service identifier to be appended to the url
|
||||
- {String} args.method the required method identifier to be appended to the url
|
||||
- {function} [args.callback] the function to receive the request answer
|
||||
###
|
||||
callService = ( args ) ->
|
||||
if not args.service or not args.method
|
||||
|
|
@ -50,9 +50,9 @@ callService = ( args ) ->
|
|||
###
|
||||
Does everything to post something in a binder
|
||||
|
||||
@param {String} companyId the comany associated to the binder
|
||||
@param {String} contextId the binder id
|
||||
@param {String} content the content to be posted
|
||||
- {String} companyId the comany associated to the binder
|
||||
- {String} contextId the binder id
|
||||
- {String} content the content to be posted
|
||||
###
|
||||
exports.newContent = ( companyId, contextId, content ) ->
|
||||
if arguments[ 4 ]
|
||||
|
|
@ -71,8 +71,8 @@ exports.newContent = ( companyId, contextId, content ) ->
|
|||
###
|
||||
Does everything to post a file info in a binder tab
|
||||
|
||||
@param {String} fromService the content service which grabs the content
|
||||
@param {String} fromId the content id from which the information is grabbed
|
||||
- {String} fromService the content service which grabs the content
|
||||
- {String} fromId the content id from which the information is grabbed
|
||||
###
|
||||
exports.makeFileEntry = ( fromService, fromId, toCompany, toContext ) ->
|
||||
getContent
|
||||
|
|
@ -87,11 +87,11 @@ exports.makeFileEntry = ( fromService, fromId, toCompany, toContext ) ->
|
|||
###
|
||||
Calls the content get service with the content id and the service id provided.
|
||||
|
||||
@param {Object} args the object containing the service id and the content id,
|
||||
- {Object} args the object containing the service id and the content id,
|
||||
success and error callback methods
|
||||
@param {String} args.serviceid the service id that is able to process this content
|
||||
@param {String} args.contentid the content id
|
||||
@param {function} [args.callback] receives the needle answer from the "call" function
|
||||
- {String} args.serviceid the service id that is able to process this content
|
||||
- {String} args.contentid the content id
|
||||
- {function} [args.callback] receives the needle answer from the "call" function
|
||||
###
|
||||
getContent = ( args ) ->
|
||||
if not args.callback
|
||||
|
|
@ -107,7 +107,7 @@ getContent = ( args ) ->
|
|||
###
|
||||
Sets the content as read.
|
||||
|
||||
@param {Object} id the content id to be set to read.
|
||||
- {Object} id the content id to be set to read.
|
||||
###
|
||||
exports.setRead = ( id ) ->
|
||||
callService
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ Remote Engine
|
|||
-------------
|
||||
#
|
||||
# Requires user params:
|
||||
|
||||
# - eventname: The event type to be pushed into the system
|
||||
# - webhook: The url to the emote webhook that will receive the event
|
||||
###
|
||||
|
|
@ -14,7 +15,7 @@ options =
|
|||
###
|
||||
Push an event into a WebAPI engine.
|
||||
|
||||
@param {Object} evt The event object that will be transmitted.
|
||||
- {Object} evt The event object that will be transmitted.
|
||||
###
|
||||
exports.pushEvent = ( evt ) ->
|
||||
if not evt
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ This is a customized module, made for Robert Frank to automatically create
|
|||
courses binders and prefill them with data.
|
||||
|
||||
This module requires user-specific parameters:
|
||||
|
||||
- binderUsername
|
||||
- binderPassword
|
||||
- importIoUserGuid
|
||||
|
|
@ -305,6 +306,7 @@ exports.createSemester = ( semester ) ->
|
|||
|
||||
|
||||
# Expects
|
||||
|
||||
# - semester
|
||||
# - studies
|
||||
# - major
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
# ---------------------
|
||||
#
|
||||
# Requires user params:
|
||||
|
||||
# - apikey: The user's EmailYak API key
|
||||
#
|
||||
|
||||
|
|
@ -24,27 +25,28 @@ exports.newMail = () ->
|
|||
log "#{ body.Emails.length } mail events pushed into the system"
|
||||
pushEvent mail for mail in body.Emails
|
||||
|
||||
###
|
||||
This will emit events of the form:
|
||||
( Refer to http://docs.emailyak.com/get-new-email.html for more information. )
|
||||
|
||||
# This will emit events of the form:
|
||||
|
||||
# ( Refer to http://docs.emailyak.com/get-new-email.html for more information. )
|
||||
|
||||
{
|
||||
"EmailID": "xquukd5z",
|
||||
"Received": "2014-04-19T11:27:11",
|
||||
"ToAddress": "test@mscliveweb.simpleyak.com",
|
||||
"ParsedData": [
|
||||
{
|
||||
"Data": "Best Regards\nTest User",
|
||||
"Part": 0,
|
||||
"Type": "Email"
|
||||
}
|
||||
],
|
||||
"FromName": "Test User",
|
||||
"ToAddressList": "test@mscliveweb.simpleyak.com",
|
||||
"FromAddress": "test.address@provider.com",
|
||||
"HtmlBody": "Best Regards\nTest User",
|
||||
"CcAddressList": "",
|
||||
"TextBody": "Best Regards\nTest User",
|
||||
"Subject": "test subject"
|
||||
}
|
||||
###
|
||||
# {
|
||||
# "EmailID": "xquukd5z",
|
||||
# "Received": "2014-04-19T11:27:11",
|
||||
# "ToAddress": "test@mscliveweb.simpleyak.com",
|
||||
# "ParsedData": [
|
||||
# {
|
||||
# "Data": "Best Regards\nTest User",
|
||||
# "Part": 0,
|
||||
# "Type": "Email"
|
||||
# }
|
||||
# ],
|
||||
# "FromName": "Test User",
|
||||
# "ToAddressList": "test@mscliveweb.simpleyak.com",
|
||||
# "FromAddress": "test.address@provider.com",
|
||||
# "HtmlBody": "Best Regards\nTest User",
|
||||
# "CcAddressList": "",
|
||||
# "TextBody": "Best Regards\nTest User",
|
||||
# "Subject": "test subject"
|
||||
# }
|
||||
|
||||
|
|
@ -57,18 +57,19 @@ exports.weekData = ( idCity ) ->
|
|||
connectorGuids: [ "2a1d789a-4d24-4942-bdca-ffa0e9f99c85" ]
|
||||
queryService params, ( data ) ->
|
||||
pushEvent data
|
||||
# [
|
||||
# {
|
||||
# wind: '9 mph',
|
||||
# day_identifier: 'Today',
|
||||
# day_name: 'Mon',
|
||||
# temp_max: '61 °F',
|
||||
# temp_min: '50 °F',
|
||||
# sunlight: '0 h',
|
||||
# rain: '0-2mm'
|
||||
# },
|
||||
# [...]
|
||||
# ]
|
||||
|
||||
# [
|
||||
# {
|
||||
# wind: '9 mph',
|
||||
# day_identifier: 'Today',
|
||||
# day_name: 'Mon',
|
||||
# temp_max: '61 °F',
|
||||
# temp_min: '50 °F',
|
||||
# sunlight: '0 h',
|
||||
# rain: '0-2mm'
|
||||
# },
|
||||
# [...]
|
||||
# ]
|
||||
|
||||
exports.currentData = ( idCity ) ->
|
||||
params =
|
||||
|
|
@ -76,14 +77,14 @@ exports.currentData = ( idCity ) ->
|
|||
connectorGuids: [ "06394265-b4e1-4b48-be82-a9f2acb9040f" ]
|
||||
queryService params, ( data ) ->
|
||||
pushEvent data
|
||||
# [
|
||||
# {
|
||||
# current_time_wind_desc: '01:00 | Overcast',
|
||||
# current_temp: '53°F',
|
||||
# coordinates: '47.56°N 7.59°E 260m asl',
|
||||
# city: 'Basel-Stadt'
|
||||
# }
|
||||
# ]
|
||||
# [
|
||||
# {
|
||||
# current_time_wind_desc: '01:00 | Overcast',
|
||||
# current_temp: '53°F',
|
||||
# coordinates: '47.56°N 7.59°E 260m asl',
|
||||
# city: 'Basel-Stadt'
|
||||
# }
|
||||
# ]
|
||||
|
||||
|
||||
# Helper function to detect and convert temperatures
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ ProBinder EVENT POLLER
|
|||
|
||||
Global variables
|
||||
This module requires user-specific parameters:
|
||||
|
||||
- username
|
||||
- password
|
||||
###
|
||||
|
|
@ -29,11 +30,11 @@ standardCallback = ( funcName ) ->
|
|||
###
|
||||
Call the ProBinder service with the given parameters.
|
||||
|
||||
@param {Object} args the required function arguments object
|
||||
@param {Object} [args.data] the data to be posted
|
||||
@param {String} args.service the required service identifier to be appended to the url
|
||||
@param {String} args.method the required method identifier to be appended to the url
|
||||
@param {function} [args.callback] the function to receive the request answer
|
||||
- {Object} args the required function arguments object
|
||||
- {Object} [args.data] the data to be posted
|
||||
- {String} args.service the required service identifier to be appended to the url
|
||||
- {String} args.method the required method identifier to be appended to the url
|
||||
- {function} [args.callback] the function to receive the request answer
|
||||
###
|
||||
callService = ( args ) ->
|
||||
if not args.service or not args.method
|
||||
|
|
@ -89,30 +90,30 @@ getContent = ( args ) ->
|
|||
service: args.contentServiceId
|
||||
callback: args.callback
|
||||
|
||||
# Returns an event of the form:
|
||||
#
|
||||
# {
|
||||
# "text": "test subject",
|
||||
# "id": 127815,
|
||||
# "createDate": "2014-04-19 16:27:45",
|
||||
# "lastModified": "2014-04-19 16:27:45",
|
||||
# "time": "5 days ago",
|
||||
# "userId": 10595,
|
||||
# "username": "Dominic Bosch",
|
||||
# "uri": "https://probinder.com/content/view/id/127815/",
|
||||
# "localUri": "https://probinder.com/content/view/id/127815/",
|
||||
# "title": "",
|
||||
# "serviceId": 27,
|
||||
# "userIds": [
|
||||
# 10595
|
||||
# ],
|
||||
# "description": "",
|
||||
# "context": [
|
||||
# {
|
||||
# "id": 18749,
|
||||
# "name": "WebAPI ECA Test Binder",
|
||||
# "remove": true,
|
||||
# "uri": "/content/context/id/18749/webapi-eca-test-binder"
|
||||
# }
|
||||
# ]
|
||||
# }
|
||||
# Returns an event of the form:
|
||||
|
||||
# {
|
||||
# "text": "test subject",
|
||||
# "id": 127815,
|
||||
# "createDate": "2014-04-19 16:27:45",
|
||||
# "lastModified": "2014-04-19 16:27:45",
|
||||
# "time": "5 days ago",
|
||||
# "userId": 10595,
|
||||
# "username": "Dominic Bosch",
|
||||
# "uri": "https://probinder.com/content/view/id/127815/",
|
||||
# "localUri": "https://probinder.com/content/view/id/127815/",
|
||||
# "title": "",
|
||||
# "serviceId": 27,
|
||||
# "userIds": [
|
||||
# 10595
|
||||
# ],
|
||||
# "description": "",
|
||||
# "context": [
|
||||
# {
|
||||
# "id": 18749,
|
||||
# "name": "WebAPI ECA Test Binder",
|
||||
# "remove": true,
|
||||
# "uri": "/content/context/id/18749/webapi-eca-test-binder"
|
||||
# }
|
||||
# ]
|
||||
# }
|
||||
|
|
@ -9,6 +9,7 @@ require( 'groc' ).CLI(
|
|||
"README.md",
|
||||
"LICENSE.md",
|
||||
"coffee/*.coffee",
|
||||
"examples/*/**",
|
||||
"-o./webpages/public/doc"
|
||||
],
|
||||
function( err ) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue