ps99-api 1.0.1 → 1.1.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/.github/actions/test/action.yml +27 -0
- package/.github/workflows/release-on-main.yml +1 -13
- package/.github/workflows/test-on-branch.yml +18 -0
- package/.idea/jsLibraryMappings.xml +6 -0
- package/README.md +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/ps99-api.d.ts +2 -3
- package/dist/ps99-api.js.map +1 -1
- package/dist/responses/activeClanBattle.d.ts +34 -29
- package/dist/responses/clan.d.ts +81 -88
- package/dist/responses/clans.d.ts +11 -18
- package/dist/responses/collection.d.ts +1355 -1240
- package/dist/responses/collections.d.ts +1 -1
- package/dist/responses/exists.d.ts +11 -29
- package/dist/responses/rap.d.ts +12 -36
- package/dump-result.js +9 -0
- package/package.json +1 -1
- package/src/__tests__/__snapshots__/ps99-api-live.ts.snap +98822 -0
- package/src/__tests__/ps99-api-changes.ts +36 -0
- package/src/__tests__/ps99-api-live.ts +177 -0
- package/src/index.ts +1 -1
- package/src/ps99-api.ts +3 -4
- package/src/responses/activeClanBattle.ts +42 -19
- package/src/responses/clan.ts +90 -64
- package/src/responses/clans.ts +11 -21
- package/src/responses/collection.ts +1543 -1261
- package/src/responses/collections.ts +1 -1
- package/src/responses/exists.ts +13 -18
- package/src/responses/rap.ts +14 -27
- package/dist/common.d.ts +0 -2
- package/dist/common.js +0 -3
- package/dist/common.js.map +0 -1
- package/src/common.ts +0 -2
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { expect, test } from "@jest/globals";
|
|
2
|
+
import { PetSimulator99API } from "../ps99-api";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* It's hard to snapshot these because certain values will always be changing but useful for dump-result checks
|
|
7
|
+
*/
|
|
8
|
+
describe.skip("Pet Simulator Public Live API Test - Changing Items", () => {
|
|
9
|
+
const api = new PetSimulator99API();
|
|
10
|
+
|
|
11
|
+
test('Active Clan Battle', async () => {
|
|
12
|
+
const results = await api.getActiveClanBattle();
|
|
13
|
+
expect(results).toMatchSnapshot();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
test('Get Clan', async () => {
|
|
17
|
+
const results = await api.getClan('MMFC');
|
|
18
|
+
expect(results).toMatchSnapshot();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test('Get Clans', async () => {
|
|
22
|
+
const results = await api.getClans({pageSize: 1});
|
|
23
|
+
expect(results).toMatchSnapshot();
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
test('Get Exists', async () => {
|
|
27
|
+
const results = await api.getExists();
|
|
28
|
+
expect(results).toMatchSnapshot();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test('Get RAP', async () => {
|
|
32
|
+
const results = await api.getRAP();
|
|
33
|
+
expect(results).toMatchSnapshot();
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
});
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { expect, test } from "@jest/globals";
|
|
2
|
+
import { PetSimulator99API } from "../ps99-api";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
describe("Pet Simulator Public Live API Test", () => {
|
|
6
|
+
const api = new PetSimulator99API();
|
|
7
|
+
|
|
8
|
+
test('Collections Have Not Changed', async () => {
|
|
9
|
+
const results = await api.getCollections();
|
|
10
|
+
expect(results).toMatchSnapshot();
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
test("Achievements shape", async () => {
|
|
14
|
+
const results = await api.getCollection('Achievements');
|
|
15
|
+
expect(results).toMatchSnapshot();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
test("Boosts shape", async () => {
|
|
19
|
+
const results = await api.getCollection('Boosts');
|
|
20
|
+
expect(results).toMatchSnapshot();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
test("Booths shape", async () => {
|
|
24
|
+
const results = await api.getCollection('Booths');
|
|
25
|
+
expect(results).toMatchSnapshot();
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
test("Boxes shape", async () => {
|
|
29
|
+
const results = await api.getCollection('Boxes');
|
|
30
|
+
expect(results).toMatchSnapshot();
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
test("Buffs shape", async () => {
|
|
34
|
+
const results = await api.getCollection('Buffs');
|
|
35
|
+
expect(results).toMatchSnapshot();
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test("Charms shape", async () => {
|
|
39
|
+
const results = await api.getCollection('Charms');
|
|
40
|
+
expect(results).toMatchSnapshot();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test("Currency shape", async () => {
|
|
44
|
+
const results = await api.getCollection('Currency');
|
|
45
|
+
expect(results).toMatchSnapshot();
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test("Eggs shape", async () => {
|
|
49
|
+
const results = await api.getCollection('Eggs');
|
|
50
|
+
expect(results).toMatchSnapshot();
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
test("Enchants shape", async () => {
|
|
54
|
+
const results = await api.getCollection('Enchants');
|
|
55
|
+
expect(results).toMatchSnapshot();
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
test("FishingRods shape", async () => {
|
|
59
|
+
const results = await api.getCollection('FishingRods');
|
|
60
|
+
expect(results).toMatchSnapshot();
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
test("Fruits shape", async () => {
|
|
64
|
+
const results = await api.getCollection('Fruits');
|
|
65
|
+
expect(results).toMatchSnapshot();
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test("GuildBattles shape", async () => {
|
|
69
|
+
const results = await api.getCollection('GuildBattles');
|
|
70
|
+
expect(results).toMatchSnapshot();
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
test("Hoverboards shape", async () => {
|
|
74
|
+
const results = await api.getCollection('Hoverboards');
|
|
75
|
+
expect(results).toMatchSnapshot();
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
test("Lootboxes shape", async () => {
|
|
79
|
+
const results = await api.getCollection('Lootboxes');
|
|
80
|
+
expect(results).toMatchSnapshot();
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
test("Mastery shape", async () => {
|
|
84
|
+
const results = await api.getCollection('Mastery');
|
|
85
|
+
expect(results).toMatchSnapshot();
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
test("MiscItems shape", async () => {
|
|
89
|
+
const results = await api.getCollection('MiscItems');
|
|
90
|
+
expect(results).toMatchSnapshot();
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
test("Pets shape", async () => {
|
|
94
|
+
const results = await api.getCollection('Pets');
|
|
95
|
+
expect(results).toMatchSnapshot();
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
test("Potions shape", async () => {
|
|
99
|
+
const results = await api.getCollection('Potions');
|
|
100
|
+
expect(results).toMatchSnapshot();
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
test("RandomEvents shape", async () => {
|
|
104
|
+
const results = await api.getCollection('RandomEvents');
|
|
105
|
+
expect(results).toMatchSnapshot();
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
test("Ranks shape", async () => {
|
|
109
|
+
const results = await api.getCollection('Ranks');
|
|
110
|
+
expect(results).toMatchSnapshot();
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
test("Rarity shape", async () => {
|
|
114
|
+
const results = await api.getCollection('Rarity');
|
|
115
|
+
expect(results).toMatchSnapshot();
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
test("Rebirths shape", async () => {
|
|
119
|
+
const results = await api.getCollection('Rebirths');
|
|
120
|
+
expect(results).toMatchSnapshot();
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
test("SecretRooms shape", async () => {
|
|
124
|
+
const results = await api.getCollection('SecretRooms');
|
|
125
|
+
expect(results).toMatchSnapshot();
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
test("Seeds shape", async () => {
|
|
129
|
+
const results = await api.getCollection('Seeds');
|
|
130
|
+
expect(results).toMatchSnapshot();
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
test("Shovels shape", async () => {
|
|
134
|
+
const results = await api.getCollection('Shovels');
|
|
135
|
+
expect(results).toMatchSnapshot();
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
test("Sprinklers shape", async () => {
|
|
139
|
+
const results = await api.getCollection('Sprinklers');
|
|
140
|
+
expect(results).toMatchSnapshot();
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
test("Ultimates shape", async () => {
|
|
144
|
+
const results = await api.getCollection('Ultimates');
|
|
145
|
+
expect(results).toMatchSnapshot();
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
test("Upgrades shape", async () => {
|
|
149
|
+
const results = await api.getCollection('Upgrades');
|
|
150
|
+
expect(results).toMatchSnapshot();
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
test("WateringCans shape", async () => {
|
|
154
|
+
const results = await api.getCollection('WateringCans');
|
|
155
|
+
expect(results).toMatchSnapshot();
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
test("Worlds shape", async () => {
|
|
159
|
+
const results = await api.getCollection('Worlds');
|
|
160
|
+
expect(results).toMatchSnapshot();
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
test("ZoneFlags shape", async () => {
|
|
164
|
+
const results = await api.getCollection('ZoneFlags');
|
|
165
|
+
expect(results).toMatchSnapshot();
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
test("Zones shape", async () => {
|
|
169
|
+
const results = await api.getCollection('Zones');
|
|
170
|
+
expect(results).toMatchSnapshot();
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
test("Merchants shape", async () => {
|
|
174
|
+
const results = await api.getCollection('Merchants');
|
|
175
|
+
expect(results).toMatchSnapshot();
|
|
176
|
+
});
|
|
177
|
+
});
|
package/src/index.ts
CHANGED
|
@@ -2,10 +2,10 @@ export * from "./ps99-api";
|
|
|
2
2
|
export * from "./request-client/common";
|
|
3
3
|
export * from "./request-client/axios";
|
|
4
4
|
export * from "./responses/collections";
|
|
5
|
-
export * from "./common";
|
|
6
5
|
export * from "./responses/clan";
|
|
7
6
|
export * from "./responses/clans";
|
|
8
7
|
export * from "./params/clans";
|
|
9
8
|
export * from "./responses/exists";
|
|
10
9
|
export * from "./responses/rap";
|
|
11
10
|
export * from "./responses/activeClanBattle";
|
|
11
|
+
export * from "./responses/collection";
|
package/src/ps99-api.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { ApiRequestParams, RequestClient } from "./request-client/common";
|
|
2
2
|
import { getAxiosRequest } from "./request-client/axios";
|
|
3
3
|
import { CollectionsResponseBody } from "./responses/collections";
|
|
4
|
-
import {
|
|
5
|
-
import { CollectionResponseBody } from "./responses/collection";
|
|
4
|
+
import {Collection, GetCollectionResponse} from "./responses/collection";
|
|
6
5
|
import { ClanResponseBody } from "./responses/clan";
|
|
7
6
|
import { ClansResponseBody } from "./responses/clans";
|
|
8
7
|
import { ClansSort, GetClansParams, SortOrder } from "./params/clans";
|
|
@@ -53,8 +52,8 @@ export class PetSimulator99API {
|
|
|
53
52
|
return this.request<CollectionsResponseBody>("/api/collections");
|
|
54
53
|
}
|
|
55
54
|
|
|
56
|
-
getCollection(collection:
|
|
57
|
-
return this.request<
|
|
55
|
+
getCollection<C extends Collection>(collection: C) {
|
|
56
|
+
return this.request<GetCollectionResponse<C>>(
|
|
58
57
|
`/api/collection/${collection}`,
|
|
59
58
|
);
|
|
60
59
|
}
|
|
@@ -1,20 +1,43 @@
|
|
|
1
|
+
export type ActiveBattleData = {
|
|
2
|
+
_id: string
|
|
3
|
+
category: string
|
|
4
|
+
configData: ActiveBattleConfigData
|
|
5
|
+
configName: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type ActiveBattleConfigData = {
|
|
9
|
+
FinishTime: number
|
|
10
|
+
PlacementRewards: ActiveBattlePlacementReward[]
|
|
11
|
+
Rewards: ActiveBattleRewards
|
|
12
|
+
StartTime: number
|
|
13
|
+
Title: string
|
|
14
|
+
_id: string
|
|
15
|
+
_script: any
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type ActiveBattlePlacementReward = {
|
|
19
|
+
Best: number
|
|
20
|
+
Item: ActiveBattleItem
|
|
21
|
+
Worst: number
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type ActiveBattleItem = {
|
|
25
|
+
_data: ActiveBattleItemData
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export type ActiveBattleItemData = {
|
|
29
|
+
id: string
|
|
30
|
+
pt?: number
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export type ActiveBattleRewards = {
|
|
34
|
+
Bronze: any[]
|
|
35
|
+
Gold: any[]
|
|
36
|
+
Good: any[]
|
|
37
|
+
Silver: any[]
|
|
38
|
+
}
|
|
39
|
+
|
|
1
40
|
export type ActiveClanBattleResponseBody = {
|
|
2
|
-
status: string
|
|
3
|
-
data:
|
|
4
|
-
|
|
5
|
-
configName: string;
|
|
6
|
-
category: string;
|
|
7
|
-
configData: {
|
|
8
|
-
_script: {};
|
|
9
|
-
FinishTime: number;
|
|
10
|
-
Title: string;
|
|
11
|
-
_id: string;
|
|
12
|
-
StartTime: number;
|
|
13
|
-
Rewards: {
|
|
14
|
-
Bronze: { _data: { id: string } }[];
|
|
15
|
-
Silver: { _data: { id: string } }[];
|
|
16
|
-
Gold: { _data: { id: string } }[];
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
};
|
|
41
|
+
status: string
|
|
42
|
+
data: ActiveBattleData
|
|
43
|
+
}
|
package/src/responses/clan.ts
CHANGED
|
@@ -1,65 +1,91 @@
|
|
|
1
1
|
export type ClanResponseBody = {
|
|
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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
2
|
+
Battles: Battles
|
|
3
|
+
BronzeMedals: number
|
|
4
|
+
CountryCode: string
|
|
5
|
+
Created: number
|
|
6
|
+
DepositedDiamonds: number
|
|
7
|
+
Desc: string
|
|
8
|
+
DiamondContributions: DiamondContributions
|
|
9
|
+
GoodMedals: number
|
|
10
|
+
GuildLevel: number
|
|
11
|
+
Icon: string
|
|
12
|
+
LastKickTimestamp: number
|
|
13
|
+
MemberCapacity: number
|
|
14
|
+
Members: Member[]
|
|
15
|
+
Name: string
|
|
16
|
+
OfficerCapacity: number
|
|
17
|
+
Owner: number
|
|
18
|
+
SilverMedals: number
|
|
19
|
+
Status: string
|
|
20
|
+
StatusTimestamp: number
|
|
21
|
+
StatusUsername: string
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type Battles = {[key: string]: PointsBattle | GoalBattle}
|
|
25
|
+
|
|
26
|
+
export type PointsBattle = {
|
|
27
|
+
AwardUserIDs: number[]
|
|
28
|
+
BattleID: string
|
|
29
|
+
EarnedMedal?: string
|
|
30
|
+
Place?: number
|
|
31
|
+
PointContributions: PointContribution[]
|
|
32
|
+
Points: number
|
|
33
|
+
ProcessedAwards: boolean
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type PointContribution = {
|
|
37
|
+
Points: number
|
|
38
|
+
UserID: number
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export type GoalBattle = {
|
|
42
|
+
AwardUserIDs: any[]
|
|
43
|
+
BattleID: string
|
|
44
|
+
EarnedMedal?: string
|
|
45
|
+
Goals: Goal[]
|
|
46
|
+
Place?: number
|
|
47
|
+
PointContributions: PointContribution[]
|
|
48
|
+
Points: number
|
|
49
|
+
ProcessedAwards: boolean
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export type Goal = {
|
|
53
|
+
Amount: number
|
|
54
|
+
Contributions: Contributions
|
|
55
|
+
Progress: number
|
|
56
|
+
Stars: number
|
|
57
|
+
Tier: number
|
|
58
|
+
Type: number
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export type Contributions = {[key: string]: number}
|
|
62
|
+
|
|
63
|
+
export type HackerBattle = {
|
|
64
|
+
AwardUserIDs: any[]
|
|
65
|
+
BattleID: string
|
|
66
|
+
Place: number
|
|
67
|
+
PointContributions: PointContribution[]
|
|
68
|
+
Points: number
|
|
69
|
+
ProcessedAwards: boolean
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
export type DiamondContributions = {
|
|
74
|
+
AllTime: AllTime
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export type AllTime = {
|
|
78
|
+
Data: Daum[]
|
|
79
|
+
Sum: number
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export type Daum = {
|
|
83
|
+
Diamonds: number
|
|
84
|
+
UserID: number
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export type Member = {
|
|
88
|
+
JoinTime: number
|
|
89
|
+
PermissionLevel: number
|
|
90
|
+
UserID: number
|
|
91
|
+
}
|
package/src/responses/clans.ts
CHANGED
|
@@ -1,25 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
export type ClansData = {
|
|
2
|
+
CountryCode: string
|
|
3
|
+
Created: number
|
|
4
|
+
DepositedDiamonds: number
|
|
5
|
+
Icon: string
|
|
6
|
+
MemberCapacity: number
|
|
7
|
+
Members: number
|
|
8
|
+
Name: string
|
|
9
|
+
Points: number
|
|
10
|
+
}
|
|
2
11
|
|
|
3
12
|
export type ClansResponseBody = {
|
|
4
13
|
status: string;
|
|
5
|
-
data:
|
|
6
|
-
| {
|
|
7
|
-
Created: number;
|
|
8
|
-
Name: string;
|
|
9
|
-
MemberCapacity: number;
|
|
10
|
-
DepositedDiamonds: number;
|
|
11
|
-
CountryCode: string;
|
|
12
|
-
Members: number;
|
|
13
|
-
Points: number;
|
|
14
|
-
}
|
|
15
|
-
| {
|
|
16
|
-
Created: number;
|
|
17
|
-
Name: ClanName;
|
|
18
|
-
CountryCode: string;
|
|
19
|
-
MemberCapacity: number;
|
|
20
|
-
DepositedDiamonds: number;
|
|
21
|
-
Members: number;
|
|
22
|
-
Points: number;
|
|
23
|
-
}
|
|
24
|
-
)[];
|
|
14
|
+
data: ClansData[];
|
|
25
15
|
};
|