Skip to content

Commit 5f04d25

Browse files
authored
Merge pull request #626 from johndoknjas/update-pgn-moves-endpoint
Documentation for new endpoint to update a chapter's moves
2 parents cdd5475 + 3871154 commit 5f04d25

3 files changed

Lines changed: 59 additions & 1 deletion

File tree

doc/specs/lichess-api.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,9 @@ paths:
475475
/api/study/{studyId}/{chapterId}/tags:
476476
$ref: "./tags/studies/api-study-studyId-chapterId-tags.yaml"
477477

478+
/api/study/{studyId}/{chapterId}/moves:
479+
$ref: "./tags/studies/api-study-studyId-chapterId-moves.yaml"
480+
478481
/api/study/by/{username}/export.pgn:
479482
$ref: "./tags/studies/api-study-by-username-export.pgn.yaml"
480483

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
post:
2+
operationId: apiStudyChapterMoves
3+
summary: Update the moves of a study chapter
4+
description: |
5+
Replaces the moves tree of a study chapter.
6+
No tags will be modified.
7+
tags:
8+
- Studies
9+
security:
10+
- OAuth2: ["study:write"]
11+
parameters:
12+
- in: path
13+
name: studyId
14+
description: The study ID
15+
required: true
16+
schema:
17+
type: string
18+
minLength: 8
19+
maxLength: 8
20+
- in: path
21+
name: chapterId
22+
description: The chapter ID
23+
required: true
24+
schema:
25+
type: string
26+
minLength: 8
27+
maxLength: 8
28+
requestBody:
29+
required: true
30+
content:
31+
application/x-www-form-urlencoded:
32+
schema:
33+
type: object
34+
properties:
35+
pgn:
36+
type: string
37+
description: |
38+
PGN text containing the moves that will replace the chapter's existing moves.
39+
Any provided tags are ignored.
40+
required:
41+
- pgn
42+
responses:
43+
"204":
44+
description: Moves updated, as the chapter exists and you are allowed to edit it.
45+
headers:
46+
Access-Control-Allow-Origin:
47+
schema:
48+
type: string
49+
default: "'*'"
50+
"400":
51+
description: Bad request - might be the provided study/chapter doesn't exist, or you aren't allowed to edit it, or the PGN is invalid.
52+
content:
53+
application/json:
54+
schema:
55+
$ref: "../../schemas/Error.yaml"

doc/specs/tags/studies/api-study-studyId-chapterId-tags.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ post:
5252
type: string
5353
default: "'*'"
5454
"400":
55-
description: The creation of the chapter(s) failed.
55+
description: The request body was invalid, such as missing or malformed PGN tag data.
5656
content:
5757
application/json:
5858
schema:

0 commit comments

Comments
 (0)