Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

YanagiEiichi/apisdk

Repository files navigation

API SDK

Usage

const api = new API(root, globalConfig);
api.PATH0..PATHn.method(currentConfig);
  • root is the root path of api, default '/'
  • globalConfig is global config for all invokes
  • currentConfig is current config for current invoke
  • PATH0..PATHn is request path of api
  • method is one of HTTP methods

  • config is the parameter of fetch api
  • config.credentials is defaultly 'include'

Examples

import API from 'apisdk';
const api = new API('http://127.0.0.1');
/* GET http://127.0.0.1/path1/path2 */
let $result = api.path1.path2.get();
import API from 'apisdk';
const api = new API();
/* POST /path1/path2 HTTP/1.1 */
let $result = api.path1.path2.post({ body: 'a=1&b=2' });

About

Build a SDK from API document

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

AltStyle によって変換されたページ (->オリジナル) /