You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/03/15 07:46:09 UTC

[GitHub] jthomas closed pull request #105: Allow string argument for action get API

jthomas closed pull request #105: Allow string argument for action get API
URL: https://github.com/apache/incubator-openwhisk-client-js/pull/105
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

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 => {


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services