api.authenticate({
username: '',
token: '',
password: '',
require_ownership: false
}).then(token => {
api.searchMods(
'bob'
).then((body) => {
api.downloadMods(body.results.map(x => {
return {name: x.name}
})).then(() => {
api.removeModsMatching({name: "bob*"}).then(() => {
})
})
})
api.downloadMod({name: 'Foreman', version: '1.0.0'}).then(() => {
api.downloadMod({name: 'Foreman'}).then(() => {
})
})
api.updateMods([
{name: 'FARL', version: '0.0.1'},
{name :'blueprint-string', version: '4.0.0'}
]).then(() => {
api.downloadMods(['Foreman', 'Factorissimo2'].map(x => {return {name: x}})).then(() => {
})
api.downloadMods([
{name: 'Foreman'},
{name :'Factorissimo2'}
]).then(() => {
api.removeMods([
{name: 'Foreman'},
{name :'Factorissimo2'},
{name :'FARL', version: '0.7.4'}
]).then(() => {
})
})
})
api.downloadDependencies({name: 'bobores'}, false).then(() => {
})
api.downloadDependencies(
{name: 'bobores', version: '0.14.0'}, true)
.then(() => {
})
api.getGames().then((body) => {
api.getGameDetails(body[0].game_id).then((details) => {
api.downloadMods(details.mods.filter(x => {
if (x.name == 'base')
return null
else
return x
})).then(() => {
})
})
let sortTop = body.sort((a, b) => {
let countA = 0
let countB = 0
if (b.players)
countB = b.players.length
if (a.players)
countA = a.players.length
return countB - countA
})
})
api.getModsFromSave('my_awesome_factory').then((mods) => {
})
api.getModsFromSaveFile('my_awesome_factory.zip').then((mods) => {
})
api.getModsFromSaves().then(list => {
})
api.readModZip({name: "FARL", version: "0.7.4"}).then((info) => {
})
api.readModZipFile("FARL_0.7.4.zip").then((info) => {
})
api.readModZips().then((list) => {
})
api.getLatestGameVersion('experimental').then(version => {
return api.downloadGame({version, build: 'alpha', distro: 'linux64'});
}).progress(value => {
console.log(Math.round(value * 100) + '%');
}).then(() => {
console.log("Done!");
}).catch(err => {
console.log(err);
});
}).catch(err => {
})
if (api.isAuthenticated()) {
api.downloadMod({name: 'Foreman'}).then(() => {
})
}