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.
@@ -0,0 +1,27 @@
1
+ name: 'Test'
2
+ description: 'Test the library'
3
+ runs:
4
+ using: 'composite'
5
+ steps:
6
+ - name: Checkout
7
+ uses: actions/checkout@v4
8
+ with:
9
+ fetch-depth: 0
10
+ - name: Setup Node.js
11
+ uses: actions/setup-node@v4
12
+ with:
13
+ node-version: "lts/*"
14
+ - name: Install dependencies
15
+ shell: bash
16
+ run: |
17
+ npm install -g npm@latest
18
+ npm ci
19
+ - name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
20
+ shell: bash
21
+ run: npm audit signatures
22
+ - name: Test
23
+ shell: bash
24
+ run: npm run test
25
+ - name: Compile
26
+ shell: bash
27
+ run: npm run build
@@ -20,20 +20,8 @@ jobs:
20
20
  uses: actions/checkout@v4
21
21
  with:
22
22
  fetch-depth: 0
23
- - name: Setup Node.js
24
- uses: actions/setup-node@v4
25
- with:
26
- node-version: "lts/*"
27
- - name: Install dependencies
28
- run: |
29
- npm install -g npm@latest
30
- npm ci
31
- - name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
32
- run: npm audit signatures
33
23
  - name: Test
34
- run: npm run test
35
- - name: Compile
36
- run: npm run build
24
+ uses: ./.github/actions/test
37
25
  - name: Release
38
26
  env:
39
27
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,18 @@
1
+ name: Test on Branch
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ push:
6
+ branches:
7
+ - '!main'
8
+
9
+ jobs:
10
+ release:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - name: Checkout
14
+ uses: actions/checkout@v4
15
+ with:
16
+ fetch-depth: 0
17
+ - name: Test
18
+ uses: ./.github/actions/test
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="JavaScriptLibraryMappings">
4
+ <includedPredefinedLibrary name="Node.js Core" />
5
+ </component>
6
+ </project>
package/README.md CHANGED
@@ -21,5 +21,6 @@ await ps99api.getClan('CAT');
21
21
 
22
22
  ## Links
23
23
 
