/aio-lib-runtime

Adobe I/O Javascript SDK implementing a value-add layer for Adobe I/O Runtime

Primary LanguageJavaScriptApache License 2.0Apache-2.0

Version Downloads/week Build Status License Greenkeeper badge Codecov Coverage

Adobe I/O Runtime Lib

Installing

$ npm install @adobe/aio-lib-runtime

Usage

  1. Initialize the SDK
const sdk = require('@adobe/aio-lib-runtime')

async function sdkTest() {
  //initialize sdk
  const client = await sdk.init({ apihost: 'apihost', api_key: 'api_key'})
}
  1. Call methods using the initialized SDK
const sdk = require('@adobe/aio-lib-runtime')

async function sdkTest() {
  // initialize sdk
  const client = await sdk.init({ apihost: 'apihost', api_key: 'api_key'})

  // call methods
  try {
    // get... something
    const result = await client.getSomething({})
    console.log(result)

  } catch (e) {
    console.error(e)
  }
}

Classes

RuntimeAPI

This class provides methods to call your RuntimeAPI APIs. Before calling any method initialize the instance by calling the init method on it with valid options argument

Functions

createKeyValueObjectFromArray(inputsArray)object

returns key value pairs in an object from the key value array supplied. Used to create parameters object

init(options)Promise.<OpenwhiskClient>

Returns a Promise that resolves with a new RuntimeAPI object.

Typedefs

OpenwhiskOptions : object
OpenwhiskClient : object

RuntimeAPI

This class provides methods to call your RuntimeAPI APIs. Before calling any method initialize the instance by calling the init method on it with valid options argument

Kind: global class

runtimeAPI.init(options) ⇒ Promise.<OpenwhiskClient>

Initializes a RuntimeAPI object and returns it.

Kind: instance method of RuntimeAPI
Returns: Promise.<OpenwhiskClient> - a RuntimeAPI object

Param Type Description
options OpenwhiskOptions options for initialization

createKeyValueObjectFromArray(inputsArray) ⇒ object

returns key value pairs in an object from the key value array supplied. Used to create parameters object

Kind: global function
Returns: object - An object of key value pairs in this format : {Your key1 : 'Your Value 1' , Your key2: 'Your value 2'}

Param Type Description
inputsArray Array Array in the form of [{'key':'key1', 'value': 'value1'}]

init(options) ⇒ Promise.<OpenwhiskClient>

Returns a Promise that resolves with a new RuntimeAPI object.

Kind: global function
Returns: Promise.<OpenwhiskClient> - a Promise with a RuntimeAPI object

Param Type Description
options OpenwhiskOptions options for initialization

OpenwhiskOptions : object

Kind: global typedef
Properties

Name Type Description
apihost string Hostname and optional port for openwhisk platform
api_key string Authorisation key
[api] string Full API URL
[apiversion] string Api version
[namespace] string Namespace for resource requests
[ignore_certs] boolean Turns off server SSL/TLS certificate verification
[key] string Client key to use when connecting to the apihost

OpenwhiskClient : object

Kind: global typedef
Properties

Name Type Description
actions ow.Actions actions
activations ow.Activations activations
namespaces ow.Namespaces namespaces
packages ow.Packages packages
rules ow.Rules rules
triggers ow.Triggers triggers
routes ow.Routes routes

Debug Logs

LOG_LEVEL=debug <your_call_here>

Prepend the LOG_LEVEL environment variable and debug value to the call that invokes your function, on the command line. This should output a lot of debug data for your SDK calls.

Contributing

Contributions are welcome! Read the Contributing Guide for more information.

Licensing

This project is licensed under the Apache V2 License. See LICENSE for more information.