bloggify-actions-client

A client for the Bloggify API functions (actions).

Usage no npm install needed!

<script type="module">
  import bloggifyActionsClient from 'https://cdn.skypack.dev/bloggify-actions-client';
</script>

README

bloggify-actions-client

Version Downloads

A client for the Bloggify API functions (actions).

:cloud: Installation

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

# Using yarn
yarn add bloggify-actions-client

:clipboard: 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);
});

:question: 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. :bug:

:memo: 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.

:yum: How to contribute

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

:scroll: License

MIT © Bloggify