eclesiar-sdk 1.0.1 → 1.0.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.
- package/README.md +71 -0
- package/package.json +1 -1
- package/src/types/country.ts +1 -0
- package/src/types/market.ts +2 -6
package/README.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Eclesiar SDK
|
|
2
|
+
|
|
3
|
+
Type-safe JavaScript / TypeScript client for the [Eclesiar](https://eclesiar.com) game API. For full API documentation, see [Eclesiar API](https://eclesiar.com/api).
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
* **Strong Types** – every endpoint returns rich interfaces so you get autocompletion and compile-time safety.
|
|
12
|
+
* **Single entry point** – import `apiClient` and you have instant access to all API domains.
|
|
13
|
+
* **Tiny & tree-shakable** – no runtime dependencies, published as ES Modules.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install eclesiar-sdk
|
|
21
|
+
# or
|
|
22
|
+
pnpm add eclesiar-sdk
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Quick start
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import { apiClient, setToken } from 'eclesiar-sdk';
|
|
31
|
+
|
|
32
|
+
setToken('<your-api-token>');
|
|
33
|
+
|
|
34
|
+
(async () => {
|
|
35
|
+
// Accounts
|
|
36
|
+
const account = await apiClient.accounts.getAccount({ account_id: 123 });
|
|
37
|
+
console.log(account.username);
|
|
38
|
+
|
|
39
|
+
// Market
|
|
40
|
+
const auctions = await apiClient.market.getAuctions();
|
|
41
|
+
console.log('Current auctions:', auctions.length);
|
|
42
|
+
})();
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Need other domains? Autocomplete will show:
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
apiClient.{ accounts | countries | market | server | statistics | wars }
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## API Surface
|
|
54
|
+
|
|
55
|
+
| Domain | Example methods |
|
|
56
|
+
|-------------|--------------------------------|
|
|
57
|
+
| `accounts` | `getAccount`, `getMyEquipment` |
|
|
58
|
+
| `countries` | `getCountries`, `getCountryRegions` |
|
|
59
|
+
| `market` | `getAuctions`, `getCoinOffers`, `getItemOffers`, `getAuctionBid`, `getJobs` |
|
|
60
|
+
| `server` | `getServerStatus`, `getServerItems`, `getServerEquipments` |
|
|
61
|
+
| `statistics`| `getStatistics` |
|
|
62
|
+
| `wars` | `getWars`, `getWarRounds`, `getWarRoundHits` |
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Contributing
|
|
68
|
+
|
|
69
|
+
PRs and issues are welcome!
|
|
70
|
+
|
|
71
|
+
---
|
package/package.json
CHANGED
package/src/types/country.ts
CHANGED
package/src/types/market.ts
CHANGED
|
@@ -5,10 +5,8 @@ export interface ApiResponse<T> {
|
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
export interface MarketCoinOffer {
|
|
8
|
-
id: number;
|
|
9
|
-
currency_id: number;
|
|
10
8
|
amount: number;
|
|
11
|
-
|
|
9
|
+
rate: number;
|
|
12
10
|
owner: {
|
|
13
11
|
id: number;
|
|
14
12
|
type: string;
|
|
@@ -16,10 +14,8 @@ export interface MarketCoinOffer {
|
|
|
16
14
|
}
|
|
17
15
|
|
|
18
16
|
export interface MarketItemOffer {
|
|
19
|
-
id: number;
|
|
20
|
-
item_id: number;
|
|
21
17
|
amount: number;
|
|
22
|
-
|
|
18
|
+
rate: number;
|
|
23
19
|
owner: {
|
|
24
20
|
id: number;
|
|
25
21
|
type: string;
|