const { default: axios } = require('axios') class Api { constructor () { this.baseUrl = 'https://api.warframe.market/v1/' this.timeout = 0 } async getOrders (url) { const response = await axios.get(this.baseUrl + 'items/' + url + '/orders') return response.data.payload.orders.filter(function (order) { return order.order_type === 'sell' && order.user.status !== 'offline' }) } async getSortedOrders (url) { const orders = await this.getOrders(url) return orders.sort(function (a, b) { return a.platinum - b.platinum }) } } module.exports = new Api()