lishogi

Lishogi - the Ruby gem for the Lishogi.org API reference

Introduction

Welcome to the reference for the Lishogi API! Lishogi is free/libre, open-source shogi server forked from lichess powered by volunteers and donations.

Currently this page is a work in progress, certain information here might be wrong and incorrect! Expect it to be done during 2022.

Endpoint

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

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 (for lichess) to help reading NDJSON streamed responses.

This SDK is automatically generated by the OpenAPI Generator project:

  • API version: 2.0.0
  • Package version: 0.1.0
  • Generator version: 7.10.0
  • Build package: org.openapitools.codegen.languages.RubyClientCodegen For more information, please visit https://lishogi.org/api

Installation

Build a gem

To build the Ruby code into a gem:

gem build lishogi.gemspec

Then either install the gem locally:

gem install ./lishogi-0.1.0.gem

(for development, run gem install --dev ./lishogi-0.1.0.gem to install the development dependencies)

or publish the gem to a gem hosting service, e.g. RubyGems.

Finally add this to the Gemfile:

gem 'lishogi', '~> 0.1.0'

Install from Git

If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:

gem 'lishogi', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'

Include the Ruby code directly

Include the Ruby code directly using -I as follows:

ruby -Ilib script.rb

Getting Started

Please follow the installation procedure and then run the following code:

# Load the gem
require 'lishogi'

# Setup authorization
Lishogi.configure do |config|
  # Configure OAuth2 access token for authorization: OAuth2
  config.access_token = 'YOUR ACCESS TOKEN'
  # Configure a proc to get access tokens in lieu of the static access_token configuration
  config.access_token_getter = -> { 'YOUR TOKEN GETTER PROC' } 
  # Configure faraday connection
  config.configure_faraday_connection { |connection| 'YOUR CONNECTION CONFIG PROC' }
end

api_instance = Lishogi::AccountApi.new

begin
  #Get my preferences
  result = api_instance.
  p result
rescue Lishogi::ApiError => e
  puts "Exception when calling AccountApi->account: #{e}"
end

Documentation for API Endpoints

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

