bloggify-actions-client

1.0.1 • Public • Published

bloggify-actions-client

Version Downloads

A client for the Bloggify API functions (actions).

☁️ Installation

# Using npm
npm install --save bloggify-actions-client

# Using yarn
yarn add bloggify-actions-client

📋 Example

var BloggifyActionsClient = require("bloggify-actions-client");

var app = new BloggifyActionsClient("http://localhost:8080");

// Make a get request
app.get("action.name", {
    query: { id: 2 }
}).then(function (_ref) {
    var data = _ref.data;

    console.log(data);
});

// Make a post request
app.post("action.name", {
    name: "PipeOrgansMap"
}).then(function (_ref2) {
    var data = _ref2.data;

    console.log(data);
});

❓ Get Help

There are few ways to get help:

  1. Please post questions on Stack Overflow. You can open issues with questions, as long you add a link to your Stack Overflow question.
  2. For bug reports and feature requests, open issues. 🐛

📝 Documentation

constructor

BloggifyActionsClient A client for the Bloggify API functions (actions).

Params

  • String host:
  • Object options: An object containing the following fields:
  • url (String): The http actions base url (default: @/bloggify/actions).
  • ws_url (String): The ws actions base url (default: !/bloggify/actions).

request(opts, cb)

Executes an HTTP(s) request.

Params

  • Object opts: Contains a set of parameters.
    • headers (Object) The request headers.
    • url (String) The access URL.
    • action (Object) The action name.
    • method (Function) The request method.
    • data (Object) The reuqest body (will be JSON-stringified)
    • query (Object) Querystring parameters to be set in the url.
  • Function cb: The callback function.

post(name, data, opts)

Executes a POST request.

Params

  • String name: The action name.
  • Object data: The request body (as an object).
  • Object opts: Additional options (optional).

get(name, opts, cb)

Executes a GET request.

Params

  • String name: The action name.
  • Object opts: Additional options (optional).
  • Function cb: The callback function.

url(name, opts)

Get the url of the action.

Params

  • String name: The action name.
  • Object opts: Additional options (optional).

Return

  • String The url string.

wsUrl(name)

Get the url of the WebSocket action.

Params

  • String name: The action name.

Return

  • String The ws url string.

😋 How to contribute

Have an idea? Found a bug? See how to contribute.

📜 License

MIT © Bloggify

Package Sidebar

Install

npm i bloggify-actions-client

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

8.83 kB

Total Files

4

Last publish

Collaborators

  • ionicabizau