ps99-api 1.0.0 → 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.
Files changed (60) hide show
  1. package/.github/actions/test/action.yml +27 -0
  2. package/.github/workflows/release-on-main.yml +7 -7
  3. package/.github/workflows/test-on-branch.yml +18 -0
  4. package/.idea/jsLibraryMappings.xml +6 -0
  5. package/README.md +1 -0
  6. package/dist/index.d.ts +11 -0
  7. package/dist/index.js +11 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/params/clans.d.ts +8 -0
  10. package/dist/params/clans.js +1 -0
  11. package/dist/params/clans.js.map +1 -0
  12. package/dist/ps99-api.d.ts +26 -0
  13. package/dist/ps99-api.js +1 -0
  14. package/dist/ps99-api.js.map +1 -0
  15. package/dist/request-client/axios.d.ts +3 -0
  16. package/dist/request-client/axios.js +1 -0
  17. package/dist/request-client/axios.js.map +1 -0
  18. package/dist/request-client/common.d.ts +18 -0
  19. package/dist/request-client/common.js +1 -0
  20. package/dist/request-client/common.js.map +1 -0
  21. package/dist/responses/activeClanBattle.d.ts +37 -0
  22. package/dist/responses/activeClanBattle.js +1 -0
  23. package/dist/responses/activeClanBattle.js.map +1 -0
  24. package/dist/responses/clan.d.ts +83 -0
  25. package/dist/responses/clan.js +1 -0
  26. package/dist/responses/clan.js.map +1 -0
  27. package/dist/responses/clans.d.ts +14 -0
  28. package/dist/responses/clans.js +1 -0
  29. package/dist/responses/clans.js.map +1 -0
  30. package/dist/responses/collection.d.ts +1357 -0
  31. package/dist/responses/collection.js +1 -0
  32. package/dist/responses/collection.js.map +1 -0
  33. package/dist/responses/collections.d.ts +5 -0
  34. package/dist/responses/collections.js +1 -0
  35. package/dist/responses/collections.js.map +1 -0
  36. package/dist/responses/exists.d.ts +14 -0
  37. package/dist/responses/exists.js +1 -0
  38. package/dist/responses/exists.js.map +1 -0
  39. package/dist/responses/rap.d.ts +15 -0
  40. package/dist/responses/rap.js +1 -0
  41. package/dist/responses/rap.js.map +1 -0
  42. package/dump-result.js +9 -0
  43. package/package.json +3 -3
  44. package/src/__tests__/__snapshots__/ps99-api-live.ts.snap +98822 -0
  45. package/src/__tests__/ps99-api-changes.ts +36 -0
  46. package/src/__tests__/ps99-api-live.ts +177 -0
  47. package/src/index.ts +10 -0
  48. package/src/ps99-api.ts +3 -4
  49. package/src/responses/activeClanBattle.ts +42 -19
  50. package/src/responses/clan.ts +90 -64
  51. package/src/responses/clans.ts +11 -21
  52. package/src/responses/collection.ts +1543 -1261
  53. package/src/responses/collections.ts +1 -1
  54. package/src/responses/exists.ts +13 -18
  55. package/src/responses/rap.ts +14 -27
  56. package/tsconfig.json +5 -2
  57. package/dist/__tests__/ps99-api.js +0 -150
  58. package/dist/common.js +0 -2
  59. package/src/common.ts +0 -2
  60. package/tsconfig.build.json +0 -10
@@ -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
@@ -16,14 +16,14 @@ jobs:
16
16
  release:
17
17
  runs-on: ubuntu-latest
18
18
  steps:
19
- - uses: actions/checkout@v4
20
- - uses: actions/setup-node@v4
19
+ - name: Checkout
20
+ uses: actions/checkout@v4
21
21
  with:
22
- node-version: 20
23
- - run: npm ci
24
- - run: npm run test
25
- - run: npm run build
26
- - env:
22
+ fetch-depth: 0
23
+ - name: Test
24
+ uses: ./.github/actions/test
25
+ - name: Release
26
+ env:
27
27
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28
28
  NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