Class Method HTTP request Description
Lishogi::AccountApi account GET /api/account/preferences Get my preferences
Lishogi::AccountApi account_email GET /api/account/email Get my email address
Lishogi::AccountApi account_kid GET /api/account/kid Get my kid mode status
Lishogi::AccountApi account_kid_post POST /api/account/kid Set my kid mode status
Lishogi::AccountApi account_me GET /api/account Get my profile
Lishogi::AnalysisApi api_cloud_eval GET /api/cloud-eval Get cloud evaluation of a position.
Lishogi::ArenaTournamentsApi api_team_arena GET /api/team/teamId/arena Get team Arena tournaments
Lishogi::ArenaTournamentsApi api_tournament GET /api/tournament Get current tournaments
Lishogi::ArenaTournamentsApi api_tournament_post POST /api/tournament Create a new Arena tournament
Lishogi::ArenaTournamentsApi api_user_name_tournament_created GET /api/user/username/tournament/created Get tournaments created by a user
Lishogi::ArenaTournamentsApi games_by_tournament GET /api/tournament/id/games Export games of an Arena tournament
Lishogi::ArenaTournamentsApi results_by_tournament GET /api/tournament/id/results Get results of an Arena tournament
Lishogi::ArenaTournamentsApi teams_by_tournament GET /api/tournament/id/teams Get team standing of a team battle
Lishogi::ArenaTournamentsApi tournament GET /api/tournament/id Get info about an Arena tournament
Lishogi::BoardApi api_board_seek POST /api/board/seek Create a seek
Lishogi::BoardApi api_stream_event GET /api/stream/event Stream incoming events
Lishogi::BoardApi board_game_abort POST /api/board/game/gameId/abort Abort a game
Lishogi::BoardApi board_game_chat_get GET /api/board/game/gameId/chat Fetch the game chat
Lishogi::BoardApi board_game_chat_post POST /api/board/game/gameId/chat Write in the chat
Lishogi::BoardApi board_game_move POST /api/board/game/gameId/move/move Make a Board move
Lishogi::BoardApi board_game_resign POST /api/board/game/gameId/resign Resign a game
Lishogi::BoardApi board_game_stream GET /api/board/game/stream/gameId Stream Board game state
Lishogi::BoardApi board_game_takeback POST /api/board/game/gameId/takeback/accept Handle takeback offers
Lishogi::BotApi api_bot_online GET /api/bot/online Get online bots
Lishogi::BotApi api_stream_event GET /api/stream/event Stream incoming events
Lishogi::BotApi bot_account_upgrade POST /api/bot/account/upgrade Upgrade to Bot account
Lishogi::BotApi bot_game_abort POST /api/bot/game/gameId/abort Abort a game
Lishogi::BotApi bot_game_chat POST /api/bot/game/gameId/chat Write in the chat
Lishogi::BotApi bot_game_chat_get GET /api/bot/game/gameId/chat Fetch the game chat
Lishogi::BotApi bot_game_move POST /api/bot/game/gameId/move/move Make a Bot move
Lishogi::BotApi bot_game_resign POST /api/bot/game/gameId/resign Resign a game
Lishogi::BotApi bot_game_stream GET /api/bot/game/stream/gameId Stream Bot game state
Lishogi::ChallengesApi challenge_accept POST /api/challenge/challengeId/accept Accept a challenge
Lishogi::ChallengesApi challenge_ai POST /api/challenge/ai Challenge the AI
Lishogi::ChallengesApi challenge_create POST /api/challenge/username Create a challenge
Lishogi::ChallengesApi challenge_decline POST /api/challenge/challengeId/decline Decline a challenge
Lishogi::ChallengesApi challenge_open POST /api/challenge/open Open-ended challenge
Lishogi::GamesApi api_account_playing GET /api/account/playing Get my ongoing games
Lishogi::GamesApi api_games_user GET /api/games/user/username Export games of a user
Lishogi::GamesApi api_user_current_game GET /api/user/username/current-game Export ongoing game of a user
Lishogi::GamesApi game_kif GET /game/export/gameId Export one game
Lishogi::GamesApi games_by_users POST /api/stream/games-by-users Stream games of users
Lishogi::GamesApi stream_game GET /api/stream/game/id Stream moves of a game
Lishogi::MessagingApi inbox_username POST /inbox/username Send a private message
Lishogi::PuzzlesApi api_puzzle_activity GET /api/puzzle/activity Get your puzzle activity
Lishogi::PuzzlesApi api_puzzle_daily GET /api/puzzle/daily Get the daily puzzle
Lishogi::PuzzlesApi api_puzzle_dashboard GET /api/puzzle/dashboard/days Get your puzzle dashboard
Lishogi::SimulsApi api_simul GET /api/simul Get current simuls
Lishogi::StudiesApi study_all_chapters_kif GET /api/study/studyId.kif Export all chapters
Lishogi::StudiesApi study_chapter_kif GET /study/studyId/chapterId.kif Export one study chapter
Lishogi::StudiesApi study_export_all_kif GET /study/by/username/export.kif Export all studies of a user
Lishogi::TVApi tv_channel_games GET /api/tv/channel Get best ongoing games of a TV channel
Lishogi::TVApi tv_channels GET /api/tv/channels Get current TV games
Lishogi::TVApi tv_feed GET /api/tv/feed Stream current TV game
Lishogi::TeamsApi api_team_arena GET /api/team/teamId/arena Get team Arena tournaments
Lishogi::TeamsApi team_all GET /api/team/all Get popular teams
Lishogi::TeamsApi team_id_join POST /team/teamId/join Join a team
Lishogi::TeamsApi team_id_kick_user_id POST /team/teamId/kick/userId Kick a user from your team
Lishogi::TeamsApi team_id_pm_all POST /team/teamId/pm-all Message all members
Lishogi::TeamsApi team_id_quit POST /team/teamId/quit Leave a team
Lishogi::TeamsApi team_id_users GET /api/team/teamId/users Get members of a team
Lishogi::TeamsApi team_of_username GET /api/team/of/username Teams of a player
Lishogi::TeamsApi team_search GET /api/team/search Search teams
Lishogi::TeamsApi team_show GET /api/team/teamId Get a single team
Lishogi::UsersApi api_crosstable GET /api/crosstable/user1/user2 Get crosstable
Lishogi::UsersApi api_user GET /api/user/username Get user public data
Lishogi::UsersApi api_user_activity GET /api/user/username/activity Get user activity
Lishogi::UsersApi api_user_rating_history GET /api/user/username/rating-history Get rating history of a user
Lishogi::UsersApi api_users POST /api/users Get users by ID
Lishogi::UsersApi api_users_status GET /api/users/status Get real-time users status
Lishogi::UsersApi player GET /player Get all top 10
Lishogi::UsersApi player_top_nb_perf_type GET /player/top/nb/perfType Get one leaderboard
Lishogi::UsersApi streamer_live GET /streamer/live Get live streamers
Lishogi::UsersApi team_id_users GET /api/team/teamId/users Get members of a team

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

OAuth2

  • Type: OAuth
  • Flow: accessCode
  • Authorization URL: https://lishogi.org/oauth
  • Scopes:
    • preference:read: Read your preferences
    • preference:write: Write your preferences
    • email:read: Read your email address
    • challenge:read: Read incoming challenges
    • challenge:write: Create, accept, decline challenges
    • study:read: Read private studies
    • study:write: Create, update and delete studies
    • tournament:write: Create tournaments
    • puzzle:read: Read puzzle activity
    • team:write: Join, leave, and manage teams
    • msg:write: Send private messages to other players
    • board:play: Play with the Board API
    • bot:play: Play with the Bot API. Only for Bot accounts