Skip to content

Commit 622de30

Browse files
committed
folders restructuration's for typescript
1 parent 4b1e990 commit 622de30

File tree

6 files changed

+248
-129
lines changed

6 files changed

+248
-129
lines changed

index.d.ts

Lines changed: 21 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -1,136 +1,28 @@
11
// TypeScript declarations for r6-data.js (module-style, no ambient wrapper)
22

3-
// ----- Types -----
4-
export type PlatformType = "uplay" | "psn" | "xbl";
5-
export type PlatformFamily = "pc" | "console";
6-
export type BoardId = "casual" | "event" | "warmup" | "standard" | "ranked";
7-
export type RankVersion = "v1" | "v2" | "v3" | "v4" | "v5" | "v6";
8-
9-
export interface AccountInfoParams {
10-
nameOnPlatform: string;
11-
platformType: PlatformType;
12-
}
13-
export interface PlayerStatsParams extends AccountInfoParams {
14-
platform_families: PlatformFamily;
15-
board_id?: BoardId;
16-
}
17-
export interface SeasonalStatsParams extends AccountInfoParams {}
18-
19-
export interface PlayerComparisonsParams {
20-
players: Array<{
21-
nameOnPlatform: string;
22-
platformType: PlatformType;
23-
}>;
24-
platform_families: PlatformFamily;
25-
board_id?: BoardId;
26-
compareFields?: string[];
27-
}
28-
29-
export interface GetMapsParams {
30-
name?: string; location?: string; releaseDate?: string; playlists?: string; mapReworked?: boolean;
31-
}
32-
export interface GetOperatorsParams {
33-
name?: string; safename?: string; realname?: string; birthplace?: string; age?: number; date_of_birth?: string; season_introduced?: string;
34-
}
35-
export interface GetSeasonsParams {
36-
name?: string; map?: string; operators?: string; weapons?: string;
37-
}
38-
export interface GetAttachmentParams {
39-
name?: string; style?: string; rarity?: string; availability?: string;
40-
}
41-
export interface GetCharmsParams {
42-
name?: string; collection?: string; rarity?: string; availability?: string; bundle?: string; season?: string;
43-
}
44-
export interface GetWeaponsParams { name?: string; }
45-
export interface GetUniversalSkinsParams { name?: string; }
46-
export interface GetRanksParams { version?: RankVersion; min_mmr?: number; max_mmr?: number; }
47-
48-
export interface SearchAllResult {
49-
query: string;
50-
summary: Record<string, number>;
51-
results: {
52-
operators: any[]; weapons: any[]; maps: any[]; seasons: any[]; charms: any[]; attachments: any[];
53-
[k: string]: any;
54-
};
55-
}
56-
export interface GameStats {
57-
steam?: { concurrent?: number; estimate?: number };
58-
crossPlatform?: { totalRegistered?: number; monthlyActive?: number; trendsEstimate?: number; platforms?: { pc?: number; playstation?: number; xbox?: number } };
59-
ubisoft?: { onlineEstimate?: number };
60-
lastUpdated?: string;
61-
[k: string]: any;
62-
}
63-
export interface DiscordWebhookOptions {
64-
playerName: string; title?: string; message?: string; color?: number; avatarUrl?: string;
65-
}
66-
67-
export interface PlayerComparisonsResult {
68-
players: Array<{
69-
player: {
70-
nameOnPlatform: string;
71-
platformType: PlatformType;
72-
};
73-
stats: any;
74-
success: boolean;
75-
error?: string;
76-
}>;
77-
comparison_summary: {
78-
field_comparisons: Record<string, {
79-
rankings: Array<{
80-
player: string;
81-
value: number;
82-
platform: PlatformType;
83-
}>;
84-
highest: {
85-
player: string;
86-
value: number;
87-
platform: PlatformType;
88-
};
89-
lowest: {
90-
player: string;
91-
value: number;
92-
platform: PlatformType;
93-
};
94-
average: number;
95-
}>;
96-
rankings: Record<string, any>;
97-
};
98-
metadata: {
99-
total_players: number;
100-
successful_fetches: number;
101-
failed_fetches: number;
102-
platform_families: PlatformFamily;
103-
board_id: string;
104-
timestamp: string;
105-
};
106-
errors?: Array<{
107-
player: {
108-
nameOnPlatform: string;
109-
platformType: PlatformType;
110-
};
111-
error: string;
112-
}>;
113-
}
114-
115-
// ----- Function declarations -----
116-
export function getAccountInfo(params: AccountInfoParams): Promise<any>;
117-
export function getPlayerStats(params: PlayerStatsParams): Promise<any>;
118-
export function getSeasonalStats(params: SeasonalStatsParams): Promise<any>;
119-
export function getServiceStatus(): Promise<any>;
120-
export function getGameStats(): Promise<GameStats>;
121-
export function getMaps(params?: GetMapsParams): Promise<any[]>;
122-
export function getOperators(params?: GetOperatorsParams): Promise<any[]>;
123-
export function getSeasons(params?: GetSeasonsParams): Promise<any[]>;
124-
export function getAttachment(params?: GetAttachmentParams): Promise<any[]>;
125-
export function getCharms(params?: GetCharmsParams): Promise<any[]>;
126-
export function getWeapons(params?: GetWeaponsParams): Promise<any[]>;
127-
export function getUniversalSkins(params?: GetUniversalSkinsParams): Promise<any[]>;
128-
export function getRanks(params?: GetRanksParams): Promise<any[]>;
129-
export function getSearchAll(query: string): Promise<SearchAllResult>;
130-
export function createDiscordR6Webhook(webhookUrl: string, playerData: any, options: DiscordWebhookOptions): Promise<any>;
131-
export function getPlayerComparisons(params: PlayerComparisonsParams): Promise<PlayerComparisonsResult>;
3+
// Re-export all types and interfaces from modular files
4+
export * from './types';
1325

