0.0.15 • Published 9 years ago

miniswagger v0.0.15

Weekly downloads
1
License
ISC
Repository
github
Last release
9 years ago

miniswagger

Installation

npm install git+https://github.com/SelfishInc/miniswagger

or

npm install git+ssh://git@github.com:SelfishInc/miniswagger.git

Usage

Works through browserify

var miniswagger = require('miniswagger').default;

Fetching specs from remote server

ready promise is resolved once the API object is constructed:

var Api = new miniswagger.fromUrl('https://spec.selfishbeta.com/selfish/apis');

Api.ready.then(
    function() {
        Api.core.getStory({id: '0689a05650017f80'})
        .then(function(v) {console.log (v); });
    },

    function(error) {
        console.log(error);
    }
);

Using spec from JSON

This is synchronous:

var specs = require('./api-specs').default;
var miniswagger = require('miniswagger').default;
var Api = new miniswagger.fromSpecs(specs);

Api.core.getStory({id: '0689a05650017f80'}).then(
    function(story) {
        console.log(story);
    },
    function(error) {
        console.error(error);
    }
);
0.0.15

9 years ago

0.0.14

9 years ago

0.0.12

10 years ago

0.0.11

10 years ago

0.0.10

10 years ago

0.0.9

10 years ago

0.0.8

10 years ago

0.0.2

10 years ago

0.0.3

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago