Fixes #14

Co-authored-by: Bryce Bauer <bluebeargreen2@gmail.com>
This commit is contained in:
Brendan Lane 2020-12-21 10:09:46 -05:00
parent 020f73417e
commit 8c2f0010dd
2 changed files with 48 additions and 1 deletions

View File

@ -2,6 +2,7 @@
// Written by Bryce Bauer and Brendan Lane - https://github.com/bluebeargreen-2 and https://brndnln.dev/
import axios from 'axios'
import { QueueType } from './types/Types'
const ecoURL = 'https://api.spookvooper.com/eco'
class Stock {
@ -50,6 +51,50 @@ class Stock {
})
})
}
public async getQueueInfo (type: QueueType): Promise<any> {
switch (type.toUpperCase()) {
case 'BUY':
break
case 'SELL':
break
default:
throw new Error('Parameter \'type\' must be \'BUY\' or \'SELL\'')
}
return await new Promise((resolve, reject) => {
axios.get(`${ecoURL}/getQueueInfo`, {
params: {
ticker: this.stockTicker,
type: type.toUpperCase()
}
})
.then((response) => {
resolve(response.data)
})
.catch((error) => {
reject(error)
})
})
}
public async getOwnerData (): Promise<any> {
return await new Promise((resolve, reject) => {
axios.get(`${ecoURL}/getOwnerData`, {
params: {
ticker: this.stockTicker
}
})
.then((response) => {
resolve(response.data)
})
.catch((error) => {
reject(error)
})
})
}
}
export default Stock

View File

@ -11,6 +11,7 @@ type AuthConfig = ConfigAuth
type District = 'Voopmont' | 'New Yam' | 'San Vooperisco' | 'Medievala' | 'Landing Cove' | 'New Spudland' | 'Vooperia City' | 'Corgi' | 'Old Yam' | 'New Vooperis' | 'The Netherlands' | 'Queensland' | 'Servers Past' | 'Los Vooperis' | 'Old King Peninsula'
type DistrictWealthType = 'ALL' | 'USER' | 'GROUP'
type SenatorDistrict = District | 'ALL'
type QueueType = 'BUY' | 'SELL'
export {
CreditAmount,
@ -20,5 +21,6 @@ export {
AuthConfig,
District,
DistrictWealthType,
SenatorDistrict
SenatorDistrict,
QueueType
}