29
29
  run: npx semantic-release
@@ -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/)
@@ -0,0 +1,11 @@
1
+ export * from "./ps99-api";
2
+ export * from "./request-client/common";
3
+ export * from "./request-client/axios";
4
+ export * from "./responses/collections";
5
+ export * from "./responses/clan";
6
+ export * from "./responses/clans";
7
+ export * from "./params/clans";
8
+ export * from "./responses/exists";
9
+ export * from "./responses/rap";
10
+ export * from "./responses/activeClanBattle";
11
+ export * from "./responses/collection";
package/dist/index.js CHANGED
@@ -15,3 +15,14 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./ps99-api"), exports);
18
+ __exportStar(require("./request-client/common"), exports);
19
+ __exportStar(require("./request-client/axios"), exports);
20
+ __exportStar(require("./responses/collections"), exports);
21
+ __exportStar(require("./responses/clan"), exports);
22
+ __exportStar(require("./responses/clans"), exports);
23
+ __exportStar(require("./params/clans"), exports);
24
+ __exportStar(require("./responses/exists"), exports);
25
+ __exportStar(require("./responses/rap"), exports);
26
+ __exportStar(require("./responses/activeClanBattle"), exports);
27
+ __exportStar(require("./responses/collection"), exports);
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,8 @@
1
+ export type ClansSort = "DepositedDiamonds" | "Points" | "Created";
2
+ export type SortOrder = "asc" | "desc";
3
+ export type GetClansParams = {
4
+ page?: number;
5
+ pageSize?: number;
6
+ sort?: ClansSort;
7
+ sortOrder?: SortOrder;
8
+ };
@@ -1,2 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=clans.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clans.js","sourceRoot":"","sources":["../../src/params/clans.ts"],"names":[],"mappings":""}
@@ -0,0 +1,26 @@
1
+ /// <reference types="node" />
2
+ import { RequestClient } from "./request-client/common";
3
+ import { CollectionsResponseBody } from "./responses/collections";
4
+ import { Collection, GetCollectionResponse } from "./responses/collection";
5
+ import { ClanResponseBody } from "./responses/clan";
6
+ import { ClansResponseBody } from "./responses/clans";
7
+ import { GetClansParams } from "./params/clans";
8
+ import { ExistsResponseBody } from "./responses/exists";
9
+ import { RAPResponseBody } from "./responses/rap";
10
+ import { ActiveClanBattleResponseBody } from "./responses/activeClanBattle";
11
+ export type PetSimulator99APIOptions = {
12
+ requestClient?: RequestClient;
13
+ };
14
+ export declare class PetSimulator99API {
15
+ requestClient: RequestClient;
16
+ constructor(params?: PetSimulator99APIOptions);
17
+ private request;
18
+ getCollections(): Promise<CollectionsResponseBody>;
19
+ getCollection<C extends Collection>(collection: C): Promise<GetCollectionResponse<C>>;
20
+ getClans(params?: GetClansParams): Promise<ClansResponseBody>;
21
+ getClan(name: string): Promise<ClanResponseBody>;
22
+ getExists(): Promise<ExistsResponseBody>;
23
+ getRAP(): Promise<RAPResponseBody>;
24
+ getActiveClanBattle(): Promise<ActiveClanBattleResponseBody>;
25
+ getImage(rbxassetid: string): Promise<Blob>;
26
+ }
package/dist/ps99-api.js CHANGED
@@ -69,3 +69,4 @@ class PetSimulator99API {
69
69
  }
70
70
  }
71
71
  exports.PetSimulator99API = PetSimulator99API;
