eclesiar-sdk 1.1.0 → 1.1.3

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 (122) hide show
  1. package/dist/ApiError.d.ts +10 -0
  2. package/dist/ApiError.js +17 -0
  3. package/dist/_.d.ts +25 -0
  4. package/dist/_.js +71 -0
  5. package/dist/api/accounts/getAccount.d.ts +4 -0
  6. package/dist/api/accounts/getAccount.js +5 -0
  7. package/dist/api/accounts/getMyEquipment.d.ts +4 -0
  8. package/dist/api/accounts/getMyEquipment.js +5 -0
  9. package/{src/api/accounts/index.ts → dist/api/accounts/index.d.ts} +2 -10
  10. package/dist/api/accounts/index.js +7 -0
  11. package/dist/api/accounts/types.d.ts +7 -0
  12. package/dist/api/accounts/types.js +1 -0
  13. package/dist/api/countries/getCountries.d.ts +2 -0
  14. package/dist/api/countries/getCountries.js +4 -0
  15. package/dist/api/countries/getCountryRegions.d.ts +6 -0
  16. package/dist/api/countries/getCountryRegions.js +5 -0
  17. package/{src/api/countries/index.ts → dist/api/countries/index.d.ts} +2 -10
  18. package/dist/api/countries/index.js +7 -0
  19. package/dist/api/countries/types.d.ts +7 -0
  20. package/dist/api/countries/types.js +1 -0
  21. package/{src/api/index.ts → dist/api/index.d.ts} +1 -2
  22. package/dist/api/index.js +6 -0
  23. package/dist/api/market/getAuctionBid.d.ts +5 -0
  24. package/dist/api/market/getAuctionBid.js +8 -0
  25. package/dist/api/market/getAuctions.d.ts +5 -0
  26. package/dist/api/market/getAuctions.js +8 -0
  27. package/dist/api/market/getCoinOffers.d.ts +6 -0
  28. package/dist/api/market/getCoinOffers.js +9 -0
  29. package/dist/api/market/getItemOffers.d.ts +6 -0
  30. package/dist/api/market/getItemOffers.js +9 -0
  31. package/dist/api/market/getJobs.d.ts +7 -0
  32. package/dist/api/market/getJobs.js +8 -0
  33. package/dist/api/market/index.d.ts +9 -0
  34. package/{src/api/market/index.ts → dist/api/market/index.js} +3 -13
  35. package/dist/api/market/types.d.ts +25 -0
  36. package/dist/api/market/types.js +1 -0
  37. package/dist/api/server/getEquipments.d.ts +4 -0
  38. package/dist/api/server/getEquipments.js +5 -0
  39. package/dist/api/server/getItems.d.ts +4 -0
  40. package/dist/api/server/getItems.js +5 -0
  41. package/dist/api/server/getStatus.d.ts +2 -0
  42. package/dist/api/server/getStatus.js +4 -0
  43. package/{src/api/server/index.ts → dist/api/server/index.d.ts} +2 -12
  44. package/dist/api/server/index.js +9 -0
  45. package/dist/api/server/types.d.ts +10 -0
  46. package/dist/api/server/types.js +1 -0
  47. package/dist/api/statistics/getStatistics.d.ts +6 -0
  48. package/dist/api/statistics/getStatistics.js +5 -0
  49. package/{src/api/statistics/index.ts → dist/api/statistics/index.d.ts} +2 -9
  50. package/dist/api/statistics/index.js +5 -0
  51. package/dist/api/statistics/types.d.ts +6 -0
  52. package/dist/api/statistics/types.js +1 -0
  53. package/dist/api/wars/getWarRoundHits.d.ts +7 -0
  54. package/dist/api/wars/getWarRoundHits.js +8 -0
  55. package/dist/api/wars/getWarRounds.d.ts +6 -0
  56. package/dist/api/wars/getWarRounds.js +5 -0
  57. package/dist/api/wars/getWars.d.ts +2 -0
  58. package/dist/api/wars/getWars.js +11 -0
  59. package/{src/api/wars/index.ts → dist/api/wars/index.d.ts} +2 -13
  60. package/dist/api/wars/index.js +9 -0
  61. package/dist/api/wars/types.d.ts +10 -0
  62. package/dist/api/wars/types.js +1 -0
  63. package/dist/client copy.d.ts +25 -0
  64. package/dist/client copy.js +71 -0
  65. package/dist/client.d.ts +17 -0
  66. package/dist/client.js +33 -0
  67. package/dist/config/index.d.ts +23 -0
  68. package/dist/config/index.js +54 -0
  69. package/dist/config/initConfigFile.d.ts +1 -0
  70. package/dist/config/initConfigFile.js +120 -0
  71. package/dist/config/types/configSchema.d.ts +19 -0
  72. package/dist/config/types/configSchema.js +14 -0
  73. package/dist/config/types/types.d.ts +19 -0
  74. package/dist/config/types/types.js +1 -0
  75. package/dist/config.d.ts +16 -0
  76. package/dist/config.js +46 -0
  77. package/dist/index.d.ts +3 -0
  78. package/dist/index.js +1 -0
  79. package/{src/types/accounts.ts → dist/types/accounts.d.ts} +3 -4
  80. package/dist/types/accounts.js +1 -0
  81. package/{src/types/country.ts → dist/types/country.d.ts} +11 -15
  82. package/dist/types/country.js +1 -0
  83. package/dist/types/index.d.ts +6 -0
  84. package/dist/types/index.js +6 -0
  85. package/dist/types/market.d.ts +52 -0
  86. package/dist/types/market.js +1 -0
  87. package/{src/types/server.ts → dist/types/server.d.ts} +5 -7
  88. package/dist/types/server.js +1 -0
  89. package/dist/types/statistics.d.ts +10 -0
  90. package/dist/types/statistics.js +1 -0
  91. package/dist/types/wars.d.ts +52 -0
  92. package/dist/types/wars.js +1 -0
  93. package/package.json +4 -1
  94. package/src/api/accounts/getAccount.ts +0 -9
  95. package/src/api/accounts/getMyEquipment.ts +0 -9
  96. package/src/api/accounts/types.ts +0 -6
  97. package/src/api/countries/getCountries.ts +0 -7
  98. package/src/api/countries/getCountryRegions.ts +0 -13
  99. package/src/api/countries/types.ts +0 -6
  100. package/src/api/market/getAuctionBid.ts +0 -14
  101. package/src/api/market/getAuctions.ts +0 -13
  102. package/src/api/market/getCoinOffers.ts +0 -20
  103. package/src/api/market/getItemOffers.ts +0 -20
  104. package/src/api/market/getJobs.ts +0 -19
  105. package/src/api/market/types.ts +0 -9
  106. package/src/api/server/getEquipments.ts +0 -9
  107. package/src/api/server/getItems.ts +0 -9
  108. package/src/api/server/getStatus.ts +0 -6
  109. package/src/api/server/types.ts +0 -6
  110. package/src/api/statistics/getStatistics.ts +0 -14
  111. package/src/api/statistics/types.ts +0 -5
  112. package/src/api/wars/getWarRoundHits.ts +0 -19
  113. package/src/api/wars/getWarRounds.ts +0 -11
  114. package/src/api/wars/getWars.ts +0 -28
  115. package/src/api/wars/types.ts +0 -7
  116. package/src/client.ts +0 -68
  117. package/src/index.ts +0 -10
  118. package/src/types/index.ts +0 -6
  119. package/src/types/market.ts +0 -57
  120. package/src/types/statistics.ts +0 -25
  121. package/src/types/wars.ts +0 -51
  122. package/tsconfig.json +0 -18
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Error class for API errors.
3
+ */
4
+ export declare class ApiError extends Error {
5
+ status: number;
6
+ statusText: string;
7
+ endpoint: string;
8
+ responseBody: unknown;
9
+ constructor(status: number, statusText: string, endpoint: string, responseBody: unknown);
10
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Error class for API errors.
3
+ */
4
+ export class ApiError extends Error {
5
+ status;
6
+ statusText;
7
+ endpoint;
8
+ responseBody;
9
+ constructor(status, statusText, endpoint, responseBody) {
10
+ super(`API Error: ${status} ${statusText} ${endpoint}`);
11
+ this.name = "ApiError";
12
+ this.status = status;
13
+ this.statusText = statusText;
14
+ this.endpoint = endpoint;
15
+ this.responseBody = responseBody;
16
+ }
17
+ }
package/dist/_.d.ts ADDED
@@ -0,0 +1,25 @@
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(token: string): void;
8
+ export interface SdkClient {
9
+ accounts: AccountsApi;
10
+ countries: CountriesApi;
11
+ market: MarketApi;
12
+ server: ServerApi;
13
+ statistics: StatisticsApi;
14
+ wars: WarsApi;
15
+ config: {
16
+ token: string | null;
17
+ baseUrl: 'https://api.eclesiar.com' | 'https://tests.eclesiar.com';
18
+ };
19
+ }
20
+ export declare const apiClient: SdkClient;
21
+ export declare function updateConfig(newConfig: {
22
+ token?: string;
23
+ baseUrl?: 'https://api.eclesiar.com' | 'https://tests.eclesiar.com';
24
+ }): SdkClient | undefined;
25
+ export declare function apiFetch<T>(endpoint: string, options?: RequestInit): Promise<T>;
package/dist/_.js ADDED
@@ -0,0 +1,71 @@
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
+ import { ApiError } from './ApiError';
8
+ let BASE_URL = 'https://api.eclesiar.com';
9
+ export function setToken(token) {
10
+ updateConfig({ token });
11
+ }
12
+ export const apiClient = {
13
+ accounts: accountsApi,
14
+ countries: countriesApi,
15
+ market: marketApi,
16
+ server: serverApi,
17
+ statistics: statisticsApi,
18
+ wars: warsApi,
19
+ config: {
20
+ token: null,
21
+ baseUrl: BASE_URL,
22
+ },
23
+ };
24
+ export function updateConfig(newConfig) {
25
+ if (newConfig.token) {
26
+ apiClient.config.token = newConfig.token;
27
+ }
28
+ if (newConfig.baseUrl) {
29
+ apiClient.config.baseUrl = newConfig.baseUrl;
30
+ }
31
+ if (apiClient.config.token && apiClient.config.baseUrl) {
32
+ return apiClient;
33
+ }
34
+ if (!apiClient.config.token && !apiClient.config.baseUrl) {
35
+ throw new Error('Config not complete: missing token and baseUrl.');
36
+ }
37
+ else if (!apiClient.config.token) {
38
+ throw new Error('Config not complete: missing token.');
39
+ }
40
+ else if (!apiClient.config.baseUrl) {
41
+ throw new Error('Config not complete: missing baseUrl.');
42
+ }
43
+ }
44
+ export async function apiFetch(endpoint, options = {}) {
45
+ if (!apiClient.config.token) {
46
+ throw new Error('No token provided');
47
+ }
48
+ if (!apiClient.config.baseUrl) {
49
+ throw new Error('No baseUrl provided');
50
+ }
51
+ const res = await fetch(`${apiClient.config.baseUrl}${endpoint}`, {
52
+ ...options,
53
+ headers: {
54
+ Authorization: `Bearer ${apiClient.config.token}`,
55
+ ...(options.headers || {}),
56
+ },
57
+ });
58
+ if (!res.ok) {
59
+ throw new ApiError(res.status, res.statusText, endpoint, await res.json());
60
+ }
61
+ const json = await res.json();
62
+ // This is a bit of a ugly fix. API returns undefined for no results instead of an empty array.
63
+ // Didnt wanna throw an error for this, so i just cast it to an empty array.
64
+ // Keep in mind, this api might change in the future, so this might break
65
+ // Also, this does not seem to be making a difference in out of bounds params, and things thats not found
66
+ if (json.code === 200 && json.data === undefined) {
67
+ json.data = [];
68
+ }
69
+ console.log({ 'API FROM SERVER:': json });
70
+ return json.data;
71
+ }
@@ -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,2 @@
1
+ import { GetWarsParams, War } from "../../types/wars";
2
+ export declare function getWars({ event_wars, extra_details, war_id, expired, page, }?: GetWarsParams): Promise<War[]>;
@@ -0,0 +1,11 @@
1
+ import { apiFetch } from "../../client";
2
+ export async function getWars({ event_wars = 0, extra_details = 0, war_id = 0, expired = 0, page = 1, } = {}) {
3
+ const query = new URLSearchParams({
4
+ event_wars: String(event_wars),
5
+ extra_details: String(extra_details),
6
+ war_id: String(war_id),
7
+ expired: String(expired),
8
+ page: String(page)
9
+ });
10
+ return apiFetch(`/wars?${query}`);
11
+ }
@@ -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, };