Skip to content

fnproject/fn_js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

24f6111 · Apr 1, 2019

History

6 Commits
Apr 1, 2019
Apr 1, 2019
Apr 1, 2019
Apr 1, 2019
Aug 30, 2017
Aug 30, 2017
Aug 30, 2017
Aug 30, 2017
Apr 1, 2019
Apr 1, 2019
Aug 30, 2017
Aug 30, 2017
Apr 1, 2019
Apr 1, 2019

Repository files navigation

fn_js

FnJs - JavaScript client for fn_js The open source serverless platform. This SDK is automatically generated by the Swagger Codegen project:

  • API version: 2.0.0
  • Package version: 2.0.0
  • Build package: io.swagger.codegen.languages.JavascriptClientCodegen

Installation

npm

To publish the library as a npm, please follow the procedure in "Publishing npm packages".

Then install it via:

npm install fn_js --save
Local development

To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing package.json (and this README). Let's call this JAVASCRIPT_CLIENT_DIR. Then run:

npm install

Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR:

npm link

Finally, switch to the directory you want to use your fn_js from, and run:

npm link /path/to/<JAVASCRIPT_CLIENT_DIR>

You should now be able to require('fn_js') in javascript files from the directory you ran the last command above from.

git

If the library is hosted at a git repository, e.g. https://github.com/YOUR_USERNAME/fn_js then install it via:

    npm install YOUR_USERNAME/fn_js --save

For browser

The library also works in the browser environment via npm and browserify. After following the above steps with Node.js and installing browserify with npm install -g browserify, perform the following (assuming main.js is your entry file, that's to say your javascript file where you actually use this library):

browserify main.js > bundle.js

Then include bundle.js in the HTML pages.

Webpack Configuration

Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:

module: {
  rules: [
    {
      parser: {
        amd: false
      }
    }
  ]
}

Getting Started

Please follow the installation instruction and execute the following JS code:

var FnJs = require('fn_js');

var api = new FnJs.AppsApi()

var body = new FnJs.App(); // {App} Application data to insert.


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.createApp(body, callback);

Documentation for API Endpoints

All URIs are relative to https://127.0.0.1:8080/v2

Class Method HTTP request Description
FnJs.AppsApi createApp POST /apps Create A New Application
FnJs.AppsApi deleteApp DELETE /apps/{appID} Delete An Application
FnJs.AppsApi getApp GET /apps/{appID} Get Information For An Application
FnJs.AppsApi listApps GET /apps Get A List Of Applications
FnJs.AppsApi updateApp PUT /apps/{appID} Update an Application
FnJs.CallApi fnsFnIDCallsCallIDGet GET /fns/{fnID}/calls/{callID} Get call information
FnJs.CallApi fnsFnIDCallsGet GET /fns/{fnID}/calls Get a fns calls.
FnJs.CallApi getCallLogs GET /fns/{fnID}/calls/{callID}/log Get logs for a call.
FnJs.FnsApi createFn POST /fns Create A New Function
FnJs.FnsApi deleteFn DELETE /fns/{fnID} Delete A Function
FnJs.FnsApi getFn GET /fns/{fnID} Get Definition Of A Function
FnJs.FnsApi listFns GET /fns Get A list Of Functions Within An Application
FnJs.FnsApi updateFn PUT /fns/{fnID} Update A Function
FnJs.LogApi getCallLogs GET /fns/{fnID}/calls/{callID}/log Get logs for a call.
FnJs.TriggersApi createTrigger POST /triggers Create A New Trigger.
FnJs.TriggersApi deleteTrigger DELETE /triggers/{triggerID} Delete A Trigger
FnJs.TriggersApi getTrigger GET /triggers/{triggerID} Get Definition Of A Trigger
FnJs.TriggersApi listTriggers GET /triggers Get A List Of Triggers Within An Application Or Function
FnJs.TriggersApi updateTrigger PUT /triggers/{triggerID} Update A Trigger

Documentation for Models

Documentation for Authorization

All endpoints do not require authorization.