Skip to content

Commit

Permalink
document /api/puzzle/next - closes lichess-org/lila#16465
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Nov 28, 2024
1 parent c77d476 commit 6b0295e
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
3 changes: 3 additions & 0 deletions doc/specs/lichess-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,9 @@ paths:
/api/puzzle/{id}:
$ref: './tags/puzzles/api-puzzle-id.yaml'

/api/puzzle/next:
$ref: './tags/puzzles/api-puzzle-next.yaml'

/api/puzzle/activity:
$ref: './tags/puzzles/api-puzzle-activity.yaml'

Expand Down
46 changes: 46 additions & 0 deletions doc/specs/tags/puzzles/api-puzzle-next.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
get:
operationId: apiPuzzleNext
summary: Get a new puzzle
description: |
Get a random Lichess puzzle in JSON format.
If authenticated, only returns puzzles that the user has never seen before.
**DO NOT** use this endpoint to enumerate puzzles for mass download. Instead, download the [full public puzzle database](https://database.lichess.org/#puzzles).
tags:
- Puzzles
security:
- OAuth2: ["puzzle:read"]
parameters:
- in: path

Check failure on line 15 in doc/specs/tags/puzzles/api-puzzle-next.yaml

View workflow job for this annotation

GitHub Actions / Lint OpenAPI spec

oas3-schema "0" property must match "then" schema.

Check failure on line 15 in doc/specs/tags/puzzles/api-puzzle-next.yaml

View workflow job for this annotation

GitHub Actions / Lint OpenAPI spec

path-params Path parameter "angle" must have "required" property that is set to "true".

Check failure on line 15 in doc/specs/tags/puzzles/api-puzzle-next.yaml

View workflow job for this annotation

GitHub Actions / Lint OpenAPI spec

path-params Parameter "angle" must be used in path "/api/puzzle/next".
name: angle
required: false

Check failure on line 17 in doc/specs/tags/puzzles/api-puzzle-next.yaml

View workflow job for this annotation

GitHub Actions / Lint OpenAPI spec

oas3-schema "required" property must be equal to constant.
description: |
The theme or opening to filter puzzles with.
Available themes are listed in [the lichess source code](https://github.com/lichess-org/lila/blob/master/modules/puzzle/src/main/PuzzleTheme.scala).
schema:
type: string
- in: path

Check failure on line 24 in doc/specs/tags/puzzles/api-puzzle-next.yaml

View workflow job for this annotation

GitHub Actions / Lint OpenAPI spec

oas3-schema "1" property must match "then" schema.

Check failure on line 24 in doc/specs/tags/puzzles/api-puzzle-next.yaml

View workflow job for this annotation

GitHub Actions / Lint OpenAPI spec

path-params Path parameter "difficulty" must have "required" property that is set to "true".

Check failure on line 24 in doc/specs/tags/puzzles/api-puzzle-next.yaml

View workflow job for this annotation

GitHub Actions / Lint OpenAPI spec

path-params Parameter "difficulty" must be used in path "/api/puzzle/next".
name: difficulty
required: false

Check failure on line 26 in doc/specs/tags/puzzles/api-puzzle-next.yaml

View workflow job for this annotation

GitHub Actions / Lint OpenAPI spec

oas3-schema "required" property must be equal to constant.
description: The desired puzzle difficulty, relative to the authenticated user puzzle rating, or 1500 if anonymous.
schema:
enum:
- easiest
- easier
- normal
- harder
- hardest
responses:
"200":
description: The requested puzzle.
headers:
Access-Control-Allow-Origin:
schema:
type: string
default: "'*'"
content:
application/json:
schema:
$ref: "../../schemas/PuzzleAndGame.yaml"

0 comments on commit 6b0295e

Please sign in to comment.