You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by ja...@apache.org on 2018/03/15 07:46:09 UTC
[incubator-openwhisk-client-js] branch master updated: Allow string
argument for action get API (#105)
This is an automated email from the ASF dual-hosted git repository.
jamesthomas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-client-js.git
The following commit(s) were added to refs/heads/master by this push:
new 3716162 Allow string argument for action get API (#105)
3716162 is described below
commit 3716162eafd290a48941e1469683c22f756766e2
Author: James Dubee <jw...@us.ibm.com>
AuthorDate: Thu Mar 15 03:46:07 2018 -0400
Allow string argument for action get API (#105)
* Allow string argument for action get API
* Group optional params together in README
---
README.md | 6 ++++++
lib/actions.js | 2 +-
test/unit/actions.test.js | 2 +-
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 0009c8e..d11110d 100644
--- a/README.md
+++ b/README.md
@@ -255,6 +255,12 @@ The following optional parameters are supported for all resource retrievals:
Optional parameters for action resource retrievals are shown below:
- `code` - set to `true` or `false` depending on whether action code should be included or excluded respectively
+This method also supports passing the `name` property directly without wrapping within an object.
+```javascript
+const name = "actionName"
+ow.actions.get(name)
+```
+
If you pass in an array for the first parameter, the `get` call will be executed for each array item. The function returns a Promise which resolves with the results when all operations have finished.
```javascript
diff --git a/lib/actions.js b/lib/actions.js
index 87d190b..c76ff15 100644
--- a/lib/actions.js
+++ b/lib/actions.js
@@ -22,7 +22,7 @@ class Actions extends Resources {
}
get (options) {
- options = options || {}
+ options = this.parse_options(options)
options.qs = this.qs(options, ['code'])
return this.operation_with_id('GET', options)
diff --git a/test/unit/actions.test.js b/test/unit/actions.test.js
index 1a5ec1c..715639a 100644
--- a/test/unit/actions.test.js
+++ b/test/unit/actions.test.js
@@ -79,7 +79,7 @@ test('should retrieve action from string identifier', t => {
t.is(path, `namespaces/${ns}/actions/12345`)
}
- return actions.get({name: '12345'})
+ return actions.get('12345')
})
test('should delete action from identifier', t => {
--
To stop receiving notification emails like this one, please contact
jamesthomas@apache.org.