0.0.1 • Published 10 years ago

visupedia v0.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
10 years ago

visupedia-api-node

Official Visupedia API library client for node.js

This library is generated by alpaca

Installation

Make sure you have npm installed.

$ npm install visupedia

Versions

Works with 0.8 / 0.9 / 0.10 / 0.11

Usage

var visupedia = require('visupedia');

// Then we instantiate a client (as shown below)

Build a client

Without any authentication
var client = visupedia.client();

// If you need to send options
var client = visupedia.client({}, clientOptions);

Client Options

The following options are available while instantiating a client:

  • base: Base url for the api
  • api_version: Default version of the api (to be used in url)
  • user_agent: Default user-agent for all requests
  • headers: Default headers for all requests
  • request_type: Default format of the request body

Response information

All the callbacks provided to an api call will recieve the response as shown below

// You can also omit the 'methodOptions' param below
client.klass('args').method('args', methodOptions, function (err, response) {
    if (err) console.log(err);

    response.code;
    // >>> 200

    response.headers;
    // >>> {'x-server': 'apache'}
}

Method Options

The following options are available while calling a method of an api:

  • api_version: Version of the api (to be used in url)
  • headers: Headers for the request
  • query: Query parameters for the url
  • body: Body of the request
  • request_type: Format of the request body

Request body information

Set request_type in options to modify the body accordingly

RAW request

When the value is set to raw, don't modify the body at all.

body = 'username=pksunkara';
// >>> 'username=pksunkara'

Visu api

Returns an MyVisu api instance

The following arguments are required:

  • key: The api key provided by Visupedia
var visu = client.visu("53214f86e2ae54.93050075");
Query a Visu (GET /api?key=:key&id=:id&lang=:lang&version=:version)

Returns all information about the wanted Visu

The following arguments are required:

  • id: The unique ID of the Visu
  • lang: The language code wanted for the Visu
  • version: Use a specific version of our API
visu.get("18074f27cb5336.93484109", "fr", "2", options, callback);

Contributors

Here is a list of Contributors

TODO

License

MIT

Bug Reports

Report here.

Contact

Gaël Gillard (dev@visupedia.net)