speedruncom.js 1.2.2 → 1.2.4

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.
@@ -1,8 +1,12 @@
1
1
  import { AxiosInstance } from 'axios';
2
- interface config {
2
+ export interface config {
3
3
  PHPSESSID?: string;
4
4
  userAgent?: string;
5
5
  }
6
+ export declare class APIError extends Error {
7
+ status: number;
8
+ constructor(message: string, status: number);
9
+ }
6
10
  export default class Client {
7
11
  /**
8
12
  * `AxiosInstance` used on instance-called methods (called with `POST`).
@@ -19,19 +23,8 @@ export default class Client {
19
23
  config(config: config): void;
20
24
  request<T>(endpoint: string, params?: object): Promise<T>;
21
25
  static request<T>(endpoint: string, params?: object): Promise<T>;
22
- /**
23
- * Attempts to authorize your cookies if using a browser, or authorizes this Client if otherwise.
24
- * If the account has two factor authentication, you have to use `setToken` with the token sent to the account's email address.
25
- */
26
- login(username: string, password: string): Promise<unknown>;
27
- /**
28
- * Attempts to authorize your cookies if using a browser, or authorizes this Client if otherwise, with the token that `login()` sent to the account's email address.
29
- * @param token The 5-digit code sent to your email after a successful `login()`.
30
- */
31
- setToken(token: string): Promise<unknown>;
32
26
  /**
33
27
  * Attempts to remove the PHPSESSID cookie if using a browser, otherwise removes your Client's authentication.
34
28
  */
35
29
  logout(): Promise<unknown>;
36
30
  }
37
- export {};
@@ -10,7 +10,7 @@ const objectToBase64 = (obj) => {
10
10
  const jsonString = JSON.stringify(obj).replace(/\s+/g, '');
11
11
  return Buffer.from(jsonString).toString('base64');
12
12
  };
13
- class APIError extends Error {
13
+ export class APIError extends Error {
14
14
  constructor(message, status) {
15
15
  super(message);
16
16
  this.message = message;
@@ -58,30 +58,6 @@ class Client {
58
58
  static async request(endpoint, params = {}) {
59
59
  return (await this.axiosClient.get(`${endpoint}?_r=${objectToBase64(params)}`)).data;
60
60
  }
61
- //Built-in endpoints for auth
62
- /**
63
- * Attempts to authorize your cookies if using a browser, or authorizes this Client if otherwise.
64
- * If the account has two factor authentication, you have to use `setToken` with the token sent to the account's email address.
65
- */
66
- async login(username, password) {
67
- this.username = username;
68
- this.password = password;
69
- return await this.request('PutAuthLogin', {
70
- name: username,
71
- password
72
- });
73
- }
74
- /**
75
- * Attempts to authorize your cookies if using a browser, or authorizes this Client if otherwise, with the token that `login()` sent to the account's email address.
76
- * @param token The 5-digit code sent to your email after a successful `login()`.
77
- */
78
- async setToken(token) {
79
- return await this.request('PutAuthLogin', {
80
- name: this.username,
81
- password: this.password,
82
- token
83
- });
84
- }
85
61
  /**
86
62
  * Attempts to remove the PHPSESSID cookie if using a browser, otherwise removes your Client's authentication.
87
63
  */
package/dist/Client.d.ts CHANGED
@@ -2,10 +2,14 @@ import { AxiosInstance } from 'axios';
2
2
  import * as GetEndpoints from './endpoints/endpoints.get.js';
3
3
  import * as PostEndpoints from './endpoints/endpoints.post.js';
4
4
  import * as Responses from './responses.js';
5
- interface config {
5
+ export interface config {
6
6
  PHPSESSID?: string;
7
7
  userAgent?: string;
8
8
  }
9
+ export declare class APIError extends Error {
10
+ status: number;
11
+ constructor(message: string, status: number);
12
+ }
9
13
  export default class Client {
10
14
  /**
11
15
  * `AxiosInstance` used on instance-called methods (called with `POST`).
@@ -22,206 +26,195 @@ export default class Client {
22
26
  config(config: config): void;
23
27
  request<T>(endpoint: string, params?: object): Promise<T>;
24
28
  static request<T>(endpoint: string, params?: object): Promise<T>;
25
- /**
26
- * Attempts to authorize your cookies if using a browser, or authorizes this Client if otherwise.
27
- * If the account has two factor authentication, you have to use `setToken` with the token sent to the account's email address.
28
- */
29
- login(username: string, password: string): Promise<unknown>;
30
- /**
31
- * Attempts to authorize your cookies if using a browser, or authorizes this Client if otherwise, with the token that `login()` sent to the account's email address.
32
- * @param token The 5-digit code sent to your email after a successful `login()`.
33
- */
34
- setToken(token: string): Promise<unknown>;
35
29
  /**
36
30
  * Attempts to remove the PHPSESSID cookie if using a browser, otherwise removes your Client's authentication.
37
31
  */
38
32
  logout(): Promise<unknown>;
39
- GetGameLeaderboard2(params?: GetEndpoints.GetGameLeaderboard2): Promise<Readonly<Responses.GetGameLeaderboard2>>;
40
- static GetGameLeaderboard2(params?: GetEndpoints.GetGameLeaderboard2): Promise<Readonly<Responses.GetGameLeaderboard2>>;
41
- GetGameLeaderboard(params?: GetEndpoints.GetGameLeaderboard): Promise<Readonly<Responses.GetGameLeaderboard>>;
42
- static GetGameLeaderboard(params?: GetEndpoints.GetGameLeaderboard): Promise<Readonly<Responses.GetGameLeaderboard>>;
43
- GetGameData(params: GetEndpoints.GetGameData): Promise<Readonly<Responses.GetGameData>>;
44
- static GetGameData(params: GetEndpoints.GetGameData): Promise<Readonly<Responses.GetGameData>>;
45
- GetGameSummary(params: GetEndpoints.GetGameSummary): Promise<Readonly<Responses.GetGameSummary>>;
46
- static GetGameSummary(params: GetEndpoints.GetGameSummary): Promise<Readonly<Responses.GetGameSummary>>;
47
- GetGameRecordHistory(params: GetEndpoints.GetGameRecordHistory): Promise<Readonly<Responses.GetGameRecordHistory>>;
48
- static GetGameRecordHistory(params: GetEndpoints.GetGameRecordHistory): Promise<Readonly<Responses.GetGameRecordHistory>>;
49
- GetSearch(params: GetEndpoints.GetSearch): Promise<Readonly<Responses.GetSearch>>;
50
- static GetSearch(params: GetEndpoints.GetSearch): Promise<Readonly<Responses.GetSearch>>;
51
- GetLatestLeaderboard(params: GetEndpoints.GetLatestLeaderboard): Promise<Readonly<Responses.GetLatestLeaderboard>>;
52
- static GetLatestLeaderboard(params: GetEndpoints.GetLatestLeaderboard): Promise<Readonly<Responses.GetLatestLeaderboard>>;
53
- GetRun(params?: GetEndpoints.GetRun): Promise<Readonly<Responses.GetRun>>;
54
- static GetRun(params?: GetEndpoints.GetRun): Promise<Readonly<Responses.GetRun>>;
55
- GetUserSummary(params?: GetEndpoints.GetUserSummary): Promise<Readonly<Responses.GetUserSummary>>;
56
- static GetUserSummary(params?: GetEndpoints.GetUserSummary): Promise<Readonly<Responses.GetUserSummary>>;
57
- GetUserComments(params?: GetEndpoints.GetUserComments): Promise<Readonly<Responses.GetUserComments>>;
58
- static GetUserComments(params?: GetEndpoints.GetUserComments): Promise<Readonly<Responses.GetUserComments>>;
59
- GetUserThreads(params?: GetEndpoints.GetUserThreads): Promise<Readonly<Responses.GetUserThreads>>;
60
- static GetUserThreads(params?: GetEndpoints.GetUserThreads): Promise<Readonly<Responses.GetUserThreads>>;
61
- GetUserPopoverData(params?: GetEndpoints.GetUserPopoverData): Promise<Readonly<Responses.GetUserPopoverData>>;
62
- static GetUserPopoverData(params?: GetEndpoints.GetUserPopoverData): Promise<Readonly<Responses.GetUserPopoverData>>;
33
+ GetGameLeaderboard2(params: GetEndpoints.GetGameLeaderboard2): Promise<Readonly<Responses.GetGameLeaderboard2>>;
34
+ static GetGameLeaderboard2(params: GetEndpoints.GetGameLeaderboard2): Promise<Readonly<Responses.GetGameLeaderboard2>>;
35
+ GetGameLeaderboard(params: GetEndpoints.GetGameLeaderboard): Promise<Readonly<Responses.GetGameLeaderboard>>;
36
+ static GetGameLeaderboard(params: GetEndpoints.GetGameLeaderboard): Promise<Readonly<Responses.GetGameLeaderboard>>;
37
+ GetGameData(params?: GetEndpoints.GetGameData): Promise<Readonly<Responses.GetGameData>>;
38
+ static GetGameData(params?: GetEndpoints.GetGameData): Promise<Readonly<Responses.GetGameData>>;
39
+ GetGameSummary(params?: GetEndpoints.GetGameSummary): Promise<Readonly<Responses.GetGameSummary>>;
40
+ static GetGameSummary(params?: GetEndpoints.GetGameSummary): Promise<Readonly<Responses.GetGameSummary>>;
41
+ GetGameRecordHistory(params?: GetEndpoints.GetGameRecordHistory): Promise<Readonly<Responses.GetGameRecordHistory>>;
42
+ static GetGameRecordHistory(params?: GetEndpoints.GetGameRecordHistory): Promise<Readonly<Responses.GetGameRecordHistory>>;
43
+ GetSearch(params?: GetEndpoints.GetSearch): Promise<Readonly<Responses.GetSearch>>;
44
+ static GetSearch(params?: GetEndpoints.GetSearch): Promise<Readonly<Responses.GetSearch>>;
45
+ GetLatestLeaderboard(params?: GetEndpoints.GetLatestLeaderboard): Promise<Readonly<Responses.GetLatestLeaderboard>>;
46
+ static GetLatestLeaderboard(params?: GetEndpoints.GetLatestLeaderboard): Promise<Readonly<Responses.GetLatestLeaderboard>>;
47
+ GetRun(params: GetEndpoints.GetRun): Promise<Readonly<Responses.GetRun>>;
48
+ static GetRun(params: GetEndpoints.GetRun): Promise<Readonly<Responses.GetRun>>;
49
+ GetUserSummary(params: GetEndpoints.GetUserSummary): Promise<Readonly<Responses.GetUserSummary>>;
50
+ static GetUserSummary(params: GetEndpoints.GetUserSummary): Promise<Readonly<Responses.GetUserSummary>>;
51
+ GetUserComments(params: GetEndpoints.GetUserComments): Promise<Readonly<Responses.GetUserComments>>;
52
+ static GetUserComments(params: GetEndpoints.GetUserComments): Promise<Readonly<Responses.GetUserComments>>;
53
+ GetUserThreads(params: GetEndpoints.GetUserThreads): Promise<Readonly<Responses.GetUserThreads>>;
54
+ static GetUserThreads(params: GetEndpoints.GetUserThreads): Promise<Readonly<Responses.GetUserThreads>>;
55
+ GetUserPopoverData(params: GetEndpoints.GetUserPopoverData): Promise<Readonly<Responses.GetUserPopoverData>>;
56
+ static GetUserPopoverData(params: GetEndpoints.GetUserPopoverData): Promise<Readonly<Responses.GetUserPopoverData>>;
63
57
  GetTitleList(): Promise<Readonly<Responses.GetTitleList>>;
64
58
  static GetTitleList(): Promise<Readonly<Responses.GetTitleList>>;
65
- GetTitle(params?: GetEndpoints.GetTitle): Promise<Readonly<Responses.GetTitle>>;
66
- static GetTitle(params?: GetEndpoints.GetTitle): Promise<Readonly<Responses.GetTitle>>;
67
- GetArticleList(params: GetEndpoints.GetArticleList): Promise<Readonly<Responses.GetArticleList>>;
68
- static GetArticleList(params: GetEndpoints.GetArticleList): Promise<Readonly<Responses.GetArticleList>>;
69
- GetArticle(params: GetEndpoints.GetArticle): Promise<Readonly<Responses.GetArticle>>;
70
- static GetArticle(params: GetEndpoints.GetArticle): Promise<Readonly<Responses.GetArticle>>;
71
- GetGameList(params: GetEndpoints.GetGameList): Promise<Readonly<Responses.GetGameList>>;
72
- static GetGameList(params: GetEndpoints.GetGameList): Promise<Readonly<Responses.GetGameList>>;
59
+ GetTitle(params: GetEndpoints.GetTitle): Promise<Readonly<Responses.GetTitle>>;
60
+ static GetTitle(params: GetEndpoints.GetTitle): Promise<Readonly<Responses.GetTitle>>;
61
+ GetArticleList(params?: GetEndpoints.GetArticleList): Promise<Readonly<Responses.GetArticleList>>;
62
+ static GetArticleList(params?: GetEndpoints.GetArticleList): Promise<Readonly<Responses.GetArticleList>>;
63
+ GetArticle(params?: GetEndpoints.GetArticle): Promise<Readonly<Responses.GetArticle>>;
64
+ static GetArticle(params?: GetEndpoints.GetArticle): Promise<Readonly<Responses.GetArticle>>;
65
+ GetGameList(params?: GetEndpoints.GetGameList): Promise<Readonly<Responses.GetGameList>>;
66
+ static GetGameList(params?: GetEndpoints.GetGameList): Promise<Readonly<Responses.GetGameList>>;
73
67
  GetPlatformList(): Promise<Readonly<Responses.GetPlatformList>>;
74
68
  static GetPlatformList(): Promise<Readonly<Responses.GetPlatformList>>;
75
69
  GetHomeSummary(): Promise<Readonly<Responses.GetHomeSummary>>;
76
70
  static GetHomeSummary(): Promise<Readonly<Responses.GetHomeSummary>>;
77
- GetSeriesList(params: GetEndpoints.GetSeriesList): Promise<Readonly<Responses.GetSeriesList>>;
78
- static GetSeriesList(params: GetEndpoints.GetSeriesList): Promise<Readonly<Responses.GetSeriesList>>;
79
- GetSeriesSummary(params?: GetEndpoints.GetSeriesSummary): Promise<Readonly<Responses.GetSeriesSummary>>;
80
- static GetSeriesSummary(params?: GetEndpoints.GetSeriesSummary): Promise<Readonly<Responses.GetSeriesSummary>>;
81
- GetGameLevelSummary(params: GetEndpoints.GetGameLevelSummary): Promise<Readonly<Responses.GetGameLevelSummary>>;
82
- static GetGameLevelSummary(params: GetEndpoints.GetGameLevelSummary): Promise<Readonly<Responses.GetGameLevelSummary>>;
71
+ GetSeriesList(params?: GetEndpoints.GetSeriesList): Promise<Readonly<Responses.GetSeriesList>>;
72
+ static GetSeriesList(params?: GetEndpoints.GetSeriesList): Promise<Readonly<Responses.GetSeriesList>>;
73
+ GetSeriesSummary(params: GetEndpoints.GetSeriesSummary): Promise<Readonly<Responses.GetSeriesSummary>>;
74
+ static GetSeriesSummary(params: GetEndpoints.GetSeriesSummary): Promise<Readonly<Responses.GetSeriesSummary>>;
75
+ GetGameLevelSummary(params?: GetEndpoints.GetGameLevelSummary): Promise<Readonly<Responses.GetGameLevelSummary>>;
76
+ static GetGameLevelSummary(params?: GetEndpoints.GetGameLevelSummary): Promise<Readonly<Responses.GetGameLevelSummary>>;
83
77
  GetGameRandom(): Promise<Readonly<Responses.GetGameRandom>>;
84
78
  static GetGameRandom(): Promise<Readonly<Responses.GetGameRandom>>;
85
- GetGuideList(params?: GetEndpoints.GetGuideList): Promise<Readonly<Responses.GetGuideList>>;
86
- static GetGuideList(params?: GetEndpoints.GetGuideList): Promise<Readonly<Responses.GetGuideList>>;
87
- GetGuide(params?: GetEndpoints.GetGuide): Promise<Readonly<Responses.GetGuide>>;
88
- static GetGuide(params?: GetEndpoints.GetGuide): Promise<Readonly<Responses.GetGuide>>;
89
- GetNewsList(params?: GetEndpoints.GetNewsList): Promise<Readonly<Responses.GetNewsList>>;
90
- static GetNewsList(params?: GetEndpoints.GetNewsList): Promise<Readonly<Responses.GetNewsList>>;
91
- GetNews(params?: GetEndpoints.GetNews): Promise<Readonly<Responses.GetNews>>;
92
- static GetNews(params?: GetEndpoints.GetNews): Promise<Readonly<Responses.GetNews>>;
93
- GetResourceList(params?: GetEndpoints.GetResourceList): Promise<Readonly<Responses.GetResourceList>>;
94
- static GetResourceList(params?: GetEndpoints.GetResourceList): Promise<Readonly<Responses.GetResourceList>>;
95
- GetStreamList(params: GetEndpoints.GetStreamList): Promise<Readonly<Responses.GetStreamList>>;
96
- static GetStreamList(params: GetEndpoints.GetStreamList): Promise<Readonly<Responses.GetStreamList>>;
97
- GetThreadList(params?: GetEndpoints.GetThreadList): Promise<Readonly<Responses.GetThreadList>>;
98
- static GetThreadList(params?: GetEndpoints.GetThreadList): Promise<Readonly<Responses.GetThreadList>>;
99
- GetThreadStateByCommentId(params?: GetEndpoints.GetThreadStateByCommentId): Promise<Readonly<Responses.GetThreadStateByCommentId>>;
100
- static GetThreadStateByCommentId(params?: GetEndpoints.GetThreadStateByCommentId): Promise<Readonly<Responses.GetThreadStateByCommentId>>;
101
- GetChallenge(params?: GetEndpoints.GetChallenge): Promise<Readonly<Responses.GetChallenge>>;
102
- static GetChallenge(params?: GetEndpoints.GetChallenge): Promise<Readonly<Responses.GetChallenge>>;
103
- GetChallengeLeaderboard(params?: GetEndpoints.GetChallengeLeaderboard): Promise<Readonly<Responses.GetChallengeLeaderboard>>;
104
- static GetChallengeLeaderboard(params?: GetEndpoints.GetChallengeLeaderboard): Promise<Readonly<Responses.GetChallengeLeaderboard>>;
79
+ GetGuideList(params: GetEndpoints.GetGuideList): Promise<Readonly<Responses.GetGuideList>>;
80
+ static GetGuideList(params: GetEndpoints.GetGuideList): Promise<Readonly<Responses.GetGuideList>>;
81
+ GetGuide(params: GetEndpoints.GetGuide): Promise<Readonly<Responses.GetGuide>>;
82
+ static GetGuide(params: GetEndpoints.GetGuide): Promise<Readonly<Responses.GetGuide>>;
83
+ GetNewsList(params: GetEndpoints.GetNewsList): Promise<Readonly<Responses.GetNewsList>>;
84
+ static GetNewsList(params: GetEndpoints.GetNewsList): Promise<Readonly<Responses.GetNewsList>>;
85
+ GetNews(params: GetEndpoints.GetNews): Promise<Readonly<Responses.GetNews>>;
86
+ static GetNews(params: GetEndpoints.GetNews): Promise<Readonly<Responses.GetNews>>;
87
+ GetResourceList(params: GetEndpoints.GetResourceList): Promise<Readonly<Responses.GetResourceList>>;
88
+ static GetResourceList(params: GetEndpoints.GetResourceList): Promise<Readonly<Responses.GetResourceList>>;
89
+ GetStreamList(params?: GetEndpoints.GetStreamList): Promise<Readonly<Responses.GetStreamList>>;
90
+ static GetStreamList(params?: GetEndpoints.GetStreamList): Promise<Readonly<Responses.GetStreamList>>;
91
+ GetThreadList(params: GetEndpoints.GetThreadList): Promise<Readonly<Responses.GetThreadList>>;
92
+ static GetThreadList(params: GetEndpoints.GetThreadList): Promise<Readonly<Responses.GetThreadList>>;
93
+ GetThreadStateByCommentId(params: GetEndpoints.GetThreadStateByCommentId): Promise<Readonly<Responses.GetThreadStateByCommentId>>;
94
+ static GetThreadStateByCommentId(params: GetEndpoints.GetThreadStateByCommentId): Promise<Readonly<Responses.GetThreadStateByCommentId>>;
95
+ GetChallenge(params: GetEndpoints.GetChallenge): Promise<Readonly<Responses.GetChallenge>>;
96
+ static GetChallenge(params: GetEndpoints.GetChallenge): Promise<Readonly<Responses.GetChallenge>>;
97
+ GetChallengeLeaderboard(params: GetEndpoints.GetChallengeLeaderboard): Promise<Readonly<Responses.GetChallengeLeaderboard>>;
98
+ static GetChallengeLeaderboard(params: GetEndpoints.GetChallengeLeaderboard): Promise<Readonly<Responses.GetChallengeLeaderboard>>;
105
99
  GetChallengeGlobalRankingList(): Promise<Readonly<Responses.GetChallengeGlobalRankingList>>;
106
100
  static GetChallengeGlobalRankingList(): Promise<Readonly<Responses.GetChallengeGlobalRankingList>>;
107
- GetChallengeRun(params?: GetEndpoints.GetChallengeRun): Promise<Readonly<Responses.GetChallengeRun>>;
108
- static GetChallengeRun(params?: GetEndpoints.GetChallengeRun): Promise<Readonly<Responses.GetChallengeRun>>;
109
- GetUserLeaderboard(params?: GetEndpoints.GetUserLeaderboard): Promise<Readonly<Responses.GetUserLeaderboard>>;
110
- static GetUserLeaderboard(params?: GetEndpoints.GetUserLeaderboard): Promise<Readonly<Responses.GetUserLeaderboard>>;
111
- GetUserModeration(params?: GetEndpoints.GetUserModeration): Promise<Readonly<Responses.GetUserModeration>>;
112
- static GetUserModeration(params?: GetEndpoints.GetUserModeration): Promise<Readonly<Responses.GetUserModeration>>;
113
- GetCommentList(params?: GetEndpoints.GetCommentList): Promise<Readonly<Responses.GetCommentList>>;
114
- static GetCommentList(params?: GetEndpoints.GetCommentList): Promise<Readonly<Responses.GetCommentList>>;
115
- GetThread(params?: GetEndpoints.GetThread): Promise<Readonly<Responses.GetThread>>;
116
- static GetThread(params?: GetEndpoints.GetThread): Promise<Readonly<Responses.GetThread>>;
101
+ GetChallengeRun(params: GetEndpoints.GetChallengeRun): Promise<Readonly<Responses.GetChallengeRun>>;
102
+ static GetChallengeRun(params: GetEndpoints.GetChallengeRun): Promise<Readonly<Responses.GetChallengeRun>>;
103
+ GetUserLeaderboard(params: GetEndpoints.GetUserLeaderboard): Promise<Readonly<Responses.GetUserLeaderboard>>;
104
+ static GetUserLeaderboard(params: GetEndpoints.GetUserLeaderboard): Promise<Readonly<Responses.GetUserLeaderboard>>;
105
+ GetUserModeration(params: GetEndpoints.GetUserModeration): Promise<Readonly<Responses.GetUserModeration>>;
106
+ static GetUserModeration(params: GetEndpoints.GetUserModeration): Promise<Readonly<Responses.GetUserModeration>>;
107
+ GetCommentList(params: GetEndpoints.GetCommentList): Promise<Readonly<Responses.GetCommentList>>;
108
+ static GetCommentList(params: GetEndpoints.GetCommentList): Promise<Readonly<Responses.GetCommentList>>;
109
+ GetThread(params: GetEndpoints.GetThread): Promise<Readonly<Responses.GetThread>>;
110
+ static GetThread(params: GetEndpoints.GetThread): Promise<Readonly<Responses.GetThread>>;
117
111
  GetStaticData(): Promise<Readonly<Responses.GetStaticData>>;
118
112
  static GetStaticData(): Promise<Readonly<Responses.GetStaticData>>;
119
113
  GetForumList(): Promise<Readonly<Responses.GetForumList>>;
120
114
  static GetForumList(): Promise<Readonly<Responses.GetForumList>>;
121
- PutAuthLogin(params?: PostEndpoints.PutAuthLogin): Promise<Readonly<Responses.PutAuthLogin>>;
115
+ PutAuthLogin(params: PostEndpoints.PutAuthLogin): Promise<Readonly<Responses.PutAuthLogin>>;
122
116
  GetSession(): Promise<Readonly<Responses.GetSession>>;
123
117
  PutSessionPing(): Promise<void>;
124
- GetAuditLogList(params: PostEndpoints.GetAuditLogList): Promise<Readonly<Responses.GetAuditLogList>>;
125
- GetGameSettings(params?: PostEndpoints.GetGameSettings): Promise<Readonly<Responses.GetGameSettings>>;
126
- PutGameSettings(params?: PostEndpoints.PutGameSettings): Promise<void>;
127
- PutCategory(params?: PostEndpoints.PutCategory): Promise<void>;
128
- PutCategoryUpdate(params?: PostEndpoints.PutCategoryUpdate): Promise<void>;
129
- PutCategoryArchive(params?: PostEndpoints.PutCategoryArchive): Promise<void>;
130
- PutCategoryRestore(params?: PostEndpoints.PutCategoryRestore): Promise<void>;
131
- PutCategoryOrder(params?: PostEndpoints.PutCategoryOrder): Promise<void>;
132
- PutLevel(params?: PostEndpoints.PutLevel): Promise<void>;
133
- PutLevelUpdate(params?: PostEndpoints.PutLevelUpdate): Promise<void>;
134
- PutLevelArchive(params?: PostEndpoints.PutLevelArchive): Promise<void>;
135
- PutLevelRestore(params?: PostEndpoints.PutLevelRestore): Promise<void>;
136
- PutLevelOrder(params?: PostEndpoints.PutLevelOrder): Promise<void>;
137
- PutVariable(params?: PostEndpoints.PutVariable): Promise<void>;
138
- PutVariableUpdate(params?: PostEndpoints.PutVariableUpdate): Promise<void>;
139
- PutVariableArchive(params?: PostEndpoints.PutVariableArchive): Promise<void>;
140
- PutVariableRestore(params?: PostEndpoints.PutVariableRestore): Promise<void>;
141
- PutVariableOrder(params?: PostEndpoints.PutVariableOrder): Promise<void>;
142
- PutVariableApplyDefault(params?: PostEndpoints.PutVariableApplyDefault): Promise<void>;
143
- PutNews(params?: PostEndpoints.PutNews): Promise<void>;
144
- PutNewsUpdate(params?: PostEndpoints.PutNewsUpdate): Promise<void>;
145
- PutNewsDelete(params?: PostEndpoints.PutNewsDelete): Promise<void>;
146
- PutGuide(params?: PostEndpoints.PutGuide): Promise<void>;
147
- PutGuideUpdate(params?: PostEndpoints.PutGuideUpdate): Promise<void>;
148
- PutGuideDelete(params?: PostEndpoints.PutGuideDelete): Promise<void>;
149
- PutResource(params?: PostEndpoints.PutResource): Promise<void>;
150
- PutResourceUpdate(params?: PostEndpoints.PutResourceUpdate): Promise<void>;
151
- PutResourceDelete(params?: PostEndpoints.PutResourceDelete): Promise<void>;
118
+ GetAuditLogList(params?: PostEndpoints.GetAuditLogList): Promise<Readonly<Responses.GetAuditLogList>>;
119
+ GetGameSettings(params: PostEndpoints.GetGameSettings): Promise<Readonly<Responses.GetGameSettings>>;
120
+ PutGameSettings(params: PostEndpoints.PutGameSettings): Promise<void>;
121
+ PutCategory(params: PostEndpoints.PutCategory): Promise<void>;
122
+ PutCategoryUpdate(params: PostEndpoints.PutCategoryUpdate): Promise<void>;
123
+ PutCategoryArchive(params: PostEndpoints.PutCategoryArchive): Promise<void>;
124
+ PutCategoryRestore(params: PostEndpoints.PutCategoryRestore): Promise<void>;
125
+ PutCategoryOrder(params: PostEndpoints.PutCategoryOrder): Promise<void>;
126
+ PutLevel(params: PostEndpoints.PutLevel): Promise<void>;
127
+ PutLevelUpdate(params: PostEndpoints.PutLevelUpdate): Promise<void>;
128
+ PutLevelArchive(params: PostEndpoints.PutLevelArchive): Promise<void>;
129
+ PutLevelRestore(params: PostEndpoints.PutLevelRestore): Promise<void>;
130
+ PutLevelOrder(params: PostEndpoints.PutLevelOrder): Promise<void>;
131
+ PutVariable(params: PostEndpoints.PutVariable): Promise<void>;
132
+ PutVariableUpdate(params: PostEndpoints.PutVariableUpdate): Promise<void>;
133
+ PutVariableArchive(params: PostEndpoints.PutVariableArchive): Promise<void>;
134
+ PutVariableRestore(params: PostEndpoints.PutVariableRestore): Promise<void>;
135
+ PutVariableOrder(params: PostEndpoints.PutVariableOrder): Promise<void>;
136
+ PutVariableApplyDefault(params: PostEndpoints.PutVariableApplyDefault): Promise<void>;
137
+ PutNews(params: PostEndpoints.PutNews): Promise<void>;
138
+ PutNewsUpdate(params: PostEndpoints.PutNewsUpdate): Promise<void>;
139
+ PutNewsDelete(params: PostEndpoints.PutNewsDelete): Promise<void>;
140
+ PutGuide(params: PostEndpoints.PutGuide): Promise<void>;
141
+ PutGuideUpdate(params: PostEndpoints.PutGuideUpdate): Promise<void>;
142
+ PutGuideDelete(params: PostEndpoints.PutGuideDelete): Promise<void>;
143
+ PutResource(params: PostEndpoints.PutResource): Promise<void>;
144
+ PutResourceUpdate(params: PostEndpoints.PutResourceUpdate): Promise<void>;
145
+ PutResourceDelete(params: PostEndpoints.PutResourceDelete): Promise<void>;
152
146
  GetModerationGames(): Promise<Readonly<Responses.GetModerationGames>>;
153
- GetModerationRuns(params?: PostEndpoints.GetModerationRuns): Promise<Readonly<Responses.GetModerationRuns>>;
154
- PutRunAssignee(params?: PostEndpoints.PutRunAssignee): Promise<void>;
155
- PutRunDelete(params?: PostEndpoints.PutRunDelete): Promise<void>;
156
- PutRunVerification(params?: PostEndpoints.PutRunVerification): Promise<void>;
157
- PutRunVideoState(params?: PostEndpoints.PutRunVideoState): Promise<void>;
158
- GetRunSettings(params?: PostEndpoints.GetRunSettings): Promise<Readonly<Responses.GetRunSettings>>;
159
- PutRunSettings(params?: PostEndpoints.PutRunSettings): Promise<Readonly<Responses.PutRunSettings>>;
147
+ GetModerationRuns(params: PostEndpoints.GetModerationRuns): Promise<Readonly<Responses.GetModerationRuns>>;
148
+ PutRunAssignee(params: PostEndpoints.PutRunAssignee): Promise<void>;
149
+ PutRunDelete(params: PostEndpoints.PutRunDelete): Promise<void>;
150
+ PutRunVerification(params: PostEndpoints.PutRunVerification): Promise<void>;
151
+ PutRunVideoState(params: PostEndpoints.PutRunVideoState): Promise<void>;
152
+ GetRunSettings(params: PostEndpoints.GetRunSettings): Promise<Readonly<Responses.GetRunSettings>>;
153
+ PutRunSettings(params: PostEndpoints.PutRunSettings): Promise<Readonly<Responses.PutRunSettings>>;
160
154
  GetConversations(): Promise<Readonly<Responses.GetConversations>>;
161
- GetConversationMessages(params?: PostEndpoints.GetConversationMessages): Promise<Readonly<Responses.GetConversationMessages>>;
162
- PutConversation(params?: PostEndpoints.PutConversation): Promise<Readonly<Responses.PutConversation>>;
163
- PutConversationMessage(params?: PostEndpoints.PutConversationMessage): Promise<Readonly<Responses.PutConversationMessage>>;
164
- PutConversationLeave(params?: PostEndpoints.PutConversationLeave): Promise<void>;
165
- PutConversationReport(params?: PostEndpoints.PutConversationReport): Promise<void>;
155
+ GetConversationMessages(params: PostEndpoints.GetConversationMessages): Promise<Readonly<Responses.GetConversationMessages>>;
156
+ PutConversation(params: PostEndpoints.PutConversation): Promise<Readonly<Responses.PutConversation>>;
157
+ PutConversationMessage(params: PostEndpoints.PutConversationMessage): Promise<Readonly<Responses.PutConversationMessage>>;
158
+ PutConversationLeave(params: PostEndpoints.PutConversationLeave): Promise<void>;
159
+ PutConversationReport(params: PostEndpoints.PutConversationReport): Promise<void>;
166
160
  GetNotifications(): Promise<Readonly<Responses.GetNotifications>>;
167
161
  PutNotificationsRead(): Promise<void>;
168
- PutGameFollower(params?: PostEndpoints.PutGameFollower): Promise<void>;
169
- PutGameFollowerDelete(params?: PostEndpoints.PutGameFollowerDelete): Promise<void>;
170
- PutUserFollower(params?: PostEndpoints.PutUserFollower): Promise<void>;
171
- PutUserFollowerDelete(params?: PostEndpoints.PutUserFollowerDelete): Promise<void>;
172
- GetUserSettings(params?: PostEndpoints.GetUserSettings): Promise<Readonly<Responses.GetUserSettings>>;
173
- PutUserSettings(params?: PostEndpoints.PutUserSettings): Promise<Readonly<Responses.PutUserSettings>>;
174
- PutUserUpdateFeaturedRun(params?: PostEndpoints.PutUserUpdateFeaturedRun): Promise<void>;
175
- PutUserUpdateGameOrdering(params?: PostEndpoints.PutUserUpdateGameOrdering): Promise<void>;
176
- GetUserApiKey(params?: PostEndpoints.GetUserApiKey): Promise<Readonly<Responses.GetUserApiKey>>;
177
- GetUserFollowers(params?: PostEndpoints.GetUserFollowers): Promise<Readonly<Responses.GetUserFollowers>>;
178
- GetUserFollowingGames(params?: PostEndpoints.GetUserFollowingGames): Promise<Readonly<Responses.GetUserFollowingGames>>;
179
- GetUserFollowingUsers(params?: PostEndpoints.GetUserFollowingUsers): Promise<Readonly<Responses.GetUserFollowingUsers>>;
180
- GetUserGameBoostData(params?: PostEndpoints.GetUserGameBoostData): Promise<Readonly<Responses.GetUserGameBoostData>>;
181
- GetUserDataExport(params?: PostEndpoints.GetUserDataExport): Promise<Readonly<Responses.GetUserDataExport>>;
182
- PutGameFollowerOrder(params?: PostEndpoints.PutGameFollowerOrder): Promise<void>;
183
- PutArticleSubmission(params?: PostEndpoints.PutArticleSubmission): Promise<void>;
184
- GetCommentable(params?: PostEndpoints.GetCommentable): Promise<Readonly<Responses.GetCommentable>>;
185
- PutComment(params?: PostEndpoints.PutComment): Promise<void>;
186
- PutLike(params?: PostEndpoints.PutLike): Promise<Readonly<Responses.PutLike>>;
187
- PutCommentableSettings(params?: PostEndpoints.PutCommentableSettings): Promise<void>;
188
- GetThreadReadStatus(params?: PostEndpoints.GetThreadReadStatus): Promise<Readonly<Responses.GetThreadReadStatus>>;
189
- PutThreadRead(params?: PostEndpoints.PutThreadRead): Promise<void>;
190
- GetForumReadStatus(params?: PostEndpoints.GetForumReadStatus): Promise<Readonly<Responses.GetForumReadStatus>>;
191
- GetThemeSettings(params: PostEndpoints.GetThemeSettings): Promise<Readonly<Responses.GetThemeSettings>>;
192
- PutThemeSettings(params?: PostEndpoints.PutThemeSettings): Promise<void>;
193
- GetUserSupporterData(params?: PostEndpoints.GetUserSupporterData): Promise<Readonly<Responses.GetUserSupporterData>>;
194
- PutUserSupporterNewSubscription(params: PostEndpoints.PutUserSupporterNewSubscription): Promise<Readonly<Responses.PutUserSupporterNewSubscription>>;
195
- PutGameBoostGrant(params?: PostEndpoints.PutGameBoostGrant): Promise<void>;
196
- PutAdvertiseContact(params?: PostEndpoints.PutAdvertiseContact): Promise<void>;
197
- GetTickets(params?: PostEndpoints.GetTickets): Promise<Readonly<Responses.GetTickets>>;
198
- GetSeriesSettings(params?: PostEndpoints.GetSeriesSettings): Promise<Readonly<Responses.GetSeriesSettings>>;
162
+ PutGameFollower(params: PostEndpoints.PutGameFollower): Promise<void>;
163
+ PutGameFollowerDelete(params: PostEndpoints.PutGameFollowerDelete): Promise<void>;
164
+ PutUserFollower(params: PostEndpoints.PutUserFollower): Promise<void>;
165
+ PutUserFollowerDelete(params: PostEndpoints.PutUserFollowerDelete): Promise<void>;
166
+ GetUserSettings(params: PostEndpoints.GetUserSettings): Promise<Readonly<Responses.GetUserSettings>>;
167
+ PutUserSettings(params: PostEndpoints.PutUserSettings): Promise<Readonly<Responses.PutUserSettings>>;
168
+ PutUserUpdateFeaturedRun(params: PostEndpoints.PutUserUpdateFeaturedRun): Promise<void>;
169
+ PutUserUpdateGameOrdering(params: PostEndpoints.PutUserUpdateGameOrdering): Promise<void>;
170
+ GetUserApiKey(params: PostEndpoints.GetUserApiKey): Promise<Readonly<Responses.GetUserApiKey>>;
171
+ GetUserFollowers(params: PostEndpoints.GetUserFollowers): Promise<Readonly<Responses.GetUserFollowers>>;
172
+ GetUserFollowingGames(params: PostEndpoints.GetUserFollowingGames): Promise<Readonly<Responses.GetUserFollowingGames>>;
173
+ GetUserFollowingUsers(params: PostEndpoints.GetUserFollowingUsers): Promise<Readonly<Responses.GetUserFollowingUsers>>;
174
+ GetUserGameBoostData(params: PostEndpoints.GetUserGameBoostData): Promise<Readonly<Responses.GetUserGameBoostData>>;
175
+ GetUserDataExport(params: PostEndpoints.GetUserDataExport): Promise<Readonly<Responses.GetUserDataExport>>;
176
+ PutGameFollowerOrder(params: PostEndpoints.PutGameFollowerOrder): Promise<void>;
177
+ PutArticleSubmission(params: PostEndpoints.PutArticleSubmission): Promise<void>;
178
+ GetCommentable(params: PostEndpoints.GetCommentable): Promise<Readonly<Responses.GetCommentable>>;
179
+ PutComment(params: PostEndpoints.PutComment): Promise<void>;
180
+ PutLike(params: PostEndpoints.PutLike): Promise<Readonly<Responses.PutLike>>;
181
+ PutCommentableSettings(params: PostEndpoints.PutCommentableSettings): Promise<void>;
182
+ GetThreadReadStatus(params: PostEndpoints.GetThreadReadStatus): Promise<Readonly<Responses.GetThreadReadStatus>>;
183
+ PutThreadRead(params: PostEndpoints.PutThreadRead): Promise<void>;
184
+ GetForumReadStatus(params: PostEndpoints.GetForumReadStatus): Promise<Readonly<Responses.GetForumReadStatus>>;
185
+ GetThemeSettings(params?: PostEndpoints.GetThemeSettings): Promise<Readonly<Responses.GetThemeSettings>>;
186
+ PutThemeSettings(params: PostEndpoints.PutThemeSettings): Promise<void>;
187
+ GetUserSupporterData(params: PostEndpoints.GetUserSupporterData): Promise<Readonly<Responses.GetUserSupporterData>>;
188
+ PutUserSupporterNewSubscription(params?: PostEndpoints.PutUserSupporterNewSubscription): Promise<Readonly<Responses.PutUserSupporterNewSubscription>>;
189
+ PutGameBoostGrant(params: PostEndpoints.PutGameBoostGrant): Promise<void>;
190
+ PutAdvertiseContact(params: PostEndpoints.PutAdvertiseContact): Promise<void>;
191
+ GetTickets(params: PostEndpoints.GetTickets): Promise<Readonly<Responses.GetTickets>>;
192
+ GetSeriesSettings(params: PostEndpoints.GetSeriesSettings): Promise<Readonly<Responses.GetSeriesSettings>>;
199
193
  GetUserBlocks(): Promise<Readonly<Responses.GetUserBlocks>>;
200
- PutUserBlock(params?: PostEndpoints.PutUserBlock): Promise<void>;
201
- PutGame(params?: PostEndpoints.PutGame): Promise<Readonly<Responses.PutGame>>;
194
+ PutUserBlock(params: PostEndpoints.PutUserBlock): Promise<void>;
195
+ PutGame(params: PostEndpoints.PutGame): Promise<Readonly<Responses.PutGame>>;
202
196
  PutGameModerator(): Promise<void>;
203
- PutGameModeratorDelete(params?: PostEndpoints.PutGameModeratorDelete): Promise<void>;
204
- PutSeriesGame(params?: PostEndpoints.PutSeriesGame): Promise<void>;
205
- PutSeriesGameDelete(params?: PostEndpoints.PutSeriesGameDelete): Promise<void>;
197
+ PutGameModeratorDelete(params: PostEndpoints.PutGameModeratorDelete): Promise<void>;
198
+ PutSeriesGame(params: PostEndpoints.PutSeriesGame): Promise<void>;
199
+ PutSeriesGameDelete(params: PostEndpoints.PutSeriesGameDelete): Promise<void>;
206
200
  PutSeriesModerator(): Promise<void>;
207
201
  PutSeriesModeratorUpdate(): Promise<void>;
208
202
  PutSeriesModeratorDelete(): Promise<void>;
209
- PutSeriesSettings(params?: PostEndpoints.PutSeriesSettings): Promise<void>;
210
- PutTicket(params?: PostEndpoints.PutTicket): Promise<Readonly<Responses.PutTicket>>;
211
- PutTicketNote(params?: PostEndpoints.PutTicketNote): Promise<void>;
212
- PutUserSocialConnection(params?: PostEndpoints.PutUserSocialConnection): Promise<void>;
213
- PutUserSocialConnectionDelete(params?: PostEndpoints.PutUserSocialConnectionDelete): Promise<void>;
214
- PutUserSocialConnectionSsoExchange(params?: PostEndpoints.PutUserSocialConnectionSsoExchange): Promise<void>;
215
- PutUserUpdatePassword(params?: PostEndpoints.PutUserUpdatePassword): Promise<void>;
216
- PutUserUpdateEmail(params?: PostEndpoints.PutUserUpdateEmail): Promise<Readonly<Responses.PutUserUpdateEmail>>;
217
- PutUserUpdateName(params?: PostEndpoints.PutUserUpdateName): Promise<Readonly<Responses.PutUserUpdateName>>;
218
- PutUserDelete(params?: PostEndpoints.PutUserDelete): Promise<void>;
219
- PutCommentUpdate(params?: PostEndpoints.PutCommentUpdate): Promise<void>;
220
- PutCommentDelete(params?: PostEndpoints.PutCommentDelete): Promise<void>;
221
- PutCommentRestore(params?: PostEndpoints.PutCommentRestore): Promise<void>;
222
- PutThread(params?: PostEndpoints.PutThread): Promise<Readonly<Responses.PutThread>>;
223
- PutThreadLocked(params?: PostEndpoints.PutThreadLocked): Promise<void>;
224
- PutThreadSticky(params?: PostEndpoints.PutThreadSticky): Promise<void>;
225
- PutThreadDelete(params?: PostEndpoints.PutThreadDelete): Promise<void>;
203
+ PutSeriesSettings(params: PostEndpoints.PutSeriesSettings): Promise<void>;
204
+ PutTicket(params: PostEndpoints.PutTicket): Promise<Readonly<Responses.PutTicket>>;
205
+ PutTicketNote(params: PostEndpoints.PutTicketNote): Promise<void>;
206
+ PutUserSocialConnection(params: PostEndpoints.PutUserSocialConnection): Promise<void>;
207
+ PutUserSocialConnectionDelete(params: PostEndpoints.PutUserSocialConnectionDelete): Promise<void>;
208
+ PutUserSocialConnectionSsoExchange(params: PostEndpoints.PutUserSocialConnectionSsoExchange): Promise<void>;
209
+ PutUserUpdatePassword(params: PostEndpoints.PutUserUpdatePassword): Promise<void>;
210
+ PutUserUpdateEmail(params: PostEndpoints.PutUserUpdateEmail): Promise<Readonly<Responses.PutUserUpdateEmail>>;
211
+ PutUserUpdateName(params: PostEndpoints.PutUserUpdateName): Promise<Readonly<Responses.PutUserUpdateName>>;
212
+ PutUserDelete(params: PostEndpoints.PutUserDelete): Promise<void>;
213
+ PutCommentUpdate(params: PostEndpoints.PutCommentUpdate): Promise<void>;
214
+ PutCommentDelete(params: PostEndpoints.PutCommentDelete): Promise<void>;
215
+ PutCommentRestore(params: PostEndpoints.PutCommentRestore): Promise<void>;
216
+ PutThread(params: PostEndpoints.PutThread): Promise<Readonly<Responses.PutThread>>;
217
+ PutThreadLocked(params: PostEndpoints.PutThreadLocked): Promise<void>;
218
+ PutThreadSticky(params: PostEndpoints.PutThreadSticky): Promise<void>;
219
+ PutThreadDelete(params: PostEndpoints.PutThreadDelete): Promise<void>;
226
220
  }
227
- export {};
package/dist/Client.js CHANGED
@@ -10,7 +10,7 @@ const objectToBase64 = (obj) => {
10
10
  const jsonString = JSON.stringify(obj).replace(/\s+/g, '');
11
11
  return Buffer.from(jsonString).toString('base64');
12
12
  };
13
- class APIError extends Error {
13
+ export class APIError extends Error {
14
14
  constructor(message, status) {
15
15
  super(message);
16
16
  this.message = message;
@@ -58,30 +58,6 @@ class Client {
58
58
  static async request(endpoint, params = {}) {
59
59
  return (await this.axiosClient.get(`${endpoint}?_r=${objectToBase64(params)}`)).data;
60
60
  }
61
- //Built-in endpoints for auth
62
- /**
63
- * Attempts to authorize your cookies if using a browser, or authorizes this Client if otherwise.
64
- * If the account has two factor authentication, you have to use `setToken` with the token sent to the account's email address.
65
- */
66
- async login(username, password) {
67
- this.username = username;
68
- this.password = password;
69
- return await this.request('PutAuthLogin', {
70
- name: username,
71
- password
72
- });
73
- }
74
- /**
75
- * Attempts to authorize your cookies if using a browser, or authorizes this Client if otherwise, with the token that `login()` sent to the account's email address.
76
- * @param token The 5-digit code sent to your email after a successful `login()`.
77
- */
78
- async setToken(token) {
79
- return await this.request('PutAuthLogin', {
80
- name: this.username,
81
- password: this.password,
82
- token
83
- });
84
- }
85
61
  /**
86
62
  * Attempts to remove the PHPSESSID cookie if using a browser, otherwise removes your Client's authentication.
87
63
  */
@@ -15,12 +15,12 @@ const isInterfaceEmpty = (interfaceName, sourceFile) => {
15
15
  const isInterfaceAllOptional = (name, sourceFile) => {
16
16
  const iface = sourceFile.getInterface(name);
17
17
  if (iface) {
18
- return iface.getProperties().some(p => !p.hasQuestionToken());
18
+ return iface.getProperties().every(p => p.hasQuestionToken());
19
19
  }
20
20
  const typeNode = sourceFile.getTypeAliasOrThrow(name).getType();
21
21
  return typeNode
22
22
  .getProperties()
23
- .some(p => !p.isOptional());
23
+ .every(p => p.isOptional());
24
24
  };
25
25
  const baseClient = project.getSourceFileOrThrow('src/BaseClient.ts');
26
26
  const clientFile = project.createSourceFile('src/Client.ts', baseClient.getFullText(), { overwrite: true });
@@ -54,11 +54,11 @@ interface GetGameData_Base {
54
54
  /**
55
55
  * ID of the game.
56
56
  */
57
- gameId?: string;
57
+ gameId: string;
58
58
  /**
59
59
  * Game page URL.
60
60
  */
61
- gameUrl?: string;
61
+ gameUrl: string;
62
62
  }
63
63
  export type GetGameData = AtLeastOne<GetGameData_Base, 'gameId' | 'gameUrl'>;
64
64
  /**
@@ -70,11 +70,11 @@ interface GetGameSummary_Base {
70
70
  /**
71
71
  * ID of the game.
72
72
  */
73
- gameId?: string;
73
+ gameId: string;
74
74
  /**
75
75
  * Subpath URL of the game.
76
76
  */
77
- gameUrl?: string;
77
+ gameUrl: string;
78
78
  }
79
79
  export type GetGameSummary = AtLeastOne<GetGameSummary_Base, 'gameId' | 'gameUrl'>;
80
80
  /**
@@ -313,10 +313,17 @@ export interface GetArticleList {
313
313
  /**
314
314
  * Gets a specific site article.
315
315
  */
316
- export interface GetArticle {
317
- id?: string;
318
- slug?: string;
316
+ interface GetArticle_Base {
317
+ /**
318
+ * ID of the article to fetch.
319
+ */
320
+ id: string;
321
+ /**
322
+ * Slug of the article to fetch.
323
+ */
324
+ slug: string;
319
325
  }
326
+ export type GetArticle = AtLeastOne<GetArticle_Base>;
320
327
  /**
321
328
  * Gets a list of games.
322
329
  */
@@ -531,14 +538,29 @@ export interface GetUserModeration {
531
538
  userId: string;
532
539
  }
533
540
  /**
534
- * Get a list of comments on an item.
541
+ * Get a list of comments on an item, and data of the parent.
535
542
  */
536
543
  export interface GetCommentList {
544
+ /**
545
+ * ID of the parent item to fetch.
546
+ */
537
547
  itemId: string;
538
548
  /**
539
549
  * `ItemType` of the item referenced in `itemId`.
540
550
  */
541
551
  itemType: Enums.ItemType;
552
+ /**
553
+ * The maximum amount of `Comment`s per page.
554
+ *
555
+ * When this is >= 500 but <= 1000, it will fetch a maximum of 500 `Run`s, but when over 1000 it will return a maximum of 20 runs.
556
+ * @max 500
557
+ * @default 20
558
+ */
559
+ limit?: number;
560
+ /**
561
+ * The comment page, in relation to `limit`.
562
+ */
563
+ page?: number;
542
564
  }
543
565
  /**
544
566
  * Get a specific thread.
@@ -260,30 +260,6 @@ export interface GetRun {
260
260
  values: Interfaces.Value[];
261
261
  variables: Interfaces.Variable[];
262
262
  }
263
- export interface GetSearch {
264
- gameList: Interfaces.Game[];
265
- newsList: Interfaces.GameNews[];
266
- pageList: Interfaces.Article[];
267
- seriesList: Interfaces.Series[];
268
- userList: Interfaces.User[];
269
- challengeList: Interfaces.Challenge[];
270
- }
271
- export interface GetSeriesList {
272
- seriesList: Interfaces.Series[];
273
- pagination: Interfaces.Pagination;
274
- }
275
- export interface GetSeriesSummary {
276
- series: Interfaces.Series;
277
- forum: Interfaces.Forum;
278
- gameList: Interfaces.Game[];
279
- moderatorList: Interfaces.SeriesModerator[];
280
- theme: Interfaces.Theme;
281
- threadList: Interfaces.Thread[];
282
- userList: Interfaces.User[];
283
- gameCount: number;
284
- streamCount: number;
285
- threadCount: number;
286
- }
287
263
  export interface GetStreamList {
288
264
  gameList: Interfaces.Game[];
289
265
  streamList: Interfaces.Stream[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "speedruncom.js",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "description": "WIP NodeJS module for Speedrun's version 2 API.",
5
5
  "type": "module",
6
6
  "author": {
@@ -16,8 +16,8 @@
16
16
  "types": "dist/index.d.ts",
17
17
  "scripts": {
18
18
  "clean": "rimraf dist src/Client.ts",
19
- "prepare": "tsx src/build-client.ts",
20
- "build": "tsc"
19
+ "build": "tsc",
20
+ "prepare": "tsx src/build-client.ts && npm run build"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@types/node": "^22.15.24",
@@ -18,13 +18,13 @@ const isInterfaceEmpty = (interfaceName: string, sourceFile: SourceFile) => {
18
18
  const isInterfaceAllOptional = (name: string, sourceFile: SourceFile) => {
19
19
  const iface = sourceFile.getInterface(name);
20
20
  if (iface) {
21
- return iface.getProperties().some(p => !p.hasQuestionToken());
21
+ return iface.getProperties().every(p => p.hasQuestionToken());
22
22
  }
23
23
 
24
24
  const typeNode = sourceFile.getTypeAliasOrThrow(name).getType();
25
25
  return typeNode
26
26
  .getProperties()
27
- .some(p => !p.isOptional());
27
+ .every(p => p.isOptional());
28
28
  };
29
29
 
30
30
  const baseClient = project.getSourceFileOrThrow('src/BaseClient.ts');
@@ -67,12 +67,12 @@ interface GetGameData_Base {
67
67
  /**
68
68
  * ID of the game.
69
69
  */
70
- gameId?: string;
70
+ gameId: string;
71
71
 
72
72
  /**
73
73
  * Game page URL.
74
74
  */
75
- gameUrl?: string;
75
+ gameUrl: string;
76
76
  }
77
77
 
78
78
  export type GetGameData = AtLeastOne<GetGameData_Base, 'gameId' | 'gameUrl'>;
@@ -87,12 +87,12 @@ interface GetGameSummary_Base {
87
87
  /**
88
88
  * ID of the game.
89
89
  */
90
- gameId?: string;
90
+ gameId: string;
91
91
 
92
92
  /**
93
93
  * Subpath URL of the game.
94
94
  */
95
- gameUrl?: string;
95
+ gameUrl: string;
96
96
  }
97
97
 
98
98
  export type GetGameSummary = AtLeastOne<GetGameSummary_Base, 'gameId' | 'gameUrl'>;
@@ -381,11 +381,21 @@ export interface GetArticleList {
381
381
  /**
382
382
  * Gets a specific site article.
383
383
  */
384
- export interface GetArticle {
385
- id?: string;
386
- slug?: string;
384
+ interface GetArticle_Base {
385
+
386
+ /**
387
+ * ID of the article to fetch.
388
+ */
389
+ id: string;
390
+
391
+ /**
392
+ * Slug of the article to fetch.
393
+ */
394
+ slug: string;
387
395
  }
388
396
 
397
+ export type GetArticle = AtLeastOne<GetArticle_Base>;
398
+
389
399
  /**
390
400
  * Gets a list of games.
391
401
  */
@@ -658,8 +668,9 @@ export interface GetCommentList {
658
668
  /**
659
669
  * The maximum amount of `Comment`s per page.
660
670
  *
661
- * @max 100
662
- * @default 100
671
+ * When this is >= 500 but <= 1000, it will fetch a maximum of 500 `Run`s, but when over 1000 it will return a maximum of 20 runs.
672
+ * @max 500
673
+ * @default 20
663
674
  */
664
675
  limit?: number;
665
676