72
+ //# sourceMappingURL=ps99-api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ps99-api.js","sourceRoot":"","sources":["../src/ps99-api.ts"],"names":[],"mappings":";;;AACA,kDAAyD;AAazD,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,MAAM;QACpB,gBAAgB,EAAE,MAAM;KACzB;QAED,MAAM,GAAG,MAAM,IAAI,EAAE,CAAC;QACtB,YAAY,GAAG,YAAY,IAAI,MAAM,CAAC;QACtC,gBAAgB,GAAG,gBAAgB,IAAI,MAAM,CAAC;QAC9C,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAI;YAChC,MAAM,EAAE,KAAK;YACb,GAAG,EAAE,yBAAyB,IAAI,EAAE;YACpC,MAAM;YACN,YAAY;YACZ,gBAAgB;SACjB,CAAC,CAAC;IACL,CAAC;IAED,cAAc;QACZ,OAAO,IAAI,CAAC,OAAO,CAA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pD,YAAY,EAAE,aAAa;YAC3B,gBAAgB,EAAE,QAAQ;SAC3B,CAAC,CAAC;IACL,CAAC;CACF;AAxFD,8CAwFC"}
@@ -0,0 +1,3 @@
1
+ import { AxiosInstance } from "axios";
2
+ import { RequestClient } from "./common";
3
+ export declare function getAxiosRequest(instance?: AxiosInstance): RequestClient;
@@ -26,3 +26,4 @@ exports.getAxiosRequest = getAxiosRequest;
26
26
  function isAxiosError(err) {
27
27
  return Object.prototype.hasOwnProperty.call(err, "isAxiosError");
28
28
  }
29
+ //# sourceMappingURL=axios.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"axios.js","sourceRoot":"","sources":["../../src/request-client/axios.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAyD;AAGzD,SAAgB,eAAe,CAAC,QAAwB;IACtD,OAAO;QACL,KAAK,CAAC,IAAI,CAAI,OAAyB;YACrC,IAAI,CAAC;gBACH,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAA,eAAK,EAAC,OAAO,CAAC,CAAC,CAAC;gBAEvE,OAAO,IAAS,CAAC;YACnB,CAAC;YAAC,OAAO,CAAU,EAAE,CAAC;gBACpB,IAAI,YAAY,CAAuB,CAAC,CAAC,EAAE,CAAC;oBAC1C,MAAM,OAAO,GAAW,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,IAAI,CAAC,CAAC,OAAO,CAAC;oBAChE,MAAM,IAAI,KAAK,CAAC,GAAG,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,KAAK,OAAO,EAAE,CAAC,CAAC;gBAClE,CAAC;gBAED,MAAM,CAAC,CAAC;YACV,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAjBD,0CAiBC;AAED,SAAS,YAAY,CACnB,GAAoC;IAEpC,OAAO,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;AACnE,CAAC"}
@@ -0,0 +1,18 @@
1
+ export type ApiRequestParams = {
2
+ method: "GET" | "POST" | "DELETE" | "PATCH";
3
+ url: string;
4
+ params?: {
5
+ [key: string]: any;
6
+ };
7
+ data?: {
8
+ [key: string]: any;
9
+ };
10
+ headers?: {
11
+ [key: string]: any;
12
+ };
13
+ responseType?: "json" | "arraybuffer";
14
+ responseEncoding?: "utf8" | "BINARY";
15
+ };
16
+ export type RequestClient = {
17
+ send<T>(options: ApiRequestParams): Promise<T>;
18
+ };
@@ -1,2 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/request-client/common.ts"],"names":[],"mappings":""}
@@ -0,0 +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
+ };
34
+ export type ActiveClanBattleResponseBody = {
35
+ status: string;
36
+ data: ActiveBattleData;
37
+ };
@@ -1,2 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=activeClanBattle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activeClanBattle.js","sourceRoot":"","sources":["../../src/responses/activeClanBattle.ts"],"names":[],"mappings":""}
@@ -0,0 +1,83 @@
1
+ export type ClanResponseBody = {
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;
83
+ };
@@ -1,2 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=clan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clan.js","sourceRoot":"","sources":["../../src/responses/clan.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
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
+ };
11
+ export type ClansResponseBody = {
12
+ status: string;
13
+ data: ClansData[];
14
+ };
@@ -1,2 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=clans.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clans.js","sourceRoot":"","sources":["../../src/responses/clans.ts"],"names":[],"mappings":""}