artifacts-api-client 1.0.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/LICENSE.md +21 -0
- package/README.md +72 -0
- package/dist/api/artifacts-accounts.api.d.ts +8 -0
- package/dist/api/artifacts-accounts.api.js +16 -0
- package/dist/api/artifacts-characters.api.d.ts +12 -0
- package/dist/api/artifacts-characters.api.js +24 -0
- package/dist/api/artifacts-events.api.d.ts +8 -0
- package/dist/api/artifacts-events.api.js +16 -0
- package/dist/api/artifacts-grand-exchange.api.d.ts +10 -0
- package/dist/api/artifacts-grand-exchange.api.js +20 -0
- package/dist/api/artifacts-items.api.d.ts +10 -0
- package/dist/api/artifacts-items.api.js +20 -0
- package/dist/api/artifacts-maps.api.d.ts +10 -0
- package/dist/api/artifacts-maps.api.js +22 -0
- package/dist/api/artifacts-monsters.api.d.ts +10 -0
- package/dist/api/artifacts-monsters.api.js +20 -0
- package/dist/api/artifacts-my-account.api.d.ts +12 -0
- package/dist/api/artifacts-my-account.api.js +27 -0
- package/dist/api/artifacts-my-characters.api.d.ts +46 -0
- package/dist/api/artifacts-my-characters.api.js +98 -0
- package/dist/api/artifacts-resources.api.d.ts +10 -0
- package/dist/api/artifacts-resources.api.js +20 -0
- package/dist/api/artifacts-token.api.d.ts +11 -0
- package/dist/api/artifacts-token.api.js +23 -0
- package/dist/api/artifacts.api.d.ts +32 -0
- package/dist/api/artifacts.api.js +54 -0
- package/dist/errors/artifacts.error.d.ts +13 -0
- package/dist/errors/artifacts.error.js +16 -0
- package/dist/http-client/artifacts.http-client.d.ts +10 -0
- package/dist/http-client/artifacts.http-client.js +66 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +7 -0
- package/dist/types/api-schema.types.d.ts +4442 -0
- package/dist/types/api-schema.types.js +6 -0
- package/dist/types/artifacts-api.types.d.ts +4 -0
- package/dist/types/artifacts-api.types.js +2 -0
- package/dist/types/artifacts-http-client.types.d.ts +17 -0
- package/dist/types/artifacts-http-client.types.js +2 -0
- package/dist/utils/toBase64.d.ts +1 -0
- package/dist/utils/toBase64.js +8 -0
- package/package.json +40 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) Kirill Gerasimenko 2024 to present.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
|
|
2
|
+
# Api Client for [Artifacts](https://artifactsmmo.com)
|
|
3
|
+
[](https://www.npmjs.com/package/artifacts-api-client)
|
|
4
|
+
[](https://github.com/siranweb/artifacts-api-client/LICENSE.md)
|
|
5
|
+
|
|
6
|
+
API wrapper for NodeJS and browsers with TypeScript support
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
```bash
|
|
10
|
+
npm i artifacts-api-client
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
`artifacts-api-client` fully implements [official API](https://api.artifactsmmo.com/docs).
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { ArtifactsApi } from 'artifacts-api-client';
|
|
19
|
+
|
|
20
|
+
// Initialization
|
|
21
|
+
const artifactsApi = ArtifactsApi.create({
|
|
22
|
+
token: 'TOKEN'
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// Usage
|
|
26
|
+
const status = await artifactsApi.getStatus();
|
|
27
|
+
const resources = await artifactsApi.resources.getAll({
|
|
28
|
+
min_level: 1,
|
|
29
|
+
max_level: 10,
|
|
30
|
+
})
|
|
31
|
+
await artifactsApi.myCharacters.fight('name');
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Alternatively, you can set token later:
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
import { ArtifactsApi } from 'artifacts-api-client';
|
|
38
|
+
|
|
39
|
+
const artifactsApi = ArtifactsApi.create();
|
|
40
|
+
|
|
41
|
+
await artifactsApi.myCharacters.fight('name'); // <-- fail, auth required
|
|
42
|
+
|
|
43
|
+
const { token } = await artifactsApi.token.generate('username', 'password');
|
|
44
|
+
artifactsApi.setToken(token);
|
|
45
|
+
|
|
46
|
+
await artifactsApi.myCharacters.fight('name'); // <-- now it works
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Error handling
|
|
50
|
+
All artifacts API errors are wrapped with `ArtifactsError`.
|
|
51
|
+
Keep in mind, that the others errors like `NetworkError` left as they are:
|
|
52
|
+
```ts
|
|
53
|
+
import { ArtifactsApi, ArtifactsError } from 'artifacts-api-client';
|
|
54
|
+
|
|
55
|
+
const artifactsApi = ArtifactsApi.create({
|
|
56
|
+
token: 'TOKEN'
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
try {
|
|
60
|
+
await artifactsApi.myCharacters.fight('name');
|
|
61
|
+
} catch (err: unknown) {
|
|
62
|
+
if (err instanceof ArtifactsError) {
|
|
63
|
+
console.error('Artifacts error', e.message, e.code, e.data);
|
|
64
|
+
} else {
|
|
65
|
+
throw e;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Changelog
|
|
71
|
+
### v1.0.0
|
|
72
|
+
* Supported API version: 1.3
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ArtifactsHttpClient } from '../http-client/artifacts.http-client';
|
|
2
|
+
import { components } from '../types/api-schema.types';
|
|
3
|
+
export declare class ArtifactsAccountsApi {
|
|
4
|
+
private readonly httpClient;
|
|
5
|
+
constructor(httpClient: ArtifactsHttpClient);
|
|
6
|
+
/** Create an account. */
|
|
7
|
+
create(body: components['schemas']['AddAccountSchema']): Promise<components['schemas']['ResponseSchema']>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ArtifactsAccountsApi = void 0;
|
|
4
|
+
class ArtifactsAccountsApi {
|
|
5
|
+
httpClient;
|
|
6
|
+
constructor(httpClient) {
|
|
7
|
+
this.httpClient = httpClient;
|
|
8
|
+
}
|
|
9
|
+
/** Create an account. */
|
|
10
|
+
create(body) {
|
|
11
|
+
return this.httpClient.post(`/accounts/create`, {
|
|
12
|
+
body,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.ArtifactsAccountsApi = ArtifactsAccountsApi;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ArtifactsHttpClient } from '../http-client/artifacts.http-client';
|
|
2
|
+
import { components, operations } from '../types/api-schema.types';
|
|
3
|
+
export declare class ArtifactsCharactersApi {
|
|
4
|
+
private readonly httpClient;
|
|
5
|
+
constructor(httpClient: ArtifactsHttpClient);
|
|
6
|
+
/** Create new character on your account. You can create up to 5 characters. */
|
|
7
|
+
create(body: components['schemas']['AddCharacterSchema']): Promise<components['schemas']['CharacterResponseSchema']>;
|
|
8
|
+
/** Fetch characters details. */
|
|
9
|
+
getAll(params?: operations['get_all_characters_characters__get']['parameters']['query']): Promise<components['schemas']['DataPage_CharacterSchema_']>;
|
|
10
|
+
/** Fetch characters details. */
|
|
11
|
+
get(name: string): Promise<components['schemas']['CharacterResponseSchema']>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ArtifactsCharactersApi = void 0;
|
|
4
|
+
class ArtifactsCharactersApi {
|
|
5
|
+
httpClient;
|
|
6
|
+
constructor(httpClient) {
|
|
7
|
+
this.httpClient = httpClient;
|
|
8
|
+
}
|
|
9
|
+
/** Create new character on your account. You can create up to 5 characters. */
|
|
10
|
+
create(body) {
|
|
11
|
+
return this.httpClient.post(`/characters/create`, { body, isSecure: true });
|
|
12
|
+
}
|
|
13
|
+
/** Fetch characters details. */
|
|
14
|
+
getAll(params = {}) {
|
|
15
|
+
return this.httpClient.get(`/characters`, {
|
|
16
|
+
query: params,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
/** Fetch characters details. */
|
|
20
|
+
get(name) {
|
|
21
|
+
return this.httpClient.get(`/characters/${name}`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.ArtifactsCharactersApi = ArtifactsCharactersApi;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ArtifactsHttpClient } from '../http-client/artifacts.http-client';
|
|
2
|
+
import { components, operations } from '../types/api-schema.types';
|
|
3
|
+
export declare class ArtifactsEventsApi {
|
|
4
|
+
private readonly httpClient;
|
|
5
|
+
constructor(httpClient: ArtifactsHttpClient);
|
|
6
|
+
/** Fetch events details. */
|
|
7
|
+
getAll(params?: operations['get_all_events_events__get']['parameters']['query']): Promise<components['schemas']['DataPage_EventSchema_']>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ArtifactsEventsApi = void 0;
|
|
4
|
+
class ArtifactsEventsApi {
|
|
5
|
+
httpClient;
|
|
6
|
+
constructor(httpClient) {
|
|
7
|
+
this.httpClient = httpClient;
|
|
8
|
+
}
|
|
9
|
+
/** Fetch events details. */
|
|
10
|
+
getAll(params = {}) {
|
|
11
|
+
return this.httpClient.get(`/events`, {
|
|
12
|
+
query: params,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.ArtifactsEventsApi = ArtifactsEventsApi;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ArtifactsHttpClient } from '../http-client/artifacts.http-client';
|
|
2
|
+
import { components, operations } from '../types/api-schema.types';
|
|
3
|
+
export declare class ArtifactsGrandExchangeApi {
|
|
4
|
+
private readonly httpClient;
|
|
5
|
+
constructor(httpClient: ArtifactsHttpClient);
|
|
6
|
+
/** Fetch Grand Exchange items details. */
|
|
7
|
+
getAll(params?: operations['get_all_ge_items_ge__get']['parameters']['query']): Promise<components['schemas']['DataPage_GEItemSchema_']>;
|
|
8
|
+
/** Retrieve the details of a Grand Exchange item. */
|
|
9
|
+
get(code: string): Promise<components['schemas']['GEItemResponseSchema']>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ArtifactsGrandExchangeApi = void 0;
|
|
4
|
+
class ArtifactsGrandExchangeApi {
|
|
5
|
+
httpClient;
|
|
6
|
+
constructor(httpClient) {
|
|
7
|
+
this.httpClient = httpClient;
|
|
8
|
+
}
|
|
9
|
+
/** Fetch Grand Exchange items details. */
|
|
10
|
+
getAll(params = {}) {
|
|
11
|
+
return this.httpClient.get(`/ge`, {
|
|
12
|
+
query: params,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
/** Retrieve the details of a Grand Exchange item. */
|
|
16
|
+
get(code) {
|
|
17
|
+
return this.httpClient.get(`/ge/${code}`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.ArtifactsGrandExchangeApi = ArtifactsGrandExchangeApi;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ArtifactsHttpClient } from '../http-client/artifacts.http-client';
|
|
2
|
+
import { components, operations } from '../types/api-schema.types';
|
|
3
|
+
export declare class ArtifactsItemsApi {
|
|
4
|
+
private readonly httpClient;
|
|
5
|
+
constructor(httpClient: ArtifactsHttpClient);
|
|
6
|
+
/** Fetch items details. */
|
|
7
|
+
getAll(params?: operations['get_all_items_items__get']['parameters']['query']): Promise<components['schemas']['DataPage_ItemSchema_']>;
|
|
8
|
+
/** Retrieve the details of an item. */
|
|
9
|
+
get(code: string): Promise<components['schemas']['ItemResponseSchema']>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ArtifactsItemsApi = void 0;
|
|
4
|
+
class ArtifactsItemsApi {
|
|
5
|
+
httpClient;
|
|
6
|
+
constructor(httpClient) {
|
|
7
|
+
this.httpClient = httpClient;
|
|
8
|
+
}
|
|
9
|
+
/** Fetch items details. */
|
|
10
|
+
getAll(params = {}) {
|
|
11
|
+
return this.httpClient.get(`/items`, {
|
|
12
|
+
query: params,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
/** Retrieve the details of an item. */
|
|
16
|
+
get(code) {
|
|
17
|
+
return this.httpClient.get(`/items/${code}`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.ArtifactsItemsApi = ArtifactsItemsApi;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ArtifactsHttpClient } from '../http-client/artifacts.http-client';
|
|
2
|
+
import { components, operations } from '../types/api-schema.types';
|
|
3
|
+
export declare class ArtifactsMapsApi {
|
|
4
|
+
private readonly httpClient;
|
|
5
|
+
constructor(httpClient: ArtifactsHttpClient);
|
|
6
|
+
/** Fetch maps details. */
|
|
7
|
+
getAll(params?: operations['get_all_maps_maps__get']['parameters']['query']): Promise<components['schemas']['DataPage_SimpleItemSchema_']>;
|
|
8
|
+
/** Retrieve the details of a map. */
|
|
9
|
+
get(x: number, y: number, params?: operations['get_all_maps_maps__get']['parameters']['query']): Promise<components['schemas']['MapResponseSchema']>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ArtifactsMapsApi = void 0;
|
|
4
|
+
class ArtifactsMapsApi {
|
|
5
|
+
httpClient;
|
|
6
|
+
constructor(httpClient) {
|
|
7
|
+
this.httpClient = httpClient;
|
|
8
|
+
}
|
|
9
|
+
/** Fetch maps details. */
|
|
10
|
+
getAll(params = {}) {
|
|
11
|
+
return this.httpClient.get(`/maps`, {
|
|
12
|
+
query: params,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
/** Retrieve the details of a map. */
|
|
16
|
+
get(x, y, params = {}) {
|
|
17
|
+
return this.httpClient.get(`/maps/${x}/${y}`, {
|
|
18
|
+
query: params,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.ArtifactsMapsApi = ArtifactsMapsApi;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ArtifactsHttpClient } from '../http-client/artifacts.http-client';
|
|
2
|
+
import { components, operations } from '../types/api-schema.types';
|
|
3
|
+
export declare class ArtifactsMonstersApi {
|
|
4
|
+
private readonly httpClient;
|
|
5
|
+
constructor(httpClient: ArtifactsHttpClient);
|
|
6
|
+
/** Fetch monsters details. */
|
|
7
|
+
getAll(params?: operations['get_all_monsters_monsters__get']['parameters']['query']): Promise<components['schemas']['DataPage_MonsterSchema_']>;
|
|
8
|
+
/** Retrieve the details of a monster. */
|
|
9
|
+
get(code: string): Promise<components['schemas']['MonsterResponseSchema']>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ArtifactsMonstersApi = void 0;
|
|
4
|
+
class ArtifactsMonstersApi {
|
|
5
|
+
httpClient;
|
|
6
|
+
constructor(httpClient) {
|
|
7
|
+
this.httpClient = httpClient;
|
|
8
|
+
}
|
|
9
|
+
/** Fetch monsters details. */
|
|
10
|
+
getAll(params = {}) {
|
|
11
|
+
return this.httpClient.get(`/monsters`, {
|
|
12
|
+
query: params,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
/** Retrieve the details of a monster. */
|
|
16
|
+
get(code) {
|
|
17
|
+
return this.httpClient.get(`/monsters/${code}`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.ArtifactsMonstersApi = ArtifactsMonstersApi;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ArtifactsHttpClient } from '../http-client/artifacts.http-client';
|
|
2
|
+
import { components, operations } from '../types/api-schema.types';
|
|
3
|
+
export declare class ArtifactsMyAccountApi {
|
|
4
|
+
private readonly httpClient;
|
|
5
|
+
constructor(httpClient: ArtifactsHttpClient);
|
|
6
|
+
/** Fetch all items in your bank. */
|
|
7
|
+
getBankItems(params?: operations['get_bank_items_my_bank_items_get']['parameters']['query']): Promise<components['schemas']['DataPage_SimpleItemSchema_']>;
|
|
8
|
+
/** Fetch golds in your bank. */
|
|
9
|
+
getBankGold(): Promise<components['schemas']['GoldBankResponseSchema']>;
|
|
10
|
+
/** Change your account password. Changing the password reset the account token. */
|
|
11
|
+
changePassword(body: components['schemas']['ChangePassword']): Promise<components['schemas']['ResponseSchema']>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ArtifactsMyAccountApi = void 0;
|
|
4
|
+
class ArtifactsMyAccountApi {
|
|
5
|
+
httpClient;
|
|
6
|
+
constructor(httpClient) {
|
|
7
|
+
this.httpClient = httpClient;
|
|
8
|
+
}
|
|
9
|
+
/** Fetch all items in your bank. */
|
|
10
|
+
getBankItems(params = {}) {
|
|
11
|
+
return this.httpClient.get(`/my/bank/items`, { query: params, isSecure: true });
|
|
12
|
+
}
|
|
13
|
+
/** Fetch golds in your bank. */
|
|
14
|
+
getBankGold() {
|
|
15
|
+
return this.httpClient.get(`/my/bank/gold`, {
|
|
16
|
+
isSecure: true,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
/** Change your account password. Changing the password reset the account token. */
|
|
20
|
+
changePassword(body) {
|
|
21
|
+
return this.httpClient.post(`/my/change_password`, {
|
|
22
|
+
body,
|
|
23
|
+
isSecure: true,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.ArtifactsMyAccountApi = ArtifactsMyAccountApi;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ArtifactsHttpClient } from '../http-client/artifacts.http-client';
|
|
2
|
+
import { components, operations } from '../types/api-schema.types';
|
|
3
|
+
export declare class ArtifactsMyCharactersApi {
|
|
4
|
+
private readonly httpClient;
|
|
5
|
+
constructor(httpClient: ArtifactsHttpClient);
|
|
6
|
+
/** Moves a character on the map using the map's X and Y position. */
|
|
7
|
+
move(name: string, body: components['schemas']['DestinationSchema']): Promise<components['schemas']['CharacterMovementResponseSchema']>;
|
|
8
|
+
/** Equip an item on your character. */
|
|
9
|
+
equipItem(name: string, body: components['schemas']['EquipSchema']): Promise<components['schemas']['EquipmentResponseSchema']>;
|
|
10
|
+
/** Unequip an item on your character. */
|
|
11
|
+
unequipItem(name: string, body: components['schemas']['UnequipSchema']): Promise<components['schemas']['EquipmentResponseSchema']>;
|
|
12
|
+
/** Start a fight against a monster on the character's map. */
|
|
13
|
+
fight(name: string): Promise<components['schemas']['CharacterFightResponseSchema']>;
|
|
14
|
+
/** Harvest a resource on the character's map. */
|
|
15
|
+
gathering(name: string): Promise<components['schemas']['SkillResponseSchema']>;
|
|
16
|
+
/** Crafting an item. The character must be on a map with a workshop. */
|
|
17
|
+
crafting(name: string): Promise<components['schemas']['SkillResponseSchema']>;
|
|
18
|
+
/** Deposit an item in a bank on the character's map. */
|
|
19
|
+
depositBank(name: string, body: components['schemas']['SimpleItemSchema']): Promise<components['schemas']['ActionItemBankResponseSchema']>;
|
|
20
|
+
/** Deposit golds in a bank on the character's map. */
|
|
21
|
+
depositBankGold(name: string, body: components['schemas']['DepositWithdrawGoldSchema']): Promise<components['schemas']['GoldResponseSchema']>;
|
|
22
|
+
/** Take an item from your bank and put it in the character's inventory. */
|
|
23
|
+
withdrawBank(name: string, body: components['schemas']['SimpleItemSchema']): Promise<components['schemas']['ActionItemBankResponseSchema']>;
|
|
24
|
+
/** Withdraw gold from your bank. */
|
|
25
|
+
withdrawBankGold(name: string, body: components['schemas']['DepositWithdrawGoldSchema']): Promise<components['schemas']['GoldResponseSchema']>;
|
|
26
|
+
/** Recycling an item. The character must be on a map with a workshop (only for equipments and weapons). */
|
|
27
|
+
recycling(name: string, body: components['schemas']['RecyclingSchema']): Promise<components['schemas']['RecyclingResponseSchema']>;
|
|
28
|
+
/** Buy an item at the Grand Exchange on the character's map. */
|
|
29
|
+
buyGrandExchangeItem(name: string, body: components['schemas']['GETransactionItemSchema']): Promise<components['schemas']['GETransactionResponseSchema']>;
|
|
30
|
+
/** Sell an item at the Grand Exchange on the character's map. */
|
|
31
|
+
sellGrandExchangeItem(name: string, body: components['schemas']['GETransactionItemSchema']): Promise<components['schemas']['GETransactionResponseSchema']>;
|
|
32
|
+
/** Accepting a new task. */
|
|
33
|
+
acceptTask(name: string): Promise<components['schemas']['TaskResponseSchema']>;
|
|
34
|
+
/** Complete a task. */
|
|
35
|
+
completeTask(name: string): Promise<components['schemas']['TaskRewardResponseSchema']>;
|
|
36
|
+
/** Exchange 3 tasks coins for a random reward. Rewards are exclusive resources for crafting items. */
|
|
37
|
+
exchangeTask(name: string): Promise<components['schemas']['TaskRewardResponseSchema']>;
|
|
38
|
+
/** Delete an item from your character's inventory. */
|
|
39
|
+
deleteItem(name: string, body: components['schemas']['SimpleItemSchema']): Promise<components['schemas']['DeleteItemResponseSchema']>;
|
|
40
|
+
/** History of your character's last 100 actions. */
|
|
41
|
+
getCharacterLogs(name: string, params?: operations['get_character_logs_my__name__logs_get']['parameters']['query']): Promise<components['schemas']['DataPage_LogSchema_']>;
|
|
42
|
+
/** History of the last 100 actions of all your characters. */
|
|
43
|
+
getLogs(params?: operations['get_all_characters_logs_my_logs_get']['parameters']['query']): Promise<components['schemas']['DataPage_LogSchema_']>;
|
|
44
|
+
/** List of your characters. */
|
|
45
|
+
getAll(): Promise<components['schemas']['MyCharactersListSchema']>;
|
|
46
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ArtifactsMyCharactersApi = void 0;
|
|
4
|
+
class ArtifactsMyCharactersApi {
|
|
5
|
+
httpClient;
|
|
6
|
+
constructor(httpClient) {
|
|
7
|
+
this.httpClient = httpClient;
|
|
8
|
+
}
|
|
9
|
+
/** Moves a character on the map using the map's X and Y position. */
|
|
10
|
+
move(name, body) {
|
|
11
|
+
return this.httpClient.post(`/my/${name}/action/move`, { body, isSecure: true });
|
|
12
|
+
}
|
|
13
|
+
/** Equip an item on your character. */
|
|
14
|
+
equipItem(name, body) {
|
|
15
|
+
return this.httpClient.post(`/my/${name}/action/equip`, { body, isSecure: true });
|
|
16
|
+
}
|
|
17
|
+
/** Unequip an item on your character. */
|
|
18
|
+
unequipItem(name, body) {
|
|
19
|
+
return this.httpClient.post(`/my/${name}/action/unequip`, { body, isSecure: true });
|
|
20
|
+
}
|
|
21
|
+
/** Start a fight against a monster on the character's map. */
|
|
22
|
+
fight(name) {
|
|
23
|
+
return this.httpClient.post(`/my/${name}/action/fight`, { isSecure: true });
|
|
24
|
+
}
|
|
25
|
+
/** Harvest a resource on the character's map. */
|
|
26
|
+
gathering(name) {
|
|
27
|
+
return this.httpClient.post(`/my/${name}/action/gathering`, { isSecure: true });
|
|
28
|
+
}
|
|
29
|
+
/** Crafting an item. The character must be on a map with a workshop. */
|
|
30
|
+
crafting(name) {
|
|
31
|
+
return this.httpClient.post(`/my/${name}/action/crafting`, { isSecure: true });
|
|
32
|
+
}
|
|
33
|
+
/** Deposit an item in a bank on the character's map. */
|
|
34
|
+
depositBank(name, body) {
|
|
35
|
+
return this.httpClient.post(`/my/${name}/action/bank/deposit`, { body, isSecure: true });
|
|
36
|
+
}
|
|
37
|
+
/** Deposit golds in a bank on the character's map. */
|
|
38
|
+
depositBankGold(name, body) {
|
|
39
|
+
return this.httpClient.post(`/my/${name}/action/bank/deposit/gold`, { body, isSecure: true });
|
|
40
|
+
}
|
|
41
|
+
/** Take an item from your bank and put it in the character's inventory. */
|
|
42
|
+
withdrawBank(name, body) {
|
|
43
|
+
return this.httpClient.post(`/my/${name}/action/bank/withdraw`, { body, isSecure: true });
|
|
44
|
+
}
|
|
45
|
+
/** Withdraw gold from your bank. */
|
|
46
|
+
withdrawBankGold(name, body) {
|
|
47
|
+
return this.httpClient.post(`/my/${name}/action/bank/withdraw/gold`, { body, isSecure: true });
|
|
48
|
+
}
|
|
49
|
+
/** Recycling an item. The character must be on a map with a workshop (only for equipments and weapons). */
|
|
50
|
+
recycling(name, body) {
|
|
51
|
+
return this.httpClient.post(`/my/${name}/action/recycling`, { body, isSecure: true });
|
|
52
|
+
}
|
|
53
|
+
/** Buy an item at the Grand Exchange on the character's map. */
|
|
54
|
+
buyGrandExchangeItem(name, body) {
|
|
55
|
+
return this.httpClient.post(`/my/${name}/action/ge/buy`, { body, isSecure: true });
|
|
56
|
+
}
|
|
57
|
+
/** Sell an item at the Grand Exchange on the character's map. */
|
|
58
|
+
sellGrandExchangeItem(name, body) {
|
|
59
|
+
return this.httpClient.post(`/my/${name}/action/ge/sell`, { body, isSecure: true });
|
|
60
|
+
}
|
|
61
|
+
/** Accepting a new task. */
|
|
62
|
+
acceptTask(name) {
|
|
63
|
+
return this.httpClient.post(`/my/${name}/action/task/new`, { isSecure: true });
|
|
64
|
+
}
|
|
65
|
+
/** Complete a task. */
|
|
66
|
+
completeTask(name) {
|
|
67
|
+
return this.httpClient.post(`/my/${name}/action/task/complete`, { isSecure: true });
|
|
68
|
+
}
|
|
69
|
+
/** Exchange 3 tasks coins for a random reward. Rewards are exclusive resources for crafting items. */
|
|
70
|
+
exchangeTask(name) {
|
|
71
|
+
return this.httpClient.post(`/my/${name}/action/task/exchange`, { isSecure: true });
|
|
72
|
+
}
|
|
73
|
+
/** Delete an item from your character's inventory. */
|
|
74
|
+
deleteItem(name, body) {
|
|
75
|
+
return this.httpClient.post(`/my/${name}/action/delete`, { body, isSecure: true });
|
|
76
|
+
}
|
|
77
|
+
/** History of your character's last 100 actions. */
|
|
78
|
+
getCharacterLogs(name, params = {}) {
|
|
79
|
+
return this.httpClient.get(`/my/${name}/logs`, {
|
|
80
|
+
query: params,
|
|
81
|
+
isSecure: true,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
/** History of the last 100 actions of all your characters. */
|
|
85
|
+
getLogs(params = {}) {
|
|
86
|
+
return this.httpClient.get(`/my/logs`, {
|
|
87
|
+
query: params,
|
|
88
|
+
isSecure: true,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
/** List of your characters. */
|
|
92
|
+
getAll() {
|
|
93
|
+
return this.httpClient.get(`/my/characters`, {
|
|
94
|
+
isSecure: true,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
exports.ArtifactsMyCharactersApi = ArtifactsMyCharactersApi;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ArtifactsHttpClient } from '../http-client/artifacts.http-client';
|
|
2
|
+
import { components, operations } from '../types/api-schema.types';
|
|
3
|
+
export declare class ArtifactsResourcesApi {
|
|
4
|
+
private readonly httpClient;
|
|
5
|
+
constructor(httpClient: ArtifactsHttpClient);
|
|
6
|
+
/** Fetch resources details. */
|
|
7
|
+
getAll(params?: operations['get_all_resources_resources__get']['parameters']['query']): Promise<components['schemas']['DataPage_ResourceSchema_']>;
|
|
8
|
+
/** Retrieve the details of a resource. */
|
|
9
|
+
get(code: string): Promise<components['schemas']['ResourceResponseSchema']>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ArtifactsResourcesApi = void 0;
|
|
4
|
+
class ArtifactsResourcesApi {
|
|
5
|
+
httpClient;
|
|
6
|
+
constructor(httpClient) {
|
|
7
|
+
this.httpClient = httpClient;
|
|
8
|
+
}
|
|
9
|
+
/** Fetch resources details. */
|
|
10
|
+
getAll(params = {}) {
|
|
11
|
+
return this.httpClient.get(`/resources`, {
|
|
12
|
+
query: params,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
/** Retrieve the details of a resource. */
|
|
16
|
+
get(code) {
|
|
17
|
+
return this.httpClient.get(`/resources/${code}`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.ArtifactsResourcesApi = ArtifactsResourcesApi;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ArtifactsHttpClient } from '../http-client/artifacts.http-client';
|
|
2
|
+
import { components } from '../types/api-schema.types';
|
|
3
|
+
export declare class ArtifactsTokenApi {
|
|
4
|
+
private readonly httpClient;
|
|
5
|
+
constructor(httpClient: ArtifactsHttpClient);
|
|
6
|
+
/**
|
|
7
|
+
* Use your account as HTTPBasic Auth to generate your token to use the API.
|
|
8
|
+
* You can also generate your token directly on the website.
|
|
9
|
+
*/
|
|
10
|
+
generate(username: string, password: string): Promise<components['schemas']['TokenResponseSchema']>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ArtifactsTokenApi = void 0;
|
|
4
|
+
const toBase64_1 = require("../utils/toBase64");
|
|
5
|
+
class ArtifactsTokenApi {
|
|
6
|
+
httpClient;
|
|
7
|
+
constructor(httpClient) {
|
|
8
|
+
this.httpClient = httpClient;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Use your account as HTTPBasic Auth to generate your token to use the API.
|
|
12
|
+
* You can also generate your token directly on the website.
|
|
13
|
+
*/
|
|
14
|
+
generate(username, password) {
|
|
15
|
+
const base64 = (0, toBase64_1.toBase64)(`${username}:${password}`);
|
|
16
|
+
return this.httpClient.post(`/token`, {
|
|
17
|
+
headers: {
|
|
18
|
+
Authorization: `Basic ${base64}`,
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.ArtifactsTokenApi = ArtifactsTokenApi;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { components } from '../types/api-schema.types';
|
|
2
|
+
import { ArtifactsHttpClient } from '../http-client/artifacts.http-client';
|
|
3
|
+
import { ArtifactsApiParams } from '../types/artifacts-api.types';
|
|
4
|
+
import { ArtifactsMyCharactersApi } from './artifacts-my-characters.api';
|
|
5
|
+
import { ArtifactsCharactersApi } from './artifacts-characters.api';
|
|
6
|
+
import { ArtifactsMyAccountApi } from './artifacts-my-account.api';
|
|
7
|
+
import { ArtifactsMapsApi } from './artifacts-maps.api';
|
|
8
|
+
import { ArtifactsItemsApi } from './artifacts-items.api';
|
|
9
|
+
import { ArtifactsMonstersApi } from './artifacts-monsters.api';
|
|
10
|
+
import { ArtifactsResourcesApi } from './artifacts-resources.api';
|
|
11
|
+
import { ArtifactsEventsApi } from './artifacts-events.api';
|
|
12
|
+
import { ArtifactsGrandExchangeApi } from './artifacts-grand-exchange.api';
|
|
13
|
+
import { ArtifactsAccountsApi } from './artifacts-accounts.api';
|
|
14
|
+
import { ArtifactsTokenApi } from './artifacts-token.api';
|
|
15
|
+
export declare class ArtifactsApi {
|
|
16
|
+
private readonly httpClient;
|
|
17
|
+
readonly myCharacters: ArtifactsMyCharactersApi;
|
|
18
|
+
readonly myAccount: ArtifactsMyAccountApi;
|
|
19
|
+
readonly characters: ArtifactsCharactersApi;
|
|
20
|
+
readonly accounts: ArtifactsAccountsApi;
|
|
21
|
+
readonly maps: ArtifactsMapsApi;
|
|
22
|
+
readonly items: ArtifactsItemsApi;
|
|
23
|
+
readonly monsters: ArtifactsMonstersApi;
|
|
24
|
+
readonly resources: ArtifactsResourcesApi;
|
|
25
|
+
readonly events: ArtifactsEventsApi;
|
|
26
|
+
readonly grandExchange: ArtifactsGrandExchangeApi;
|
|
27
|
+
readonly token: ArtifactsTokenApi;
|
|
28
|
+
protected constructor(httpClient: ArtifactsHttpClient);
|
|
29
|
+
static create(params?: ArtifactsApiParams): ArtifactsApi;
|
|
30
|
+
getStatus(): Promise<components['schemas']['StatusResponseSchema']>;
|
|
31
|
+
setToken(token: string): void;
|
|
32
|
+
}
|