eclesiar-sdk 1.0.2 → 1.0.4

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/dist/api/accounts/getAccount.d.ts +4 -0
  2. package/dist/api/accounts/getAccount.js +5 -0
  3. package/dist/api/accounts/getMyEquipment.d.ts +4 -0
  4. package/dist/api/accounts/getMyEquipment.js +5 -0
  5. package/{src/api/accounts/index.ts → dist/api/accounts/index.d.ts} +2 -10
  6. package/dist/api/accounts/index.js +7 -0
  7. package/dist/api/accounts/types.d.ts +7 -0
  8. package/dist/api/accounts/types.js +1 -0
  9. package/dist/api/countries/getCountries.d.ts +2 -0
  10. package/dist/api/countries/getCountries.js +4 -0
  11. package/dist/api/countries/getCountryRegions.d.ts +6 -0
  12. package/dist/api/countries/getCountryRegions.js +5 -0
  13. package/{src/api/countries/index.ts → dist/api/countries/index.d.ts} +2 -10
  14. package/dist/api/countries/index.js +7 -0
  15. package/dist/api/countries/types.d.ts +7 -0
  16. package/dist/api/countries/types.js +1 -0
  17. package/{src/api/index.ts → dist/api/index.d.ts} +1 -2
  18. package/dist/api/index.js +6 -0
  19. package/dist/api/market/getAuctionBid.d.ts +5 -0
  20. package/dist/api/market/getAuctionBid.js +8 -0
  21. package/dist/api/market/getAuctions.d.ts +5 -0
  22. package/dist/api/market/getAuctions.js +8 -0
  23. package/dist/api/market/getCoinOffers.d.ts +6 -0
  24. package/dist/api/market/getCoinOffers.js +9 -0
  25. package/dist/api/market/getItemOffers.d.ts +6 -0
  26. package/dist/api/market/getItemOffers.js +9 -0
  27. package/dist/api/market/getJobs.d.ts +7 -0
  28. package/dist/api/market/getJobs.js +8 -0
  29. package/dist/api/market/index.d.ts +9 -0
  30. package/{src/api/market/index.ts → dist/api/market/index.js} +3 -13
  31. package/dist/api/market/types.d.ts +25 -0
  32. package/dist/api/market/types.js +1 -0
  33. package/dist/api/server/getEquipments.d.ts +4 -0
  34. package/dist/api/server/getEquipments.js +5 -0
  35. package/dist/api/server/getItems.d.ts +4 -0
  36. package/dist/api/server/getItems.js +5 -0
  37. package/dist/api/server/getStatus.d.ts +2 -0
  38. package/dist/api/server/getStatus.js +4 -0
  39. package/{src/api/server/index.ts → dist/api/server/index.d.ts} +2 -12
  40. package/dist/api/server/index.js +9 -0
  41. package/dist/api/server/types.d.ts +10 -0
  42. package/dist/api/server/types.js +1 -0
  43. package/dist/api/statistics/getStatistics.d.ts +6 -0
  44. package/dist/api/statistics/getStatistics.js +5 -0
  45. package/{src/api/statistics/index.ts → dist/api/statistics/index.d.ts} +2 -9
  46. package/dist/api/statistics/index.js +5 -0
  47. package/dist/api/statistics/types.d.ts +6 -0
  48. package/dist/api/statistics/types.js +1 -0
  49. package/dist/api/wars/getWarRoundHits.d.ts +7 -0
  50. package/dist/api/wars/getWarRoundHits.js +8 -0
  51. package/dist/api/wars/getWarRounds.d.ts +6 -0
  52. package/dist/api/wars/getWarRounds.js +5 -0
  53. package/dist/api/wars/getWars.d.ts +8 -0
  54. package/dist/api/wars/getWars.js +9 -0
  55. package/{src/api/wars/index.ts → dist/api/wars/index.d.ts} +2 -13
  56. package/dist/api/wars/index.js +9 -0
  57. package/dist/api/wars/types.d.ts +10 -0
  58. package/dist/api/wars/types.js +1 -0
  59. package/dist/client.d.ts +17 -0
  60. package/dist/client.js +33 -0
  61. package/dist/index.d.ts +3 -0
  62. package/dist/index.js +1 -0
  63. package/{src/types/accounts.ts → dist/types/accounts.d.ts} +3 -4
  64. package/dist/types/accounts.js +1 -0
  65. package/{src/types/country.ts → dist/types/country.d.ts} +12 -15
  66. package/dist/types/country.js +1 -0
  67. package/dist/types/index.d.ts +6 -0
  68. package/dist/types/index.js +6 -0
  69. package/dist/types/market.d.ts +52 -0
  70. package/dist/types/market.js +1 -0
  71. package/{src/types/server.ts → dist/types/server.d.ts} +5 -7
  72. package/dist/types/server.js +1 -0
  73. package/dist/types/statistics.d.ts +10 -0
  74. package/dist/types/statistics.js +1 -0
  75. package/dist/types/wars.d.ts +45 -0
  76. package/dist/types/wars.js +1 -0
  77. package/package.json +4 -1
  78. package/src/api/accounts/getAccount.ts +0 -9
  79. package/src/api/accounts/getMyEquipment.ts +0 -9
  80. package/src/api/accounts/types.ts +0 -6
  81. package/src/api/countries/getCountries.ts +0 -7
  82. package/src/api/countries/getCountryRegions.ts +0 -13
  83. package/src/api/countries/types.ts +0 -6
  84. package/src/api/market/getAuctionBid.ts +0 -14
  85. package/src/api/market/getAuctions.ts +0 -13
  86. package/src/api/market/getCoinOffers.ts +0 -20
  87. package/src/api/market/getItemOffers.ts +0 -20
  88. package/src/api/market/getJobs.ts +0 -19
  89. package/src/api/market/types.ts +0 -9
  90. package/src/api/server/getEquipments.ts +0 -9
  91. package/src/api/server/getItems.ts +0 -9
  92. package/src/api/server/getStatus.ts +0 -6
  93. package/src/api/server/types.ts +0 -6
  94. package/src/api/statistics/getStatistics.ts +0 -14
  95. package/src/api/statistics/types.ts +0 -5
  96. package/src/api/wars/getWarRoundHits.ts +0 -19
  97. package/src/api/wars/getWarRounds.ts +0 -11
  98. package/src/api/wars/getWars.ts +0 -22
  99. package/src/api/wars/types.ts +0 -7
  100. package/src/client.ts +0 -68
  101. package/src/index.ts +0 -10
  102. package/src/types/index.ts +0 -6
  103. package/src/types/market.ts +0 -61
  104. package/src/types/statistics.ts +0 -25
  105. package/src/types/wars.ts +0 -51
  106. package/tsconfig.json +0 -18
