Skip to content

Commit

Permalink
qDSAFWEFAS
Browse files Browse the repository at this point in the history
  • Loading branch information
Owen3H committed Jul 11, 2024
1 parent a017dde commit 6691876
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
22 changes: 9 additions & 13 deletions src/OAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { townyData } from './utils/endpoint.js'
import { FetchError } from './utils/errors.js'

const parseResident = (res: RawResident) => {
const obj: any = {}
const obj = {} as OAPIResident

if (res.status)
obj.status = res.status
Expand Down Expand Up @@ -51,12 +51,11 @@ const parseResident = (res: RawResident) => {
if (res.friends)
obj.friends = res.friends

return obj as OAPIResident
return obj
}

const parseTown = (town: RawTown) => {
const rnao = town.perms.rnaoPerms
const flags = town.perms.flagPerms

const obj: any = {
...town,
Expand All @@ -67,7 +66,7 @@ const parseTown = (town: RawTown) => {
destroy: rnao.destroyPerms,
switch: rnao.switchPerms,
itemUse: rnao.itemUsePerms,
flags
flags: town.perms.flagPerms
}
}

Expand All @@ -93,7 +92,11 @@ const parseNation = (nation: RawNation) => {
const ParamErr = () => new SyntaxError(`Parameter 'name' is invalid. Must be of type string!`)
const FetchErr = (type: string, name: string) => new FetchError(`Could not fetch ${type} '${name}'. Invalid response received!`)

class OAPIV2 {
export class OAPIV3 {
static serverInfo = async() => (await townyData('', 'v3')) as RawServerInfoV3
}

export class OAPIV2 {
static serverInfo = async (): Promise<RawServerInfoV2> => {
return townyData('', 'v2')
}
Expand Down Expand Up @@ -126,13 +129,6 @@ class OAPIV2 {
}
}

class OAPIV3 {
static serverInfo = async (): Promise<RawServerInfoV3> => {
return townyData('', 'v3')
}
}

export {
OAPIV3 as default,
OAPIV3, OAPIV2
OAPIV3 as default
}
2 changes: 1 addition & 1 deletion src/types/oapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ export interface RawServerInfoV3 {
numQuarters: number
}
voteParty: {
target: number,
target: number
numRemaining: number
}
}
Expand Down

0 comments on commit 6691876

Please sign in to comment.