💻 Sync with local
This commit is contained in:
parent
5e42d23577
commit
3df6f57d19
|
@ -48,7 +48,7 @@ class District {
|
|||
this.districtName = name
|
||||
}
|
||||
|
||||
public async getWealth (type: DistrictWealthType): Promise<any> {
|
||||
public async getWealth (type: DistrictWealthType): Promise<number> {
|
||||
switch (type.toUpperCase()) {
|
||||
case 'ALL':
|
||||
return await new Promise((resolve, reject) => {
|
||||
|
@ -105,7 +105,7 @@ class District {
|
|||
axios.get(`${userURL}/getSenators`)
|
||||
.then((response) => {
|
||||
const data: any[] = response.data
|
||||
if (district !== undefined) {
|
||||
if (district !== undefined && district !== 'ALL') {
|
||||
const found = data.find(user => user.district === district)
|
||||
resolve(found)
|
||||
} else if (district === 'ALL') {
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
// SpookVooper API - modules/interfaces/Interfaces.ts
|
||||
// Written by Brendan Lane - https://brndnln.dev/
|
||||
|
||||
import { DistrictWealthType, SenatorDistrict } from '../types/Types'
|
||||
|
||||
interface EntityUser {
|
||||
svid: string
|
||||
apikey: string
|
||||
getUser: () => Promise<any>
|
||||
getUsername: () => Promise<any>
|
||||
getBalance: () => Promise<any>
|
||||
|
@ -11,24 +15,36 @@ interface EntityUser {
|
|||
getStockOffers: () => Promise<any>
|
||||
buyStock: () => Promise<any>
|
||||
sellStock: () => Promise<any>
|
||||
svid: string
|
||||
apikey: string
|
||||
}
|
||||
|
||||
interface ConfigUser {
|
||||
svid: string
|
||||
apikey?: string
|
||||
}
|
||||
|
||||
interface EntityGroup {
|
||||
svid: string
|
||||
}
|
||||
|
||||
interface AuthConfig {
|
||||
interface EntityDistrict {
|
||||
name: string
|
||||
getWealth: (type: DistrictWealthType) => Promise<number>
|
||||
getSenator: (district: SenatorDistrict) => Promise<ReturnedUser>
|
||||
}
|
||||
|
||||
/*
|
||||
Class Constructor Configuration
|
||||
*/
|
||||
|
||||
interface ConfigUser {
|
||||
svid: string
|
||||
apikey?: string
|
||||
}
|
||||
|
||||
interface ConfigAuth {
|
||||
clientid: string
|
||||
clientsecret: string
|
||||
}
|
||||
|
||||
/*
|
||||
Returned values from SVAPI
|
||||
*/
|
||||
|
||||
interface ReturnedUser {
|
||||
userName: string
|
||||
twitch_id: string | null
|
||||
|
@ -61,9 +77,13 @@ interface ReturnedUser {
|
|||
}
|
||||
|
||||
export {
|
||||
// API Entities
|
||||
EntityUser,
|
||||
EntityGroup,
|
||||
EntityDistrict,
|
||||
// Class Config Interfaces
|
||||
ConfigUser,
|
||||
AuthConfig,
|
||||
ConfigAuth,
|
||||
// API Return Values
|
||||
ReturnedUser
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
// SpookVooper API - modules/types/Types.ts
|
||||
// Written by Brendan Lane - https://brndnln.dev/
|
||||
|
||||
import { EntityUser, AuthConfig as AuthConfigInt } from './../interfaces/Interfaces'
|
||||
import { EntityUser, ConfigAuth } from './../interfaces/Interfaces'
|
||||
|
||||
type CreditAmount = string | number
|
||||
type PaymentEntity = string | EntityUser
|
||||
type AuthEntity = EntityUser
|
||||
type GroupMember = string | EntityUser
|
||||
type AuthConfig = AuthConfigInt
|
||||
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'
|
||||
|
|
Loading…
Reference in New Issue