@@ -0,0 +1,4 @@
1
+ import { AccountData } from "../../types/accounts";
2
+ export declare function getAccount({ account_id }: {
3
+ account_id: number;
4
+ }): Promise<AccountData>;
@@ -0,0 +1,5 @@
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
+ }
@@ -0,0 +1,4 @@
1
+ import { EquipmentItem } from "../../types/accounts";
2
+ export declare function getMyEquipment({ page }?: {
3
+ page?: number;
4
+ }): Promise<EquipmentItem[]>;
@@ -0,0 +1,5 @@
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,14 +1,6 @@
1
1
  import { getAccount } from './getAccount';
2
2
  import { getMyEquipment } from './getMyEquipment';
3
-
4
3
  import type { AccountsApi } from './types';
5
-
6
- export const accountsApi: AccountsApi = {
7
- getAccount,
8
- getMyEquipment,
9
- }
4
+ export declare const accountsApi: AccountsApi;
10
5
  export type { AccountsApi };
11
- export {
12
- getAccount,
13
- getMyEquipment,
14
- }
6
+ export { getAccount, getMyEquipment, };
@@ -0,0 +1,7 @@
1
+ import { getAccount } from './getAccount';
2
+ import { getMyEquipment } from './getMyEquipment';
3
+ export const accountsApi = {
4
+ getAccount,
5
+ getMyEquipment,
6
+ };
7
+ export { getAccount, getMyEquipment, };
@@ -0,0 +1,7 @@
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
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import { Nation } from "../../types/country";
2
+ export declare function getCountries(): Promise<Nation[]>;
@@ -0,0 +1,4 @@
1
+ import { apiFetch } from "../../client";
2
+ export async function getCountries() {
3
+ return apiFetch(`/countries`);
4
+ }
@@ -0,0 +1,6 @@
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 {};
@@ -0,0 +1,5 @@
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,14 +1,6 @@
1
1
  import { getCountries } from './getCountries';
