-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added ban types
- Loading branch information
Showing
21 changed files
with
2,199 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"request": "launch", | ||
"name": "Launch Program", | ||
"type": "node", | ||
"cwd": "${workspaceFolder}/javascript-sdk/etf2l/", | ||
"env": {}, | ||
"runtimeExecutable": "C:\\Users\\Patrick\\.deno\\bin\\deno.EXE", | ||
"runtimeArgs": [ | ||
"test", | ||
"--unstable", | ||
"--inspect-wait", | ||
"--allow-all" | ||
], | ||
"attachSimplePort": 9229, | ||
"outputCapture": "std" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"github.copilot.inlineSuggest.enable": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
{ | ||
"exclude": [".git", "coverage", "docs"], | ||
"tasks": { | ||
"ok": "deno lint && deno fmt --check" | ||
"ok": "deno lint && deno fmt --check", | ||
"test": "deno test --allow-net" | ||
}, | ||
"workspace": ["./logstf", "./etf2l"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1,951 changes: 1,951 additions & 0 deletions
1,951
javascript-sdk/etf2l/tests/etf2lTypeGuards.guard.ts
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import type { Etf2lBan, Etf2lCompetitionDetails, Etf2lCompetitionList, Etf2lCompetitionMatches, Etf2lCompetitionResults, Etf2lCompetitionTables, Etf2lCompetitionTeams, Etf2lDemos, Etf2lMatch, Etf2lMatchDetails, Etf2lPlayer, Etf2lPlayerResults, Etf2lPlayerTransfers, Etf2lRecruitmentPlayers, Etf2lRecruitmentTeams, Etf2lTeam, Etf2lTeamMatches, Etf2lTeamResults, Etf2lTeamTransfers, Etf2lWhitelists } from "../types/mod.ts"; | ||
|
||
/** @see {isEtf2lBan} ts-auto-guard:type-guard */ | ||
export type Etf2lBanG = Etf2lBan; | ||
|
||
/** @see {isEtf2lCompetitionDetails} ts-auto-guard:type-guard */ | ||
export type Etf2lCompetitionDetailsG = Etf2lCompetitionDetails; | ||
|
||
/** @see {isEtf2lCompetitionList} ts-auto-guard:type-guard */ | ||
export type Etf2lCompetitionListG = Etf2lCompetitionList; | ||
|
||
/** @see {isEtf2lCompetitionMatches} ts-auto-guard:type-guard */ | ||
export type Etf2lCompetitionMatchesG = Etf2lCompetitionMatches; | ||
|
||
/** @see {isEtf2lCompetitionResults} ts-auto-guard:type-guard */ | ||
export type Etf2lCompetitionResultsG = Etf2lCompetitionResults; | ||
|
||
/** @see {isEtf2lCompetitionTeams} ts-auto-guard:type-guard */ | ||
export type Etf2lCompetitionTeamsG = Etf2lCompetitionTeams; | ||
|
||
/** @see {isEtf2lCompetitionTables} ts-auto-guard:type-guard */ | ||
export type Etf2lCompetitionTablesG = Etf2lCompetitionTables; | ||
|
||
/** @see {isEtf2lDemos} ts-auto-guard:type-guard */ | ||
export type Etf2lDemosG = Etf2lDemos; | ||
|
||
/** @see {isEtf2lMatch} ts-auto-guard:type-guard */ | ||
export type Etf2lMatchG = Etf2lMatch; | ||
|
||
/** @see {isEtf2lMatchDetails} ts-auto-guard:type-guard */ | ||
export type Etf2lMatchDetailsG = Etf2lMatchDetails; | ||
|
||
/** @see {isEtf2lPlayer} ts-auto-guard:type-guard */ | ||
export type Etf2lPlayerG = Etf2lPlayer; | ||
|
||
/** @see {isEtf2lPlayerResults} ts-auto-guard:type-guard */ | ||
export type Etf2lPlayerResultsG = Etf2lPlayerResults; | ||
|
||
/** @see {isEtf2lPlayerTransfers} ts-auto-guard:type-guard */ | ||
export type Etf2lPlayerTransfersG = Etf2lPlayerTransfers; | ||
|
||
/** @see {isEtf2lRecruitmentPlayers} ts-auto-guard:type-guard */ | ||
export type Etf2lRecruitmentPlayersG = Etf2lRecruitmentPlayers; | ||
|
||
/** @see {isEtf2lRecruitmentTeams} ts-auto-guard:type-guard */ | ||
export type Etf2lRecruitmentTeamsG = Etf2lRecruitmentTeams; | ||
|
||
/** @see {isEtf2lTeam} ts-auto-guard:type-guard */ | ||
export type Etf2lTeamG = Etf2lTeam; | ||
|
||
/** @see {isEtf2lTeamMatches} ts-auto-guard:type-guard */ | ||
export type Etf2lTeamMatchesG = Etf2lTeamMatches; | ||
|
||
/** @see {isEtf2lTeamResults} ts-auto-guard:type-guard */ | ||
export type Etf2lTeamResultsG = Etf2lTeamResults; | ||
|
||
/** @see {isEtf2lTeamTransfers} ts-auto-guard:type-guard */ | ||
export type Etf2lTeamTransfersG = Etf2lTeamTransfers; | ||
|
||
/** @see {isEtf2lWhitelists} ts-auto-guard:type-guard */ | ||
export type Etf2lWhitelistsG = Etf2lWhitelists; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
import { describe, it, beforeAll } from "jsr:@std/testing/bdd"; | ||
import { expect } from "jsr:@std/expect"; | ||
import { Etf2l } from "./../api/mod.ts"; | ||
import { isEtf2lBan, isEtf2lCompetitionDetails, isEtf2lCompetitionList, isEtf2lCompetitionResults, isEtf2lCompetitionTables, isEtf2lCompetitionTeams, isEtf2lDemos, isEtf2lMatch, isEtf2lMatchDetails, isEtf2lPlayer, isEtf2lPlayerResults, isEtf2lPlayerTransfers, isEtf2lRecruitmentPlayers, isEtf2lRecruitmentTeams, isEtf2lTeam, isEtf2lTeamMatches, isEtf2lTeamResults, isEtf2lTeamTransfers, isEtf2lWhitelists } from "./etf2lTypeGuards.guard.ts"; | ||
|
||
describe("etf2l", () => { | ||
let etf2l: Etf2l; | ||
let playerId: number; | ||
let matchId: number; | ||
let competitionId: number; | ||
let teamId: number; | ||
|
||
beforeAll(() => { | ||
etf2l = new Etf2l(); | ||
playerId = 123; | ||
matchId = 123; | ||
competitionId = 10; | ||
teamId = 123; | ||
}); | ||
|
||
describe("returns correct types", () => { | ||
it("ban types", async () => { | ||
const bans = await etf2l.bans(); | ||
expect(isEtf2lBan(bans)).toBe(true); | ||
}); | ||
it("competitionList types", async () => { | ||
const competitions = await etf2l.competitionList(); | ||
expect(isEtf2lCompetitionList(competitions)).toBe(true); | ||
}); | ||
it("competitionDetails types", async () => { | ||
const competition = await etf2l.competitionDetails(competitionId); | ||
expect(isEtf2lCompetitionDetails(competition)).toBe(true); | ||
}); | ||
it("competitionResults types", async () => { | ||
const competition = await etf2l.competitionResults(competitionId); | ||
expect(isEtf2lCompetitionResults(competition)).toBe(true); | ||
}); | ||
it("competitionTeams types", async () => { | ||
const competition = await etf2l.competitionTeams(competitionId); | ||
expect(isEtf2lCompetitionTeams(competition)).toBe(true); | ||
}); | ||
it("competitionTables types", async () => { | ||
const competition = await etf2l.competitionTables(competitionId); | ||
expect(isEtf2lCompetitionTables(competition)).toBe(true); | ||
}); | ||
it("demos types", async () => { | ||
const demos = await etf2l.demos(); | ||
expect(isEtf2lDemos(demos)).toBe(true); | ||
}); | ||
it("matches types", async () => { | ||
const matches = await etf2l.matches(); | ||
expect(isEtf2lMatch(matches)).toBe(true); | ||
}); | ||
it("matchDetails types", async () => { | ||
const match = await etf2l.matchDetails(matchId); | ||
expect(isEtf2lMatchDetails(match)).toBe(true); | ||
}); | ||
it("player types", async () => { | ||
const player = await etf2l.player(playerId); | ||
expect(isEtf2lPlayer(player)).toBe(true); | ||
}); | ||
it("playerTransfers types", async () => { | ||
const transfers = await etf2l.playerTransfers(playerId); | ||
expect(isEtf2lPlayerTransfers(transfers)).toBe(true); | ||
}); | ||
it("playerResults types", async () => { | ||
const results = await etf2l.playerResults(playerId); | ||
expect(isEtf2lPlayerResults(results)).toBe(true); | ||
}); | ||
it("playerRecruitment types", async () => { | ||
const recruitment = await etf2l.playerRecruitment({country: null, player_class: ["soldier"], skill: null, type: null, user: null}); | ||
expect(isEtf2lRecruitmentPlayers(recruitment)).toBe(true); | ||
}); | ||
it("teamRecruitment types", async () => { | ||
const recruitment = await etf2l.teamRecruitment(); | ||
expect(isEtf2lRecruitmentTeams(recruitment)).toBe(true); | ||
}); | ||
it("team types", async () => { | ||
const team = await etf2l.team(teamId); | ||
expect(isEtf2lTeam(team)).toBe(true); | ||
}); | ||
it("teamTransfers types", async () => { | ||
const transfers = await etf2l.teamTransfers(teamId); | ||
expect(isEtf2lTeamTransfers(transfers)).toBe(true); | ||
}); | ||
it("teamResults types", async () => { | ||
const results = await etf2l.teamResults(teamId); | ||
expect(isEtf2lTeamResults(results)).toBe(true); | ||
}); | ||
it("teamMatches types", async () => { | ||
const matches = await etf2l.teamMatches(teamId); | ||
expect(isEtf2lTeamMatches(matches)).toBe(true); | ||
}); | ||
it("whitelists types", async () => { | ||
const whitelists = await etf2l.whitelists(); | ||
expect(isEtf2lWhitelists(whitelists)).toBe(true); | ||
}); | ||
}); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** | ||
This tsconfig file is only needed for ts-auto-guard | ||
**/ | ||
|
||
{ | ||
"compilerOptions": { | ||
"module": "ESNext", | ||
"target": "ESNext", | ||
"emitDecoratorMetadata": false, | ||
"skipLibCheck": true, | ||
"strictNullChecks": true, | ||
"lib": ["ESNext"], | ||
"removeComments": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export type SmallBan = { | ||
start: number; | ||
end: number; | ||
reason: string; | ||
} | ||
|
||
export type Ban = SmallBan & { | ||
name: string; | ||
steamid: string; | ||
steamid64: string; | ||
profile: string; | ||
expired: boolean | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
import type { PlayerData } from "../../player/mod.ts"; | ||
import type { Ban } from "../../common/ban.ts"; | ||
import type { MultiPage } from "../../mod.ts"; | ||
|
||
export type Etf2lBan = PlayerData; | ||
export type Etf2lBan = { | ||
bans: MultiPage & { | ||
data: Ban[]; | ||
}; | ||
}; |
4 changes: 2 additions & 2 deletions
4
javascript-sdk/etf2l/types/endpoints/recruitment/etf2lRecruitmentPlayers.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import type { RecruitmentPlayer } from "../../recruitment/recruitmentPlayer.ts"; | ||
//import type { Status } from "types/common/status"; | ||
import type { Status } from "../../common/status.ts"; | ||
|
||
export type Etf2lRecruitmentPlayers = { | ||
recruitment: RecruitmentPlayer; | ||
status: { status: number; message: string }; // Status; | ||
status: Status; | ||
}; |
4 changes: 2 additions & 2 deletions
4
javascript-sdk/etf2l/types/endpoints/recruitment/etf2lRecruitmentTeams.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
//import type { Status } from "types/common/status.ts"; | ||
import type { Status } from "../../common/status.ts"; | ||
import type { RecruitmentTeam } from "../../recruitment/mod.ts"; | ||
|
||
export type Etf2lRecruitmentTeams = { | ||
recruitment: RecruitmentTeam; | ||
status: { status: number; message: string }; // Status; | ||
status: Status; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters