Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: update /problem/:pid response #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
0f-0b merged 1 commit into main from update-problem-api
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 107 additions & 35 deletions luogu-api.d.ts
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export interface LentilleDataResponse<T> {
}

export interface UpdateTestCasesSettingsResponse {
problem: ProblemDetails;
problem: LegacyProblemDetails;
testCases: TestCase[];
scoringStrategy: ScoringStrategy;
subtaskScoringStrategies: ScoringStrategy[];
Expand Down Expand Up @@ -357,6 +357,13 @@ export interface ConfigResponse {
OpenIdPlatformType: {
[id: number]: { type: string; id: number; name: string };
};
ProblemDifficulty: {
type: string;
id: number;
name: string;
color: string;
}[];
ProblemFlag: { [id: number]: { type: string; id: number; name: string } };
ProblemType: {
[id: string]: {
type: string;
Expand All @@ -367,15 +374,40 @@ export interface ConfigResponse {
searchable: boolean;
};
};
CodeLanguage: {
[id: number]: {
type: string;
id: number;
name: string;
order: number;
family: string | null;
disabled: boolean;
canO2: boolean;
fileExt: string[];
hljs: string;
};
};
RecordStatus: {
[id: number]: {
type: string;
id: number;
name: string;
shortName: string;
color: string;
filterable: boolean;
};
};
TeamJoinPermissionType: { type: string; id: number; name: string }[];
TeamJoinRequestStatusType: { type: string; id: number; name: string }[];
TeamMemberType: { [id: number]: { type: string; id: number; name: string } };
TeamType: { [id: number]: { type: string; id: number; name: string } };
UserMessageReceiveMode: { type: string; id: number }[];
UserNotificationType: {
[id: number]: { type: string; id: number; name: string };
};
UserOfflinePrizeShowLevel: { type: string; id: number; name: string }[];
UserOpenSourceType: { [id: number]: { type: string; id: number } };
UserRelationshipType: { [id: number]: { type: string; id: number } };
UserRelationship: { [id: number]: { type: string; id: number } };
VoteType: { [id: number]: { type: string; id: number } };
route: { [id: string]: string };
routeAttr: { [id: string]: { instance: string } };
Expand All @@ -394,15 +426,16 @@ export interface TagsResponse {

export interface ProblemData {
problem: ProblemDetails & Maybe<ProblemStatus>;
contest: ContestSummary | null;
discussions: LegacyPostSummary[];
translations: { [locale: string]: ProblemContents };
bookmarked: boolean;
contest: ContestSummary | null;
vjudgeUsername: string | null;
recommendations: (LegacyProblemSummary & Maybe<ProblemStatus>)[];
lastLanguage: number;
lastCode: string;
privilegedTeams: TeamSummary[];
userTranslation: null; // TODO
lastLanguage: number | null;
lastCode: string | null;
recommendations: (ProblemSummary & Maybe<ProblemStatus>)[];
forum: Forum | null;
discussions: PostSummary[] | null;
canEdit: boolean;
}

export interface SolutionsData {
Expand Down Expand Up @@ -453,13 +486,13 @@ export interface RecordData {
export interface PostListData {
forum: Forum | null;
publicForums: Forum[];
posts: List<PostSummary>;
posts: List<Post>;
canPost: boolean;
}

export interface PostData {
forum: Forum;
post: Post;
post: PostDetails;
replies: List<Reply>;
canReply: boolean;
}
Expand Down Expand Up @@ -662,7 +695,7 @@ export interface ProblemSummary {
difficulty: number | null;
}

export interface Problem extends LegacyProblemSummary {
export interface Problem extends ProblemSummary {
tags: number[];
wantsTranslation: boolean;
totalSubmit: number;
Expand All @@ -671,27 +704,38 @@ export interface Problem extends LegacyProblemSummary {
}

export interface ProblemDetails extends Problem {
provider: (UserSummary & Maybe<SelfSummary>) | TeamSummary;
content: ProblemContents;
attachments: ProblemAttachment[];
acceptSolution: boolean;
acceptLanguages: number[];
samples: [input: string, output: string][];
limits: { time: number[]; memory: number[] };
stdCode: string;
showScore?: boolean;
score?: number | null;
vjudge?: { id: string; link: string };
translation: string;
}

export interface ProblemContents {
user: null;
version: 1;
Comment on lines +722 to +723
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Mr-Python-in-China 这两个属性有没有别的可能值?此外还有补充吗?

Copy link
Contributor

@Mr-Python-in-China Mr-Python-in-China Feb 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我暂时还没发现 有问题再说吧

name: string;
background: string;
description: string;
inputFormat: string;
outputFormat: string;
samples: [string, string][];
formatI: string;
formatO: string;
hint: string;
provider: UserSummary | TeamSummary;
attachments: {
size: number;
uploadTime: number;
downloadLink: string;
id: string;
fileName: string;
}[];
canEdit: boolean;
limits: { time: number[]; memory: number[] };
showScore: boolean;
score: number | null;
stdCode: string;
vjudge?: { origin: string; link: string; id: string };
translation?: string;
locale: string;
}

export interface ProblemAttachment {
id: string;
filename: string;
size: number;
uploadTime: number;
downloadLink: string;
}

export interface ProblemSettings {
Expand All @@ -700,16 +744,16 @@ export interface ProblemSettings {
description: string;
inputFormat: string;
outputFormat: string;
samples: [string, string][];
samples: [input: string, output: string][];
hint: string;
translation: string;
needsTranslation: boolean;
acceptSolution: boolean;
allowDataDownload: boolean;
tags: number[];
difficulty: number;
showScore: boolean;
flag: number;
tags: number[];
}

export interface ProblemStatus {
Expand All @@ -730,7 +774,7 @@ export interface TestCase {

export interface ScoringStrategy {
type: number;
script: string;
script?: string;
}

export interface ProblemSet {
Expand All @@ -747,7 +791,7 @@ export interface ProblemSet {

export interface ProblemSetDetails extends ProblemSet {
description: string;
problems: { problem: Problem }[];
problems: { problem: LegacyProblem }[];
userScore: {
user: UserSummary;
totalScore: number;
Expand Down Expand Up @@ -872,6 +916,9 @@ export interface PostSummary {
title: string;
author: UserSummary;
time: number;
}

export interface Post extends PostSummary {
forum: Forum;
topped: boolean;
valid: boolean;
Expand All @@ -880,7 +927,7 @@ export interface PostSummary {
recentReply: ReplySummary | false;
}

export interface Post extends PostSummary {
export interface PostDetails extends Post {
content: string;
pinnedReply: Reply | null;
}
Expand Down Expand Up @@ -1192,6 +1239,31 @@ export interface LegacyProblemSummary extends ProblemSummary {
fullScore: number;
}

/** @deprecated */
export interface LegacyProblem extends LegacyProblemSummary {
tags: number[];
wantsTranslation: boolean;
totalSubmit: number;
totalAccepted: number;
flag: number;
}

/** @deprecated */
export interface LegacyProblemDetails extends LegacyProblem {
background: string;
description: string;
inputFormat: string;
outputFormat: string;
samples: [input: string, output: string][];
hint: string;
provider: UserSummary | TeamSummary;
attachments: ProblemAttachment[];
canEdit: boolean;
limits: { time: number[]; memory: number[] };
stdCode: string;
translation?: string;
}

/** @deprecated */
export interface LegacyPostSummary {
id: number;
Expand Down
6 changes: 3 additions & 3 deletions problems.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</tr>
<tr>
<th align="right">响应主体</th>
<td><code>application/json</code> (<code>DataResponse&lt;{ problems: List&lt;Problem &amp; Maybe&lt;ProblemStatus&gt;&gt;; page: number }&gt;</code>)</td>
<td><code>application/json</code> (<code>DataResponse&lt;{ problems: List&lt;LegacyProblem &amp; Maybe&lt;ProblemStatus&gt;&gt;; page: number }&gt;</code>)</td>
</tr>
</table>

Expand All @@ -30,7 +30,7 @@
</tr>
<tr>
<th align="right">响应主体</th>
<td><code>application/json</code> (<code>{ problems: List&lt;Problem&gt; }</code>)</td>
<td><code>application/json</code> (<code>{ problems: List&lt;LegacyProblem&gt; }</code>)</td>
</tr>
</table>

Expand All @@ -47,7 +47,7 @@
</tr>
<tr>
<th align="right">响应主体</th>
<td><code>application/json</code> (<code>DataResponse&lt;ProblemData&gt;</code>)</td>
<td><code>application/json</code> (<code>LentilleDataResponse&lt;ProblemData&gt;</code>)</td>
</tr>
</table>

Expand Down
2 changes: 1 addition & 1 deletion teams.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
</tr>
<tr>
<th align="right">响应主体</th>
<td><code>application/json</code> (<code>{ problems: List&lt;Problem&gt; }</code>)</td>
<td><code>application/json</code> (<code>{ problems: List&lt;LegacyProblem&gt; }</code>)</td>
</tr>
</table>

Expand Down

AltStyle によって変換されたページ (->オリジナル) /