shado-js-client
v0.0.5
Published
SHADO Javascript REST API client
Readme
README
This README would normally document whatever steps are necessary to get your application up and running.
What is this repository for?
- Quick summary
- Version
- Learn Markdown
How do I get set up?
brew install swagger-codegen
wget http://localhost:8889/explorer/swagger.json
swagger-codegen generate -i swagger.json -l javascript --additional-properties usePromises=true -o .edit the basePath variable inside the src/ApiClient.js
npm install --save shado-js-clientInside a node interpreter type the following script for Account login:
var shado = require('shado-js-client');
shado.ApiClient.instance.basePath = 'http://localhost:8889/api'; // set host endpoint
var credentials = {
username: 'admin',
password: 'admin',
};
shado.AccountApi.accountLogin(credentials).then(console.log).catch(console.error);Later you could invoke other operations using the module. If you already have a valid Access Token you could execute:
var shado = require('shado-js-client');
shado.ApiClient.instance.basePath = 'http://localhost:8889/api';
shado.ApiClient.setAccessToken('Fh0KWcSdqZARIpZ9Cs5A6mjDluoJQyxCcur5KGaUBbUJiXQznP7uHSlpS5BBjiOZ');
shado.AccountApi.accountFind({}).then(console.log).catch(console.error);Or you could join both this functionalities (login and then query the backend):
var shado = require('shado-js-client');
var credentials = {
username: 'admin',
password: 'admin',
};
shado.AccountApi.accountLogin(credentials).then(function(data) {
console.log(data);
shado.ApiClient.instance.authentications['shado'] = data.id;
return accountSvc.accountFind({});
}).then(console.log).catch(console.error);
- Summary of set up
- Configuration
- Dependencies
- Database configuration
- How to run tests
- Deployment instructions
Contribution guidelines
- Writing tests
- Code review
- Other guidelines
Who do I talk to?
- Repo owner or admin
- Other community or team contact