2
2
  import { getCountryRegions } from './getCountryRegions';
3
-
4
3
  import type { CountriesApi } from './types';
5
-
6
- export const countriesApi: CountriesApi = {
7
- getCountries,
8
- getCountryRegions,
9
- }
4
+ export declare const countriesApi: CountriesApi;
10
5
  export type { CountriesApi };
11
- export {
12
- getCountries,
13
- getCountryRegions,
14
- }
6
+ export { getCountries, getCountryRegions, };
@@ -0,0 +1,7 @@
1
+ import { getCountries } from './getCountries';
2
+ import { getCountryRegions } from './getCountryRegions';
3
+ export const countriesApi = {
4
+ getCountries,
5
+ getCountryRegions,
6
+ };
7
+ export { getCountries, getCountryRegions, };
@@ -0,0 +1,7 @@
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
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -4,10 +4,9 @@ export { marketApi as market } from './market';
4
4
  export { serverApi as server } from './server';
5
5
  export { statisticsApi as statistics } from './statistics';
6
6
  export { warsApi as wars } from './wars';
7
-
8
7
  export type { AccountsApi } from './accounts/types';
9
8
  export type { CountriesApi } from './countries/types';
10
9
  export type { MarketApi } from './market/types';
11
10
  export type { ServerApi } from './server/types';
12
11
  export type { StatisticsApi } from './statistics/types';
13
- export type { WarsApi } from './wars/types';
12
+ export type { WarsApi } from './wars/types';
@@ -0,0 +1,6 @@
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';
@@ -0,0 +1,5 @@
1
+ import { MarketAuctionBid } from "../../types/market";
2
+ export declare function getAuctionBid({ auction_id, page, }: {
3
+ auction_id: number;
4
+ page?: number;
5
+ }): Promise<MarketAuctionBid[]>;
@@ -0,0 +1,8 @@
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
+ }
@@ -0,0 +1,5 @@
1
+ import { MarketAuction } from "../../types/market";
2
+ export declare function getAuctions({ finished, page, }?: {
3
+ finished?: 0 | 1;
4
+ page?: number;
5
+ }): Promise<MarketAuction[]>;
@@ -0,0 +1,8 @@
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
+ }
@@ -0,0 +1,6 @@
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[]>;
@@ -0,0 +1,9 @@
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
+ }
@@ -0,0 +1,6 @@
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[]>;
@@ -0,0 +1,9 @@
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
+ }
@@ -0,0 +1,7 @@
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 {};
@@ -0,0 +1,8 @@
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
+ }
@@ -0,0 +1,9 @@
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, };
@@ -3,21 +3,11 @@ import { getItemOffers } from './getItemOffers';
3
3
  import { getJobs } from './getJobs';
4
4
  import { getAuctions } from './getAuctions';
5
5
  import { getAuctionBid } from './getAuctionBid';
6
-
7
- import type { MarketApi } from './types';
8
-
9
- export const marketApi: MarketApi = {
6
+ export const marketApi = {
10
7
  getCoinOffers,
11
8
  getItemOffers,
12
9
  getJobs,
13
10
  getAuctions,
14
11
  getAuctionBid,
15
- }
16
- export type { MarketApi };
17
- export {
18
- getCoinOffers,
19
- getItemOffers,
20
- getJobs,
21
- getAuctions,
22
- getAuctionBid,
23
- }
12
+ };
13
+ export { getCoinOffers, getItemOffers, getJobs, getAuctions, getAuctionBid, };
@@ -0,0 +1,25 @@
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
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import { ServerEquipment } from "../../types/server";
2
+ export declare function getServerEquipments({ page }?: {
3
+ page?: number;
4
+ }): Promise<ServerEquipment[]>;
@@ -0,0 +1,5 @@
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
+ }
@@ -0,0 +1,4 @@
1
+ import { ServerItem } from "../../types/server";
2
+ export declare function getServerItems({ page }?: {
3
+ page?: number;
4
+ }): Promise<ServerItem[]>;
@@ -0,0 +1,5 @@
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
+ }
@@ -0,0 +1,2 @@
1
+ import { ServerStatus } from "../../types/server";
2
+ export declare function getServerStatus(): Promise<ServerStatus[]>;
@@ -0,0 +1,4 @@
1
+ import { apiFetch } from "../../client";
2
+ export async function getServerStatus() {
3
+ return apiFetch("/server/status");
4
+ }
@@ -1,17 +1,7 @@
1
1
  import { getServerStatus } from './getStatus';