1336
// ----- Default export -----
7+
import {
8+
getAccountInfo,
9+
getPlayerStats,
10+
getSeasonalStats,
11+
getServiceStatus,
12+
getGameStats,
13+
getMaps,
14+
getOperators,
15+
getSeasons,
16+
getAttachment,
17+
getCharms,
18+
getWeapons,
19+
getUniversalSkins,
20+
getRanks,
21+
getSearchAll,
22+
createDiscordR6Webhook,
23+
getPlayerComparisons
24+
} from './types/function-declarations';
25+
13426
declare const r6Data: {
13527
getAccountInfo: typeof getAccountInfo;
13628
getPlayerStats: typeof getPlayerStats;

types/base-types.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Base types for r6-data.js
2+
3+
export type PlatformType = "uplay" | "psn" | "xbl";
4+
export type PlatformFamily = "pc" | "console";
5+
export type BoardId = "casual" | "event" | "warmup" | "standard" | "ranked";
6+
export type RankVersion = "v1" | "v2" | "v3" | "v4" | "v5" | "v6";

types/function-declarations.d.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Function declarations for r6-data.js
2+
3+
import {
4+
AccountInfoParams,
5+
PlayerStatsParams,
6+
SeasonalStatsParams,
7+
PlayerComparisonsParams,
8+
GetMapsParams,
9+
GetOperatorsParams,
10+
GetSeasonsParams,
11+
GetAttachmentParams,
12+
GetCharmsParams,
13+
GetWeaponsParams,
14+
GetUniversalSkinsParams,
15+
GetRanksParams,
16+
DiscordWebhookOptions
17+
} from './params-interfaces';
18+
19+
import {
20+
SearchAllResult,
21+
GameStats,
22+
PlayerComparisonsResult
23+
} from './result-interfaces';
24+
25+
export function getAccountInfo(params: AccountInfoParams): Promise<any>;
26+
export function getPlayerStats(params: PlayerStatsParams): Promise<any>;
27+
export function getSeasonalStats(params: SeasonalStatsParams): Promise<any>;
28+
export function getServiceStatus(): Promise<any>;
29+
export function getGameStats(): Promise<GameStats>;
30+
export function getMaps(params?: GetMapsParams): Promise<any[]>;
31+
export function getOperators(params?: GetOperatorsParams): Promise<any[]>;
32+
export function getSeasons(params?: GetSeasonsParams): Promise<any[]>;
33+
export function getAttachment(params?: GetAttachmentParams): Promise<any[]>;
34+
export function getCharms(params?: GetCharmsParams): Promise<any[]>;
35+
export function getWeapons(params?: GetWeaponsParams): Promise<any[]>;
36+
export function getUniversalSkins(params?: GetUniversalSkinsParams): Promise<any[]>;
37+
export function getRanks(params?: GetRanksParams): Promise<any[]>;
38+
export function getSearchAll(query: string): Promise<SearchAllResult>;
39+
export function createDiscordR6Webhook(webhookUrl: string, playerData: any, options: DiscordWebhookOptions): Promise<any>;
40+
export function getPlayerComparisons(params: PlayerComparisonsParams): Promise<PlayerComparisonsResult>;

types/index.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Index file for all types - re-exports everything for convenience
2+
3+
export * from './base-types';
4+
export * from './params-interfaces';
5+
export * from './result-interfaces';
6+
export * from './function-declarations';

types/params-interfaces.d.ts

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
// Parameter interfaces for r6-data.js
2+
3+
import { PlatformType, PlatformFamily, BoardId, RankVersion } from './base-types';
4+
5+
export interface AccountInfoParams {
6+
nameOnPlatform: string;
7+
platformType: PlatformType;
8+
}
9+
10+
export interface PlayerStatsParams extends AccountInfoParams {
11+
platform_families: PlatformFamily;
12+
board_id?: BoardId;
13+
}
14+
15+
export interface SeasonalStatsParams extends AccountInfoParams {}
16+
17+
export interface PlayerComparisonsParams {
18+
players: Array<{
19+
nameOnPlatform: string;
20+
platformType: PlatformType;
21+
}>;
22+
platform_families: PlatformFamily;
23+
board_id?: BoardId;
24+
compareFields?: string[];
25+
}
26+
27+
export interface GetMapsParams {
28+
name?: string;
29+
location?: string;
30+
releaseDate?: string;
31+
playlists?: string;
32+
mapReworked?: boolean;
33+
}
34+
35+
export interface GetOperatorsParams {
36+
name?: string;
37+
safename?: string;
38+
realname?: string;
39+
birthplace?: string;
40+
age?: number;
41+
date_of_birth?: string;
42+
season_introduced?: string;
43+
}
44+
45+
export interface GetSeasonsParams {
46+
name?: string;
47+
map?: string;
48+
operators?: string;
49+
weapons?: string;
50+
}
51+
52+
export interface GetAttachmentParams {
53+
name?: string;
54+
style?: string;
55+
rarity?: string;
56+
availability?: string;
57+
}
58+
59+
export interface GetCharmsParams {
60+
name?: string;
61+
collection?: string;
62+
rarity?: string;
63+
availability?: string;
64+
bundle?: string;
65+
season?: string;
66+
}
67+
68+
export interface GetWeaponsParams {
69+
name?: string;
70+
}
71+
72+
export interface GetUniversalSkinsParams {
73+
name?: string;
74+
}
75+
76+
export interface GetRanksParams {
77+
version?: RankVersion;
78+
min_mmr?: number;
79+
max_mmr?: number;
80+
}
81+
82+
export interface DiscordWebhookOptions {
83+
playerName: string;
84+
title?: string;
85+
message?: string;
86+
color?: number;
87+
avatarUrl?: string;
88+
}

types/result-interfaces.d.ts

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
// Result interfaces for r6-data.js
2+
3+
import { PlatformType, PlatformFamily } from './base-types';
4+
5+
export interface SearchAllResult {
6+
query: string;
7+
summary: Record<string, number>;
8+
results: {
9+
operators: any[];
10+
weapons: any[];
11+
maps: any[];
12+
seasons: any[];
13+
charms: any[];
14+
attachments: any[];
15+
[k: string]: any;
16+
};
17+
}
18+
19+
export interface GameStats {
20+
steam?: {
21+
concurrent?: number;
22+
estimate?: number;
23+
};
24+
crossPlatform?: {
25+
totalRegistered?: number;
26+
monthlyActive?: number;
27+
trendsEstimate?: number;
28+
platforms?: {
29+
pc?: number;
30+
playstation?: number;
31+
xbox?: number;
32+
};
33+
};
34+
ubisoft?: {
35+
onlineEstimate?: number;
36+
};
37+
lastUpdated?: string;
38+
[k: string]: any;
39+
}
40+
41+
export interface PlayerComparisonsResult {
42+
players: Array<{
43+
player: {
44+
nameOnPlatform: string;
45+
platformType: PlatformType;
46+
};
47+
stats: any;
48+
success: boolean;
49+
error?: string;
50+
}>;
51+
comparison_summary: {
52+
field_comparisons: Record<string, {
53+
rankings: Array<{
54+
player: string;
55+
value: number;
56+
platform: PlatformType;
57+
}>;
58+
highest: {
59+
player: string;
60+
value: number;
61+
platform: PlatformType;
62+
};
63+
lowest: {
64+
player: string;
65+
value: number;
66+
platform: PlatformType;
67+
};
68+
average: number;
69+
}>;
70+
rankings: Record<string, any>;
71+
};
72+
metadata: {
73+
total_players: number;
74+
successful_fetches: number;
75+
failed_fetches: number;
76+
platform_families: PlatformFamily;
77+
board_id: string;
78+
timestamp: string;
79+
};
80+
errors?: Array<{
81+
player: {
82+
nameOnPlatform: string;
83+
platformType: PlatformType;
84+
};
85+
error: string;
86+
}>;
87+
}

0 commit comments

Comments
 (0)