artifacts-api-client 1.1.0 → 1.2.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/README.md +20 -3
- package/dist/api/artifacts-accounts.api.d.ts +2 -2
- package/dist/api/artifacts-characters.api.d.ts +4 -4
- package/dist/api/artifacts-characters.api.js +4 -1
- package/dist/api/artifacts-events.api.d.ts +2 -2
- package/dist/api/artifacts-grand-exchange.api.d.ts +3 -3
- package/dist/api/artifacts-items.api.d.ts +3 -3
- package/dist/api/artifacts-maps.api.d.ts +3 -3
- package/dist/api/artifacts-maps.api.js +2 -4
- package/dist/api/artifacts-monsters.api.d.ts +3 -3
- package/dist/api/artifacts-my-account.api.d.ts +4 -4
- package/dist/api/artifacts-my-account.api.js +4 -1
- package/dist/api/artifacts-my-characters.api.d.ts +24 -21
- package/dist/api/artifacts-my-characters.api.js +56 -15
- package/dist/api/artifacts-resources.api.d.ts +3 -3
- package/dist/api/artifacts-token.api.d.ts +2 -2
- package/dist/api/artifacts.api.d.ts +3 -3
- package/dist/api/types/api-schema-bindings.types.d.ts +64 -0
- package/dist/http-client/artifacts.http-client.d.ts +1 -1
- package/dist/http-client/types/artifacts-http-client.types.js +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +15 -0
- package/package.json +2 -3
- /package/dist/{types/artifacts-api.types.js → api/types/api-schema-bindings.types.js} +0 -0
- /package/dist/{types → api/types}/api-schema.types.d.ts +0 -0
- /package/dist/{types → api/types}/api-schema.types.js +0 -0
- /package/dist/{types → api/types}/artifacts-api.types.d.ts +0 -0
- /package/dist/{types/artifacts-http-client.types.js → api/types/artifacts-api.types.js} +0 -0
- /package/dist/{types → http-client/types}/artifacts-http-client.types.d.ts +0 -0
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ await artifactsApi.myCharacters.fight('name');
|
|
|
33
33
|
|
|
34
34
|
Alternatively, you can set token later:
|
|
35
35
|
|
|
36
|
-
```
|
|
36
|
+
```js
|
|
37
37
|
import { ArtifactsApi } from 'artifacts-api-client';
|
|
38
38
|
|
|
39
39
|
const artifactsApi = ArtifactsApi.create();
|
|
@@ -49,7 +49,7 @@ await artifactsApi.myCharacters.fight('name'); // <-- now it works
|
|
|
49
49
|
## Error handling
|
|
50
50
|
All artifacts API errors are wrapped with `ArtifactsError`.
|
|
51
51
|
Keep in mind, that the others errors like `NetworkError` left as they are:
|
|
52
|
-
```
|
|
52
|
+
```js
|
|
53
53
|
import { ArtifactsApi, ArtifactsError } from 'artifacts-api-client';
|
|
54
54
|
|
|
55
55
|
const artifactsApi = ArtifactsApi.create({
|
|
@@ -58,7 +58,7 @@ const artifactsApi = ArtifactsApi.create({
|
|
|
58
58
|
|
|
59
59
|
try {
|
|
60
60
|
await artifactsApi.myCharacters.fight('name');
|
|
61
|
-
} catch (err
|
|
61
|
+
} catch (err) {
|
|
62
62
|
if (err instanceof ArtifactsError) {
|
|
63
63
|
console.error('Artifacts error', e.message, e.code, e.data);
|
|
64
64
|
} else {
|
|
@@ -66,3 +66,20 @@ try {
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
```
|
|
69
|
+
|
|
70
|
+
## Type bindings
|
|
71
|
+
If package being used with TypeScript you'll probably need methods' types.
|
|
72
|
+
They are available to import:
|
|
73
|
+
|
|
74
|
+
```ts
|
|
75
|
+
import { ArtifactsApi, GetAllMapsApiResult, GetAllMapsApiQuery } from 'artifacts-api-client';
|
|
76
|
+
|
|
77
|
+
const artifactsApi = ArtifactsApi.create({
|
|
78
|
+
token: 'TOKEN'
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
function getMaps(params: GetAllMapsApiQuery): Promise<GetAllMapsApiResult> {
|
|
82
|
+
// ... custom logic ...
|
|
83
|
+
return artifactsApi.maps.getAll(params);
|
|
84
|
+
};
|
|
85
|
+
```
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ArtifactsHttpClient } from '../http-client/artifacts.http-client';
|
|
2
|
-
import {
|
|
2
|
+
import { CreateAccountApiBody, CreateAccountApiResult } from './types/api-schema-bindings.types';
|
|
3
3
|
export declare class ArtifactsAccountsApi {
|
|
4
4
|
private readonly httpClient;
|
|
5
5
|
constructor(httpClient: ArtifactsHttpClient);
|
|
6
6
|
/** Create an account. */
|
|
7
|
-
create(body:
|
|
7
|
+
create(body: CreateAccountApiBody): Promise<CreateAccountApiResult>;
|
|
8
8
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ArtifactsHttpClient } from '../http-client/artifacts.http-client';
|
|
2
|
-
import {
|
|
2
|
+
import { CreateCharacterApiBody, CreateCharacterApiResult, GetAllCharactersApiQuery, GetAllCharactersApiResult, GetCharacterApiResult } from './types/api-schema-bindings.types';
|
|
3
3
|
export declare class ArtifactsCharactersApi {
|
|
4
4
|
private readonly httpClient;
|
|
5
5
|
constructor(httpClient: ArtifactsHttpClient);
|
|
6
6
|
/** Create new character on your account. You can create up to 5 characters. */
|
|
7
|
-
create(body:
|
|
7
|
+
create(body: CreateCharacterApiBody): Promise<CreateCharacterApiResult>;
|
|
8
8
|
/** Fetch characters details. */
|
|
9
|
-
getAll(params?:
|
|
9
|
+
getAll(params?: GetAllCharactersApiQuery): Promise<GetAllCharactersApiResult>;
|
|
10
10
|
/** Fetch characters details. */
|
|
11
|
-
get(name: string): Promise<
|
|
11
|
+
get(name: string): Promise<GetCharacterApiResult>;
|
|
12
12
|
}
|
|
@@ -8,7 +8,10 @@ class ArtifactsCharactersApi {
|
|
|
8
8
|
}
|
|
9
9
|
/** Create new character on your account. You can create up to 5 characters. */
|
|
10
10
|
create(body) {
|
|
11
|
-
return this.httpClient.post(`/characters/create`, {
|
|
11
|
+
return this.httpClient.post(`/characters/create`, {
|
|
12
|
+
body,
|
|
13
|
+
isSecure: true,
|
|
14
|
+
});
|
|
12
15
|
}
|
|
13
16
|
/** Fetch characters details. */
|
|
14
17
|
getAll(params = {}) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ArtifactsHttpClient } from '../http-client/artifacts.http-client';
|
|
2
|
-
import {
|
|
2
|
+
import { GetAllEventsApiQuery, GetAllEventsApiResult } from './types/api-schema-bindings.types';
|
|
3
3
|
export declare class ArtifactsEventsApi {
|
|
4
4
|
private readonly httpClient;
|
|
5
5
|
constructor(httpClient: ArtifactsHttpClient);
|
|
6
6
|
/** Fetch events details. */
|
|
7
|
-
getAll(params?:
|
|
7
|
+
getAll(params?: GetAllEventsApiQuery): Promise<GetAllEventsApiResult>;
|
|
8
8
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ArtifactsHttpClient } from '../http-client/artifacts.http-client';
|
|
2
|
-
import {
|
|
2
|
+
import { GetAllGrandExchangeApiQuery, GetAllGrandExchangeApiResult, GetGrandExchangeApiResult } from './types/api-schema-bindings.types';
|
|
3
3
|
export declare class ArtifactsGrandExchangeApi {
|
|
4
4
|
private readonly httpClient;
|
|
5
5
|
constructor(httpClient: ArtifactsHttpClient);
|
|
6
6
|
/** Fetch Grand Exchange items details. */
|
|
7
|
-
getAll(params?:
|
|
7
|
+
getAll(params?: GetAllGrandExchangeApiQuery): Promise<GetAllGrandExchangeApiResult>;
|
|
8
8
|
/** Retrieve the details of a Grand Exchange item. */
|
|
9
|
-
get(code: string): Promise<
|
|
9
|
+
get(code: string): Promise<GetGrandExchangeApiResult>;
|
|
10
10
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ArtifactsHttpClient } from '../http-client/artifacts.http-client';
|
|
2
|
-
import {
|
|
2
|
+
import { GetAllItemsApiQuery, GetAllItemsApiResult, GetItemApiResult } from './types/api-schema-bindings.types';
|
|
3
3
|
export declare class ArtifactsItemsApi {
|
|
4
4
|
private readonly httpClient;
|
|
5
5
|
constructor(httpClient: ArtifactsHttpClient);
|
|
6
6
|
/** Fetch items details. */
|
|
7
|
-
getAll(params?:
|
|
7
|
+
getAll(params?: GetAllItemsApiQuery): Promise<GetAllItemsApiResult>;
|
|
8
8
|
/** Retrieve the details of an item. */
|
|
9
|
-
get(code: string): Promise<
|
|
9
|
+
get(code: string): Promise<GetItemApiResult>;
|
|
10
10
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ArtifactsHttpClient } from '../http-client/artifacts.http-client';
|
|
2
|
-
import {
|
|
2
|
+
import { GetAllMapsApiQuery, GetAllMapsApiResult, GetMapApiResult } from './types/api-schema-bindings.types';
|
|
3
3
|
export declare class ArtifactsMapsApi {
|
|
4
4
|
private readonly httpClient;
|
|
5
5
|
constructor(httpClient: ArtifactsHttpClient);
|
|
6
6
|
/** Fetch maps details. */
|
|
7
|
-
getAll(params?:
|
|
7
|
+
getAll(params?: GetAllMapsApiQuery): Promise<GetAllMapsApiResult>;
|
|
8
8
|
/** Retrieve the details of a map. */
|
|
9
|
-
get(x: number, y: number
|
|
9
|
+
get(x: number, y: number): Promise<GetMapApiResult>;
|
|
10
10
|
}
|
|
@@ -13,10 +13,8 @@ class ArtifactsMapsApi {
|
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
15
|
/** Retrieve the details of a map. */
|
|
16
|
-
get(x, y
|
|
17
|
-
return this.httpClient.get(`/maps/${x}/${y}
|
|
18
|
-
query: params,
|
|
19
|
-
});
|
|
16
|
+
get(x, y) {
|
|
17
|
+
return this.httpClient.get(`/maps/${x}/${y}`);
|
|
20
18
|
}
|
|
21
19
|
}
|
|
22
20
|
exports.ArtifactsMapsApi = ArtifactsMapsApi;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ArtifactsHttpClient } from '../http-client/artifacts.http-client';
|
|
2
|
-
import {
|
|
2
|
+
import { GetAllMonstersApiQuery, GetAllMonstersApiResult, GetMonsterApiResult } from './types/api-schema-bindings.types';
|
|
3
3
|
export declare class ArtifactsMonstersApi {
|
|
4
4
|
private readonly httpClient;
|
|
5
5
|
constructor(httpClient: ArtifactsHttpClient);
|
|
6
6
|
/** Fetch monsters details. */
|
|
7
|
-
getAll(params?:
|
|
7
|
+
getAll(params?: GetAllMonstersApiQuery): Promise<GetAllMonstersApiResult>;
|
|
8
8
|
/** Retrieve the details of a monster. */
|
|
9
|
-
get(code: string): Promise<
|
|
9
|
+
get(code: string): Promise<GetMonsterApiResult>;
|
|
10
10
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ArtifactsHttpClient } from '../http-client/artifacts.http-client';
|
|
2
|
-
import {
|
|
2
|
+
import { ChangePasswordApiBody, ChangePasswordApiResult, GetBankGoldApiResult, GetBankItemsApiQuery, GetBankItemsApiResult } from './types/api-schema-bindings.types';
|
|
3
3
|
export declare class ArtifactsMyAccountApi {
|
|
4
4
|
private readonly httpClient;
|
|
5
5
|
constructor(httpClient: ArtifactsHttpClient);
|
|
6
6
|
/** Fetch all items in your bank. */
|
|
7
|
-
getBankItems(params?:
|
|
7
|
+
getBankItems(params?: GetBankItemsApiQuery): Promise<GetBankItemsApiResult>;
|
|
8
8
|
/** Fetch golds in your bank. */
|
|
9
|
-
getBankGold(): Promise<
|
|
9
|
+
getBankGold(): Promise<GetBankGoldApiResult>;
|
|
10
10
|
/** Change your account password. Changing the password reset the account token. */
|
|
11
|
-
changePassword(body:
|
|
11
|
+
changePassword(body: ChangePasswordApiBody): Promise<ChangePasswordApiResult>;
|
|
12
12
|
}
|
|
@@ -8,7 +8,10 @@ class ArtifactsMyAccountApi {
|
|
|
8
8
|
}
|
|
9
9
|
/** Fetch all items in your bank. */
|
|
10
10
|
getBankItems(params = {}) {
|
|
11
|
-
return this.httpClient.get(`/my/bank/items`, {
|
|
11
|
+
return this.httpClient.get(`/my/bank/items`, {
|
|
12
|
+
query: params,
|
|
13
|
+
isSecure: true,
|
|
14
|
+
});
|
|
12
15
|
}
|
|
13
16
|
/** Fetch golds in your bank. */
|
|
14
17
|
getBankGold() {
|
|
@@ -1,44 +1,47 @@
|
|
|
1
1
|
import { ArtifactsHttpClient } from '../http-client/artifacts.http-client';
|
|
2
|
-
import {
|
|
2
|
+
import { CraftingApiBody, CraftingApiResult, DepositBankApiBody, DepositBankGoldApiBody, DepositBankGoldApiResult, DepositBankApiResult, EquipItemApiBody, EquipItemApiResult, FightApiResult, GatheringApiResult, MoveApiBody, MoveApiResult, UnequipItemApiBody, UnequipItemApiResult, WithdrawBankApiBody, WithdrawBankApiResult, WithdrawBankGoldApiBody, WithdrawBankGoldApiResult, RecyclingApiBody, RecyclingApiResult, BuyGrandExchangeItemApiBody, BuyGrandExchangeItemApiResult, SellGrandExchangeItemApiBody, SellGrandExchangeItemApiResult, DeleteItemApiBody, DeleteItemApiResult, AcceptTaskApiResult, CompleteTaskApiResult, ExchangeTaskApiResult, GetLogsApiResult, GetLogsApiQuery, GetMyCharactersApiResult } from './types/api-schema-bindings.types';
|
|
3
3
|
export declare class ArtifactsMyCharactersApi {
|
|
4
4
|
private readonly httpClient;
|
|
5
5
|
constructor(httpClient: ArtifactsHttpClient);
|
|
6
6
|
/** Moves a character on the map using the map's X and Y position. */
|
|
7
|
-
move(name: string, body:
|
|
7
|
+
move(name: string, body: MoveApiBody): Promise<MoveApiResult>;
|
|
8
8
|
/** Equip an item on your character. */
|
|
9
|
-
equipItem(name: string, body:
|
|
9
|
+
equipItem(name: string, body: EquipItemApiBody): Promise<EquipItemApiResult>;
|
|
10
10
|
/** Unequip an item on your character. */
|
|
11
|
-
unequipItem(name: string, body:
|
|
11
|
+
unequipItem(name: string, body: UnequipItemApiBody): Promise<UnequipItemApiResult>;
|
|
12
12
|
/** Start a fight against a monster on the character's map. */
|
|
13
|
-
fight(name: string): Promise<
|
|
13
|
+
fight(name: string): Promise<FightApiResult>;
|
|
14
14
|
/** Harvest a resource on the character's map. */
|
|
15
|
-
gathering(name: string): Promise<
|
|
15
|
+
gathering(name: string): Promise<GatheringApiResult>;
|
|
16
16
|
/** Crafting an item. The character must be on a map with a workshop. */
|
|
17
|
-
crafting(name: string, body:
|
|
17
|
+
crafting(name: string, body: CraftingApiBody): Promise<CraftingApiResult>;
|
|
18
18
|
/** Deposit an item in a bank on the character's map. */
|
|
19
|
-
depositBank(name: string, body:
|
|
19
|
+
depositBank(name: string, body: DepositBankApiBody): Promise<DepositBankApiResult>;
|
|
20
20
|
/** Deposit golds in a bank on the character's map. */
|
|
21
|
-
depositBankGold(name: string, body:
|
|
21
|
+
depositBankGold(name: string, body: DepositBankGoldApiBody): Promise<DepositBankGoldApiResult>;
|
|
22
22
|
/** Take an item from your bank and put it in the character's inventory. */
|
|
23
|
-
withdrawBank(name: string, body:
|
|
23
|
+
withdrawBank(name: string, body: WithdrawBankApiBody): Promise<WithdrawBankApiResult>;
|
|
24
24
|
/** Withdraw gold from your bank. */
|
|
25
|
-
withdrawBankGold(name: string, body:
|
|
25
|
+
withdrawBankGold(name: string, body: WithdrawBankGoldApiBody): Promise<WithdrawBankGoldApiResult>;
|
|
26
26
|
/** Recycling an item. The character must be on a map with a workshop (only for equipments and weapons). */
|
|
27
|
-
recycling(name: string, body:
|
|
27
|
+
recycling(name: string, body: RecyclingApiBody): Promise<RecyclingApiResult>;
|
|
28
28
|
/** Buy an item at the Grand Exchange on the character's map. */
|
|
29
|
-
buyGrandExchangeItem(name: string, body:
|
|
29
|
+
buyGrandExchangeItem(name: string, body: BuyGrandExchangeItemApiBody): Promise<BuyGrandExchangeItemApiResult>;
|
|
30
30
|
/** Sell an item at the Grand Exchange on the character's map. */
|
|
31
|
-
sellGrandExchangeItem(name: string, body:
|
|
31
|
+
sellGrandExchangeItem(name: string, body: SellGrandExchangeItemApiBody): Promise<SellGrandExchangeItemApiResult>;
|
|
32
32
|
/** Accepting a new task. */
|
|
33
|
-
acceptTask(name: string): Promise<
|
|
33
|
+
acceptTask(name: string): Promise<AcceptTaskApiResult>;
|
|
34
34
|
/** Complete a task. */
|
|
35
|
-
completeTask(name: string): Promise<
|
|
36
|
-
/**
|
|
37
|
-
|
|
35
|
+
completeTask(name: string): Promise<CompleteTaskApiResult>;
|
|
36
|
+
/**
|
|
37
|
+
* Exchange 3 tasks coins for a random reward.
|
|
38
|
+
* Rewards are exclusive resources for crafting items.
|
|
39
|
+
*/
|
|
40
|
+
exchangeTask(name: string): Promise<ExchangeTaskApiResult>;
|
|
38
41
|
/** Delete an item from your character's inventory. */
|
|
39
|
-
deleteItem(name: string, body:
|
|
42
|
+
deleteItem(name: string, body: DeleteItemApiBody): Promise<DeleteItemApiResult>;
|
|
40
43
|
/** History of the last 100 actions of all your characters. */
|
|
41
|
-
getLogs(params?:
|
|
44
|
+
getLogs(params?: GetLogsApiQuery): Promise<GetLogsApiResult>;
|
|
42
45
|
/** List of your characters. */
|
|
43
|
-
getAll(): Promise<
|
|
46
|
+
getAll(): Promise<GetMyCharactersApiResult>;
|
|
44
47
|
}
|
|
@@ -12,11 +12,17 @@ class ArtifactsMyCharactersApi {
|
|
|
12
12
|
}
|
|
13
13
|
/** Equip an item on your character. */
|
|
14
14
|
equipItem(name, body) {
|
|
15
|
-
return this.httpClient.post(`/my/${name}/action/equip`, {
|
|
15
|
+
return this.httpClient.post(`/my/${name}/action/equip`, {
|
|
16
|
+
body,
|
|
17
|
+
isSecure: true,
|
|
18
|
+
});
|
|
16
19
|
}
|
|
17
20
|
/** Unequip an item on your character. */
|
|
18
21
|
unequipItem(name, body) {
|
|
19
|
-
return this.httpClient.post(`/my/${name}/action/unequip`, {
|
|
22
|
+
return this.httpClient.post(`/my/${name}/action/unequip`, {
|
|
23
|
+
body,
|
|
24
|
+
isSecure: true,
|
|
25
|
+
});
|
|
20
26
|
}
|
|
21
27
|
/** Start a fight against a monster on the character's map. */
|
|
22
28
|
fight(name) {
|
|
@@ -24,23 +30,37 @@ class ArtifactsMyCharactersApi {
|
|
|
24
30
|
}
|
|
25
31
|
/** Harvest a resource on the character's map. */
|
|
26
32
|
gathering(name) {
|
|
27
|
-
return this.httpClient.post(`/my/${name}/action/gathering`, {
|
|
33
|
+
return this.httpClient.post(`/my/${name}/action/gathering`, {
|
|
34
|
+
isSecure: true,
|
|
35
|
+
});
|
|
28
36
|
}
|
|
29
37
|
/** Crafting an item. The character must be on a map with a workshop. */
|
|
30
38
|
crafting(name, body) {
|
|
31
|
-
return this.httpClient.post(`/my/${name}/action/crafting`, {
|
|
39
|
+
return this.httpClient.post(`/my/${name}/action/crafting`, {
|
|
40
|
+
body,
|
|
41
|
+
isSecure: true,
|
|
42
|
+
});
|
|
32
43
|
}
|
|
33
44
|
/** Deposit an item in a bank on the character's map. */
|
|
34
45
|
depositBank(name, body) {
|
|
35
|
-
return this.httpClient.post(`/my/${name}/action/bank/deposit`, {
|
|
46
|
+
return this.httpClient.post(`/my/${name}/action/bank/deposit`, {
|
|
47
|
+
body,
|
|
48
|
+
isSecure: true,
|
|
49
|
+
});
|
|
36
50
|
}
|
|
37
51
|
/** Deposit golds in a bank on the character's map. */
|
|
38
52
|
depositBankGold(name, body) {
|
|
39
|
-
return this.httpClient.post(`/my/${name}/action/bank/deposit/gold`, {
|
|
53
|
+
return this.httpClient.post(`/my/${name}/action/bank/deposit/gold`, {
|
|
54
|
+
body,
|
|
55
|
+
isSecure: true,
|
|
56
|
+
});
|
|
40
57
|
}
|
|
41
58
|
/** Take an item from your bank and put it in the character's inventory. */
|
|
42
59
|
withdrawBank(name, body) {
|
|
43
|
-
return this.httpClient.post(`/my/${name}/action/bank/withdraw`, {
|
|
60
|
+
return this.httpClient.post(`/my/${name}/action/bank/withdraw`, {
|
|
61
|
+
body,
|
|
62
|
+
isSecure: true,
|
|
63
|
+
});
|
|
44
64
|
}
|
|
45
65
|
/** Withdraw gold from your bank. */
|
|
46
66
|
withdrawBankGold(name, body) {
|
|
@@ -48,31 +68,52 @@ class ArtifactsMyCharactersApi {
|
|
|
48
68
|
}
|
|
49
69
|
/** Recycling an item. The character must be on a map with a workshop (only for equipments and weapons). */
|
|
50
70
|
recycling(name, body) {
|
|
51
|
-
return this.httpClient.post(`/my/${name}/action/recycling`, {
|
|
71
|
+
return this.httpClient.post(`/my/${name}/action/recycling`, {
|
|
72
|
+
body,
|
|
73
|
+
isSecure: true,
|
|
74
|
+
});
|
|
52
75
|
}
|
|
53
76
|
/** Buy an item at the Grand Exchange on the character's map. */
|
|
54
77
|
buyGrandExchangeItem(name, body) {
|
|
55
|
-
return this.httpClient.post(`/my/${name}/action/ge/buy`, {
|
|
78
|
+
return this.httpClient.post(`/my/${name}/action/ge/buy`, {
|
|
79
|
+
body,
|
|
80
|
+
isSecure: true,
|
|
81
|
+
});
|
|
56
82
|
}
|
|
57
83
|
/** Sell an item at the Grand Exchange on the character's map. */
|
|
58
84
|
sellGrandExchangeItem(name, body) {
|
|
59
|
-
return this.httpClient.post(`/my/${name}/action/ge/sell`, {
|
|
85
|
+
return this.httpClient.post(`/my/${name}/action/ge/sell`, {
|
|
86
|
+
body,
|
|
87
|
+
isSecure: true,
|
|
88
|
+
});
|
|
60
89
|
}
|
|
61
90
|
/** Accepting a new task. */
|
|
62
91
|
acceptTask(name) {
|
|
63
|
-
return this.httpClient.post(`/my/${name}/action/task/new`, {
|
|
92
|
+
return this.httpClient.post(`/my/${name}/action/task/new`, {
|
|
93
|
+
isSecure: true,
|
|
94
|
+
});
|
|
64
95
|
}
|
|
65
96
|
/** Complete a task. */
|
|
66
97
|
completeTask(name) {
|
|
67
|
-
return this.httpClient.post(`/my/${name}/action/task/complete`, {
|
|
98
|
+
return this.httpClient.post(`/my/${name}/action/task/complete`, {
|
|
99
|
+
isSecure: true,
|
|
100
|
+
});
|
|
68
101
|
}
|
|
69
|
-
/**
|
|
102
|
+
/**
|
|
103
|
+
* Exchange 3 tasks coins for a random reward.
|
|
104
|
+
* Rewards are exclusive resources for crafting items.
|
|
105
|
+
*/
|
|
70
106
|
exchangeTask(name) {
|
|
71
|
-
return this.httpClient.post(`/my/${name}/action/task/exchange`, {
|
|
107
|
+
return this.httpClient.post(`/my/${name}/action/task/exchange`, {
|
|
108
|
+
isSecure: true,
|
|
109
|
+
});
|
|
72
110
|
}
|
|
73
111
|
/** Delete an item from your character's inventory. */
|
|
74
112
|
deleteItem(name, body) {
|
|
75
|
-
return this.httpClient.post(`/my/${name}/action/delete`, {
|
|
113
|
+
return this.httpClient.post(`/my/${name}/action/delete`, {
|
|
114
|
+
body,
|
|
115
|
+
isSecure: true,
|
|
116
|
+
});
|
|
76
117
|
}
|
|
77
118
|
/** History of the last 100 actions of all your characters. */
|
|
78
119
|
getLogs(params = {}) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ArtifactsHttpClient } from '../http-client/artifacts.http-client';
|
|
2
|
-
import {
|
|
2
|
+
import { GetAllResourcesApiQuery, GetAllResourcesApiResult, GetResourceApiResult } from './types/api-schema-bindings.types';
|
|
3
3
|
export declare class ArtifactsResourcesApi {
|
|
4
4
|
private readonly httpClient;
|
|
5
5
|
constructor(httpClient: ArtifactsHttpClient);
|
|
6
6
|
/** Fetch resources details. */
|
|
7
|
-
getAll(params?:
|
|
7
|
+
getAll(params?: GetAllResourcesApiQuery): Promise<GetAllResourcesApiResult>;
|
|
8
8
|
/** Retrieve the details of a resource. */
|
|
9
|
-
get(code: string): Promise<
|
|
9
|
+
get(code: string): Promise<GetResourceApiResult>;
|
|
10
10
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ArtifactsHttpClient } from '../http-client/artifacts.http-client';
|
|
2
|
-
import {
|
|
2
|
+
import { GenerateTokenResult } from './types/api-schema-bindings.types';
|
|
3
3
|
export declare class ArtifactsTokenApi {
|
|
4
4
|
private readonly httpClient;
|
|
5
5
|
constructor(httpClient: ArtifactsHttpClient);
|
|
@@ -7,5 +7,5 @@ export declare class ArtifactsTokenApi {
|
|
|
7
7
|
* Use your account as HTTPBasic Auth to generate your token to use the API.
|
|
8
8
|
* You can also generate your token directly on the website.
|
|
9
9
|
*/
|
|
10
|
-
generate(username: string, password: string): Promise<
|
|
10
|
+
generate(username: string, password: string): Promise<GenerateTokenResult>;
|
|
11
11
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { components } from '../types/api-schema.types';
|
|
2
1
|
import { ArtifactsHttpClient } from '../http-client/artifacts.http-client';
|
|
3
|
-
import { ArtifactsApiParams } from '
|
|
2
|
+
import { ArtifactsApiParams } from './types/artifacts-api.types';
|
|
4
3
|
import { ArtifactsMyCharactersApi } from './artifacts-my-characters.api';
|
|
5
4
|
import { ArtifactsCharactersApi } from './artifacts-characters.api';
|
|
6
5
|
import { ArtifactsMyAccountApi } from './artifacts-my-account.api';
|
|
@@ -12,6 +11,7 @@ import { ArtifactsEventsApi } from './artifacts-events.api';
|
|
|
12
11
|
import { ArtifactsGrandExchangeApi } from './artifacts-grand-exchange.api';
|
|
13
12
|
import { ArtifactsAccountsApi } from './artifacts-accounts.api';
|
|
14
13
|
import { ArtifactsTokenApi } from './artifacts-token.api';
|
|
14
|
+
import { GetStatusApiResult } from './types/api-schema-bindings.types';
|
|
15
15
|
export declare class ArtifactsApi {
|
|
16
16
|
private readonly httpClient;
|
|
17
17
|
readonly myCharacters: ArtifactsMyCharactersApi;
|
|
@@ -27,6 +27,6 @@ export declare class ArtifactsApi {
|
|
|
27
27
|
readonly token: ArtifactsTokenApi;
|
|
28
28
|
protected constructor(httpClient: ArtifactsHttpClient);
|
|
29
29
|
static create(params?: ArtifactsApiParams): ArtifactsApi;
|
|
30
|
-
getStatus(): Promise<
|
|
30
|
+
getStatus(): Promise<GetStatusApiResult>;
|
|
31
31
|
setToken(token: string): void;
|
|
32
32
|
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { paths } from './api-schema.types';
|
|
2
|
+
export type GetStatusApiResult = paths['/']['get']['responses'][200]['content']['application/json'];
|
|
3
|
+
export type MoveApiBody = paths['/my/{name}/action/move']['post']['requestBody']['content']['application/json'];
|
|
4
|
+
export type MoveApiResult = paths['/my/{name}/action/move']['post']['responses'][200]['content']['application/json'];
|
|
5
|
+
export type EquipItemApiBody = paths['/my/{name}/action/equip']['post']['requestBody']['content']['application/json'];
|
|
6
|
+
export type EquipItemApiResult = paths['/my/{name}/action/equip']['post']['responses'][200]['content']['application/json'];
|
|
7
|
+
export type UnequipItemApiBody = paths['/my/{name}/action/unequip']['post']['requestBody']['content']['application/json'];
|
|
8
|
+
export type UnequipItemApiResult = paths['/my/{name}/action/unequip']['post']['responses'][200]['content']['application/json'];
|
|
9
|
+
export type FightApiResult = paths['/my/{name}/action/fight']['post']['responses'][200]['content']['application/json'];
|
|
10
|
+
export type GatheringApiResult = paths['/my/{name}/action/gathering']['post']['responses'][200]['content']['application/json'];
|
|
11
|
+
export type CraftingApiBody = paths['/my/{name}/action/crafting']['post']['requestBody']['content']['application/json'];
|
|
12
|
+
export type CraftingApiResult = paths['/my/{name}/action/crafting']['post']['responses'][200]['content']['application/json'];
|
|
13
|
+
export type DepositBankApiBody = paths['/my/{name}/action/bank/deposit']['post']['requestBody']['content']['application/json'];
|
|
14
|
+
export type DepositBankApiResult = paths['/my/{name}/action/bank/deposit']['post']['responses'][200]['content']['application/json'];
|
|
15
|
+
export type DepositBankGoldApiBody = paths['/my/{name}/action/bank/deposit/gold']['post']['requestBody']['content']['application/json'];
|
|
16
|
+
export type DepositBankGoldApiResult = paths['/my/{name}/action/bank/deposit/gold']['post']['responses'][200]['content']['application/json'];
|
|
17
|
+
export type WithdrawBankApiBody = paths['/my/{name}/action/bank/withdraw']['post']['requestBody']['content']['application/json'];
|
|
18
|
+
export type WithdrawBankApiResult = paths['/my/{name}/action/bank/withdraw']['post']['responses'][200]['content']['application/json'];
|
|
19
|
+
export type WithdrawBankGoldApiBody = paths['/my/{name}/action/bank/withdraw/gold']['post']['requestBody']['content']['application/json'];
|
|
20
|
+
export type WithdrawBankGoldApiResult = paths['/my/{name}/action/bank/withdraw/gold']['post']['responses'][200]['content']['application/json'];
|
|
21
|
+
export type RecyclingApiBody = paths['/my/{name}/action/recycling']['post']['requestBody']['content']['application/json'];
|
|
22
|
+
export type RecyclingApiResult = paths['/my/{name}/action/recycling']['post']['responses'][200]['content']['application/json'];
|
|
23
|
+
export type BuyGrandExchangeItemApiBody = paths['/my/{name}/action/ge/buy']['post']['requestBody']['content']['application/json'];
|
|
24
|
+
export type BuyGrandExchangeItemApiResult = paths['/my/{name}/action/ge/buy']['post']['responses'][200]['content']['application/json'];
|
|
25
|
+
export type SellGrandExchangeItemApiBody = paths['/my/{name}/action/ge/sell']['post']['requestBody']['content']['application/json'];
|
|
26
|
+
export type SellGrandExchangeItemApiResult = paths['/my/{name}/action/ge/sell']['post']['responses'][200]['content']['application/json'];
|
|
27
|
+
export type AcceptTaskApiResult = paths['/my/{name}/action/task/new']['post']['responses'][200]['content']['application/json'];
|
|
28
|
+
export type CompleteTaskApiResult = paths['/my/{name}/action/task/complete']['post']['responses'][200]['content']['application/json'];
|
|
29
|
+
export type ExchangeTaskApiResult = paths['/my/{name}/action/task/exchange']['post']['responses'][200]['content']['application/json'];
|
|
30
|
+
export type DeleteItemApiBody = paths['/my/{name}/action/delete']['post']['requestBody']['content']['application/json'];
|
|
31
|
+
export type DeleteItemApiResult = paths['/my/{name}/action/delete']['post']['responses'][200]['content']['application/json'];
|
|
32
|
+
export type GetLogsApiQuery = paths['/my/logs']['get']['parameters']['query'];
|
|
33
|
+
export type GetLogsApiResult = paths['/my/logs']['get']['responses'][200]['content']['application/json'];
|
|
34
|
+
export type GetMyCharactersApiResult = paths['/my/characters']['get']['responses'][200]['content']['application/json'];
|
|
35
|
+
export type CreateAccountApiBody = paths['/accounts/create']['post']['requestBody']['content']['application/json'];
|
|
36
|
+
export type CreateAccountApiResult = paths['/accounts/create']['post']['responses'][200]['content']['application/json'];
|
|
37
|
+
export type CreateCharacterApiBody = paths['/characters/create']['post']['requestBody']['content']['application/json'];
|
|
38
|
+
export type CreateCharacterApiResult = paths['/accounts/create']['post']['responses'][200]['content']['application/json'];
|
|
39
|
+
export type GetAllCharactersApiQuery = paths['/characters/']['get']['parameters']['query'];
|
|
40
|
+
export type GetAllCharactersApiResult = paths['/characters/']['get']['responses'][200]['content']['application/json'];
|
|
41
|
+
export type GetCharacterApiResult = paths['/characters/{name}']['get']['responses'][200]['content']['application/json'];
|
|
42
|
+
export type GetAllEventsApiQuery = paths['/events/']['get']['parameters']['query'];
|
|
43
|
+
export type GetAllEventsApiResult = paths['/events/']['get']['responses'][200]['content']['application/json'];
|
|
44
|
+
export type GetAllGrandExchangeApiQuery = paths['/ge/']['get']['parameters']['query'];
|
|
45
|
+
export type GetAllGrandExchangeApiResult = paths['/ge/']['get']['responses'][200]['content']['application/json'];
|
|
46
|
+
export type GetGrandExchangeApiResult = paths['/ge/{code}']['get']['responses'][200]['content']['application/json'];
|
|
47
|
+
export type GetAllItemsApiQuery = paths['/items/']['get']['parameters']['query'];
|
|
48
|
+
export type GetAllItemsApiResult = paths['/items/']['get']['responses'][200]['content']['application/json'];
|
|
49
|
+
export type GetItemApiResult = paths['/items/{code}']['get']['responses'][200]['content']['application/json'];
|
|
50
|
+
export type GetAllMapsApiQuery = paths['/maps/']['get']['parameters']['query'];
|
|
51
|
+
export type GetAllMapsApiResult = paths['/maps/']['get']['responses'][200]['content']['application/json'];
|
|
52
|
+
export type GetMapApiResult = paths['/maps/{x}/{y}']['get']['responses'][200]['content']['application/json'];
|
|
53
|
+
export type GetAllMonstersApiQuery = paths['/monsters/']['get']['parameters']['query'];
|
|
54
|
+
export type GetAllMonstersApiResult = paths['/monsters/']['get']['responses'][200]['content']['application/json'];
|
|
55
|
+
export type GetMonsterApiResult = paths['/monsters/{code}']['get']['responses'][200]['content']['application/json'];
|
|
56
|
+
export type GetBankItemsApiQuery = paths['/my/bank/items']['get']['parameters']['query'];
|
|
57
|
+
export type GetBankItemsApiResult = paths['/my/bank/items']['get']['responses'][200]['content']['application/json'];
|
|
58
|
+
export type GetBankGoldApiResult = paths['/my/bank/gold']['get']['responses'][200]['content']['application/json'];
|
|
59
|
+
export type ChangePasswordApiBody = paths['/my/change_password']['post']['requestBody']['content']['application/json'];
|
|
60
|
+
export type ChangePasswordApiResult = paths['/my/change_password']['post']['responses'][200]['content']['application/json'];
|
|
61
|
+
export type GetAllResourcesApiQuery = paths['/resources/']['get']['parameters']['query'];
|
|
62
|
+
export type GetAllResourcesApiResult = paths['/resources/']['get']['responses'][200]['content']['application/json'];
|
|
63
|
+
export type GetResourceApiResult = paths['/resources/{code}']['get']['responses'][200]['content']['application/json'];
|
|
64
|
+
export type GenerateTokenResult = paths['/token/']['post']['responses'][200]['content']['application/json'];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GetRequestParams, PostRequestParams } from '
|
|
1
|
+
import { GetRequestParams, PostRequestParams } from './types/artifacts-http-client.types';
|
|
2
2
|
export declare class ArtifactsHttpClient {
|
|
3
3
|
private readonly baseUrl;
|
|
4
4
|
private token;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
17
|
exports.ArtifactsError = exports.ArtifactsApi = void 0;
|
|
4
18
|
var artifacts_api_1 = require("./api/artifacts.api");
|
|
5
19
|
Object.defineProperty(exports, "ArtifactsApi", { enumerable: true, get: function () { return artifacts_api_1.ArtifactsApi; } });
|
|
6
20
|
var artifacts_error_1 = require("./errors/artifacts.error");
|
|
7
21
|
Object.defineProperty(exports, "ArtifactsError", { enumerable: true, get: function () { return artifacts_error_1.ArtifactsError; } });
|
|
22
|
+
__exportStar(require("./api/types/api-schema-bindings.types"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "artifacts-api-client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Api client for https://artifactsmmo.com",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"repository": "https://github.com/siranweb/artifacts-api-client.git",
|
|
@@ -10,12 +10,11 @@
|
|
|
10
10
|
"client"
|
|
11
11
|
],
|
|
12
12
|
"scripts": {
|
|
13
|
-
"test": "jest",
|
|
14
13
|
"build": "tsc",
|
|
15
14
|
"ts-check": "tsc --noEmit",
|
|
16
15
|
"lint": "eslint --max-warnings 0 --ext .ts lib",
|
|
17
16
|
"format": "prettier --log-level warn --write lib",
|
|
18
|
-
"generate-schema": "openapi-typescript https://api.artifactsmmo.com/openapi.json -o
|
|
17
|
+
"generate-schema": "openapi-typescript https://api.artifactsmmo.com/openapi.json -o lib/api/types/api-schema.types.ts"
|
|
19
18
|
},
|
|
20
19
|
"author": "Kirill Gerasimenko <siranweb.public@tuta.io>",
|
|
21
20
|
"license": "MIT",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|