2020-12-08 20:50:31 +00:00
|
|
|
// SpookVooper API - modules/interfaces/Interfaces.ts
|
2021-06-15 15:36:22 +00:00
|
|
|
// Written by Quinn Lane - https://quinnlane.dev/
|
2020-12-08 20:50:31 +00:00
|
|
|
|
2020-12-23 06:12:43 +00:00
|
|
|
import { CreditAmount, DistrictWealthType, PaymentEntity, SenatorDistrict } from '../types/Types'
|
2020-12-16 05:42:08 +00:00
|
|
|
|
2020-12-15 05:41:13 +00:00
|
|
|
interface EntityUser {
|
2020-12-16 05:42:08 +00:00
|
|
|
svid: string
|
|
|
|
apikey: string
|
2020-12-08 20:50:31 +00:00
|
|
|
getUser: () => Promise<any>
|
|
|
|
getUsername: () => Promise<any>
|
|
|
|
getBalance: () => Promise<any>
|
2020-12-23 06:12:43 +00:00
|
|
|
hasDiscordRole: (role: string) => Promise<any>
|
2020-12-08 20:50:31 +00:00
|
|
|
getDiscordRoles: () => Promise<any>
|
2020-12-23 06:12:43 +00:00
|
|
|
sendCredits: (amount: CreditAmount, to: PaymentEntity, reason: string) => Promise<any>
|
|
|
|
getStockOffers: (ticker: string) => Promise<any>
|
|
|
|
buyStock: (ticker: string, amount: number, price: CreditAmount) => Promise<any>
|
|
|
|
sellStock: (ticker: string, amount: number, price: CreditAmount) => Promise<any>
|
2020-12-08 20:50:31 +00:00
|
|
|
}
|
|
|
|
|
2020-12-16 05:42:08 +00:00
|
|
|
interface EntityGroup {
|
2020-12-08 20:50:31 +00:00
|
|
|
svid: string
|
|
|
|
}
|
|
|
|
|
2020-12-16 05:42:08 +00:00
|
|
|
interface EntityDistrict {
|
|
|
|
name: string
|
|
|
|
getWealth: (type: DistrictWealthType) => Promise<number>
|
|
|
|
getSenator: (district: SenatorDistrict) => Promise<ReturnedUser>
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
Class Constructor Configuration
|
|
|
|
*/
|
|
|
|
|
|
|
|
interface ConfigUser {
|
2020-12-08 20:50:31 +00:00
|
|
|
svid: string
|
2020-12-16 05:42:08 +00:00
|
|
|
apikey?: string
|
2020-12-08 20:50:31 +00:00
|
|
|
}
|
2020-12-09 07:34:30 +00:00
|
|
|
|
2020-12-16 05:42:08 +00:00
|
|
|
interface ConfigAuth {
|
2020-12-09 07:34:30 +00:00
|
|
|
clientid: string
|
|
|
|
clientsecret: string
|
|
|
|
}
|
2020-12-15 05:41:13 +00:00
|
|
|
|
2020-12-16 05:42:08 +00:00
|
|
|
/*
|
|
|
|
Returned values from SVAPI
|
|
|
|
*/
|
|
|
|
|
2020-12-15 05:41:13 +00:00
|
|
|
interface ReturnedUser {
|
|
|
|
userName: string
|
|
|
|
twitch_id: string | null
|
|
|
|
discord_id: number | null
|
|
|
|
post_likes: number
|
|
|
|
comment_likes: number
|
|
|
|
nationstate: string | null
|
|
|
|
description: string | null
|
|
|
|
api_use_count: number
|
|
|
|
minecraft_id: string | null
|
|
|
|
twitch_last_message_minute: number
|
|
|
|
twitch_message_xp: number
|
|
|
|
twitch_messages: number
|
|
|
|
discord_commends: number
|
|
|
|
discord_commends_sent: number
|
|
|
|
discord_last_commend_hour: number
|
|
|
|
discord_last_commend_message: number
|
|
|
|
discord_message_xp: number
|
|
|
|
discord_message_count: number
|
|
|
|
discord_last_message_minute: number
|
|
|
|
discord_warning_count: number
|
|
|
|
discord_ban_count: number
|
|
|
|
discord_kick_count: number
|
|
|
|
discord_game_xp: number
|
|
|
|
district: string | null
|
|
|
|
id: string
|
|
|
|
name: string
|
|
|
|
credits: number
|
|
|
|
image_Url: string | null
|
|
|
|
}
|
|
|
|
|
2020-12-18 06:18:52 +00:00
|
|
|
interface ReturnedTransaction {
|
|
|
|
FromAccount: string
|
|
|
|
ToAccount: string
|
|
|
|
Amount: number
|
|
|
|
Detail: string
|
|
|
|
Force: boolean
|
|
|
|
IsCompleted: boolean
|
|
|
|
Tax: number
|
|
|
|
Result: {
|
|
|
|
Info: string
|
|
|
|
Succeeded: boolean
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-15 05:41:13 +00:00
|
|
|
export {
|
2020-12-16 05:42:08 +00:00
|
|
|
// API Entities
|
2020-12-15 05:41:13 +00:00
|
|
|
EntityUser,
|
|
|
|
EntityGroup,
|
2020-12-16 05:42:08 +00:00
|
|
|
EntityDistrict,
|
|
|
|
// Class Config Interfaces
|
2020-12-15 05:41:13 +00:00
|
|
|
ConfigUser,
|
2020-12-16 05:42:08 +00:00
|
|
|
ConfigAuth,
|
|
|
|
// API Return Values
|
2020-12-18 06:18:52 +00:00
|
|
|
ReturnedUser,
|
|
|
|
ReturnedTransaction
|
2020-12-15 05:41:13 +00:00
|
|
|
}
|