Skip to content
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
55 changes: 53 additions & 2 deletions articles.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@

## 列出文章

<table>
<tr>
<th align="right">请求</th>
<td><code>GET /article</code></td>
</tr>
<tr>
<th align="right">参数</th>
<td><code>{ category?: number; page?: number }</code></td>
</tr>
<tr>
<th align="right">响应主体</th>
<td><code>application/json</code> (<code>LentilleDataResponse&lt;ArticleListData&gt;</code>)</td>
</tr>
</table>

## 列出用户文章

<table>
<tr>
<th align="right">请求</th>
Expand All @@ -17,7 +34,7 @@
</tr>
</table>

## 列出发布的文章
## 列出创建的文章

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

Expand Down Expand Up @@ -177,6 +194,23 @@
</tr>
</table>

## 赞/踩文章

<table>
<tr>
<th align="right">请求</th>
<td><code>POST /api/article/vote/:lid</code></td>
</tr>
<tr>
<th align="right">参数</th>
<td><code>{ vote: number }</code></td>
</tr>
<tr>
<th align="right">响应主体</th>
<td><code>application/json</code> (<code>{ voted: number; upvotes: number }</code>)</td>
</tr>
</table>

## 申请全站推荐

<table>
Expand Down Expand Up @@ -220,6 +254,23 @@
</tr>
</table>

## 发表评论

<table>
<tr>
<th align="right">请求</th>
<td><code>POST /article/:lid/reply</code></td>
</tr>
<tr>
<th align="right">请求主体</th>
<td><code>application/json</code> (<code>{ content: string }</code>)</td>
</tr>
<tr>
<th align="right">响应主体</th>
<td><code>application/json</code> (<code>{ reply: Comment }</code>)</td>
</tr>
</table>

## 删除评论

<table>
Expand Down
15 changes: 11 additions & 4 deletions luogu-api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,12 @@ export interface ImageListData {
}

export interface ArticleListData {
articles: List<Article>;
featuredCollections: ArticleCollectionSummary[];
category: number | null;
}

export interface CreatedArticleListData {
articles: List<Article>;
stat: { promoted: number; public: number; hidden: number };
}
Expand All @@ -530,6 +536,7 @@ export interface ArticleData {

export interface ArticleCollectionData {
articles: List<Article>;
featuredCollections: ArticleCollectionSummary[];
collection: ArticleCollection;
}

Expand Down Expand Up @@ -651,7 +658,7 @@ export interface ProblemSummary {
pid: string;
type: string;
title: string;
difficulty: number;
difficulty: number | null;
}

export interface Problem extends LegacyProblemSummary {
Expand Down Expand Up @@ -1103,7 +1110,6 @@ export interface Article {
}

export interface ArticleDetails extends Article {
id: number;
contentFull: boolean;
adminNote: string | null;
voted?: number | null;
Expand All @@ -1118,6 +1124,7 @@ export interface ArticleCollectionSummary {

export interface ArticleCollection extends ArticleCollectionSummary {
opening: boolean;
featured: number;
categoryLimitation: null;
}

Expand All @@ -1140,10 +1147,10 @@ export interface Blog extends BlogSummary {
}

export interface Comment {
content: string;
id: number;
author: UserSummary;
author: UserSummary & Maybe<SelfSummary>;
time: number;
content: string;
}

export interface PageTree {
Expand Down