#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
project:
    name: WhiskSystem
    packages:
        utils:
            license: Apache-2.0
            version: 0.0.1
            public: true
            annotations:
                description: Building blocks that format and assemble data
            actions:
                echo:
                    version: 0.0.1
                    function: echo.js
                    annotations:
                        description: "Returns the input"
                        parameters: [
                            {
                                "name": "payload",
                                "required": false,
                                "description": "Any JSON entity"
                            }
                        ]
                        sampleInput: { "payload": "Five fuzzy felines"}
                        sampleOutput: { "payload": "Five fuzzy felines"}
                cat:
                    version: 0.0.1
                    function: cat.js
                    annotations:
                        description: "Concatenates input into a string"
                        parameters: [
                            {
                                "name": "lines",
                                "required": true,
                                "type": "array",
                                "description": "An array of strings or numbers"
                            }
                        ]
                        sampleInput: { "lines": [4, 2, 3] }
                        sampleOutput: { "lines": [4, 2, 3] }
                smash:
                    version: 0.0.1
                    function: smash.js
                    annotations:
                        description: "Nests all properties under given property"
                        parameters: [
                            {
                                "name": "$fieldName",
                                "required":true,
                                "type": "string",
                                "description": "Name of property to nest object under"
                            }
                        ]
                        sampleInput: {
                            "a": 1,
                            "b": {
                                "c": 2,
                                "d": 3
                            },
                            "$fieldName": "p"
                        }
                        sampleOutput: {
                            "p": {
                                "a": 1,
                                "b": {
                                    "c": 2,
                                    "d": 3
                                }
                            }
                        }
                split:
                    version: 0.0.1
                    function: split.js
                    annotations:
                        description: "Split a string into an array"
                        parameters: [
                            {
                                "name": "payload",
                                "required":true,
                                "description":"A string"
                            },
                            {
                                "name": "separator",
                                "required": false,
                                "description": "The character, or the regular expression, to use for splitting the string"
                            }
                        ]
                        sampleInput: {
                            "payload": "one,two,three",
                            "separator": ","
                        }
                        sampleOutput: {
                            "lines": ["one", "two", "three"],
                            "payload": "one,two,three"
                        }
                sort:
                    version: 0.0.1
                    function: sort.js
                    annotations:
                        description: "Sorts an array"
                        parameters: [
                            {
                                "name": "lines",
                                "required": true,
                                "type": "array",
                                "description": "An array of strings"
                            }
                        ]
                        sampleInput: { "lines": [4, 2, 3] }
                        sampleOutput: {
                            "lines": [2, 3, 4],
                            "length": 3
                        }
                head:
                    version: 0.0.1
                    function: head.js
                    annotations:
                        description: "Extract prefix of an array"
                        parameters: [
                            {
                                "name": "lines",
                                "required": true,
                                "type": "array",
                                "description": "An array of strings"
                            },
                            {
                                "name": "num",
                                "required": false,
                                "type": "integer",
                                "description": "The length of the prefix"
                            }
                        ]
                        sampleInput: {
                            "lines": [4, 2, 3],
                            "num": 2
                        }
                        sampleOutput: {
                            "lines": [4, 2],
                            "num": 2
                        }
                date:
                    version: 0.0.1
                    function: date.js
                    annotations:
                        description: "Current date and time"
                        sampleOutput: { "date": "2016-03-22T00:59:55.961Z" }
                namespace:
                    version: 0.0.1
                    function: namespace.js
                    annotations:
                        description: "Returns namespace for the authorization key used to invoke this action"
                        sampleOutput: { "namespace": "guest" }
                hosturl:
                    version: 0.0.1
                    function: hosturl.js
                    annotations:
                        description: "Returns the URL to activate an action or trigger"
                        parameters: [
                            {
                                "name": "web",
                                "type": "boolean",
                                "description": "True for web actions"
                            },
                            {
                                "name": "ext",
                                "type": "string",
                                "description": "Extension for web action, one of .html, .http, .json, .text"
                            },
                            {
                                "name": "trigger",
                                "type": "boolean",
                                "description": "True to construct path for trigger instead of action."
                            },
                            {
                                "name": "path",
                                "type": "string",
                                "description": "The action name as just <action name> or <package name>/<action name>."
                            }
                        ]
                        sampleInput: {
                            "web": true,
                            "path": "utils/echo"
                        }
                        sampleOutput: { "url": "https://openwhisk.ng.bluemix.net/api/v1/experimental/web/guest/utils/echo.json" }
