Skip to content

Latest commit

 

History

History
362 lines (329 loc) · 31 KB

Generated-README.md

File metadata and controls

362 lines (329 loc) · 31 KB

Rust API client for openapi

Introduction

Welcome to the reference for the Lichess API! Lichess is free/libre, open-source chess server powered by volunteers and donations.

Endpoint

All requests go to https://lichess.org (unless otherwise specified).

Clients

Rate limiting

All requests are rate limited using various strategies, to ensure the API remains responsive for everyone. Only make one request at a time. If you receive an HTTP response with a 429 status, please wait a full minute before resuming API usage.

Streaming with ND-JSON

Some API endpoints stream their responses as Newline Delimited JSON a.k.a. nd-json, with one JSON object per line.

Here's a JavaScript utility function to help reading NDJSON streamed responses.

Authentication

Which authentication method is right for me?

Read about the Lichess API authentication methods and code examples

Personal Access Token

Personal API access tokens allow you to quickly interact with Lichess API without going through an OAuth flow.

Authorization Code Flow with PKCE

The authorization code flow with PKCE allows your users to login with Lichess. Lichess supports unregistered and public clients (no client authentication, choose any unique client id). The only accepted code challenge method is S256. Access tokens are long-lived (expect one year), unless they are revoked. Refresh tokens are not supported.

See the documentation for the OAuth endpoints or the PKCE RFC for a precise protocol description.

Real life examples

Token format

Access tokens and authorization codes match ^[A-Za-z0-9_]+$. The length of tokens can be increased without notice. Make sure your application can handle at least 512 characters. By convention tokens have a recognizable prefix, but do not rely on this.

For more information, please visit https://lichess.org/api

Overview

This API client was generated by the OpenAPI Generator project. By using the openapi-spec from a remote server, you can easily generate an API client.

  • API version: 2.0.0
  • Package version: 2.0.0
  • Build package: org.openapitools.codegen.languages.RustClientCodegen

Installation

Put the package under your project folder in a directory named openapi and add the following to Cargo.toml under [dependencies]:

openapi = { path = "./openapi" }

Documentation for API Endpoints

All URIs are relative to https://lichess.org

