eclesiar-sdk 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/package.json +24 -0
  2. package/src/api/accounts/getAccount.ts +9 -0
  3. package/src/api/accounts/getMyEquipment.ts +9 -0
  4. package/src/api/accounts/index.ts +14 -0
  5. package/src/api/accounts/types.ts +6 -0
  6. package/src/api/countries/getCountries.ts +7 -0
  7. package/src/api/countries/getCountryRegions.ts +13 -0
  8. package/src/api/countries/index.ts +14 -0
  9. package/src/api/countries/types.ts +6 -0
  10. package/src/api/index.ts +13 -0
  11. package/src/api/market/getAuctionBid.ts +14 -0
  12. package/src/api/market/getAuctions.ts +13 -0
  13. package/src/api/market/getCoinOffers.ts +20 -0
  14. package/src/api/market/getItemOffers.ts +20 -0
  15. package/src/api/market/getJobs.ts +19 -0
  16. package/src/api/market/index.ts +23 -0
  17. package/src/api/market/types.ts +9 -0
  18. package/src/api/server/getEquipments.ts +9 -0
  19. package/src/api/server/getItems.ts +9 -0
  20. package/src/api/server/getStatus.ts +6 -0
  21. package/src/api/server/index.ts +17 -0
  22. package/src/api/server/types.ts +6 -0
  23. package/src/api/statistics/getStatistics.ts +14 -0
  24. package/src/api/statistics/index.ts +12 -0
  25. package/src/api/statistics/types.ts +5 -0
  26. package/src/api/wars/getWarRoundHits.ts +19 -0
  27. package/src/api/wars/getWarRounds.ts +11 -0
  28. package/src/api/wars/getWars.ts +22 -0
  29. package/src/api/wars/index.ts +18 -0
  30. package/src/api/wars/types.ts +7 -0
  31. package/src/client.ts +68 -0
  32. package/src/index.ts +10 -0
  33. package/src/types/accounts.ts +17 -0
  34. package/src/types/country.ts +41 -0
  35. package/src/types/index.ts +6 -0
  36. package/src/types/market.ts +61 -0
  37. package/src/types/server.ts +41 -0
  38. package/src/types/statistics.ts +25 -0
  39. package/src/types/wars.ts +51 -0
  40. package/tsconfig.json +18 -0
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "eclesiar-sdk",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "import": "./dist/index.js",
10
+ "require": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ }
13
+ },
14
+ "license": "ISC",
15
+ "type": "module",
16
+ "scripts": {
17
+ "build": "tsc --declaration --outDir dist --moduleResolution node && tsc-alias"
18
+ },
19
+ "devDependencies": {
20
+ "@types/node": "^24.0.15",
21
+ "tsc-alias": "^1.8.16",
22
+ "typescript": "^5.8.3"
23
+ }
24
+ }
@@ -0,0 +1,9 @@
1
+ import { apiFetch } from "@/client";
2
+ import { AccountData } from "@/types/accounts";
3
+
4
+ export async function getAccount({
5
+ account_id
6
+ }: { account_id: number }): Promise<AccountData>{
7
+ const params = new URLSearchParams({ account_id: String(account_id) });
8
+ return apiFetch<AccountData>(`/account?${params.toString()}`)
9
+ }
@@ -0,0 +1,9 @@
1
+ import { apiFetch } from "@/client";
2
+ import { EquipmentItem } from "@/types/accounts";
3
+
4
+ export async function getMyEquipment({
5
+ page = 1
6
+ }: { page?: number } = {}): Promise<EquipmentItem[]>{
7
+ const params = new URLSearchParams({ page: String(page) });
8
+ return apiFetch<EquipmentItem[]>(`/account/mine/equipments?${params.toString()}`)
9
+ }
@@ -0,0 +1,14 @@
1
+ import { getAccount } from './getAccount';
2
+ import { getMyEquipment } from './getMyEquipment';
3
+
4
+ import type { AccountsApi } from './types';
5
+
6
+ export const accountsApi: AccountsApi = {
7
+ getAccount,
8
+ getMyEquipment,
9
+ }
10
+ export type { AccountsApi };
11
+ export {
12
+ getAccount,
13
+ getMyEquipment,
14
+ }
@@ -0,0 +1,6 @@
1
+ import { AccountData, EquipmentItem } from "@/types";
2
+
3
+ export interface AccountsApi {
4
+ getAccount({ account_id }: { account_id: number }): Promise<AccountData>
5
+ getMyEquipment(): Promise<EquipmentItem[]>;
6
+ }
@@ -0,0 +1,7 @@
1
+ import { apiFetch } from "@/client";
2
+ import { Nation } from "@/types/country";
3
+
4
+ export async function getCountries(
5
+ ): Promise<Nation[]>{
6
+ return apiFetch<Nation[]>(`/countries`)
7
+ }
@@ -0,0 +1,13 @@
1
+ import { apiFetch } from "@/client";
2
+ import { Region } from "@/types/country";
3
+
4
+ type GetCountryRegionsParams = {
5
+ country_id: number;
6
+ };
7
+
8
+ export async function getCountryRegions({
9
+ country_id
10
+ }: GetCountryRegionsParams): Promise<Region[]>{
11
+ const params = new URLSearchParams({ country_id: String(country_id) });
12
+ return apiFetch<Region[]>(`/country/regions?${params.toString()}`)
13
+ }
@@ -0,0 +1,14 @@
1
+ import { getCountries } from './getCountries';
2
+ import { getCountryRegions } from './getCountryRegions';
3
+
4
+ import type { CountriesApi } from './types';
5
+
6
+ export const countriesApi: CountriesApi = {
7
+ getCountries,
8
+ getCountryRegions,
9
+ }
10
+ export type { CountriesApi };
11
+ export {
12
+ getCountries,
13
+ getCountryRegions,
14
+ }
@@ -0,0 +1,6 @@
1
+ import { Nation, Region } from "@/types";
2
+
3
+ export interface CountriesApi {
4
+ getCountries(): Promise<Nation[]>;
5
+ getCountryRegions({ country_id }: { country_id: number }): Promise<Region[]>;
6
+ }
@@ -0,0 +1,13 @@
1
+ export { accountsApi as accounts } from './accounts';
2
+ export { countriesApi as countries } from './countries';
3
+ export { marketApi as market } from './market';
4
+ export { serverApi as server } from './server';
5
+ export { statisticsApi as statistics } from './statistics';
6
+ export { warsApi as wars } from './wars';
7
+
8
+ export type { AccountsApi } from './accounts/types';
9
+ export type { CountriesApi } from './countries/types';
10
+ export type { MarketApi } from './market/types';
11
+ export type { ServerApi } from './server/types';
12
+ export type { StatisticsApi } from './statistics/types';
13
+ export type { WarsApi } from './wars/types';
@@ -0,0 +1,14 @@
1
+ import { apiFetch } from "@/client";
2
+ import { MarketAuctionBid } from "@/types/market";
3
+
4
+ export async function getAuctionBid({
5
+ auction_id,
6
+ page = 1,
7
+ }: { auction_id: number; page?: number }): Promise<MarketAuctionBid[]> {
8
+ const params = new URLSearchParams({
9
+ auction_id: String(auction_id),
10
+ page: String(page),
11
+ });
12
+
13
+ return apiFetch<MarketAuctionBid[]>(`/market/auction/bids/get?${params.toString()}`);
14
+ }
@@ -0,0 +1,13 @@
1
+ import { apiFetch } from "@/client";
2
+ import { MarketAuction } from "@/types/market";
3
+
4
+ export async function getAuctions({
5
+ finished = 0,
6
+ page = 1,
7
+ }: { finished?: 0 | 1; page?: number } = {}): Promise<MarketAuction[]> {
8
+ const params = new URLSearchParams({
9
+ finished: finished.toString(),
10
+ page: page.toString(),
11
+ });
12
+ return apiFetch<MarketAuction[]>(`/market/auctions/get?${params.toString()}`);
13
+ }
@@ -0,0 +1,20 @@
1
+ import { apiFetch } from '@/client';
2
+ import { MarketCoinOffer } from '@/types/market';
3
+
4
+ export async function getCoinOffers({
5
+ currency_id,
6
+ transaction = 'BUY',
7
+ page = 1,
8
+ }: {
9
+ currency_id: number;
10
+ transaction?: 'BUY' | 'SELL';
11
+ page?: number;
12
+ }): Promise<MarketCoinOffer[]> {
13
+ const query = new URLSearchParams({
14
+ currency_id: String(currency_id),
15
+ transaction: String(transaction),
16
+ page: String(page),
17
+ });
18
+
19
+ return apiFetch<MarketCoinOffer[]>(`/market/coin/get?${query}`);
20
+ }
@@ -0,0 +1,20 @@
1
+ import { apiFetch } from '@/client';
2
+ import { MarketItemOffer } from '@/types/market';
3
+
4
+ export async function getItemOffers({
5
+ country_id,
6
+ item_id,
7
+ page = 1,
8
+ }: {
9
+ country_id: number;
10
+ item_id: number;
11
+ page?: number;
12
+ }): Promise<MarketItemOffer[]> {
13
+ const query = new URLSearchParams({
14
+ country_id: String(country_id),
15
+ item_id: String(item_id),
16
+ page: String(page),
17
+ });
18
+
19
+ return apiFetch<MarketItemOffer[]>(`/market/items/get?${query}`);
20
+ }
@@ -0,0 +1,19 @@
1
+ import { apiFetch } from "@/client";
2
+ import { MarketJobOffer } from "@/types/market";
3
+
4
+ type GetJobsParams = {
5
+ country_id: number;
6
+ page?: number;
7
+ };
8
+
9
+ export async function getJobs({
10
+ country_id,
11
+ page = 1,
12
+ }: GetJobsParams): Promise<MarketJobOffer[]> {
13
+ const query = new URLSearchParams({
14
+ country_id: String(country_id),
15
+ page: String(page),
16
+ });
17
+
18
+ return apiFetch<MarketJobOffer[]>(`/market/jobs/get?${query}`);
19
+ }
@@ -0,0 +1,23 @@
1
+ import { getCoinOffers } from './getCoinOffers';
2
+ import { getItemOffers } from './getItemOffers';
3
+ import { getJobs } from './getJobs';
4
+ import { getAuctions } from './getAuctions';
5
+ import { getAuctionBid } from './getAuctionBid';
6
+
7
+ import type { MarketApi } from './types';
8
+
9
+ export const marketApi: MarketApi = {
10
+ getCoinOffers,
11
+ getItemOffers,
12
+ getJobs,
13
+ getAuctions,
14
+ getAuctionBid,
15
+ }
16
+ export type { MarketApi };
17
+ export {
18
+ getCoinOffers,
19
+ getItemOffers,
20
+ getJobs,
21
+ getAuctions,
22
+ getAuctionBid,
23
+ }
@@ -0,0 +1,9 @@
1
+ import { MarketAuction, MarketAuctionBid, MarketCoinOffer, MarketItemOffer, MarketJobOffer } from "@/types";
2
+
3
+ export interface MarketApi {
4
+ getCoinOffers({ currency_id, transaction, page }: { currency_id: number, transaction: 'BUY' | 'SELL', page?: number }): Promise<MarketCoinOffer[]>;
5
+ getItemOffers({ country_id, item_id, page }: { country_id: number, item_id: number, page?: number }): Promise<MarketItemOffer[]>;
6
+ getJobs({ country_id, page }: { country_id: number, page?: number }): Promise<MarketJobOffer[]>;
7
+ getAuctions({ finished, page }: { finished?: 0 | 1, page?: number }): Promise<MarketAuction[]>;
8
+ getAuctionBid({ auction_id, page }: { auction_id: number, page?: number }): Promise<MarketAuctionBid[]>;
9
+ }
@@ -0,0 +1,9 @@
1
+ import { apiFetch } from "@/client";
2
+ import { ServerEquipment } from "@/types/server";
3
+
4
+ export async function getServerEquipments(
5
+ { page = 1 }: { page?: number } = {}
6
+ ): Promise<ServerEquipment[]> {
7
+ const params = new URLSearchParams({ page: String(page) });
8
+ return apiFetch<ServerEquipment[]>(`/server/equipments?${params}`);
9
+ }
@@ -0,0 +1,9 @@
1
+ import { apiFetch } from "@/client";
2
+ import { ServerItem } from "@/types/server";
3
+
4
+ export async function getServerItems(
5
+ { page = 1 }: { page?: number } = {}
6
+ ): Promise<ServerItem[]> {
7
+ const params = new URLSearchParams({ page: String(page) });
8
+ return apiFetch<ServerItem[]>(`/server/items?${params}`);
9
+ }
@@ -0,0 +1,6 @@
1
+ import { apiFetch } from "@/client";
2
+ import { ServerStatus } from "@/types/server";
3
+
4
+ export async function getServerStatus(): Promise<ServerStatus[]> {
5
+ return apiFetch<ServerStatus[]>("/server/status");
6
+ }
@@ -0,0 +1,17 @@
1
+ import { getServerStatus } from './getStatus';
2
+ import { getServerItems } from './getItems';
3
+ import { getServerEquipments } from './getEquipments';
4
+
5
+ import type { ServerApi } from './types';
6
+
7
+ export const serverApi: ServerApi = {
8
+ getServerStatus,
9
+ getServerItems,
10
+ getServerEquipments,
11
+ };
12
+ export type { ServerApi };
13
+ export {
14
+ getServerStatus,
15
+ getServerItems,
16
+ getServerEquipments,
17
+ };
@@ -0,0 +1,6 @@
1
+ import { ServerEquipment, ServerItem, ServerStatus } from "@/types/server";
2
+ export interface ServerApi {
3
+ getServerStatus(): Promise<ServerStatus[]>;
4
+ getServerItems({ page }: { page?: number }): Promise<ServerItem[]>;
5
+ getServerEquipments({ page }: { page?: number }): Promise<ServerEquipment[]>;
6
+ }
@@ -0,0 +1,14 @@
1
+ import { apiFetch } from "@/client";
2
+ import { CountryStatisticType, RankingItem } from "@/types/statistics";
3
+
4
+ type GetStatisticsParams = {
5
+ statistic: CountryStatisticType;
6
+ };
7
+
8
+ export async function getStatistics({
9
+ statistic,
10
+ }: GetStatisticsParams): Promise<RankingItem[]> {
11
+ const query = new URLSearchParams({ statistic });
12
+
13
+ return apiFetch<RankingItem[]>(`/statistics/country?${query}`);
14
+ }
@@ -0,0 +1,12 @@
1
+ import { getStatistics } from './getStatistics';
2
+
3
+ import type { StatisticsApi } from './types';
4
+
5
+ export const statisticsApi: StatisticsApi = {
6
+ getStatistics,
7
+ }
8
+
9
+ export type { StatisticsApi };
10
+ export {
11
+ getStatistics,
12
+ }
@@ -0,0 +1,5 @@
1
+ import { CountryStatisticType, RankingItem } from "@/types";
2
+
3
+ export interface StatisticsApi {
4
+ getStatistics({ statistic }: { statistic: CountryStatisticType }): Promise<RankingItem[]>;
5
+ }
@@ -0,0 +1,19 @@
1
+ import { apiFetch } from "@/client";
2
+ import { WarHit } from "@/types/wars";
3
+
4
+ type GetWarRoundHitsParams = {
5
+ war_round_id: number;
6
+ page?: number;
7
+ };
8
+
9
+ export async function getWarRoundHits({
10
+ war_round_id,
11
+ page = 1,
12
+ }: GetWarRoundHitsParams): Promise<WarHit[]> {
13
+ const query = new URLSearchParams({
14
+ war_round_id: String(war_round_id),
15
+ page: String(page),
16
+ });
17
+
18
+ return apiFetch<WarHit[]>(`/war/round/hits?${query}`);
19
+ }
@@ -0,0 +1,11 @@
1
+ import { apiFetch } from "@/client";
2
+ import { WarRound } from "@/types/wars";
3
+
4
+ type GetWarRoundsParams = {
5
+ war_id: number;
6
+ };
7
+
8
+ export async function getWarRounds({ war_id }: GetWarRoundsParams): Promise<WarRound[]> {
9
+ const query = new URLSearchParams({ war_id: String(war_id) });
10
+ return apiFetch<WarRound[]>(`/war/rounds?${query}`);
11
+ }
@@ -0,0 +1,22 @@
1
+ import { apiFetch } from "@/client";
2
+ import { War } from "@/types/wars";
3
+
4
+ type GetWarsParams = {
5
+ event_wars?: 0 | 1;
6
+ extra_details?: 0 | 1;
7
+ war_id?: number;
8
+ };
9
+
10
+ export async function getWars({
11
+ event_wars = 0,
12
+ extra_details = 0,
13
+ war_id = 0,
14
+ }: GetWarsParams = {}): Promise<War[]> {
15
+ const query = new URLSearchParams({
16
+ event_wars: String(event_wars),
17
+ extra_details: String(extra_details),
18
+ war_id: String(war_id),
19
+ });
20
+
21
+ return apiFetch<War[]>(`/wars?${query}`);
22
+ }
@@ -0,0 +1,18 @@
1
+ import { getWars } from './getWars';
2
+ import { getWarRounds } from './getWarRounds';
3
+ import { getWarRoundHits } from './getWarRoundHits';
4
+
5
+ import type { WarsApi } from './types';
6
+
7
+ export const warsApi: WarsApi = {
8
+ getWars,
9
+ getWarRounds,
10
+ getWarRoundHits,
11
+ }
12
+
13
+ export type { WarsApi };
14
+ export {
15
+ getWars,
16
+ getWarRounds,
17
+ getWarRoundHits,
18
+ }
@@ -0,0 +1,7 @@
1
+ import { WarRound, WarHit, War } from "@/types";
2
+
3
+ export interface WarsApi {
4
+ getWars(): Promise<War[]>;
5
+ getWarRounds({ war_id }: { war_id: number }): Promise<WarRound[]>;
6
+ getWarRoundHits({ war_round_id }: { war_round_id: number }): Promise<WarHit[]>;
7
+ }
package/src/client.ts ADDED
@@ -0,0 +1,68 @@
1
+ import { accountsApi } from './api/accounts';
2
+ import { countriesApi } from './api/countries';
3
+ import { marketApi } from './api/market';
4
+ import { serverApi } from './api/server';
5
+ import { statisticsApi } from './api/statistics';
6
+ import { warsApi } from './api/wars';
7
+
8
+ import type { AccountsApi } from './api/accounts/types';
9
+ import type { CountriesApi } from './api/countries/types';
10
+ import type { MarketApi } from './api/market/types';
11
+ import type { ServerApi } from './api/server/types';
12
+ import type { StatisticsApi } from './api/statistics/types';
13
+ import type { WarsApi } from './api/wars/types';
14
+
15
+ type ApiResponse<T> = {
16
+ code: number;
17
+ description: string;
18
+ data: T;
19
+ };
20
+
21
+ const BASE_URL = 'https://api.eclesiar.com';
22
+
23
+ let token = '';
24
+
25
+ export function setToken(newToken: string) {
26
+ token = newToken;
27
+ }
28
+
29
+ export async function apiFetch<T>(
30
+ endpoint: string,
31
+ options: RequestInit = {}
32
+ ): Promise<T> {
33
+ const res = await fetch(`${BASE_URL}${endpoint}`, {
34
+ ...options,
35
+ headers: {
36
+ Authorization: `Bearer ${token}`,
37
+ ...(options.headers || {}),
38
+ },
39
+ });
40
+
41
+ if (!res.ok) {
42
+ throw new Error(
43
+ `API Error: ${res.status} ${res.statusText} ${endpoint}`
44
+ );
45
+ }
46
+
47
+ const json: ApiResponse<T> = await res.json();
48
+
49
+ return json.data;
50
+ }
51
+
52
+ export interface SdkClient {
53
+ accounts: AccountsApi;
54
+ countries: CountriesApi;
55
+ market: MarketApi;
56
+ server: ServerApi;
57
+ statistics: StatisticsApi;
58
+ wars: WarsApi;
59
+ }
60
+
61
+ export const apiClient: SdkClient = {
62
+ accounts: accountsApi,
63
+ countries: countriesApi,
64
+ market: marketApi,
65
+ server: serverApi,
66
+ statistics: statisticsApi,
67
+ wars: warsApi,
68
+ };
package/src/index.ts ADDED
@@ -0,0 +1,10 @@
1
+ export { apiClient, setToken } from './client';
2
+ export type {
3
+ AccountsApi,
4
+ CountriesApi,
5
+ MarketApi,
6
+ ServerApi,
7
+ StatisticsApi,
8
+ WarsApi,
9
+ } from './api';
10
+ export type { SdkClient } from './client';
@@ -0,0 +1,17 @@
1
+ export type AccountData = {
2
+ id: number;
3
+ username: string;
4
+ avatar: string;
5
+ region_id: number;
6
+ nationality_id: number;
7
+ total_damage: number;
8
+ total_mined_gold: number;
9
+ total_builder_progress: number;
10
+ day_of_birth: number;
11
+ }
12
+
13
+ export type EquipmentItem = {
14
+ id: number;
15
+ equipment_id: number;
16
+ is_equipped: boolean;
17
+ }
@@ -0,0 +1,41 @@
1
+ export type Currency = {
2
+ id: number;
3
+ name: string;
4
+ symbol: string;
5
+ }
6
+
7
+ export type Nation = {
8
+ id: number;
9
+ name: string;
10
+ avatar: string;
11
+ currency: Currency;
12
+ }
13
+
14
+ export interface RegionBonus {
15
+ type: string;
16
+ value: number;
17
+ }
18
+
19
+ export type RegionFactories = {
20
+ food: number;
21
+ weapon: number;
22
+ oil: number;
23
+ grain: number;
24
+ iron: number;
25
+ aircraft: number;
26
+ titanium: number;
27
+ tickets: number;
28
+ }
29
+
30
+ export type Region = {
31
+ id: number;
32
+ name: string;
33
+ type: number;
34
+ population: number;
35
+ original_country_id: number;
36
+ country_id: number;
37
+ nb_npcs: number;
38
+ pollution: number;
39
+ factories: RegionFactories;
40
+ bonus: RegionBonus[];
41
+ }
@@ -0,0 +1,6 @@
1
+ export * from './market';
2
+ export * from './server';
3
+ export * from './accounts'
4
+ export * from './country'
5
+ export * from './statistics'
6
+ export * from './wars'
@@ -0,0 +1,61 @@
1
+ export interface ApiResponse<T> {
2
+ code: number;
3
+ description: string;
4
+ data: T;
5
+ }
6
+
7
+ export interface MarketCoinOffer {
8
+ id: number;
9
+ currency_id: number;
10
+ amount: number;
11
+ price: number;
12
+ owner: {
13
+ id: number;
14
+ type: string;
15
+ };
16
+ }
17
+
18
+ export interface MarketItemOffer {
19
+ id: number;
20
+ item_id: number;
21
+ amount: number;
22
+ price: number;
23
+ owner: {
24
+ id: number;
25
+ type: string;
26
+ };
27
+ }
28
+
29
+ export interface MarketJobOffer {
30
+ value: number;
31
+ amount: number;
32
+ economic_skill: number;
33
+ currency_id: number;
34
+ business_id: number;
35
+ }
36
+
37
+ export interface MarketAuction {
38
+ id: number;
39
+ item: {
40
+ id: number;
41
+ type: string;
42
+ };
43
+ owner: {
44
+ id: number;
45
+ type: string;
46
+ };
47
+ initial_bid: number;
48
+ created_at: string;
49
+ end_at: string;
50
+ status: number;
51
+ }
52
+
53
+ export interface MarketAuctionBid {
54
+ id: number;
55
+ bid: number;
56
+ created_at: string;
57
+ owner: {
58
+ id: number;
59
+ type: string;
60
+ };
61
+ }
@@ -0,0 +1,41 @@
1
+ export type ServerStatus = {
2
+ status: string;
3
+ version: string;
4
+ server_name: string;
5
+ server_time: string;
6
+ server_day: number;
7
+ };
8
+
9
+ export type ServerItem = {
10
+ id: number;
11
+ name: string;
12
+ quality: number;
13
+ type: string;
14
+ avatar: string;
15
+ };
16
+
17
+ export type ServerEquipment = {
18
+ id: number;
19
+ slot: number;
20
+ grade: number;
21
+ critical_chance: number;
22
+ critical_hit: number;
23
+ damage_percentage: number;
24
+ true_damage: number;
25
+ flatland_damage_percentage: number;
26
+ mountains_damage_percentage: number;
27
+ forest_damage_percentage: number;
28
+ desert_damage_percentage: number;
29
+ accuracy: number;
30
+ drop_chance: number;
31
+ construction_percentage: number;
32
+ hospital_construction_percentage: number;
33
+ militarybase_construction_percentage: number;
34
+ productionfields_construction_percentage: number;
35
+ industrialzone_construction_percentage: number;
36
+ construction_item_donation_percentage: number;
37
+ mining_gold_percentage: number;
38
+ construction_energy_reduction_percentage: number;
39
+ avatar: string;
40
+ drop_category: string;
41
+ };
@@ -0,0 +1,25 @@
1
+ export type CountryStatisticType =
2
+ | "development"
3
+ | "citizens"
4
+ | "builders"
5
+ | "buildings"
6
+ | "miners"
7
+ | "todaycitizens"
8
+ | "productivity"
9
+ | "activecitizens"
10
+ | "damagetoday"
11
+ | "damage"
12
+ | "strength"
13
+ | "regions"
14
+ | "npcwage";
15
+
16
+ export type RankedEntity = {
17
+ id: number;
18
+ name: string;
19
+ avatar: string;
20
+ }
21
+
22
+ export type RankingItem = {
23
+ entity: RankedEntity;
24
+ value: number;
25
+ }
@@ -0,0 +1,51 @@
1
+ export type WarNation = {
2
+ id: number;
3
+ name: string;
4
+ avatar: string;
5
+ };
6
+
7
+ export type WarRegion = {
8
+ id: number;
9
+ name: string;
10
+ };
11
+
12
+ export type WarFlags = {
13
+ is_revolution: 0 | 1;
14
+ };
15
+
16
+ export type War = {
17
+ id: number;
18
+ attackers: WarNation;
19
+ defenders: WarNation;
20
+ region: WarRegion;
21
+ attackers_score: number;
22
+ defenders_score: number;
23
+ current_round_number: number;
24
+ current_round_id: number;
25
+ flags: WarFlags;
26
+ };
27
+
28
+ export type WarRound = {
29
+ id: number;
30
+ end_date: string;
31
+ attackers_score: number;
32
+ defenders_score: number;
33
+ attackers_points: number;
34
+ defenders_points: number;
35
+ attackers_hero: number | null;
36
+ defenders_hero: number | null;
37
+ };
38
+
39
+ export type HitFighter = {
40
+ id: number;
41
+ type: "account";
42
+ };
43
+
44
+ export type WarHit = {
45
+ id: number;
46
+ fighter: HitFighter;
47
+ damage: number;
48
+ side: "ATTACKER" | "DEFENDER";
49
+ item_id: number | null;
50
+ created_at: string;
51
+ };
package/tsconfig.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "ES2022",
5
+ "moduleResolution": "node",
6
+ "outDir": "dist",
7
+ "declaration": true,
8
+ "emitDeclarationOnly": false,
9
+ "strict": true,
10
+ "esModuleInterop": true,
11
+ "skipLibCheck": true,
12
+ "baseUrl": "./src",
13
+ "paths": {
14
+ "@/*": ["*"]
15
+ }
16
+ },
17
+ "include": ["src"]
18
+ }