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.
Files changed (106) hide show
  1. package/package.json +1 -4
  2. package/src/api/accounts/getAccount.ts +9 -0
  3. package/src/api/accounts/getMyEquipment.ts +9 -0
  4. package/{dist/api/accounts/index.d.ts → src/api/accounts/index.ts} +10 -2
  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/{dist/api/countries/index.d.ts → src/api/countries/index.ts} +10 -2
  9. package/src/api/countries/types.ts +6 -0
  10. package/{dist/api/index.d.ts → src/api/index.ts} +2 -1
  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/{dist/api/market/index.js → src/api/market/index.ts} +13 -3
  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/{dist/api/server/index.d.ts → src/api/server/index.ts} +12 -2
  22. package/src/api/server/types.ts +6 -0
  23. package/src/api/statistics/getStatistics.ts +14 -0
  24. package/{dist/api/statistics/index.d.ts → src/api/statistics/index.ts} +9 -2
  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 +28 -0
  29. package/{dist/api/wars/index.d.ts → src/api/wars/index.ts} +13 -2
  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/{dist/types/accounts.d.ts → src/types/accounts.ts} +4 -3
  34. package/{dist/types/country.d.ts → src/types/country.ts} +15 -11
  35. package/src/types/index.ts +6 -0
  36. package/src/types/market.ts +57 -0
  37. package/{dist/types/server.d.ts → src/types/server.ts} +7 -5
  38. package/src/types/statistics.ts +25 -0
  39. package/src/types/wars.ts +51 -0
  40. package/tsconfig.json +18 -0
  41. package/dist/api/accounts/getAccount.d.ts +0 -4
  42. package/dist/api/accounts/getAccount.js +0 -5
  43. package/dist/api/accounts/getMyEquipment.d.ts +0 -4
  44. package/dist/api/accounts/getMyEquipment.js +0 -5
  45. package/dist/api/accounts/index.js +0 -7
  46. package/dist/api/accounts/types.d.ts +0 -7
  47. package/dist/api/accounts/types.js +0 -1
  48. package/dist/api/countries/getCountries.d.ts +0 -2
  49. package/dist/api/countries/getCountries.js +0 -4
  50. package/dist/api/countries/getCountryRegions.d.ts +0 -6
  51. package/dist/api/countries/getCountryRegions.js +0 -5
  52. package/dist/api/countries/index.js +0 -7
  53. package/dist/api/countries/types.d.ts +0 -7
  54. package/dist/api/countries/types.js +0 -1
  55. package/dist/api/index.js +0 -6
  56. package/dist/api/market/getAuctionBid.d.ts +0 -5
  57. package/dist/api/market/getAuctionBid.js +0 -8
  58. package/dist/api/market/getAuctions.d.ts +0 -5
  59. package/dist/api/market/getAuctions.js +0 -8
  60. package/dist/api/market/getCoinOffers.d.ts +0 -6
  61. package/dist/api/market/getCoinOffers.js +0 -9
  62. package/dist/api/market/getItemOffers.d.ts +0 -6
  63. package/dist/api/market/getItemOffers.js +0 -9
  64. package/dist/api/market/getJobs.d.ts +0 -7
  65. package/dist/api/market/getJobs.js +0 -8
  66. package/dist/api/market/index.d.ts +0 -9
  67. package/dist/api/market/types.d.ts +0 -25
  68. package/dist/api/market/types.js +0 -1
  69. package/dist/api/server/getEquipments.d.ts +0 -4
  70. package/dist/api/server/getEquipments.js +0 -5
  71. package/dist/api/server/getItems.d.ts +0 -4
  72. package/dist/api/server/getItems.js +0 -5
  73. package/dist/api/server/getStatus.d.ts +0 -2
  74. package/dist/api/server/getStatus.js +0 -4
  75. package/dist/api/server/index.js +0 -9
  76. package/dist/api/server/types.d.ts +0 -10
  77. package/dist/api/server/types.js +0 -1
  78. package/dist/api/statistics/getStatistics.d.ts +0 -6
  79. package/dist/api/statistics/getStatistics.js +0 -5
  80. package/dist/api/statistics/index.js +0 -5
  81. package/dist/api/statistics/types.d.ts +0 -6
  82. package/dist/api/statistics/types.js +0 -1
  83. package/dist/api/wars/getWarRoundHits.d.ts +0 -7
  84. package/dist/api/wars/getWarRoundHits.js +0 -8
  85. package/dist/api/wars/getWarRounds.d.ts +0 -6
  86. package/dist/api/wars/getWarRounds.js +0 -5
  87. package/dist/api/wars/getWars.d.ts +0 -8
  88. package/dist/api/wars/getWars.js +0 -9
  89. package/dist/api/wars/index.js +0 -9
  90. package/dist/api/wars/types.d.ts +0 -10
  91. package/dist/api/wars/types.js +0 -1
  92. package/dist/client.d.ts +0 -17
  93. package/dist/client.js +0 -33
  94. package/dist/index.d.ts +0 -3
  95. package/dist/index.js +0 -1
  96. package/dist/types/accounts.js +0 -1
  97. package/dist/types/country.js +0 -1
  98. package/dist/types/index.d.ts +0 -6
  99. package/dist/types/index.js +0 -6
  100. package/dist/types/market.d.ts +0 -52
  101. package/dist/types/market.js +0 -1
  102. package/dist/types/server.js +0 -1
  103. package/dist/types/statistics.d.ts +0 -10
  104. package/dist/types/statistics.js +0 -1
  105. package/dist/types/wars.d.ts +0 -45
  106. 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
