0.2.0 • Published 6 years ago

@iaipes/apiclient v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

ApiClient

Latest Version on npm Total Downloads

Client for the REST API at developers portal of IAIP.

Note: This package is under development and should not be used in production sites, until version 1.0.0 or above is released.

Dependencies

Installation

Via npm

$ npm install @iaipes/apiclient

Configuration

Configure the object

const Config = require('@iaipes/apiclient').Config
Config.baseURL = "http://developers.iaip.iw.sv"
Config.headers['Authorization'] = 'Bearer ' + '{token}'

Note: replace {token} with your developer access token.

Usage

const ApiV1InformationRequestClient = require('@iaipes/apiclient').ApiV1InformationRequestClient
const request = async function(){
   try {
    let response = await informationRequest.index({
      include: 'institution',
      filter: {
        profession_cont: 'Desarrollador'
      },
      sort: 'created_at desc'
    })
    console.log(response)
  } catch (error) {
    console.log(error)
  }
}

request()

Note: For more information about classes and methods, please check the documentation

Change log

Please see the changelog for more information on what has changed recently.

Testing

Create a .dot file inside the test folder

IAIPES_API_TOKEN={token}
IAIPES_API_URL=http://developers.iaip.iw.sv

Note: Replace {token} with your developer access token

Run the rest with the next command

$ yarn test

Contributing

Please see contributing.md for details and a todolist.

Security

If you discover any security related issues, please email author email instead of using the issue tracker.

Credits

License

license. Please see the license file for more information.