Class Method HTTP request Description
AccountApi account GET /api/account/preferences Get my preferences
AccountApi account_email GET /api/account/email Get my email address
AccountApi account_kid GET /api/account/kid Get my kid mode status
AccountApi account_kid_post POST /api/account/kid Set my kid mode status
AccountApi account_me GET /api/account Get my profile
AccountApi timeline GET /api/timeline Get my timeline
AnalysisApi api_cloud_eval GET /api/cloud-eval Get cloud evaluation of a position.
ArenaTournamentsApi api_team_arena GET /api/team/{teamId}/arena Get team Arena tournaments
ArenaTournamentsApi api_tournament GET /api/tournament Get current tournaments
ArenaTournamentsApi api_tournament_join POST /api/tournament/{id}/join Join an Arena tournament
ArenaTournamentsApi api_tournament_post POST /api/tournament Create a new Arena tournament
ArenaTournamentsApi api_tournament_team_battle_post POST /api/tournament/team-battle/{id} Update a team battle
ArenaTournamentsApi api_tournament_terminate POST /api/tournament/{id}/terminate Terminate an Arena tournament
ArenaTournamentsApi api_tournament_update POST /api/tournament/{id} Update an Arena tournament
ArenaTournamentsApi api_tournament_withdraw POST /api/tournament/{id}/withdraw Pause or leave an Arena tournament
ArenaTournamentsApi api_user_name_tournament_created GET /api/user/{username}/tournament/created Get tournaments created by a user
ArenaTournamentsApi games_by_tournament GET /api/tournament/{id}/games Export games of an Arena tournament
ArenaTournamentsApi results_by_tournament GET /api/tournament/{id}/results Get results of an Arena tournament
ArenaTournamentsApi teams_by_tournament GET /api/tournament/{id}/teams Get team standing of a team battle
ArenaTournamentsApi tournament GET /api/tournament/{id} Get info about an Arena tournament
BoardApi api_board_seek POST /api/board/seek Create a seek
BoardApi api_stream_event GET /api/stream/event Stream incoming events
BoardApi board_game_abort POST /api/board/game/{gameId}/abort Abort a game
BoardApi board_game_berserk POST /api/board/game/{gameId}/berserk Berserk a tournament game
BoardApi board_game_chat_get GET /api/board/game/{gameId}/chat Fetch the game chat
BoardApi board_game_chat_post POST /api/board/game/{gameId}/chat Write in the chat
BoardApi board_game_claim_victory POST /api/board/game/{gameId}/claim-victory Claim victory of a game
BoardApi board_game_draw POST /api/board/game/{gameId}/draw/{accept} Handle draw offers
BoardApi board_game_move POST /api/board/game/{gameId}/move/{move} Make a Board move
BoardApi board_game_resign POST /api/board/game/{gameId}/resign Resign a game
BoardApi board_game_stream GET /api/board/game/stream/{gameId} Stream Board game state
BoardApi board_game_takeback POST /api/board/game/{gameId}/takeback/{accept} Handle takeback offers
BotApi api_bot_online GET /api/bot/online Get online bots
BotApi api_stream_event GET /api/stream/event Stream incoming events
BotApi bot_account_upgrade POST /api/bot/account/upgrade Upgrade to Bot account
BotApi bot_game_abort POST /api/bot/game/{gameId}/abort Abort a game
BotApi bot_game_chat POST /api/bot/game/{gameId}/chat Write in the chat
BotApi bot_game_chat_get GET /api/bot/game/{gameId}/chat Fetch the game chat
BotApi bot_game_draw POST /api/bot/game/{gameId}/draw/{accept} Handle draw offers in bot games
BotApi bot_game_move POST /api/bot/game/{gameId}/move/{move} Make a Bot move
BotApi bot_game_resign POST /api/bot/game/{gameId}/resign Resign a game
BotApi bot_game_stream GET /api/bot/game/stream/{gameId} Stream Bot game state
BroadcastsApi broadcast_all_rounds_pgn GET /api/broadcast/{broadcastTournamentId}.pgn Export all rounds as PGN
BroadcastsApi broadcast_index GET /api/broadcast Get official broadcasts
BroadcastsApi broadcast_my_rounds_get GET /api/broadcast/my-rounds Get your broadcast rounds
BroadcastsApi broadcast_push POST /broadcast/round/{broadcastRoundId}/push Push PGN to your broadcast round
BroadcastsApi broadcast_round_create POST /broadcast/{broadcastTournamentId}/new Create a broadcast round
BroadcastsApi broadcast_round_get GET /api/broadcast/{broadcastTournamentSlug}/{broadcastRoundSlug}/{broadcastRoundId} Get a broadcast round
BroadcastsApi broadcast_round_pgn GET /api/broadcast/round/{broadcastRoundId}.pgn Export one round as PGN
BroadcastsApi broadcast_round_update POST /broadcast/round/{broadcastRoundId}/edit Update your broadcast round
BroadcastsApi broadcast_stream_round_pgn GET /api/stream/broadcast/round/{broadcastRoundId}.pgn Stream an ongoing broadcast tournament as PGN
BroadcastsApi broadcast_tour_create POST /broadcast/new Create a broadcast tournament
BroadcastsApi broadcast_tour_get GET /broadcast/{slug}/{broadcastTournamentId} Get your broadcast tournament
BroadcastsApi broadcast_tour_update POST /broadcast/{broadcastTournamentId}/edit Update your broadcast tournament
BulkPairingsApi bulk_pairing_create POST /api/bulk-pairing Create a bulk pairing
BulkPairingsApi bulk_pairing_delete DELETE /api/bulk-pairing/{id} Cancel a bulk pairing
BulkPairingsApi bulk_pairing_get GET /api/bulk-pairing/{id} Show a bulk pairing
BulkPairingsApi bulk_pairing_list GET /api/bulk-pairing View your bulk pairings
BulkPairingsApi bulk_pairing_start_clocks POST /api/bulk-pairing/{id}/start-clocks Manually start clocks
ChallengesApi admin_challenge_tokens POST /api/token/admin-challenge Admin challenge tokens
ChallengesApi challenge_accept POST /api/challenge/{challengeId}/accept Accept a challenge
ChallengesApi challenge_ai POST /api/challenge/ai Challenge the AI
ChallengesApi challenge_cancel POST /api/challenge/{challengeId}/cancel Cancel a challenge
ChallengesApi challenge_create POST /api/challenge/{username} Create a challenge
ChallengesApi challenge_decline POST /api/challenge/{challengeId}/decline Decline a challenge
ChallengesApi challenge_list GET /api/challenge List your challenges
ChallengesApi challenge_open POST /api/challenge/open Open-ended challenge
ChallengesApi challenge_start_clocks POST /api/challenge/{gameId}/start-clocks Start clocks of a game
ChallengesApi round_add_time POST /api/round/{gameId}/add-time/{seconds} Add time to the opponent clock
ExternalEngineApi api_external_engine_acquire POST /api/external-engine/work Acquire analysis request
ExternalEngineApi api_external_engine_analyse POST /api/external-engine/{id}/analyse Analyse with external engine
ExternalEngineApi api_external_engine_create POST /api/external-engine Create external engine
ExternalEngineApi api_external_engine_delete DELETE /api/external-engine/{id} Delete external engine
ExternalEngineApi api_external_engine_get GET /api/external-engine/{id} Get external engine
ExternalEngineApi api_external_engine_list GET /api/external-engine List external engines
ExternalEngineApi api_external_engine_put PUT /api/external-engine/{id} Update external engine
ExternalEngineApi api_external_engine_submit POST /api/external-engine/work/{id} Answer analysis request
GamesApi api_account_playing GET /api/account/playing Get my ongoing games
GamesApi api_games_user GET /api/games/user/{username} Export games of a user
GamesApi api_imported_games_user GET /api/games/export/imports Export your imported games
GamesApi api_user_current_game GET /api/user/{username}/current-game Export ongoing game of a user
GamesApi game_import POST /api/import Import one game
GamesApi game_pgn GET /game/export/{gameId} Export one game
GamesApi games_by_ids POST /api/stream/games/{streamId} Stream games by IDs
GamesApi games_by_ids_add POST /api/stream/games/{streamId}/add Add game IDs to stream
GamesApi games_by_users POST /api/stream/games-by-users Stream games of users
GamesApi games_export_ids POST /api/games/export/_ids Export games by IDs
GamesApi stream_game GET /api/stream/game/{id} Stream moves of a game
MessagingApi inbox_username POST /inbox/{username} Send a private message
OAuthApi api_token POST /api/token Obtain access token
OAuthApi api_token_delete DELETE /api/token Revoke access token
OAuthApi oauth GET /oauth Request authorization code
OAuthApi token_test POST /api/token/test Test multiple OAuth tokens
OpeningExplorerApi opening_explorer_lichess GET /lichess Lichess games
OpeningExplorerApi opening_explorer_master GET /masters Masters database
OpeningExplorerApi opening_explorer_master_game GET /master/pgn/{gameId} OTB master game
OpeningExplorerApi opening_explorer_player GET /player Player games
PuzzlesApi api_puzzle_activity GET /api/puzzle/activity Get your puzzle activity
PuzzlesApi api_puzzle_daily GET /api/puzzle/daily Get the daily puzzle
PuzzlesApi api_puzzle_dashboard GET /api/puzzle/dashboard/{days} Get your puzzle dashboard
PuzzlesApi api_puzzle_id GET /api/puzzle/{id} Get a puzzle by its ID
PuzzlesApi api_storm_dashboard GET /api/storm/dashboard/{username} Get the storm dashboard of a player
PuzzlesApi racer_post POST /api/racer Create and join a puzzle race
RelationsApi api_user_following GET /api/rel/following Get users followed by the logged in user
RelationsApi follow_user POST /api/rel/follow/{username} Follow a player
RelationsApi unfollow_user POST /api/rel/unfollow/{username} Unfollow a player
SimulsApi api_simul GET /api/simul Get current simuls
StudiesApi api_study_import_pgn POST /api/study/{studyId}/import-pgn Import PGN into a study
StudiesApi study_all_chapters_head HEAD /api/study/{studyId}.pgn Study metadata
StudiesApi study_all_chapters_pgn GET /api/study/{studyId}.pgn Export all chapters
StudiesApi study_chapter_pgn GET /api/study/{studyId}/{chapterId}.pgn Export one study chapter
StudiesApi study_export_all_pgn GET /study/by/{username}/export.pgn Export all studies of a user
StudiesApi study_list_metadata GET /api/study/by/{username} List studies of a user
SwissTournamentsApi api_swiss_join POST /api/swiss/{id}/join Join a Swiss tournament
SwissTournamentsApi api_swiss_new POST /api/swiss/new/{teamId} Create a new Swiss tournament
SwissTournamentsApi api_swiss_schedule_next_round POST /api/swiss/{id}/schedule-next-round Manually schedule the next round
SwissTournamentsApi api_swiss_terminate POST /api/swiss/{id}/terminate Terminate a Swiss tournament
SwissTournamentsApi api_swiss_update POST /api/swiss/{id}/edit Update a Swiss tournament
SwissTournamentsApi api_swiss_withdraw POST /api/swiss/{id}/withdraw Pause or leave a swiss tournament
SwissTournamentsApi api_team_swiss GET /api/team/{teamId}/swiss Get team swiss tournaments
SwissTournamentsApi games_by_swiss GET /api/swiss/{id}/games Export games of a Swiss tournament
SwissTournamentsApi results_by_swiss GET /api/swiss/{id}/results Get results of a swiss tournament
SwissTournamentsApi swiss GET /api/swiss/{id} Get info about a Swiss tournament
SwissTournamentsApi swiss_trf GET /swiss/{id}.trf Export TRF of a Swiss tournament
TvApi tv_channel_games GET /api/tv/{channel} Get best ongoing games of a TV channel
TvApi tv_channels GET /api/tv/channels Get current TV games
TvApi tv_feed GET /api/tv/feed Stream current TV game
TablebaseApi antichess_atomic GET /antichess Tablebase lookup for Antichess
TablebaseApi tablebase_atomic GET /atomic Tablebase lookup for Atomic chess
TablebaseApi tablebase_standard GET /standard Tablebase lookup
TeamsApi api_team_arena GET /api/team/{teamId}/arena Get team Arena tournaments
TeamsApi api_team_swiss GET /api/team/{teamId}/swiss Get team swiss tournaments
TeamsApi team_all GET /api/team/all Get popular teams
TeamsApi team_id_join POST /team/{teamId}/join Join a team
TeamsApi team_id_kick_user_id POST /api/team/{teamId}/kick/{userId} Kick a user from your team
TeamsApi team_id_pm_all POST /team/{teamId}/pm-all Message all members
TeamsApi team_id_quit POST /team/{teamId}/quit Leave a team
TeamsApi team_id_users GET /api/team/{teamId}/users Get members of a team
TeamsApi team_of_username GET /api/team/of/{username} Teams of a player
TeamsApi team_request_accept POST /api/team/{teamId}/request/{userId}/accept Accept join request
TeamsApi team_request_decline POST /api/team/{teamId}/request/{userId}/decline Decline join request
TeamsApi team_requests GET /api/team/{teamId}/requests Get join requests
TeamsApi team_search GET /api/team/search Search teams
TeamsApi team_show GET /api/team/{teamId} Get a single team
UsersApi api_crosstable GET /api/crosstable/{user1}/{user2} Get crosstable
UsersApi api_player_autocomplete GET /api/player/autocomplete Autocomplete usernames
UsersApi api_user GET /api/user/{username} Get user public data
UsersApi api_user_activity GET /api/user/{username}/activity Get user activity
UsersApi api_user_perf GET /api/user/{username}/perf/{perf} Get performance statistics of a user
UsersApi api_user_rating_history GET /api/user/{username}/rating-history Get rating history of a user
UsersApi api_users POST /api/users Get users by ID
UsersApi api_users_status GET /api/users/status Get real-time users status
UsersApi player GET /api/player Get all top 10
UsersApi player_top_nb_perf_type GET /api/player/top/{nb}/{perfType} Get one leaderboard
UsersApi read_note GET /api/user/{username}/note Get notes for a user
UsersApi streamer_live GET /api/streamer/live Get live streamers
UsersApi write_note POST /api/user/{username}/note Add a note for a user

Documentation For Models

To get access to the crate's generated documentation, use:

cargo doc --open

Author

[email protected]