2
2
  import { getServerItems } from './getItems';
3
3
  import { getServerEquipments } from './getEquipments';
4
-
5
4
  import type { ServerApi } from './types';
6
-
7
- export const serverApi: ServerApi = {
8
- getServerStatus,
9
- getServerItems,
10
- getServerEquipments,
11
- };
5
+ export declare const serverApi: ServerApi;
12
6
  export type { ServerApi };
13
- export {
14
- getServerStatus,
15
- getServerItems,
16
- getServerEquipments,
17
- };
7
+ export { getServerStatus, getServerItems, getServerEquipments, };
@@ -0,0 +1,9 @@
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, };
@@ -0,0 +1,10 @@
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
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
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 {};
@@ -0,0 +1,5 @@
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,12 +1,5 @@
1
1
  import { getStatistics } from './getStatistics';
2
-
3
2
  import type { StatisticsApi } from './types';
4
-
5
- export const statisticsApi: StatisticsApi = {
6
- getStatistics,
7
- }
8
-
3
+ export declare const statisticsApi: StatisticsApi;
9
4
  export type { StatisticsApi };
10
- export {
11
- getStatistics,
12
- }
5
+ export { getStatistics, };
@@ -0,0 +1,5 @@
1
+ import { getStatistics } from './getStatistics';
2
+ export const statisticsApi = {
3
+ getStatistics,
4
+ };
5
+ export { getStatistics, };
@@ -0,0 +1,6 @@
1
+ import { CountryStatisticType, RankingItem } from "../../types";
2
+ export interface StatisticsApi {
3
+ getStatistics({ statistic }: {
4
+ statistic: CountryStatisticType;
5
+ }): Promise<RankingItem[]>;
6
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
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 {};
@@ -0,0 +1,8 @@
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
+ }
@@ -0,0 +1,6 @@
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 {};
@@ -0,0 +1,5 @@
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
+ }
@@ -0,0 +1,8 @@
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 {};
@@ -0,0 +1,9 @@
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,18 +1,7 @@
1
1
  import { getWars } from './getWars';
2
2
  import { getWarRounds } from './getWarRounds';
3
3
  import { getWarRoundHits } from './getWarRoundHits';
4
-
5
4
  import type { WarsApi } from './types';
6
-
7
- export const warsApi: WarsApi = {
8
- getWars,
9
- getWarRounds,
10
- getWarRoundHits,
11
- }
12
-
5
+ export declare const warsApi: WarsApi;
13
6
  export type { WarsApi };
14
- export {
15
- getWars,
16
- getWarRounds,
17
- getWarRoundHits,
18
- }
7
+ export { getWars, getWarRounds, getWarRoundHits, };
@@ -0,0 +1,9 @@
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, };
@@ -0,0 +1,10 @@
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
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
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 ADDED
@@ -0,0 +1,33 @@
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
+ };
@@ -0,0 +1,3 @@
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 ADDED
@@ -0,0 +1 @@
1
+ export { apiClient, setToken } from './client';
@@ -8,10 +8,9 @@ export type AccountData = {
8
8
  total_mined_gold: number;
9
9
  total_builder_progress: number;
10
10
  day_of_birth: number;
11
- }
12
-
13
- export type EquipmentItem = {
11
+ };
12
+ export type EquipmentItem = {
14
13
  id: number;
15
14
  equipment_id: number;
16
15
  is_equipped: boolean;
17
- }
16
+ };
@@ -0,0 +1 @@
1
+ export {};