- export type ServerItem = {
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
- export type ServerEquipment = {
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,4 +0,0 @@
1
- import { AccountData } from "../../types/accounts";
2
- export declare function getAccount({ account_id }: {
3
- account_id: number;
4
- }): Promise<AccountData>;
@@ -1,5 +0,0 @@
1
- import { apiFetch } from "../../client";
2
- export async function getAccount({ account_id }) {
3
- const params = new URLSearchParams({ account_id: String(account_id) });
4
- return apiFetch(`/account?${params.toString()}`);
5
- }
@@ -1,4 +0,0 @@
1
- import { EquipmentItem } from "../../types/accounts";
2
- export declare function getMyEquipment({ page }?: {
3
- page?: number;
4
- }): Promise<EquipmentItem[]>;
@@ -1,5 +0,0 @@
1
- import { apiFetch } from "../../client";
2
- export async function getMyEquipment({ page = 1 } = {}) {
3
- const params = new URLSearchParams({ page: String(page) });
4
- return apiFetch(`/account/mine/equipments?${params.toString()}`);
5
- }
@@ -1,7 +0,0 @@
1
- import { getAccount } from './getAccount';
2
- import { getMyEquipment } from './getMyEquipment';
3
- export const accountsApi = {
4
- getAccount,
5
- getMyEquipment,
6
- };
7
- export { getAccount, getMyEquipment, };
@@ -1,7 +0,0 @@
1
- import { AccountData, EquipmentItem } from "../../types";
2
- export interface AccountsApi {
3
- getAccount({ account_id }: {
4
- account_id: number;
5
- }): Promise<AccountData>;
6
- getMyEquipment(): Promise<EquipmentItem[]>;
7
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- import { Nation } from "../../types/country";
2
- export declare function getCountries(): Promise<Nation[]>;
@@ -1,4 +0,0 @@
1
- import { apiFetch } from "../../client";
2
- export async function getCountries() {
3
- return apiFetch(`/countries`);
4
- }
@@ -1,6 +0,0 @@
1
- import { Region } from "../../types/country";
2
- type GetCountryRegionsParams = {
3
- country_id: number;
4
- };
5
- export declare function getCountryRegions({ country_id }: GetCountryRegionsParams): Promise<Region[]>;
6
- export {};
@@ -1,5 +0,0 @@
1
- import { apiFetch } from "../../client";
2
- export async function getCountryRegions({ country_id }) {
3
- const params = new URLSearchParams({ country_id: String(country_id) });
4
- return apiFetch(`/country/regions?${params.toString()}`);
5
- }
@@ -1,7 +0,0 @@
1
- import { getCountries } from './getCountries';
2
- import { getCountryRegions } from './getCountryRegions';
3
- export const countriesApi = {
4
- getCountries,
5
- getCountryRegions,
6
- };
7
- export { getCountries, getCountryRegions, };
@@ -1,7 +0,0 @@
1
- import { Nation, Region } from "../../types";
2
- export interface CountriesApi {
3
- getCountries(): Promise<Nation[]>;
4
- getCountryRegions({ country_id }: {
5
- country_id: number;
6
- }): Promise<Region[]>;
7
- }
@@ -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,5 +0,0 @@
1
- import { MarketAuctionBid } from "../../types/market";
2
- export declare function getAuctionBid({ auction_id, page, }: {
3
- auction_id: number;
4
- page?: number;
5
- }): Promise<MarketAuctionBid[]>;
@@ -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,5 +0,0 @@
1
- import { MarketAuction } from "../../types/market";
2
- export declare function getAuctions({ finished, page, }?: {
3
- finished?: 0 | 1;
4
- page?: number;
5
- }): Promise<MarketAuction[]>;
@@ -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,6 +0,0 @@
1
- import { MarketCoinOffer } from '../../types/market';
2
- export declare function getCoinOffers({ currency_id, transaction, page, }: {
3
- currency_id: number;
4
- transaction?: 'BUY' | 'SELL';
5
- page?: number;
6
- }): Promise<MarketCoinOffer[]>;
@@ -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,6 +0,0 @@
1
- import { MarketItemOffer } from '../../types/market';
2
- export declare function getItemOffers({ country_id, item_id, page, }: {
3
- country_id: number;
4
- item_id: number;
5
- page?: number;
6
- }): Promise<MarketItemOffer[]>;
@@ -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,7 +0,0 @@
1
- import { MarketJobOffer } from "../../types/market";
2
- type GetJobsParams = {
3
- country_id: number;
4
- page?: number;
5
- };
6
- export declare function getJobs({ country_id, page, }: GetJobsParams): Promise<MarketJobOffer[]>;
7
- export {};
@@ -1,8 +0,0 @@
1
- import { apiFetch } from "../../client";
2
- export async function getJobs({ country_id, page = 1, }) {
3
- const query = new URLSearchParams({
4
- country_id: String(country_id),
5
- page: String(page),
6
- });
7
- return apiFetch(`/market/jobs/get?${query}`);
8
- }
@@ -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
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,4 +0,0 @@
1
- import { ServerEquipment } from "../../types/server";
2
- export declare function getServerEquipments({ page }?: {
3
- page?: number;
4
- }): Promise<ServerEquipment[]>;
@@ -1,5 +0,0 @@
1
- import { apiFetch } from "../../client";
2
- export async function getServerEquipments({ page = 1 } = {}) {
3
- const params = new URLSearchParams({ page: String(page) });
4
- return apiFetch(`/server/equipments?${params}`);
5
- }
@@ -1,4 +0,0 @@
1
- import { ServerItem } from "../../types/server";
2
- export declare function getServerItems({ page }?: {
3
- page?: number;
4
- }): Promise<ServerItem[]>;
@@ -1,5 +0,0 @@
1
- import { apiFetch } from "../../client";
2
- export async function getServerItems({ page = 1 } = {}) {
3
- const params = new URLSearchParams({ page: String(page) });
4
- return apiFetch(`/server/items?${params}`);
5
- }
@@ -1,2 +0,0 @@
1
- import { ServerStatus } from "../../types/server";
2
- export declare function getServerStatus(): Promise<ServerStatus[]>;
@@ -1,4 +0,0 @@
1
- import { apiFetch } from "../../client";
2
- export async function getServerStatus() {
3
- return apiFetch("/server/status");
4
- }
@@ -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
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,6 +0,0 @@
1
- import { CountryStatisticType, RankingItem } from "../../types/statistics";
2
- type GetStatisticsParams = {
3
- statistic: CountryStatisticType;
4
- };
5
- export declare function getStatistics({ statistic, }: GetStatisticsParams): Promise<RankingItem[]>;
6
- export {};
@@ -1,5 +0,0 @@
1
- import { apiFetch } from "../../client";
2
- export async function getStatistics({ statistic, }) {
3
- const query = new URLSearchParams({ statistic });
4
- return apiFetch(`/statistics/country?${query}`);
5
- }
@@ -1,5 +0,0 @@
1
- import { getStatistics } from './getStatistics';
2
- export const statisticsApi = {
3
- getStatistics,
4
- };
5
- export { getStatistics, };
@@ -1,6 +0,0 @@
1
- import { CountryStatisticType, RankingItem } from "../../types";
2
- export interface StatisticsApi {
3
- getStatistics({ statistic }: {
4
- statistic: CountryStatisticType;
5
- }): Promise<RankingItem[]>;
6
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,7 +0,0 @@
1
- import { WarHit } from "../../types/wars";
2
- type GetWarRoundHitsParams = {
3
- war_round_id: number;
4
- page?: number;
5
- };
6
- export declare function getWarRoundHits({ war_round_id, page, }: GetWarRoundHitsParams): Promise<WarHit[]>;
7
- 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
- }
@@ -1,6 +0,0 @@
1
- import { WarRound } from "../../types/wars";
2
- type GetWarRoundsParams = {
3
- war_id: number;
4
- };
5
- export declare function getWarRounds({ war_id }: GetWarRoundsParams): Promise<WarRound[]>;
6
- export {};
@@ -1,5 +0,0 @@
1
- import { apiFetch } from "../../client";
2
- export async function getWarRounds({ war_id }) {
3
- const query = new URLSearchParams({ war_id: String(war_id) });
4
- return apiFetch(`/war/rounds?${query}`);
5
- }
@@ -1,8 +0,0 @@
1
- import { War } from "../../types/wars";
2
- type GetWarsParams = {
3
- event_wars?: 0 | 1;
4
- extra_details?: 0 | 1;
5
- war_id?: number;
6
- };
7
- export declare function getWars({ event_wars, extra_details, war_id, }?: GetWarsParams): Promise<War[]>;
8
- export {};
@@ -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
- }
@@ -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, };
@@ -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
- }
@@ -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
@@ -1,3 +0,0 @@
1
- export { apiClient, setToken } from './client';
2
- export type { AccountsApi, CountriesApi, MarketApi, ServerApi, StatisticsApi, WarsApi, } from './api';
3
- export type { SdkClient } from './client';
package/dist/index.js DELETED
@@ -1 +0,0 @@
1
- export { apiClient, setToken } from './client';
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,6 +0,0 @@
1
- export * from './market';
2
- export * from './server';
3
- export * from './accounts';
4
- export * from './country';
5
- export * from './statistics';
6
- export * from './wars';
@@ -1,6 +0,0 @@
1
- export * from './market';
2
- export * from './server';
3
- export * from './accounts';
4
- export * from './country';
5
- export * from './statistics';
6
- export * from './wars';