-
Notifications
You must be signed in to change notification settings - Fork 3
/
test.js
31 lines (25 loc) · 1.11 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const MortalSoftClient = require('./index');
const baseUrl = 'https://api-prod.mortalsoft.online';
const token = 'your_token';
const client = new MortalSoftClient(baseUrl, token);
// Example usage
(async () => {
try {
// Example 1: List Games
const responseGames = await client.listGames();
console.log('List of Games:', responseGames);
// Example 2: Get Balance
const identifier = 'user123'; // Replace 'user123' with the actual user identifier
const responseBalance = await client.getBalance(identifier);
console.log('User Balance:', responseBalance);
// Example 3: Change Balance
const amount = 50.00; // Replace 50.00 with the desired amount
const responseChangeBalance = await client.changeBalance(identifier, amount);
console.log('Balance changed successfully:', responseChangeBalance);
// Example 4: Create Session
const responseCreateSession = await client.createSession(identifier);
console.log('User session created. JWT Token:', responseCreateSession.token);
} catch (error) {
console.error('Error:', error.message);
}
})();