lishogi 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/LICENSE +661 -0
- data/LICENSE~ +1 -0
- data/Makefile +39 -0
- data/Makefile~ +7 -0
- data/README.md +276 -0
- data/Rakefile +10 -0
- data/docs/Account200Response.md +20 -0
- data/docs/AccountApi.md +345 -0
- data/docs/AccountEmail200Response.md +18 -0
- data/docs/AccountKid200Response.md +18 -0
- data/docs/AnalysisApi.md +77 -0
- data/docs/ApiStreamEvent200Response.md +53 -0
- data/docs/ApiUsersStatus200ResponseInner.md +30 -0
- data/docs/ArenaTournaments.md +22 -0
- data/docs/ArenaTournamentsApi.md +601 -0
- data/docs/BoardApi.md +659 -0
- data/docs/BoardGameStream200Response.md +51 -0
- data/docs/BoardGameTakebackAcceptParameter.md +15 -0
- data/docs/BotApi.md +634 -0
- data/docs/ChallengeDeclinedEvent.md +20 -0
- data/docs/ChallengeEvent.md +20 -0
- data/docs/ChallengeJson.md +42 -0
- data/docs/ChallengeJsonPerf.md +20 -0
- data/docs/ChallengeJsonTimeControl.md +51 -0
- data/docs/ChallengeJsonTimeControlOneOf.md +28 -0
- data/docs/ChallengeJsonTimeControlOneOf1.md +20 -0
- data/docs/ChallengeJsonTimeControlOneOf2.md +18 -0
- data/docs/ChallengeUser.md +30 -0
- data/docs/ChallengesApi.md +414 -0
- data/docs/ChatLineEvent.md +24 -0
- data/docs/Clock.md +24 -0
- data/docs/Count.md +38 -0
- data/docs/Error.md +18 -0
- data/docs/GameEventInfo.md +22 -0
- data/docs/GameEventInfoCompat.md +20 -0
- data/docs/GameEventPlayer.md +28 -0
- data/docs/GameFinishEvent.md +20 -0
- data/docs/GameFullEvent.md +42 -0
- data/docs/GameFullEventPerf.md +18 -0
- data/docs/GameJson.md +50 -0
- data/docs/GameJsonAnalysisInner.md +24 -0
- data/docs/GameJsonAnalysisInnerJudgment.md +20 -0
- data/docs/GameJsonClock.md +26 -0
- data/docs/GameJsonPlayers.md +20 -0
- data/docs/GameStartEvent.md +20 -0
- data/docs/GameStateEvent.md +38 -0
- data/docs/GameStatus.md +15 -0
- data/docs/GameUser.md +32 -0
- data/docs/GameUserAnalysis.md +24 -0
- data/docs/GamesApi.md +473 -0
- data/docs/LightUser.md +24 -0
- data/docs/LightUserTitle.md +49 -0
- data/docs/MessagingApi.md +79 -0
- data/docs/Move.md +28 -0
- data/docs/NotFound.md +18 -0
- data/docs/OAuthError.md +20 -0
- data/docs/Ok.md +18 -0
- data/docs/Perf.md +26 -0
- data/docs/PerfType.md +15 -0
- data/docs/Perfs.md +30 -0
- data/docs/PlayTime.md +20 -0
- data/docs/Profile.md +28 -0
- data/docs/PuzzleRoundJson.md +24 -0
- data/docs/PuzzlesApi.md +211 -0
- data/docs/SimulsApi.md +69 -0
- data/docs/Speed.md +15 -0
- data/docs/StudiesApi.md +233 -0
- data/docs/TVApi.md +208 -0
- data/docs/Team.md +32 -0
- data/docs/TeamAll200Response.md +30 -0
- data/docs/TeamRequest.md +24 -0
- data/docs/TeamRequestWithUser.md +20 -0
- data/docs/TeamsApi.md +702 -0
- data/docs/Title.md +15 -0
- data/docs/User.md +42 -0
- data/docs/UserExtended.md +60 -0
- data/docs/UserPreferences.md +72 -0
- data/docs/UsersApi.md +667 -0
- data/docs/Variant.md +22 -0
- data/docs/VariantKey.md +15 -0
- data/git_push.sh +57 -0
- data/lib/lishogi/api/account_api.rb +314 -0
- data/lib/lishogi/api/analysis_api.rb +92 -0
- data/lib/lishogi/api/arena_tournaments_api.rb +681 -0
- data/lib/lishogi/api/board_api.rb +685 -0
- data/lib/lishogi/api/bot_api.rb +608 -0
- data/lib/lishogi/api/challenges_api.rb +554 -0
- data/lib/lishogi/api/games_api.rb +514 -0
- data/lib/lishogi/api/messaging_api.rb +97 -0
- data/lib/lishogi/api/puzzles_api.rb +210 -0
- data/lib/lishogi/api/simuls_api.rb +79 -0
- data/lib/lishogi/api/studies_api.rb +244 -0
- data/lib/lishogi/api/teams_api.rb +678 -0
- data/lib/lishogi/api/tv_api.rb +222 -0
- data/lib/lishogi/api/users_api.rb +677 -0
- data/lib/lishogi/api_client.rb +437 -0
- data/lib/lishogi/api_error.rb +58 -0
- data/lib/lishogi/configuration.rb +392 -0
- data/lib/lishogi/models/account200_response.rb +223 -0
- data/lib/lishogi/models/account_email200_response.rb +214 -0
- data/lib/lishogi/models/account_kid200_response.rb +214 -0
- data/lib/lishogi/models/api_stream_event200_response.rb +107 -0
- data/lib/lishogi/models/api_users_status200_response_inner.rb +273 -0
- data/lib/lishogi/models/arena_tournaments.rb +238 -0
- data/lib/lishogi/models/board_game_stream200_response.rb +106 -0
- data/lib/lishogi/models/board_game_takeback_accept_parameter.rb +104 -0
- data/lib/lishogi/models/challenge_declined_event.rb +257 -0
- data/lib/lishogi/models/challenge_event.rb +257 -0
- data/lib/lishogi/models/challenge_json.rb +453 -0
- data/lib/lishogi/models/challenge_json_perf.rb +223 -0
- data/lib/lishogi/models/challenge_json_time_control.rb +106 -0
- data/lib/lishogi/models/challenge_json_time_control_one_of.rb +259 -0
- data/lib/lishogi/models/challenge_json_time_control_one_of1.rb +223 -0
- data/lib/lishogi/models/challenge_json_time_control_one_of2.rb +214 -0
- data/lib/lishogi/models/challenge_user.rb +275 -0
- data/lib/lishogi/models/chat_line_event.rb +315 -0
- data/lib/lishogi/models/clock.rb +242 -0
- data/lib/lishogi/models/count.rb +304 -0
- data/lib/lishogi/models/error.rb +215 -0
- data/lib/lishogi/models/game_event_info.rb +266 -0
- data/lib/lishogi/models/game_event_info_compat.rb +223 -0
- data/lib/lishogi/models/game_event_player.rb +260 -0
- data/lib/lishogi/models/game_finish_event.rb +257 -0
- data/lib/lishogi/models/game_full_event.rb +436 -0
- data/lib/lishogi/models/game_full_event_perf.rb +215 -0
- data/lib/lishogi/models/game_json.rb +457 -0
- data/lib/lishogi/models/game_json_analysis_inner.rb +251 -0
- data/lib/lishogi/models/game_json_analysis_inner_judgment.rb +258 -0
- data/lib/lishogi/models/game_json_clock.rb +250 -0
- data/lib/lishogi/models/game_json_players.rb +223 -0
- data/lib/lishogi/models/game_start_event.rb +257 -0
- data/lib/lishogi/models/game_state_event.rb +396 -0
- data/lib/lishogi/models/game_status.rb +52 -0
- data/lib/lishogi/models/game_user.rb +277 -0
- data/lib/lishogi/models/game_user_analysis.rb +269 -0
- data/lib/lishogi/models/light_user.rb +241 -0
- data/lib/lishogi/models/light_user_title.rb +105 -0
- data/lib/lishogi/models/move.rb +259 -0
- data/lib/lishogi/models/not_found.rb +214 -0
- data/lib/lishogi/models/o_auth_error.rb +225 -0
- data/lib/lishogi/models/ok.rb +214 -0
- data/lib/lishogi/models/perf.rb +250 -0
- data/lib/lishogi/models/perf_type.rb +49 -0
- data/lib/lishogi/models/perfs.rb +268 -0
- data/lib/lishogi/models/play_time.rb +223 -0
- data/lib/lishogi/models/profile.rb +259 -0
- data/lib/lishogi/models/puzzle_round_json.rb +241 -0
- data/lib/lishogi/models/speed.rb +44 -0
- data/lib/lishogi/models/team.rb +280 -0
- data/lib/lishogi/models/team_all200_response.rb +272 -0
- data/lib/lishogi/models/team_request.rb +241 -0
- data/lib/lishogi/models/team_request_with_user.rb +223 -0
- data/lib/lishogi/models/title.rb +64 -0
- data/lib/lishogi/models/user.rb +322 -0
- data/lib/lishogi/models/user_extended.rb +410 -0
- data/lib/lishogi/models/user_preferences.rb +515 -0
- data/lib/lishogi/models/variant.rb +256 -0
- data/lib/lishogi/models/variant_key.rb +44 -0
- data/lib/lishogi/version.rb +15 -0
- data/lib/lishogi.rb +112 -0
- data/lishogi-api.patched.yaml +5806 -0
- data/lishogi-api.yaml +5811 -0
- data/lishogi.gemspec +41 -0
- data/manifest.scm +1 -0
- data/manifest.scm~ +1 -0
- data/patch +5 -0
- data/patch~ +1 -0
- data/pkg/lishogi-0.1.0.gem +0 -0
- data/smoke +5 -0
- data/smoke~ +2 -0
- data/spec/api/account_api_spec.rb +91 -0
- data/spec/api/analysis_api_spec.rb +49 -0
- data/spec/api/arena_tournaments_api_spec.rb +160 -0
- data/spec/api/board_api_spec.rb +154 -0
- data/spec/api/bot_api_spec.rb +144 -0
- data/spec/api/challenges_api_spec.rb +123 -0
- data/spec/api/games_api_spec.rb +135 -0
- data/spec/api/messaging_api_spec.rb +48 -0
- data/spec/api/puzzles_api_spec.rb +70 -0
- data/spec/api/simuls_api_spec.rb +46 -0
- data/spec/api/studies_api_spec.rb +81 -0
- data/spec/api/teams_api_spec.rb +160 -0
- data/spec/api/tv_api_spec.rb +74 -0
- data/spec/api/users_api_spec.rb +157 -0
- data/spec/models/account200_response_spec.rb +42 -0
- data/spec/models/account_email200_response_spec.rb +36 -0
- data/spec/models/account_kid200_response_spec.rb +36 -0
- data/spec/models/api_stream_event200_response_spec.rb +32 -0
- data/spec/models/api_users_status200_response_inner_spec.rb +72 -0
- data/spec/models/arena_tournaments_spec.rb +48 -0
- data/spec/models/board_game_stream200_response_spec.rb +32 -0
- data/spec/models/board_game_takeback_accept_parameter_spec.rb +21 -0
- data/spec/models/challenge_declined_event_spec.rb +46 -0
- data/spec/models/challenge_event_spec.rb +46 -0
- data/spec/models/challenge_json_perf_spec.rb +42 -0
- data/spec/models/challenge_json_spec.rb +120 -0
- data/spec/models/challenge_json_time_control_one_of1_spec.rb +42 -0
- data/spec/models/challenge_json_time_control_one_of2_spec.rb +36 -0
- data/spec/models/challenge_json_time_control_one_of_spec.rb +66 -0
- data/spec/models/challenge_json_time_control_spec.rb +32 -0
- data/spec/models/challenge_user_spec.rb +72 -0
- data/spec/models/chat_line_event_spec.rb +62 -0
- data/spec/models/clock_spec.rb +54 -0
- data/spec/models/count_spec.rb +96 -0
- data/spec/models/error_spec.rb +36 -0
- data/spec/models/game_event_info_compat_spec.rb +42 -0
- data/spec/models/game_event_info_spec.rb +52 -0
- data/spec/models/game_event_player_spec.rb +66 -0
- data/spec/models/game_finish_event_spec.rb +46 -0
- data/spec/models/game_full_event_perf_spec.rb +36 -0
- data/spec/models/game_full_event_spec.rb +112 -0
- data/spec/models/game_json_analysis_inner_judgment_spec.rb +46 -0
- data/spec/models/game_json_analysis_inner_spec.rb +54 -0
- data/spec/models/game_json_clock_spec.rb +60 -0
- data/spec/models/game_json_players_spec.rb +42 -0
- data/spec/models/game_json_spec.rb +136 -0
- data/spec/models/game_start_event_spec.rb +46 -0
- data/spec/models/game_state_event_spec.rb +100 -0
- data/spec/models/game_status_spec.rb +30 -0
- data/spec/models/game_user_analysis_spec.rb +54 -0
- data/spec/models/game_user_spec.rb +78 -0
- data/spec/models/light_user_spec.rb +54 -0
- data/spec/models/light_user_title_spec.rb +32 -0
- data/spec/models/move_spec.rb +66 -0
- data/spec/models/not_found_spec.rb +36 -0
- data/spec/models/o_auth_error_spec.rb +42 -0
- data/spec/models/ok_spec.rb +36 -0
- data/spec/models/perf_spec.rb +60 -0
- data/spec/models/perf_type_spec.rb +30 -0
- data/spec/models/perfs_spec.rb +72 -0
- data/spec/models/play_time_spec.rb +42 -0
- data/spec/models/profile_spec.rb +66 -0
- data/spec/models/puzzle_round_json_spec.rb +54 -0
- data/spec/models/speed_spec.rb +30 -0
- data/spec/models/team_all200_response_spec.rb +72 -0
- data/spec/models/team_request_spec.rb +54 -0
- data/spec/models/team_request_with_user_spec.rb +42 -0
- data/spec/models/team_spec.rb +78 -0
- data/spec/models/title_spec.rb +30 -0
- data/spec/models/user_extended_spec.rb +162 -0
- data/spec/models/user_preferences_spec.rb +210 -0
- data/spec/models/user_spec.rb +108 -0
- data/spec/models/variant_key_spec.rb +30 -0
- data/spec/models/variant_spec.rb +48 -0
- data/spec/spec_helper.rb +111 -0
- metadata +446 -0
@@ -0,0 +1,144 @@
|
|
1
|
+
=begin
|
2
|
+
#Lishogi.org API reference
|
3
|
+
|
4
|
+
## 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. - Get help in the [Lishogi Discord channel](https://discord.gg/YFtpMGg3rR) - [Contribute to this documentation on Github](https://github.com/WandererXII/lishogi/blob/master/public/doc/lishogi-api.yaml) - Check out [Lishogi widgets to embed in your website](https://lishogi.org/developers) ## 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](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#429), 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**](http://ndjson.org/), with one JSON object per line. Here's a [JavaScript utility function (for lichess)](https://gist.github.com/ornicar/a097406810939cf7be1df8ea30e94f3e) to help reading NDJSON streamed responses.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 2.0.0
|
7
|
+
Contact: contact@lishogi.org
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.10.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
|
16
|
+
# Unit tests for Lishogi::BotApi
|
17
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
18
|
+
# Please update as you see appropriate
|
19
|
+
describe 'BotApi' do
|
20
|
+
before do
|
21
|
+
# run before each test
|
22
|
+
@api_instance = Lishogi::BotApi.new
|
23
|
+
end
|
24
|
+
|
25
|
+
after do
|
26
|
+
# run after each test
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'test an instance of BotApi' do
|
30
|
+
it 'should create an instance of BotApi' do
|
31
|
+
expect(@api_instance).to be_instance_of(Lishogi::BotApi)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# unit tests for api_bot_online
|
36
|
+
# Get online bots
|
37
|
+
# Stream the [online bot users](https://lishogi.org/player/bots), as [ndjson](#section/Introduction/Streaming-with-ND-JSON). Throttled to 50 bot users per second.
|
38
|
+
# @param [Hash] opts the optional parameters
|
39
|
+
# @option opts [Integer] :nb How many bot users to fetch
|
40
|
+
# @return [User]
|
41
|
+
describe 'api_bot_online test' do
|
42
|
+
it 'should work' do
|
43
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# unit tests for api_stream_event
|
48
|
+
# Stream incoming events
|
49
|
+
# Stream the events reaching a lishogi user in real time as [ndjson](#section/Introduction/Streaming-with-ND-JSON). Each line is a JSON object containing a `type` field. Possible values are: - `gameStart` Start of a game - `gameFinish` Completion of a game - `challenge` A player sends you a challenge or you challenge someone - `challengeDeclined` The opponent declines your challenge When the stream opens, all current challenges and games are sent.
|
50
|
+
# @param [Hash] opts the optional parameters
|
51
|
+
# @return [ApiStreamEvent200Response]
|
52
|
+
describe 'api_stream_event test' do
|
53
|
+
it 'should work' do
|
54
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# unit tests for bot_account_upgrade
|
59
|
+
# Upgrade to Bot account
|
60
|
+
# Upgrade a lishogi player account into a Bot account. Only Bot accounts can use the Bot API. The account **cannot have played any game** before becoming a Bot account. The upgrade is **irreversible**. The account will only be able to play as a Bot. To upgrade an account to Bot, use the [official lishogi-bot client](https://github.com/ShailChoksi/lishogi-bot), or follow these steps: - Create an [API access token](https://lishogi.org/account/oauth/token/create?scopes[]=bot:play) with \"Play bot moves\" permission. - `curl -d '' https://lishogi.org/api/bot/account/upgrade -H \"Authorization: Bearer <yourTokenHere>\"` To know if an account has already been upgraded, use the [Get my profile API](#operation/accountMe): the `title` field should be set to `BOT`.
|
61
|
+
# @param [Hash] opts the optional parameters
|
62
|
+
# @return [Ok]
|
63
|
+
describe 'bot_account_upgrade test' do
|
64
|
+
it 'should work' do
|
65
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# unit tests for bot_game_abort
|
70
|
+
# Abort a game
|
71
|
+
# Abort a game being played with the Bot API.
|
72
|
+
# @param game_id
|
73
|
+
# @param [Hash] opts the optional parameters
|
74
|
+
# @return [Ok]
|
75
|
+
describe 'bot_game_abort test' do
|
76
|
+
it 'should work' do
|
77
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
# unit tests for bot_game_chat
|
82
|
+
# Write in the chat
|
83
|
+
# Post a message to the player or spectator chat, in a game being played with the Bot API.
|
84
|
+
# @param game_id
|
85
|
+
# @param room
|
86
|
+
# @param text
|
87
|
+
# @param [Hash] opts the optional parameters
|
88
|
+
# @return [Ok]
|
89
|
+
describe 'bot_game_chat test' do
|
90
|
+
it 'should work' do
|
91
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
# unit tests for bot_game_chat_get
|
96
|
+
# Fetch the game chat
|
97
|
+
# Get the messages posted in the game chat
|
98
|
+
# @param game_id
|
99
|
+
# @param [Hash] opts the optional parameters
|
100
|
+
# @return [Object]
|
101
|
+
describe 'bot_game_chat_get test' do
|
102
|
+
it 'should work' do
|
103
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
# unit tests for bot_game_move
|
108
|
+
# Make a Bot move
|
109
|
+
# Make a move in a game being played with the Bot API.
|
110
|
+
# @param game_id
|
111
|
+
# @param move The move to play, in USI format
|
112
|
+
# @param [Hash] opts the optional parameters
|
113
|
+
# @return [Ok]
|
114
|
+
describe 'bot_game_move test' do
|
115
|
+
it 'should work' do
|
116
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
# unit tests for bot_game_resign
|
121
|
+
# Resign a game
|
122
|
+
# Resign a game being played with the Bot API.
|
123
|
+
# @param game_id
|
124
|
+
# @param [Hash] opts the optional parameters
|
125
|
+
# @return [Ok]
|
126
|
+
describe 'bot_game_resign test' do
|
127
|
+
it 'should work' do
|
128
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
# unit tests for bot_game_stream
|
133
|
+
# Stream Bot game state
|
134
|
+
# Stream the state of a game being played with the Bot API, as [ndjson](#section/Introduction/Streaming-with-ND-JSON). Use this endpoint to get updates about the game in real-time, with a single request. Each line is a JSON object containing a `type` field. Possible values are: - `gameFull` Full game data. All values are immutable, except for the `state` field. - `gameState` Current state of the game. Immutable values not included. - `chatLine` Chat message sent by a user (or the bot itself) in the `room` \"player\" or \"spectator\". The first line is always of type `gameFull`.
|
135
|
+
# @param game_id
|
136
|
+
# @param [Hash] opts the optional parameters
|
137
|
+
# @return [BoardGameStream200Response]
|
138
|
+
describe 'bot_game_stream test' do
|
139
|
+
it 'should work' do
|
140
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
end
|
@@ -0,0 +1,123 @@
|
|
1
|
+
=begin
|
2
|
+
#Lishogi.org API reference
|
3
|
+
|
4
|
+
## 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. - Get help in the [Lishogi Discord channel](https://discord.gg/YFtpMGg3rR) - [Contribute to this documentation on Github](https://github.com/WandererXII/lishogi/blob/master/public/doc/lishogi-api.yaml) - Check out [Lishogi widgets to embed in your website](https://lishogi.org/developers) ## 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](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#429), 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**](http://ndjson.org/), with one JSON object per line. Here's a [JavaScript utility function (for lichess)](https://gist.github.com/ornicar/a097406810939cf7be1df8ea30e94f3e) to help reading NDJSON streamed responses.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 2.0.0
|
7
|
+
Contact: contact@lishogi.org
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.10.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
|
16
|
+
# Unit tests for Lishogi::ChallengesApi
|
17
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
18
|
+
# Please update as you see appropriate
|
19
|
+
describe 'ChallengesApi' do
|
20
|
+
before do
|
21
|
+
# run before each test
|
22
|
+
@api_instance = Lishogi::ChallengesApi.new
|
23
|
+
end
|
24
|
+
|
25
|
+
after do
|
26
|
+
# run after each test
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'test an instance of ChallengesApi' do
|
30
|
+
it 'should create an instance of ChallengesApi' do
|
31
|
+
expect(@api_instance).to be_instance_of(Lishogi::ChallengesApi)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# unit tests for challenge_accept
|
36
|
+
# Accept a challenge
|
37
|
+
# Accept an incoming challenge. You should receive a `gameStart` event on the [incoming events stream](#operation/apiStreamEvent).
|
38
|
+
# @param challenge_id
|
39
|
+
# @param [Hash] opts the optional parameters
|
40
|
+
# @return [Ok]
|
41
|
+
describe 'challenge_accept test' do
|
42
|
+
it 'should work' do
|
43
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# unit tests for challenge_ai
|
48
|
+
# Challenge the AI
|
49
|
+
# Start a game with Lishogi AI. You will be notified on the [event stream](#operation/apiStreamEvent) that a new game has started.
|
50
|
+
# @param [Hash] opts the optional parameters
|
51
|
+
# @option opts [Float] :level AI strength
|
52
|
+
# @option opts [Float] :clock_limit Clock initial time in seconds. If empty, a correspondence game is created.
|
53
|
+
# @option opts [Integer] :clock_increment Clock increment in seconds. If empty, a correspondence game is created.
|
54
|
+
# @option opts [Integer] :clock_byoyomi Clock byoyomi in seconds. If empty, a correspondence game is created.
|
55
|
+
# @option opts [Integer] :clock_periods Clock periods for byoyomi in seconds. If empty, a correspondence game is created.
|
56
|
+
# @option opts [Integer] :days Days per move, for correspondence games. Clock settings must be omitted.
|
57
|
+
# @option opts [String] :color Which color you get to play
|
58
|
+
# @option opts [VariantKey] :variant
|
59
|
+
# @option opts [String] :sfen Custom initial position (in SFEN). Variant must be standard, and the game cannot be rated.
|
60
|
+
# @return [GameJson]
|
61
|
+
describe 'challenge_ai test' do
|
62
|
+
it 'should work' do
|
63
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
# unit tests for challenge_create
|
68
|
+
# Create a challenge
|
69
|
+
# Challenge someone to play. The targeted player can choose to accept or decline. If the challenge is accepted, you will be notified on the [event stream](#operation/apiStreamEvent) that a new game has started. The game ID will be the same as the challenge ID. If you also have an OAuth token with `challenge:write` scope for the receiving user, you can make them accept the challenge immediately by setting the `acceptByToken` field. Challenges for realtime games (not correspondence) expire after 20s if not accepted. To prevent that, use the `keepAliveStream` flag described below.
|
70
|
+
# @param username
|
71
|
+
# @param [Hash] opts the optional parameters
|
72
|
+
# @option opts [Boolean] :rated Game is rated and impacts players ratings
|
73
|
+
# @option opts [Float] :clock_limit Clock initial time in seconds. If empty, a correspondence game is created.
|
74
|
+
# @option opts [Integer] :clock_increment Clock increment in seconds. If empty, a correspondence game is created.
|
75
|
+
# @option opts [Integer] :clock_byoyomi Clock byoyomi in seconds. If empty, a correspondence game is created.
|
76
|
+
# @option opts [Integer] :clock_periods Clock periods for byoyomi in seconds. If empty, a correspondence game is created.
|
77
|
+
# @option opts [Integer] :days Days per move, for correspondence games. Clock settings must be omitted.
|
78
|
+
# @option opts [String] :color Which color you get to play
|
79
|
+
# @option opts [VariantKey] :variant
|
80
|
+
# @option opts [String] :sfen Custom initial position (in SFEN). Variant must be standard, and the game cannot be rated.
|
81
|
+
# @option opts [Boolean] :keep_alive_stream If set, the response is streamed as [ndjson](#section/Introduction/Streaming-with-ND-JSON). The challenge is kept alive until the connection is closed by the client. When the challenge is accepted or declined, a message of the form `{\\\"done\\\":\\\"accepted\\\"}` is sent, then the connection is closed by the server. If not set, the response is not streamed, and the challenge expires after 20s if not accepted.
|
82
|
+
# @option opts [String] :accept_by_token Immediately accept the challenge and create the game. Pass in an OAuth token (with the `challenge:write` scope) for the receiving user. On success, the response will contain a `game` field instead of a `challenge` field.
|
83
|
+
# @option opts [String] :message **Only if `acceptByToken` is set.** Message that is sent to each player, when the game is created. It is sent from your user account. `{opponent}`, `{player}` and `{game}` are placeholders that will be replaced with the opponent name, player name, and the game URLs. You can omit this field to send the default message, but if you set your own message, it must at least contain the `{game}` placeholder.
|
84
|
+
# @return [ChallengeJson]
|
85
|
+
describe 'challenge_create test' do
|
86
|
+
it 'should work' do
|
87
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
# unit tests for challenge_decline
|
92
|
+
# Decline a challenge
|
93
|
+
# Decline an incoming challenge.
|
94
|
+
# @param challenge_id
|
95
|
+
# @param [Hash] opts the optional parameters
|
96
|
+
# @return [Ok]
|
97
|
+
describe 'challenge_decline test' do
|
98
|
+
it 'should work' do
|
99
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
# unit tests for challenge_open
|
104
|
+
# Open-ended challenge
|
105
|
+
# Create a challenge that any 2 players can join. Share the URL of the challenge. the first 2 players to click it will be paired for a game. The response body also contains `senteUrl` and `goteUrl`. You can control which color each player gets by giving them these URLs, instead of the main challenge URL. Open challenges expire after 24h. To directly pair 2 known players, use [this endpoint](#operation/challengeCreate) instead, with the `acceptByToken` parameter.
|
106
|
+
# @param [Hash] opts the optional parameters
|
107
|
+
# @option opts [Boolean] :rated Game is rated and impacts players ratings
|
108
|
+
# @option opts [Float] :clock_limit Clock initial time in seconds. If empty, a correspondence game is created.
|
109
|
+
# @option opts [Integer] :clock_increment Clock increment in seconds. If empty, a correspondence game is created.
|
110
|
+
# @option opts [Integer] :clock_byoyomi Clock byoyomi in seconds. If empty, a correspondence game is created.
|
111
|
+
# @option opts [Integer] :clock_periods Clock periods for byoyomi in seconds. If empty, a correspondence game is created.
|
112
|
+
# @option opts [Integer] :days Days per turn. For correspondence challenges.
|
113
|
+
# @option opts [VariantKey] :variant
|
114
|
+
# @option opts [String] :sfen Custom initial position (in SFEN). Variant must be standard, and the game cannot be rated.
|
115
|
+
# @option opts [String] :name Optional name for the challenge, that players will see on the challenge page.
|
116
|
+
# @return [Object]
|
117
|
+
describe 'challenge_open test' do
|
118
|
+
it 'should work' do
|
119
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
end
|
@@ -0,0 +1,135 @@
|
|
1
|
+
=begin
|
2
|
+
#Lishogi.org API reference
|
3
|
+
|
4
|
+
## 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. - Get help in the [Lishogi Discord channel](https://discord.gg/YFtpMGg3rR) - [Contribute to this documentation on Github](https://github.com/WandererXII/lishogi/blob/master/public/doc/lishogi-api.yaml) - Check out [Lishogi widgets to embed in your website](https://lishogi.org/developers) ## 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](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#429), 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**](http://ndjson.org/), with one JSON object per line. Here's a [JavaScript utility function (for lichess)](https://gist.github.com/ornicar/a097406810939cf7be1df8ea30e94f3e) to help reading NDJSON streamed responses.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 2.0.0
|
7
|
+
Contact: contact@lishogi.org
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.10.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
|
16
|
+
# Unit tests for Lishogi::GamesApi
|
17
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
18
|
+
# Please update as you see appropriate
|
19
|
+
describe 'GamesApi' do
|
20
|
+
before do
|
21
|
+
# run before each test
|
22
|
+
@api_instance = Lishogi::GamesApi.new
|
23
|
+
end
|
24
|
+
|
25
|
+
after do
|
26
|
+
# run after each test
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'test an instance of GamesApi' do
|
30
|
+
it 'should create an instance of GamesApi' do
|
31
|
+
expect(@api_instance).to be_instance_of(Lishogi::GamesApi)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# unit tests for api_account_playing
|
36
|
+
# Get my ongoing games
|
37
|
+
# Get the ongoing games of the current user. Real-time and correspondence games are included. The most urgent games are listed first.
|
38
|
+
# @param [Hash] opts the optional parameters
|
39
|
+
# @option opts [Integer] :nb Max number of games to fetch
|
40
|
+
# @return [Object]
|
41
|
+
describe 'api_account_playing test' do
|
42
|
+
it 'should work' do
|
43
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# unit tests for api_games_user
|
48
|
+
# Export games of a user
|
49
|
+
# Download all games of any user in KIF or [ndjson](#section/Introduction/Streaming-with-ND-JSON) format. Games are sorted by reverse chronological order (most recent first). We recommend streaming the response, for it can be very long. <https://lishogi.org/@/YoBot_v2> for instance has more than 15,000 games. The game stream is throttled, depending on who is making the request: - Anonymous request: 20 games per second - [OAuth2 authenticated](#section/Authentication) request: 30 games per second - Authenticated, downloading your own games: 60 games per second
|
50
|
+
# @param username The user name.
|
51
|
+
# @param [Hash] opts the optional parameters
|
52
|
+
# @option opts [Integer] :since Download games played since this timestamp. Defaults to account creation date.
|
53
|
+
# @option opts [Integer] :_until Download games played until this timestamp. Defaults to now.
|
54
|
+
# @option opts [Integer] :max How many games to download. Leave empty to download all games.
|
55
|
+
# @option opts [String] :vs [Filter] Only games played against this opponent
|
56
|
+
# @option opts [Boolean] :rated [Filter] Only rated (`true`) or casual (`false`) games
|
57
|
+
# @option opts [PerfType] :perf_type [Filter] Only games in these speeds or variants. Multiple perf types can be specified, separated by a comma. Example: blitz,rapid,classical
|
58
|
+
# @option opts [String] :color [Filter] Only games played as this color.
|
59
|
+
# @option opts [Boolean] :analysed [Filter] Only games with or without a computer analysis available
|
60
|
+
# @option opts [Boolean] :moves Include the KIF moves.
|
61
|
+
# @option opts [Boolean] :pgn_in_json Include the full KIF within the JSON response, in a `notation` field. The response type must be set to `application/x-ndjson` by the request `Accept` header.
|
62
|
+
# @option opts [Boolean] :tags Include the KIF tags.
|
63
|
+
# @option opts [Boolean] :clocks Include clock comments in the KIF moves, when available. Example: `22 同 玉(51) (00:02/00:00:13)`
|
64
|
+
# @option opts [Boolean] :evals Include analysis evaluation comments in the KIF, when available. Example: `9 7八銀(79) * [%eval -1.48]`
|
65
|
+
# @option opts [Boolean] :ongoing Include ongoing games. The last 3 moves will be omitted.
|
66
|
+
# @option opts [Boolean] :finished Include finished games. Set to `false` to only get ongoing games.
|
67
|
+
# @option opts [String] :players URL of a text file containing real names and ratings, to replace Lishogi usernames and ratings in the KIF. Example: <https://gist.githubusercontent.com/ornicar/6bfa91eb61a2dcae7bcd14cce1b2a4eb/raw/768b9f6cc8a8471d2555e47ba40fb0095e5fba37/gistfile1.txt>
|
68
|
+
# @option opts [String] :sort Sort order of the games.
|
69
|
+
# @return [Object]
|
70
|
+
describe 'api_games_user test' do
|
71
|
+
it 'should work' do
|
72
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# unit tests for api_user_current_game
|
77
|
+
# Export ongoing game of a user
|
78
|
+
# Download the ongoing game, or the last game played, of a user. Available in either KIF or JSON format. If the game is ongoing, the 3 last moves are omitted.
|
79
|
+
# @param username
|
80
|
+
# @param [Hash] opts the optional parameters
|
81
|
+
# @option opts [Boolean] :moves Include the KIF moves.
|
82
|
+
# @option opts [Boolean] :tags Include the KIF tags.
|
83
|
+
# @option opts [Boolean] :clocks Include clock comments in the KIF moves, when available. Example: `22 同 玉(51) (00:02/00:00:13)`
|
84
|
+
# @option opts [Boolean] :evals Include analysis evaluation comments in the KIF, when available. Example: `9 7八銀(79) * [%eval -1.48]`
|
85
|
+
# @option opts [String] :players URL of a text file containing real names and ratings, to replace Lishogi usernames and ratings in the KIF. Example: <https://gist.githubusercontent.com/ornicar/6bfa91eb61a2dcae7bcd14cce1b2a4eb/raw/768b9f6cc8a8471d2555e47ba40fb0095e5fba37/gistfile1.txt>
|
86
|
+
# @return [Object]
|
87
|
+
describe 'api_user_current_game test' do
|
88
|
+
it 'should work' do
|
89
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
# unit tests for game_kif
|
94
|
+
# Export one game
|
95
|
+
# Download one game in either KIF or JSON format. Ongoing games have their last 3 moves omitted, after move 5.
|
96
|
+
# @param game_id The game ID (8 characters).
|
97
|
+
# @param [Hash] opts the optional parameters
|
98
|
+
# @option opts [Boolean] :moves Include the KIF moves.
|
99
|
+
# @option opts [Boolean] :tags Include the KIF tags.
|
100
|
+
# @option opts [Boolean] :clocks Include clock comments in the KIF moves, when available. Example: `22 同 玉(51) (00:02/00:00:13)`
|
101
|
+
# @option opts [Boolean] :evals Include analysis evaluation comments in the KIF, when available. Example: `9 7八銀(79) * [%eval -1.48]`
|
102
|
+
# @option opts [String] :players URL of a text file containing real names and ratings, to replace Lishogi usernames and ratings in the KIF. Example: <https://gist.githubusercontent.com/ornicar/6bfa91eb61a2dcae7bcd14cce1b2a4eb/raw/768b9f6cc8a8471d2555e47ba40fb0095e5fba37/gistfile1.txt>
|
103
|
+
# @return [Object]
|
104
|
+
describe 'game_kif test' do
|
105
|
+
it 'should work' do
|
106
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
# unit tests for games_by_users
|
111
|
+
# Stream games of users
|
112
|
+
# Stream the games played between a list of users, in real time. Only games where **both players** are part of the list are included. By default, games are only sent to the stream when they start. To also get all ongoing games at the beginning of the stream, use the `withCurrentGames` flag. Maximum number of users: 300. Games are streamed as [ndjson](#section/Introduction/Streaming-with-ND-JSON). The method is `POST` so a longer list of IDs can be sent in the request body.
|
113
|
+
# @param body Up to 300 user IDs separated by commas.
|
114
|
+
# @param [Hash] opts the optional parameters
|
115
|
+
# @option opts [Boolean] :with_current_games Include the already started games at the beginning of the stream.
|
116
|
+
# @return [Object]
|
117
|
+
describe 'games_by_users test' do
|
118
|
+
it 'should work' do
|
119
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
# unit tests for stream_game
|
124
|
+
# Stream moves of a game
|
125
|
+
# Stream positions and moves of any ongoing game, in [ndjson](#section/Introduction/Streaming-with-ND-JSON). A description of the game is sent as a first message. Then a message is sent each time a move is played. Finally a description of the game is sent when it finishes, and the stream is closed. After move 5, the stream intentionally remains 3 moves behind the game status, as to prevent cheat bots from using this API. No more than 8 game streams can be opened at the same time from the same IP address.
|
126
|
+
# @param id
|
127
|
+
# @param [Hash] opts the optional parameters
|
128
|
+
# @return [Object]
|
129
|
+
describe 'stream_game test' do
|
130
|
+
it 'should work' do
|
131
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
=begin
|
2
|
+
#Lishogi.org API reference
|
3
|
+
|
4
|
+
## 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. - Get help in the [Lishogi Discord channel](https://discord.gg/YFtpMGg3rR) - [Contribute to this documentation on Github](https://github.com/WandererXII/lishogi/blob/master/public/doc/lishogi-api.yaml) - Check out [Lishogi widgets to embed in your website](https://lishogi.org/developers) ## 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](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#429), 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**](http://ndjson.org/), with one JSON object per line. Here's a [JavaScript utility function (for lichess)](https://gist.github.com/ornicar/a097406810939cf7be1df8ea30e94f3e) to help reading NDJSON streamed responses.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 2.0.0
|
7
|
+
Contact: contact@lishogi.org
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.10.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
|
16
|
+
# Unit tests for Lishogi::MessagingApi
|
17
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
18
|
+
# Please update as you see appropriate
|
19
|
+
describe 'MessagingApi' do
|
20
|
+
before do
|
21
|
+
# run before each test
|
22
|
+
@api_instance = Lishogi::MessagingApi.new
|
23
|
+
end
|
24
|
+
|
25
|
+
after do
|
26
|
+
# run after each test
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'test an instance of MessagingApi' do
|
30
|
+
it 'should create an instance of MessagingApi' do
|
31
|
+
expect(@api_instance).to be_instance_of(Lishogi::MessagingApi)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# unit tests for inbox_username
|
36
|
+
# Send a private message
|
37
|
+
# Send a private message to another player.
|
38
|
+
# @param username
|
39
|
+
# @param text
|
40
|
+
# @param [Hash] opts the optional parameters
|
41
|
+
# @return [Ok]
|
42
|
+
describe 'inbox_username test' do
|
43
|
+
it 'should work' do
|
44
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
=begin
|
2
|
+
#Lishogi.org API reference
|
3
|
+
|
4
|
+
## 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. - Get help in the [Lishogi Discord channel](https://discord.gg/YFtpMGg3rR) - [Contribute to this documentation on Github](https://github.com/WandererXII/lishogi/blob/master/public/doc/lishogi-api.yaml) - Check out [Lishogi widgets to embed in your website](https://lishogi.org/developers) ## 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](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#429), 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**](http://ndjson.org/), with one JSON object per line. Here's a [JavaScript utility function (for lichess)](https://gist.github.com/ornicar/a097406810939cf7be1df8ea30e94f3e) to help reading NDJSON streamed responses.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 2.0.0
|
7
|
+
Contact: contact@lishogi.org
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.10.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
|
16
|
+
# Unit tests for Lishogi::PuzzlesApi
|
17
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
18
|
+
# Please update as you see appropriate
|
19
|
+
describe 'PuzzlesApi' do
|
20
|
+
before do
|
21
|
+
# run before each test
|
22
|
+
@api_instance = Lishogi::PuzzlesApi.new
|
23
|
+
end
|
24
|
+
|
25
|
+
after do
|
26
|
+
# run after each test
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'test an instance of PuzzlesApi' do
|
30
|
+
it 'should create an instance of PuzzlesApi' do
|
31
|
+
expect(@api_instance).to be_instance_of(Lishogi::PuzzlesApi)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# unit tests for api_puzzle_activity
|
36
|
+
# Get your puzzle activity
|
37
|
+
# Download your puzzle activity in [ndjson](#section/Introduction/Streaming-with-ND-JSON) format. Puzzle activity is sorted by reverse chronological order (most recent first) We recommend streaming the response, for it can be very long.
|
38
|
+
# @param [Hash] opts the optional parameters
|
39
|
+
# @option opts [Integer] :max How many entries to download. Leave empty to download all activity.
|
40
|
+
# @return [PuzzleRoundJson]
|
41
|
+
describe 'api_puzzle_activity test' do
|
42
|
+
it 'should work' do
|
43
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# unit tests for api_puzzle_daily
|
48
|
+
# Get the daily puzzle
|
49
|
+
# Get the daily Lishogi puzzle in JSON format.
|
50
|
+
# @param [Hash] opts the optional parameters
|
51
|
+
# @return [Object]
|
52
|
+
describe 'api_puzzle_daily test' do
|
53
|
+
it 'should work' do
|
54
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# unit tests for api_puzzle_dashboard
|
59
|
+
# Get your puzzle dashboard
|
60
|
+
# Download your [puzzle dashboard](https://lishogi.org/training/dashboard/30/dashboard) as JSON. Also includes all puzzle themes played, with aggregated results. Allows re-creating the [improvement/strengths](https://lishogi.org/training/dashboard/30/improvementAreas) interfaces.
|
61
|
+
# @param days How many days to look back when aggregating puzzle results. 30 is sensible.
|
62
|
+
# @param [Hash] opts the optional parameters
|
63
|
+
# @return [Object]
|
64
|
+
describe 'api_puzzle_dashboard test' do
|
65
|
+
it 'should work' do
|
66
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
=begin
|
2
|
+
#Lishogi.org API reference
|
3
|
+
|
4
|
+
## 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. - Get help in the [Lishogi Discord channel](https://discord.gg/YFtpMGg3rR) - [Contribute to this documentation on Github](https://github.com/WandererXII/lishogi/blob/master/public/doc/lishogi-api.yaml) - Check out [Lishogi widgets to embed in your website](https://lishogi.org/developers) ## 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](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#429), 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**](http://ndjson.org/), with one JSON object per line. Here's a [JavaScript utility function (for lichess)](https://gist.github.com/ornicar/a097406810939cf7be1df8ea30e94f3e) to help reading NDJSON streamed responses.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 2.0.0
|
7
|
+
Contact: contact@lishogi.org
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.10.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
|
16
|
+
# Unit tests for Lishogi::SimulsApi
|
17
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
18
|
+
# Please update as you see appropriate
|
19
|
+
describe 'SimulsApi' do
|
20
|
+
before do
|
21
|
+
# run before each test
|
22
|
+
@api_instance = Lishogi::SimulsApi.new
|
23
|
+
end
|
24
|
+
|
25
|
+
after do
|
26
|
+
# run after each test
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'test an instance of SimulsApi' do
|
30
|
+
it 'should create an instance of SimulsApi' do
|
31
|
+
expect(@api_instance).to be_instance_of(Lishogi::SimulsApi)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# unit tests for api_simul
|
36
|
+
# Get current simuls
|
37
|
+
# Get recently finished, ongoing, and upcoming simuls.
|
38
|
+
# @param [Hash] opts the optional parameters
|
39
|
+
# @return [Array<Object>]
|
40
|
+
describe 'api_simul test' do
|
41
|
+
it 'should work' do
|
42
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|