stratumn-sdk
Version:
Stratumn SDK for Javascript
26 lines (21 loc) • 738 B
JavaScript
import { get } from './request';
import config from './config';
import createMap from './createMap';
import getLink from './getLink';
import getMap from './getMap';
import getMapIds from './getMapIds';
import getBranches from './getBranches';
export default function getApplication(appName, appLocation) {
const url = appLocation || config.applicationUrl.replace('%s', appName);
return get(url)
.then(res => {
const app = res.body;
app.url = url;
app.createMap = createMap.bind(null, app);
app.getLink = getLink.bind(null, app);
app.getMap = getMap.bind(null, app);
app.getBranches = getBranches.bind(null, app);
app.getMapIds = getMapIds.bind(null, app);
return app;
});
}