Skip to content

Commit

Permalink
chore(types): update private API type definition (#358)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
bangumi-bot and github-actions[bot] authored Feb 13, 2023
1 parent d1c42ce commit 66efafd
Show file tree
Hide file tree
Showing 3 changed files with 156 additions and 4 deletions.
69 changes: 68 additions & 1 deletion packages/client/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ paths:
- user
/p1/groups/-/posts/{postID}:
put:
operationId: editReply
operationId: editGroupReply
parameters:
- example: 2092074
in: path
Expand Down Expand Up @@ -776,6 +776,73 @@ paths:
description: 意料之外的服务器错误
tags:
- topic
/p1/groups/-/topics/{topicID}:
put:
operationId: editGroupTopic
parameters:
- example: 371602
in: path
name: topicID
required: true
schema:
type: integer
requestBody:
content:
application/json:
example:
text: new contents
title: new topic title
schema:
properties:
text:
minLength: 1
type: string
title:
minLength: 1
type: string
required:
- title
- text
type: object
required: true
responses:
'200':
content:
application/json:
schema:
properties: {}
type: object
description: Default Response
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
description: Default Response
'401':
content:
application/json:
examples:
NOT_ALLOWED:
value:
code: NOT_ALLOWED
error: Unauthorized
message: you don't have permission to edit a topic
statusCode: 401
schema:
$ref: '#/components/schemas/Error'
description: Default Response
'500':
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
description: 意料之外的服务器错误
description: 意料之外的服务器错误
security:
- CookiesSession: []
tags:
- group
/p1/groups/-/topics/{topicID}/replies:
post:
operationId: createGroupReply
Expand Down
36 changes: 35 additions & 1 deletion packages/client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export async function clearNotice(
}),
);
}
export async function editReply(
export async function editGroupReply(
postId: number,
body: {
text: string;
Expand Down Expand Up @@ -263,6 +263,40 @@ export async function getGroupTopicDetail(id: number, opts?: Oazapfts.RequestOpt
...opts,
});
}
export async function editGroupTopic(
topicId: number,
body: {
text: string;
title: string;
},
opts?: Oazapfts.RequestOpts,
) {
return oazapfts.fetchJson<
| {
status: 200;
data: {};
}
| {
status: 400;
data: Error;
}
| {
status: 401;
data: Error;
}
| {
status: 500;
data: Error;
}
>(
`/p1/groups/-/topics/${encodeURIComponent(topicId)}`,
oazapfts.json({
...opts,
method: 'PUT',
body,
}),
);
}
export async function createGroupReply(
topicId: number,
body: {
Expand Down
55 changes: 53 additions & 2 deletions packages/client/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@ export interface paths {
post: operations['clearNotice'];
};
'/p1/groups/-/posts/{postID}': {
put: operations['editReply'];
put: operations['editGroupReply'];
};
'/p1/groups/-/topics/{id}': {
/** @description 获取帖子列表 */
get: operations['getGroupTopicDetail'];
};
'/p1/groups/-/topics/{topicID}': {
put: operations['editGroupTopic'];
};
'/p1/groups/-/topics/{topicID}/replies': {
post: operations['createGroupReply'];
};
Expand Down Expand Up @@ -352,7 +355,7 @@ export interface operations {
};
};
};
editReply: {
editGroupReply: {
parameters: {
/** @example 2092074 */
path: {
Expand Down Expand Up @@ -421,6 +424,54 @@ export interface operations {
};
};
};
editGroupTopic: {
parameters: {
/** @example 371602 */
path: {
topicID: number;
};
};
requestBody: {
content: {
/**
* @example {
* "text": "new contents",
* "title": "new topic title"
* }
*/
'application/json': {
text: string;
title: string;
};
};
};
responses: {
/** @description Default Response */
200: {
content: {
'application/json': Record<string, never>;
};
};
/** @description Default Response */
400: {
content: {
'application/json': components['schemas']['Error'];
};
};
/** @description Default Response */
401: {
content: {
'application/json': components['schemas']['Error'];
};
};
/** @description 意料之外的服务器错误 */
500: {
content: {
'application/json': components['schemas']['Error'];
};
};
};
};
createGroupReply: {
parameters: {
/** @example 371602 */
Expand Down

0 comments on commit 66efafd

Please sign in to comment.