Add support for action limits and annotations (#73)

* Add support for action limits and annotations
* Add unit tests
* Add documentation for action annotations and limits
diff --git a/README.md b/README.md
index ab80a96..fdd4998 100644
--- a/README.md
+++ b/README.md
@@ -333,6 +333,8 @@
 The following optional parameters are supported:
 - `namespace` - set custom namespace for endpoint
 - `params` - object containing default parameters for the action (default: `{}`)
+- `annotations` - object containing annotations for the action (default: `{}`)
+- `limits` - object containing limits for the action (default: `{}`)
 - `kind` - runtime environment parameter, ignored when `action` is an object (default: `nodejs:default`)
 - `version` - set semantic version of the action. If parameter is empty when create new action openwisk generate 0.0.1 value when update an action increase the patch version.
 
diff --git a/lib/actions.js b/lib/actions.js
index 05dde00..87ca22c 100644
--- a/lib/actions.js
+++ b/lib/actions.js
@@ -57,6 +57,14 @@
       body.version = options.version;
     }
 
+    if (options.limits) {
+      body.limits = options.limits;
+    }
+
+    if (typeof options.annotations === 'object') {
+      body.annotations = Object.keys(options.annotations).map(key => ({ key, value: options.annotations[key] }))
+    }
+
     return body
   }
 }
diff --git a/test/unit/actions.test.js b/test/unit/actions.test.js
index cc75ec8..fd16af1 100644
--- a/test/unit/actions.test.js
+++ b/test/unit/actions.test.js
@@ -328,6 +328,48 @@
   return actions.create({name: '12345', action, params})
 })
 
+test('create a new action with annotations', t => {
+  t.plan(4)
+  const ns = '_'
+  const client = {}
+  const action = 'function main() { // main function body};'
+  const annotations = {
+    foo: 'bar'
+  }
+  const actions = new Actions(client)
+
+  client.request = (method, path, options) => {
+    t.is(method, 'PUT')
+    t.is(path, `namespaces/${ns}/actions/12345`)
+    t.deepEqual(options.qs, {})
+    t.deepEqual(options.body, {exec: {kind: 'nodejs:default', code: action}, annotations: [
+      { key: 'foo', value: 'bar' }
+    ]})
+  }
+
+  return actions.create({name: '12345', action, annotations})
+})
+
+test('create a new action with limits', t => {
+  t.plan(4)
+  const ns = '_'
+  const client = {}
+  const action = 'function main() { // main function body};'
+  const limits = {
+    timeout: 300000
+  }
+  const actions = new Actions(client)
+
+  client.request = (method, path, options) => {
+    t.is(method, 'PUT')
+    t.is(path, `namespaces/${ns}/actions/12345`)
+    t.deepEqual(options.qs, {})
+    t.deepEqual(options.body, {exec: {kind: 'nodejs:default', code: action}, limits: {timeout: 300000}})
+  }
+
+  return actions.create({name: '12345', action, limits})
+})
+
 test('create an action without providing an action body', t => {
   const actions = new Actions()
   t.throws(() => actions.create({name: '12345'}), /Missing mandatory action/)