eclesiar-sdk 1.0.4 → 1.1.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.
- package/package.json +1 -4
- package/src/api/accounts/getAccount.ts +9 -0
- package/src/api/accounts/getMyEquipment.ts +9 -0
- package/{dist/api/accounts/index.d.ts → src/api/accounts/index.ts} +10 -2
- package/src/api/accounts/types.ts +6 -0
- package/src/api/countries/getCountries.ts +7 -0
- package/src/api/countries/getCountryRegions.ts +13 -0
- package/{dist/api/countries/index.d.ts → src/api/countries/index.ts} +10 -2
- package/src/api/countries/types.ts +6 -0
- package/{dist/api/index.d.ts → src/api/index.ts} +2 -1
- package/src/api/market/getAuctionBid.ts +14 -0
- package/src/api/market/getAuctions.ts +13 -0
- package/src/api/market/getCoinOffers.ts +20 -0
- package/src/api/market/getItemOffers.ts +20 -0
- package/src/api/market/getJobs.ts +19 -0
- package/{dist/api/market/index.js → src/api/market/index.ts} +13 -3
- package/src/api/market/types.ts +9 -0
- package/src/api/server/getEquipments.ts +9 -0
- package/src/api/server/getItems.ts +9 -0
- package/src/api/server/getStatus.ts +6 -0
- package/{dist/api/server/index.d.ts → src/api/server/index.ts} +12 -2
- package/src/api/server/types.ts +6 -0
- package/src/api/statistics/getStatistics.ts +14 -0
- package/{dist/api/statistics/index.d.ts → src/api/statistics/index.ts} +9 -2
- package/src/api/statistics/types.ts +5 -0
- package/src/api/wars/getWarRoundHits.ts +19 -0
- package/src/api/wars/getWarRounds.ts +11 -0
- package/src/api/wars/getWars.ts +28 -0
- package/{dist/api/wars/index.d.ts → src/api/wars/index.ts} +13 -2
- package/src/api/wars/types.ts +7 -0
- package/src/client.ts +68 -0
- package/src/index.ts +10 -0
- package/{dist/types/accounts.d.ts → src/types/accounts.ts} +4 -3
- package/{dist/types/country.d.ts → src/types/country.ts} +15 -11
- package/src/types/index.ts +6 -0
- package/src/types/market.ts +57 -0
- package/{dist/types/server.d.ts → src/types/server.ts} +7 -5
- package/src/types/statistics.ts +25 -0
- package/src/types/wars.ts +51 -0
- package/tsconfig.json +18 -0
- package/dist/api/accounts/getAccount.d.ts +0 -4
- package/dist/api/accounts/getAccount.js +0 -5
- package/dist/api/accounts/getMyEquipment.d.ts +0 -4
- package/dist/api/accounts/getMyEquipment.js +0 -5
- package/dist/api/accounts/index.js +0 -7
- package/dist/api/accounts/types.d.ts +0 -7
- package/dist/api/accounts/types.js +0 -1
- package/dist/api/countries/getCountries.d.ts +0 -2
- package/dist/api/countries/getCountries.js +0 -4
- package/dist/api/countries/getCountryRegions.d.ts +0 -6
- package/dist/api/countries/getCountryRegions.js +0 -5
- package/dist/api/countries/index.js +0 -7
- package/dist/api/countries/types.d.ts +0 -7
- package/dist/api/countries/types.js +0 -1
- package/dist/api/index.js +0 -6
- package/dist/api/market/getAuctionBid.d.ts +0 -5
- package/dist/api/market/getAuctionBid.js +0 -8
- package/dist/api/market/getAuctions.d.ts +0 -5
- package/dist/api/market/getAuctions.js +0 -8
- package/dist/api/market/getCoinOffers.d.ts +0 -6
- package/dist/api/market/getCoinOffers.js +0 -9
- package/dist/api/market/getItemOffers.d.ts +0 -6
- package/dist/api/market/getItemOffers.js +0 -9
- package/dist/api/market/getJobs.d.ts +0 -7
- package/dist/api/market/getJobs.js +0 -8
- package/dist/api/market/index.d.ts +0 -9
- package/dist/api/market/types.d.ts +0 -25
- package/dist/api/market/types.js +0 -1
- package/dist/api/server/getEquipments.d.ts +0 -4
- package/dist/api/server/getEquipments.js +0 -5
- package/dist/api/server/getItems.d.ts +0 -4
- package/dist/api/server/getItems.js +0 -5
- package/dist/api/server/getStatus.d.ts +0 -2
- package/dist/api/server/getStatus.js +0 -4
- package/dist/api/server/index.js +0 -9
- package/dist/api/server/types.d.ts +0 -10
- package/dist/api/server/types.js +0 -1
- package/dist/api/statistics/getStatistics.d.ts +0 -6
- package/dist/api/statistics/getStatistics.js +0 -5
- package/dist/api/statistics/index.js +0 -5
- package/dist/api/statistics/types.d.ts +0 -6
- package/dist/api/statistics/types.js +0 -1
- package/dist/api/wars/getWarRoundHits.d.ts +0 -7
- package/dist/api/wars/getWarRoundHits.js +0 -8
- package/dist/api/wars/getWarRounds.d.ts +0 -6
- package/dist/api/wars/getWarRounds.js +0 -5
- package/dist/api/wars/getWars.d.ts +0 -8
- package/dist/api/wars/getWars.js +0 -9
- package/dist/api/wars/index.js +0 -9
- package/dist/api/wars/types.d.ts +0 -10
- package/dist/api/wars/types.js +0 -1
- package/dist/client.d.ts +0 -17
- package/dist/client.js +0 -33
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -1
- package/dist/types/accounts.js +0 -1
- package/dist/types/country.js +0 -1
- package/dist/types/index.d.ts +0 -6
- package/dist/types/index.js +0 -6
- package/dist/types/market.d.ts +0 -52
- package/dist/types/market.js +0 -1
- package/dist/types/server.js +0 -1
- package/dist/types/statistics.d.ts +0 -10
- package/dist/types/statistics.js +0 -1
- package/dist/types/wars.d.ts +0 -45
- package/dist/types/wars.js +0 -1
|
@@ -4,15 +4,17 @@ export type ServerStatus = {
|
|
|
4
4
|
server_name: string;
|
|
5
5
|
server_time: string;
|
|
6
6
|
server_day: number;
|
|
7
|
-
};
|
|
8
|
-
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export type ServerItem = {
|
|
9
10
|
id: number;
|
|
10
11
|
name: string;
|
|
11
12
|
quality: number;
|
|
12
13
|
type: string;
|
|
13
14
|
avatar: string;
|
|
14
|
-
};
|
|
15
|
-
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type ServerEquipment = {
|
|
16
18
|
id: number;
|
|
17
19
|
slot: number;
|
|
18
20
|
grade: number;
|
|
@@ -36,4 +38,4 @@ export type ServerEquipment = {
|
|
|
36
38
|
construction_energy_reduction_percentage: number;
|
|
37
39
|
avatar: string;
|
|
38
40
|
drop_category: string;
|
|
39
|
-
};
|
|
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
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/api/index.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
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';
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { apiFetch } from "../../client";
|
|
2
|
-
export async function getAuctionBid({ auction_id, page = 1, }) {
|
|
3
|
-
const params = new URLSearchParams({
|
|
4
|
-
auction_id: String(auction_id),
|
|
5
|
-
page: String(page),
|
|
6
|
-
});
|
|
7
|
-
return apiFetch(`/market/auction/bids/get?${params.toString()}`);
|
|
8
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { apiFetch } from "../../client";
|
|
2
|
-
export async function getAuctions({ finished = 0, page = 1, } = {}) {
|
|
3
|
-
const params = new URLSearchParams({
|
|
4
|
-
finished: finished.toString(),
|
|
5
|
-
page: page.toString(),
|
|
6
|
-
});
|
|
7
|
-
return apiFetch(`/market/auctions/get?${params.toString()}`);
|
|
8
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { apiFetch } from '../../client';
|
|
2
|
-
export async function getCoinOffers({ currency_id, transaction = 'BUY', page = 1, }) {
|
|
3
|
-
const query = new URLSearchParams({
|
|
4
|
-
currency_id: String(currency_id),
|
|
5
|
-
transaction: String(transaction),
|
|
6
|
-
page: String(page),
|
|
7
|
-
});
|
|
8
|
-
return apiFetch(`/market/coin/get?${query}`);
|
|
9
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { apiFetch } from '../../client';
|
|
2
|
-
export async function getItemOffers({ country_id, item_id, page = 1, }) {
|
|
3
|
-
const query = new URLSearchParams({
|
|
4
|
-
country_id: String(country_id),
|
|
5
|
-
item_id: String(item_id),
|
|
6
|
-
page: String(page),
|
|
7
|
-
});
|
|
8
|
-
return apiFetch(`/market/items/get?${query}`);
|
|
9
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
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
|
-
import type { MarketApi } from './types';
|
|
7
|
-
export declare const marketApi: MarketApi;
|
|
8
|
-
export type { MarketApi };
|
|
9
|
-
export { getCoinOffers, getItemOffers, getJobs, getAuctions, getAuctionBid, };
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { MarketAuction, MarketAuctionBid, MarketCoinOffer, MarketItemOffer, MarketJobOffer } from "../../types";
|
|
2
|
-
export interface MarketApi {
|
|
3
|
-
getCoinOffers({ currency_id, transaction, page }: {
|
|
4
|
-
currency_id: number;
|
|
5
|
-
transaction: 'BUY' | 'SELL';
|
|
6
|
-
page?: number;
|
|
7
|
-
}): Promise<MarketCoinOffer[]>;
|
|
8
|
-
getItemOffers({ country_id, item_id, page }: {
|
|
9
|
-
country_id: number;
|
|
10
|
-
item_id: number;
|
|
11
|
-
page?: number;
|
|
12
|
-
}): Promise<MarketItemOffer[]>;
|
|
13
|
-
getJobs({ country_id, page }: {
|
|
14
|
-
country_id: number;
|
|
15
|
-
page?: number;
|
|
16
|
-
}): Promise<MarketJobOffer[]>;
|
|
17
|
-
getAuctions({ finished, page }: {
|
|
18
|
-
finished?: 0 | 1;
|
|
19
|
-
page?: number;
|
|
20
|
-
}): Promise<MarketAuction[]>;
|
|
21
|
-
getAuctionBid({ auction_id, page }: {
|
|
22
|
-
auction_id: number;
|
|
23
|
-
page?: number;
|
|
24
|
-
}): Promise<MarketAuctionBid[]>;
|
|
25
|
-
}
|
package/dist/api/market/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/api/server/index.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { getServerStatus } from './getStatus';
|
|
2
|
-
import { getServerItems } from './getItems';
|
|
3
|
-
import { getServerEquipments } from './getEquipments';
|
|
4
|
-
export const serverApi = {
|
|
5
|
-
getServerStatus,
|
|
6
|
-
getServerItems,
|
|
7
|
-
getServerEquipments,
|
|
8
|
-
};
|
|
9
|
-
export { getServerStatus, getServerItems, getServerEquipments, };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ServerEquipment, ServerItem, ServerStatus } from "../../types/server";
|
|
2
|
-
export interface ServerApi {
|
|
3
|
-
getServerStatus(): Promise<ServerStatus[]>;
|
|
4
|
-
getServerItems({ page }: {
|
|
5
|
-
page?: number;
|
|
6
|
-
}): Promise<ServerItem[]>;
|
|
7
|
-
getServerEquipments({ page }: {
|
|
8
|
-
page?: number;
|
|
9
|
-
}): Promise<ServerEquipment[]>;
|
|
10
|
-
}
|
package/dist/api/server/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { apiFetch } from "../../client";
|
|
2
|
-
export async function getWarRoundHits({ war_round_id, page = 1, }) {
|
|
3
|
-
const query = new URLSearchParams({
|
|
4
|
-
war_round_id: String(war_round_id),
|
|
5
|
-
page: String(page),
|
|
6
|
-
});
|
|
7
|
-
return apiFetch(`/war/round/hits?${query}`);
|
|
8
|
-
}
|
package/dist/api/wars/getWars.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { apiFetch } from "../../client";
|
|
2
|
-
export async function getWars({ event_wars = 0, extra_details = 0, war_id = 0, } = {}) {
|
|
3
|
-
const query = new URLSearchParams({
|
|
4
|
-
event_wars: String(event_wars),
|
|
5
|
-
extra_details: String(extra_details),
|
|
6
|
-
war_id: String(war_id),
|
|
7
|
-
});
|
|
8
|
-
return apiFetch(`/wars?${query}`);
|
|
9
|
-
}
|
package/dist/api/wars/index.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { getWars } from './getWars';
|
|
2
|
-
import { getWarRounds } from './getWarRounds';
|
|
3
|
-
import { getWarRoundHits } from './getWarRoundHits';
|
|
4
|
-
export const warsApi = {
|
|
5
|
-
getWars,
|
|
6
|
-
getWarRounds,
|
|
7
|
-
getWarRoundHits,
|
|
8
|
-
};
|
|
9
|
-
export { getWars, getWarRounds, getWarRoundHits, };
|
package/dist/api/wars/types.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { WarRound, WarHit, War } from "../../types";
|
|
2
|
-
export interface WarsApi {
|
|
3
|
-
getWars(): Promise<War[]>;
|
|
4
|
-
getWarRounds({ war_id }: {
|
|
5
|
-
war_id: number;
|
|
6
|
-
}): Promise<WarRound[]>;
|
|
7
|
-
getWarRoundHits({ war_round_id }: {
|
|
8
|
-
war_round_id: number;
|
|
9
|
-
}): Promise<WarHit[]>;
|
|
10
|
-
}
|
package/dist/api/wars/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/client.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { AccountsApi } from './api/accounts/types';
|
|
2
|
-
import type { CountriesApi } from './api/countries/types';
|
|
3
|
-
import type { MarketApi } from './api/market/types';
|
|
4
|
-
import type { ServerApi } from './api/server/types';
|
|
5
|
-
import type { StatisticsApi } from './api/statistics/types';
|
|
6
|
-
import type { WarsApi } from './api/wars/types';
|
|
7
|
-
export declare function setToken(newToken: string): void;
|
|
8
|
-
export declare function apiFetch<T>(endpoint: string, options?: RequestInit): Promise<T>;
|
|
9
|
-
export interface SdkClient {
|
|
10
|
-
accounts: AccountsApi;
|
|
11
|
-
countries: CountriesApi;
|
|
12
|
-
market: MarketApi;
|
|
13
|
-
server: ServerApi;
|
|
14
|
-
statistics: StatisticsApi;
|
|
15
|
-
wars: WarsApi;
|
|
16
|
-
}
|
|
17
|
-
export declare const apiClient: SdkClient;
|
package/dist/client.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
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
|
-
const BASE_URL = 'https://api.eclesiar.com';
|
|
8
|
-
let token = '';
|
|
9
|
-
export function setToken(newToken) {
|
|
10
|
-
token = newToken;
|
|
11
|
-
}
|
|
12
|
-
export async function apiFetch(endpoint, options = {}) {
|
|
13
|
-
const res = await fetch(`${BASE_URL}${endpoint}`, {
|
|
14
|
-
...options,
|
|
15
|
-
headers: {
|
|
16
|
-
Authorization: `Bearer ${token}`,
|
|
17
|
-
...(options.headers || {}),
|
|
18
|
-
},
|
|
19
|
-
});
|
|
20
|
-
if (!res.ok) {
|
|
21
|
-
throw new Error(`API Error: ${res.status} ${res.statusText} ${endpoint}`);
|
|
22
|
-
}
|
|
23
|
-
const json = await res.json();
|
|
24
|
-
return json.data;
|
|
25
|
-
}
|
|
26
|
-
export const apiClient = {
|
|
27
|
-
accounts: accountsApi,
|
|
28
|
-
countries: countriesApi,
|
|
29
|
-
market: marketApi,
|
|
30
|
-
server: serverApi,
|
|
31
|
-
statistics: statisticsApi,
|
|
32
|
-
wars: warsApi,
|
|
33
|
-
};
|
package/dist/index.d.ts
DELETED
package/dist/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { apiClient, setToken } from './client';
|
package/dist/types/accounts.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/types/country.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/types/index.d.ts
DELETED