Coder Social home page Coder Social logo

unirio-js-api's Introduction

unirio-api

NPM

NPM package that provides an api client for the API provided by the Universidade Federal do Estado do Rio de Janeiro (UNIRIO) Please visit http://sistemas.unirio.br/api for further information.

Installing

npm install unirio-api

Testing

npm test

Basic Usage

var Unirio = require('unirio-api');

var KEY = "94ebdcee824a8fc9876c4c0b22580540a8d2330da2ec089d2e396afce2ee20332383a2df43936763358021ef9d163a21";

var api = new Unirio.API(KEY, Unirio.APIServers.PRODUCTION);

api.get('UNIT_TEST', undefined, undefined, function(data, error){
    if (typeof error === 'undefined'){
        // Do something with `data`
    }
});

Methods

The public module interface for interacting with the API methods is as follows:

get(path, params={}, fields=[], callback)
  • @param {string} path - The API endpoint to use for the request, for example 'ALUNOS'
  • @param {Object} [params] - The parameters for the request. A value of None sends the automatic API parameters
  • @param {string[]} [fields] - The return fields for the request. A value of None is equal do requesting ALL the fields
  • @param {API~getCallback} callback - A callback to be performed after the response/error
post(path, params={}, callback)
  • @param {string} path: The API endpoint to use for the request, for example 'ALUNOS'
  • @param {Object} params: The parameters for the request. Should contain all the not-null attributes.
  • @param {API~postCallback} callback - A callback to be performed after the response/error
put(path, params, callback)
  • @param {string} path - The API endpoint to use for the request, for example 'ALUNOS'
  • @param {Object} params - The parameters for the request. Should contain all the attributes that should be updated as well as the endpoint unique identifier.
  • @param {API~changeCallback} callback
del(path, params, callback)
  • @param {string} path - The API endpoint to use for the request, for example 'ALUNOS'
  • @param {Object} params - The parameters for the request. Should contain the endpoint unique identifier. e.g.: {'ID_ALUNO': 235}
  • @param {API~changeCallback} callback
callProcedure(name, data, fields=[], callback)
  • @param {string} name - Procedure name to be called
  • @param {Object[]} data - Array of objects to be serialized
  • @param {string[]} [fields] - Array with de desired return fields. Empty list or None will return all
  • @param {API~getCallback} callback - A callback to be performed after the response/error

To do

  • Improve test coverage
  • Implement caching integration
  • Callbacks documentation

unirio-js-api's People

Contributors

diogommartins avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.