24
+
24
25
  * [ps99-public-api-docs](https://github.com/BIG-Games-LLC/ps99-public-api-docs)
25
26
  * [Pet Simulator Public API](https://docs.biggamesapi.io/)
package/dist/index.d.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/dist/index.js CHANGED
@@ -18,11 +18,11 @@ __exportStar(require("./ps99-api"), exports);
18
18
  __exportStar(require("./request-client/common"), exports);
19
19
  __exportStar(require("./request-client/axios"), exports);
20
20
  __exportStar(require("./responses/collections"), exports);
21
- __exportStar(require("./common"), exports);
22
21
  __exportStar(require("./responses/clan"), exports);
23
22
  __exportStar(require("./responses/clans"), exports);
24
23
  __exportStar(require("./params/clans"), exports);
25
24
  __exportStar(require("./responses/exists"), exports);
26
25
  __exportStar(require("./responses/rap"), exports);
27
26
  __exportStar(require("./responses/activeClanBattle"), exports);
27
+ __exportStar(require("./responses/collection"), exports);
28
28
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,0DAAwC;AACxC,yDAAuC;AACvC,0DAAwC;AACxC,2CAAyB;AACzB,mDAAiC;AACjC,oDAAkC;AAClC,iDAA+B;AAC/B,qDAAmC;AACnC,kDAAgC;AAChC,+DAA6C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,0DAAwC;AACxC,yDAAuC;AACvC,0DAAwC;AACxC,mDAAiC;AACjC,oDAAkC;AAClC,iDAA+B;AAC/B,qDAAmC;AACnC,kDAAgC;AAChC,+DAA6C;AAC7C,yDAAuC"}
@@ -1,8 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  import { RequestClient } from "./request-client/common";
3
3
  import { CollectionsResponseBody } from "./responses/collections";
4
- import { Collection } from "./common";
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 { GetClansParams } from "./params/clans";
@@ -17,7 +16,7 @@ export declare class PetSimulator99API {
17
16
  constructor(params?: PetSimulator99APIOptions);
18
17
  private request;
19
18
  getCollections(): Promise<CollectionsResponseBody>;
20
- getCollection(collection: Collection): Promise<CollectionResponseBody>;
19
+ getCollection<C extends Collection>(collection: C): Promise<GetCollectionResponse<C>>;
21
20
  getClans(params?: GetClansParams): Promise<ClansResponseBody>;
22
21
  getClan(name: string): Promise<ClanResponseBody>;
23
22
  getExists(): Promise<ExistsResponseBody>;
@@ -1 +1 @@
1
- {"version":3,"file":"ps99-api.js","sourceRoot":"","sources":["../src/ps99-api.ts"],"names":[],"mappings":";;;AACA,kDAAyD;AAczD,MAAa,iBAAiB;IACrB,aAAa,CAAgB;IAEpC,YAAY,MAAiC;QAC3C,IAAI,CAAC,aAAa;YAChB,MAAM,IAAI,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,IAAA,uBAAe,GAAE,CAAC;IAC9E,CAAC;IAEO,OAAO,CACb,IAAY,EACZ,EACE,MAAM,EACN,YAAY,EACZ,gBAAgB,MAKd;QACF,MAAM,EAAE,EAAE;QACV,YAAY,EAAE,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QACD,OAAO,IAAI,CAAC,OAAO,CAAO,cAAc,UAAU,EAAE,EAAE;YACpD,YAAY,EAAE,aAAa;YAC3B,gBAAgB,EAAE,QAAQ;SAC3B,CAAC,CAAC;IACL,CAAC;CACF;AAxFD,8CAwFC"}
@@ -1,32 +1,37 @@
1
+ export type ActiveBattleData = {
2
+ _id: string;
3
+ category: string;
4
+ configData: ActiveBattleConfigData;
5
+ configName: string;
6
+ };
7
+ export type ActiveBattleConfigData = {
8
+ FinishTime: number;
9
+ PlacementRewards: ActiveBattlePlacementReward[];
10
+ Rewards: ActiveBattleRewards;
11
+ StartTime: number;
12
+ Title: string;
13
+ _id: string;
14
+ _script: any;
15
+ };
16
+ export type ActiveBattlePlacementReward = {
17
+ Best: number;
18
+ Item: ActiveBattleItem;
19
+ Worst: number;
20
+ };
21
+ export type ActiveBattleItem = {
22
+ _data: ActiveBattleItemData;
23
+ };
24
+ export type ActiveBattleItemData = {
25
+ id: string;
26
+ pt?: number;
27
+ };
28
+ export type ActiveBattleRewards = {
29
+ Bronze: any[];
30
+ Gold: any[];
31
+ Good: any[];
32
+ Silver: any[];
33
+ };
1
34
  export type ActiveClanBattleResponseBody = {
2
35
  status: string;
3
- data: {
4
- _id: string;
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: {
15
- _data: {
16
- id: string;
17
- };
18
- }[];
19
- Silver: {
20
- _data: {
21
- id: string;
22
- };
23
- }[];
24
- Gold: {
25
- _data: {
26
- id: string;
27
- };
28
- }[];
29
- };
30
- };
31
- };
36
+ data: ActiveBattleData;
32
37
  };
@@ -1,90 +1,83 @@
1
1
  export type ClanResponseBody = {
2
- status: string;
3
- data: {
4
- Created: number;
5
- Owner: number;
6
- Name: string;
7
- Icon: string;
8
- Desc: string;
9
- MemberCapacity: number;
10
- OfficerCapacity: number;
11
- GuildLevel: number;
12
- Members: {
13
- UserID: number;
14
- PermissionLevel: number;
15
- JoinTime: number;
16
- }[];
17
- DepositedDiamonds: number;
18
- DiamondContributions: {
19
- AllTime: {
20
- Sum: number;
21
- Data: {
22
- UserID: number;
23
- Diamonds: number;
24
- }[];
25
- };
26
- };
27
- Status: string;
28
- StatusTimestamp: number;
29
- StatusUsername: string;
30
- Battles: {
31
- Christmas2023: {
32
- ProcessedAwards: boolean;
33
- AwardUserIDs: number[];
34
- BattleID: string;
35
- Points: number;
36
- PointContributions: {
37
- UserID: number;
38
- Points: number;
39
- }[];
40
- EarnedMedal: string;
41
- };
42
- DecemberActiveHugePets: {
43
- ProcessedAwards: boolean;
44
- AwardUserIDs: number[];
45
- BattleID: string;
46
- Points: number;
47
- PointContributions: {
48
- UserID: number;
49
- Points: number;
50
- }[];
51
- EarnedMedal: string;
52
- };
53
- IndexBattle: {
54
- ProcessedAwards: boolean;
55
- AwardUserIDs: number[];
56
- BattleID: string;
57
- Points: number;
58
- PointContributions: {
59
- UserID: number;
60
- Points: number;
61
- }[];
62
- EarnedMedal: string;
63
- };
64
- AchBattle: {
65
- ProcessedAwards: boolean;
66
- AwardUserIDs: number[];
67
- BattleID: string;
68
- Points: number;
69
- PointContributions: {
70
- UserID: number;
71
- Points: number;
72
- }[];
73
- EarnedMedal: string;
74
- };
75
- RaidBattle: {
76
- ProcessedAwards: boolean;
77
- AwardUserIDs: any[];
78
- BattleID: string;
79
- Points: number;
80
- PointContributions: {
81
- UserID: number;
82
- Points: number;
83
- }[];
84
- };
85
- };
86
- CountryCode: string;
87
- BronzeMedals: number;
88
- LastKickTimestamp: number;
89
- };
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
+ export type Battles = {
24
+ [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
+ export type PointContribution = {
36
+ Points: number;
37
+ UserID: number;
38
+ };
39
+ export type GoalBattle = {
40
+ AwardUserIDs: any[];
41
+ BattleID: string;
42
+ EarnedMedal?: string;
43
+ Goals: Goal[];
44
+ Place?: number;
45
+ PointContributions: PointContribution[];
46
+ Points: number;
47
+ ProcessedAwards: boolean;
48
+ };
49
+ export type Goal = {
50
+ Amount: number;
51
+ Contributions: Contributions;
52
+ Progress: number;
53
+ Stars: number;
54
+ Tier: number;
55
+ Type: number;
56
+ };
57
+ export type Contributions = {
58
+ [key: string]: number;
59
+ };
60
+ export type HackerBattle = {
61
+ AwardUserIDs: any[];
62
+ BattleID: string;
63
+ Place: number;
64
+ PointContributions: PointContribution[];
65
+ Points: number;
66
+ ProcessedAwards: boolean;
67
+ };
68
+ export type DiamondContributions = {
69
+ AllTime: AllTime;
70
+ };
71
+ export type AllTime = {
72
+ Data: Daum[];
73
+ Sum: number;
74
+ };
75
+ export type Daum = {
76
+ Diamonds: number;
77
+ UserID: number;
78
+ };
79
+ export type Member = {
80
+ JoinTime: number;
81
+ PermissionLevel: number;
82
+ UserID: number;
90
83
  };
@@ -1,21 +1,14 @@
1
- import { ClanName } from "../common";
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
  export type ClansResponseBody = {
3
12
  status: string;
4
- data: ({
5
- Created: number;
6
- Name: string;
7
- MemberCapacity: number;
8
- DepositedDiamonds: number;
9
- CountryCode: string;
10
- Members: number;
11
- Points: number;
12
- } | {
13
- Created: number;
14
- Name: ClanName;
15
- CountryCode: string;
16
- MemberCapacity: number;
17
- DepositedDiamonds: number;
18
- Members: number;
19
- Points: number;
20
- })[];
13
+ data: ClansData[];
21
14
  };