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,514 @@
|
|
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 'cgi'
|
14
|
+
|
15
|
+
module Lishogi
|
16
|
+
class GamesApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Get my ongoing games
|
23
|
+
# Get the ongoing games of the current user. Real-time and correspondence games are included. The most urgent games are listed first.
|
24
|
+
# @param [Hash] opts the optional parameters
|
25
|
+
# @option opts [Integer] :nb Max number of games to fetch (default to 9)
|
26
|
+
# @return [Object]
|
27
|
+
def api_account_playing(opts = {})
|
28
|
+
data, _status_code, _headers = api_account_playing_with_http_info(opts)
|
29
|
+
data
|
30
|
+
end
|
31
|
+
|
32
|
+
# Get my ongoing games
|
33
|
+
# Get the ongoing games of the current user. Real-time and correspondence games are included. The most urgent games are listed first.
|
34
|
+
# @param [Hash] opts the optional parameters
|
35
|
+
# @option opts [Integer] :nb Max number of games to fetch (default to 9)
|
36
|
+
# @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
|
37
|
+
def api_account_playing_with_http_info(opts = {})
|
38
|
+
if @api_client.config.debugging
|
39
|
+
@api_client.config.logger.debug 'Calling API: GamesApi.api_account_playing ...'
|
40
|
+
end
|
41
|
+
if @api_client.config.client_side_validation && !opts[:'nb'].nil? && opts[:'nb'] > 50
|
42
|
+
fail ArgumentError, 'invalid value for "opts[:"nb"]" when calling GamesApi.api_account_playing, must be smaller than or equal to 50.'
|
43
|
+
end
|
44
|
+
|
45
|
+
if @api_client.config.client_side_validation && !opts[:'nb'].nil? && opts[:'nb'] < 1
|
46
|
+
fail ArgumentError, 'invalid value for "opts[:"nb"]" when calling GamesApi.api_account_playing, must be greater than or equal to 1.'
|
47
|
+
end
|
48
|
+
|
49
|
+
# resource path
|
50
|
+
local_var_path = '/api/account/playing'
|
51
|
+
|
52
|
+
# query parameters
|
53
|
+
query_params = opts[:query_params] || {}
|
54
|
+
query_params[:'nb'] = opts[:'nb'] if !opts[:'nb'].nil?
|
55
|
+
|
56
|
+
# header parameters
|
57
|
+
header_params = opts[:header_params] || {}
|
58
|
+
# HTTP header 'Accept' (if needed)
|
59
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
60
|
+
|
61
|
+
# form parameters
|
62
|
+
form_params = opts[:form_params] || {}
|
63
|
+
|
64
|
+
# http body (model)
|
65
|
+
post_body = opts[:debug_body]
|
66
|
+
|
67
|
+
# return_type
|
68
|
+
return_type = opts[:debug_return_type] || 'Object'
|
69
|
+
|
70
|
+
# auth_names
|
71
|
+
auth_names = opts[:debug_auth_names] || ['OAuth2']
|
72
|
+
|
73
|
+
new_options = opts.merge(
|
74
|
+
:operation => :"GamesApi.api_account_playing",
|
75
|
+
:header_params => header_params,
|
76
|
+
:query_params => query_params,
|
77
|
+
:form_params => form_params,
|
78
|
+
:body => post_body,
|
79
|
+
:auth_names => auth_names,
|
80
|
+
:return_type => return_type
|
81
|
+
)
|
82
|
+
|
83
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
84
|
+
if @api_client.config.debugging
|
85
|
+
@api_client.config.logger.debug "API called: GamesApi#api_account_playing\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
86
|
+
end
|
87
|
+
return data, status_code, headers
|
88
|
+
end
|
89
|
+
|
90
|
+
# Export games of a user
|
91
|
+
# 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
|
92
|
+
# @param username [String] The user name.
|
93
|
+
# @param [Hash] opts the optional parameters
|
94
|
+
# @option opts [Integer] :since Download games played since this timestamp. Defaults to account creation date.
|
95
|
+
# @option opts [Integer] :_until Download games played until this timestamp. Defaults to now.
|
96
|
+
# @option opts [Integer] :max How many games to download. Leave empty to download all games.
|
97
|
+
# @option opts [String] :vs [Filter] Only games played against this opponent
|
98
|
+
# @option opts [Boolean] :rated [Filter] Only rated (`true`) or casual (`false`) games
|
99
|
+
# @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
|
100
|
+
# @option opts [String] :color [Filter] Only games played as this color.
|
101
|
+
# @option opts [Boolean] :analysed [Filter] Only games with or without a computer analysis available
|
102
|
+
# @option opts [Boolean] :moves Include the KIF moves.
|
103
|
+
# @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. (default to false)
|
104
|
+
# @option opts [Boolean] :tags Include the KIF tags. (default to true)
|
105
|
+
# @option opts [Boolean] :clocks Include clock comments in the KIF moves, when available. Example: `22 同 玉(51) (00:02/00:00:13)` (default to false)
|
106
|
+
# @option opts [Boolean] :evals Include analysis evaluation comments in the KIF, when available. Example: `9 7八銀(79) * [%eval -1.48]` (default to false)
|
107
|
+
# @option opts [Boolean] :ongoing Include ongoing games. The last 3 moves will be omitted. (default to false)
|
108
|
+
# @option opts [Boolean] :finished Include finished games. Set to `false` to only get ongoing games. (default to true)
|
109
|
+
# @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>
|
110
|
+
# @option opts [String] :sort Sort order of the games. (default to 'dateDesc')
|
111
|
+
# @return [Object]
|
112
|
+
def api_games_user(username, opts = {})
|
113
|
+
data, _status_code, _headers = api_games_user_with_http_info(username, opts)
|
114
|
+
data
|
115
|
+
end
|
116
|
+
|
117
|
+
# Export games of a user
|
118
|
+
# 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
|
119
|
+
# @param username [String] The user name.
|
120
|
+
# @param [Hash] opts the optional parameters
|
121
|
+
# @option opts [Integer] :since Download games played since this timestamp. Defaults to account creation date.
|
122
|
+
# @option opts [Integer] :_until Download games played until this timestamp. Defaults to now.
|
123
|
+
# @option opts [Integer] :max How many games to download. Leave empty to download all games.
|
124
|
+
# @option opts [String] :vs [Filter] Only games played against this opponent
|
125
|
+
# @option opts [Boolean] :rated [Filter] Only rated (`true`) or casual (`false`) games
|
126
|
+
# @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
|
127
|
+
# @option opts [String] :color [Filter] Only games played as this color.
|
128
|
+
# @option opts [Boolean] :analysed [Filter] Only games with or without a computer analysis available
|
129
|
+
# @option opts [Boolean] :moves Include the KIF moves.
|
130
|
+
# @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. (default to false)
|
131
|
+
# @option opts [Boolean] :tags Include the KIF tags. (default to true)
|
132
|
+
# @option opts [Boolean] :clocks Include clock comments in the KIF moves, when available. Example: `22 同 玉(51) (00:02/00:00:13)` (default to false)
|
133
|
+
# @option opts [Boolean] :evals Include analysis evaluation comments in the KIF, when available. Example: `9 7八銀(79) * [%eval -1.48]` (default to false)
|
134
|
+
# @option opts [Boolean] :ongoing Include ongoing games. The last 3 moves will be omitted. (default to false)
|
135
|
+
# @option opts [Boolean] :finished Include finished games. Set to `false` to only get ongoing games. (default to true)
|
136
|
+
# @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>
|
137
|
+
# @option opts [String] :sort Sort order of the games. (default to 'dateDesc')
|
138
|
+
# @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
|
139
|
+
def api_games_user_with_http_info(username, opts = {})
|
140
|
+
if @api_client.config.debugging
|
141
|
+
@api_client.config.logger.debug 'Calling API: GamesApi.api_games_user ...'
|
142
|
+
end
|
143
|
+
# verify the required parameter 'username' is set
|
144
|
+
if @api_client.config.client_side_validation && username.nil?
|
145
|
+
fail ArgumentError, "Missing the required parameter 'username' when calling GamesApi.api_games_user"
|
146
|
+
end
|
147
|
+
if @api_client.config.client_side_validation && !opts[:'since'].nil? && opts[:'since'] < 1356998400070
|
148
|
+
fail ArgumentError, 'invalid value for "opts[:"since"]" when calling GamesApi.api_games_user, must be greater than or equal to 1356998400070.'
|
149
|
+
end
|
150
|
+
|
151
|
+
if @api_client.config.client_side_validation && !opts[:'_until'].nil? && opts[:'_until'] < 1356998400070
|
152
|
+
fail ArgumentError, 'invalid value for "opts[:"_until"]" when calling GamesApi.api_games_user, must be greater than or equal to 1356998400070.'
|
153
|
+
end
|
154
|
+
|
155
|
+
if @api_client.config.client_side_validation && !opts[:'max'].nil? && opts[:'max'] < 1
|
156
|
+
fail ArgumentError, 'invalid value for "opts[:"max"]" when calling GamesApi.api_games_user, must be greater than or equal to 1.'
|
157
|
+
end
|
158
|
+
|
159
|
+
allowable_values = ["sente", "gote"]
|
160
|
+
if @api_client.config.client_side_validation && opts[:'color'] && !allowable_values.include?(opts[:'color'])
|
161
|
+
fail ArgumentError, "invalid value for \"color\", must be one of #{allowable_values}"
|
162
|
+
end
|
163
|
+
allowable_values = ["dateAsc", "dateDesc"]
|
164
|
+
if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
|
165
|
+
fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
|
166
|
+
end
|
167
|
+
# resource path
|
168
|
+
local_var_path = '/api/games/user/{username}'.sub('{' + 'username' + '}', CGI.escape(username.to_s))
|
169
|
+
|
170
|
+
# query parameters
|
171
|
+
query_params = opts[:query_params] || {}
|
172
|
+
query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?
|
173
|
+
query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?
|
174
|
+
query_params[:'max'] = opts[:'max'] if !opts[:'max'].nil?
|
175
|
+
query_params[:'vs'] = opts[:'vs'] if !opts[:'vs'].nil?
|
176
|
+
query_params[:'rated'] = opts[:'rated'] if !opts[:'rated'].nil?
|
177
|
+
query_params[:'perfType'] = opts[:'perf_type'] if !opts[:'perf_type'].nil?
|
178
|
+
query_params[:'color'] = opts[:'color'] if !opts[:'color'].nil?
|
179
|
+
query_params[:'analysed'] = opts[:'analysed'] if !opts[:'analysed'].nil?
|
180
|
+
query_params[:'moves'] = opts[:'moves'] if !opts[:'moves'].nil?
|
181
|
+
query_params[:'pgnInJson'] = opts[:'pgn_in_json'] if !opts[:'pgn_in_json'].nil?
|
182
|
+
query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?
|
183
|
+
query_params[:'clocks'] = opts[:'clocks'] if !opts[:'clocks'].nil?
|
184
|
+
query_params[:'evals'] = opts[:'evals'] if !opts[:'evals'].nil?
|
185
|
+
query_params[:'ongoing'] = opts[:'ongoing'] if !opts[:'ongoing'].nil?
|
186
|
+
query_params[:'finished'] = opts[:'finished'] if !opts[:'finished'].nil?
|
187
|
+
query_params[:'players'] = opts[:'players'] if !opts[:'players'].nil?
|
188
|
+
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
|
189
|
+
|
190
|
+
# header parameters
|
191
|
+
header_params = opts[:header_params] || {}
|
192
|
+
# HTTP header 'Accept' (if needed)
|
193
|
+
header_params['Accept'] = @api_client.select_header_accept(['text/plain', 'application/x-ndjson']) unless header_params['Accept']
|
194
|
+
|
195
|
+
# form parameters
|
196
|
+
form_params = opts[:form_params] || {}
|
197
|
+
|
198
|
+
# http body (model)
|
199
|
+
post_body = opts[:debug_body]
|
200
|
+
|
201
|
+
# return_type
|
202
|
+
return_type = opts[:debug_return_type] || 'Object'
|
203
|
+
|
204
|
+
# auth_names
|
205
|
+
auth_names = opts[:debug_auth_names] || ['OAuth2']
|
206
|
+
|
207
|
+
new_options = opts.merge(
|
208
|
+
:operation => :"GamesApi.api_games_user",
|
209
|
+
:header_params => header_params,
|
210
|
+
:query_params => query_params,
|
211
|
+
:form_params => form_params,
|
212
|
+
:body => post_body,
|
213
|
+
:auth_names => auth_names,
|
214
|
+
:return_type => return_type
|
215
|
+
)
|
216
|
+
|
217
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
218
|
+
if @api_client.config.debugging
|
219
|
+
@api_client.config.logger.debug "API called: GamesApi#api_games_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
220
|
+
end
|
221
|
+
return data, status_code, headers
|
222
|
+
end
|
223
|
+
|
224
|
+
# Export ongoing game of a user
|
225
|
+
# 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.
|
226
|
+
# @param username [String]
|
227
|
+
# @param [Hash] opts the optional parameters
|
228
|
+
# @option opts [Boolean] :moves Include the KIF moves. (default to true)
|
229
|
+
# @option opts [Boolean] :tags Include the KIF tags. (default to true)
|
230
|
+
# @option opts [Boolean] :clocks Include clock comments in the KIF moves, when available. Example: `22 同 玉(51) (00:02/00:00:13)` (default to true)
|
231
|
+
# @option opts [Boolean] :evals Include analysis evaluation comments in the KIF, when available. Example: `9 7八銀(79) * [%eval -1.48]` (default to true)
|
232
|
+
# @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>
|
233
|
+
# @return [Object]
|
234
|
+
def api_user_current_game(username, opts = {})
|
235
|
+
data, _status_code, _headers = api_user_current_game_with_http_info(username, opts)
|
236
|
+
data
|
237
|
+
end
|
238
|
+
|
239
|
+
# Export ongoing game of a user
|
240
|
+
# 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.
|
241
|
+
# @param username [String]
|
242
|
+
# @param [Hash] opts the optional parameters
|
243
|
+
# @option opts [Boolean] :moves Include the KIF moves. (default to true)
|
244
|
+
# @option opts [Boolean] :tags Include the KIF tags. (default to true)
|
245
|
+
# @option opts [Boolean] :clocks Include clock comments in the KIF moves, when available. Example: `22 同 玉(51) (00:02/00:00:13)` (default to true)
|
246
|
+
# @option opts [Boolean] :evals Include analysis evaluation comments in the KIF, when available. Example: `9 7八銀(79) * [%eval -1.48]` (default to true)
|
247
|
+
# @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>
|
248
|
+
# @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
|
249
|
+
def api_user_current_game_with_http_info(username, opts = {})
|
250
|
+
if @api_client.config.debugging
|
251
|
+
@api_client.config.logger.debug 'Calling API: GamesApi.api_user_current_game ...'
|
252
|
+
end
|
253
|
+
# verify the required parameter 'username' is set
|
254
|
+
if @api_client.config.client_side_validation && username.nil?
|
255
|
+
fail ArgumentError, "Missing the required parameter 'username' when calling GamesApi.api_user_current_game"
|
256
|
+
end
|
257
|
+
# resource path
|
258
|
+
local_var_path = '/api/user/{username}/current-game'.sub('{' + 'username' + '}', CGI.escape(username.to_s))
|
259
|
+
|
260
|
+
# query parameters
|
261
|
+
query_params = opts[:query_params] || {}
|
262
|
+
query_params[:'moves'] = opts[:'moves'] if !opts[:'moves'].nil?
|
263
|
+
query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?
|
264
|
+
query_params[:'clocks'] = opts[:'clocks'] if !opts[:'clocks'].nil?
|
265
|
+
query_params[:'evals'] = opts[:'evals'] if !opts[:'evals'].nil?
|
266
|
+
query_params[:'players'] = opts[:'players'] if !opts[:'players'].nil?
|
267
|
+
|
268
|
+
# header parameters
|
269
|
+
header_params = opts[:header_params] || {}
|
270
|
+
# HTTP header 'Accept' (if needed)
|
271
|
+
header_params['Accept'] = @api_client.select_header_accept(['text/plain', 'application/json']) unless header_params['Accept']
|
272
|
+
|
273
|
+
# form parameters
|
274
|
+
form_params = opts[:form_params] || {}
|
275
|
+
|
276
|
+
# http body (model)
|
277
|
+
post_body = opts[:debug_body]
|
278
|
+
|
279
|
+
# return_type
|
280
|
+
return_type = opts[:debug_return_type] || 'Object'
|
281
|
+
|
282
|
+
# auth_names
|
283
|
+
auth_names = opts[:debug_auth_names] || []
|
284
|
+
|
285
|
+
new_options = opts.merge(
|
286
|
+
:operation => :"GamesApi.api_user_current_game",
|
287
|
+
:header_params => header_params,
|
288
|
+
:query_params => query_params,
|
289
|
+
:form_params => form_params,
|
290
|
+
:body => post_body,
|
291
|
+
:auth_names => auth_names,
|
292
|
+
:return_type => return_type
|
293
|
+
)
|
294
|
+
|
295
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
296
|
+
if @api_client.config.debugging
|
297
|
+
@api_client.config.logger.debug "API called: GamesApi#api_user_current_game\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
298
|
+
end
|
299
|
+
return data, status_code, headers
|
300
|
+
end
|
301
|
+
|
302
|
+
# Export one game
|
303
|
+
# Download one game in either KIF or JSON format. Ongoing games have their last 3 moves omitted, after move 5.
|
304
|
+
# @param game_id [String] The game ID (8 characters).
|
305
|
+
# @param [Hash] opts the optional parameters
|
306
|
+
# @option opts [Boolean] :moves Include the KIF moves. (default to true)
|
307
|
+
# @option opts [Boolean] :tags Include the KIF tags. (default to true)
|
308
|
+
# @option opts [Boolean] :clocks Include clock comments in the KIF moves, when available. Example: `22 同 玉(51) (00:02/00:00:13)` (default to true)
|
309
|
+
# @option opts [Boolean] :evals Include analysis evaluation comments in the KIF, when available. Example: `9 7八銀(79) * [%eval -1.48]` (default to true)
|
310
|
+
# @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>
|
311
|
+
# @return [Object]
|
312
|
+
def game_kif(game_id, opts = {})
|
313
|
+
data, _status_code, _headers = game_kif_with_http_info(game_id, opts)
|
314
|
+
data
|
315
|
+
end
|
316
|
+
|
317
|
+
# Export one game
|
318
|
+
# Download one game in either KIF or JSON format. Ongoing games have their last 3 moves omitted, after move 5.
|
319
|
+
# @param game_id [String] The game ID (8 characters).
|
320
|
+
# @param [Hash] opts the optional parameters
|
321
|
+
# @option opts [Boolean] :moves Include the KIF moves. (default to true)
|
322
|
+
# @option opts [Boolean] :tags Include the KIF tags. (default to true)
|
323
|
+
# @option opts [Boolean] :clocks Include clock comments in the KIF moves, when available. Example: `22 同 玉(51) (00:02/00:00:13)` (default to true)
|
324
|
+
# @option opts [Boolean] :evals Include analysis evaluation comments in the KIF, when available. Example: `9 7八銀(79) * [%eval -1.48]` (default to true)
|
325
|
+
# @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>
|
326
|
+
# @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
|
327
|
+
def game_kif_with_http_info(game_id, opts = {})
|
328
|
+
if @api_client.config.debugging
|
329
|
+
@api_client.config.logger.debug 'Calling API: GamesApi.game_kif ...'
|
330
|
+
end
|
331
|
+
# verify the required parameter 'game_id' is set
|
332
|
+
if @api_client.config.client_side_validation && game_id.nil?
|
333
|
+
fail ArgumentError, "Missing the required parameter 'game_id' when calling GamesApi.game_kif"
|
334
|
+
end
|
335
|
+
# resource path
|
336
|
+
local_var_path = '/game/export/{gameId}'.sub('{' + 'gameId' + '}', CGI.escape(game_id.to_s))
|
337
|
+
|
338
|
+
# query parameters
|
339
|
+
query_params = opts[:query_params] || {}
|
340
|
+
query_params[:'moves'] = opts[:'moves'] if !opts[:'moves'].nil?
|
341
|
+
query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?
|
342
|
+
query_params[:'clocks'] = opts[:'clocks'] if !opts[:'clocks'].nil?
|
343
|
+
query_params[:'evals'] = opts[:'evals'] if !opts[:'evals'].nil?
|
344
|
+
query_params[:'players'] = opts[:'players'] if !opts[:'players'].nil?
|
345
|
+
|
346
|
+
# header parameters
|
347
|
+
header_params = opts[:header_params] || {}
|
348
|
+
# HTTP header 'Accept' (if needed)
|
349
|
+
header_params['Accept'] = @api_client.select_header_accept(['text/plain', 'application/json']) unless header_params['Accept']
|
350
|
+
|
351
|
+
# form parameters
|
352
|
+
form_params = opts[:form_params] || {}
|
353
|
+
|
354
|
+
# http body (model)
|
355
|
+
post_body = opts[:debug_body]
|
356
|
+
|
357
|
+
# return_type
|
358
|
+
return_type = opts[:debug_return_type] || 'Object'
|
359
|
+
|
360
|
+
# auth_names
|
361
|
+
auth_names = opts[:debug_auth_names] || []
|
362
|
+
|
363
|
+
new_options = opts.merge(
|
364
|
+
:operation => :"GamesApi.game_kif",
|
365
|
+
:header_params => header_params,
|
366
|
+
:query_params => query_params,
|
367
|
+
:form_params => form_params,
|
368
|
+
:body => post_body,
|
369
|
+
:auth_names => auth_names,
|
370
|
+
:return_type => return_type
|
371
|
+
)
|
372
|
+
|
373
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
374
|
+
if @api_client.config.debugging
|
375
|
+
@api_client.config.logger.debug "API called: GamesApi#game_kif\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
376
|
+
end
|
377
|
+
return data, status_code, headers
|
378
|
+
end
|
379
|
+
|
380
|
+
# Stream games of users
|
381
|
+
# 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.
|
382
|
+
# @param body [String] Up to 300 user IDs separated by commas.
|
383
|
+
# @param [Hash] opts the optional parameters
|
384
|
+
# @option opts [Boolean] :with_current_games Include the already started games at the beginning of the stream. (default to false)
|
385
|
+
# @return [Object]
|
386
|
+
def games_by_users(body, opts = {})
|
387
|
+
data, _status_code, _headers = games_by_users_with_http_info(body, opts)
|
388
|
+
data
|
389
|
+
end
|
390
|
+
|
391
|
+
# Stream games of users
|
392
|
+
# 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.
|
393
|
+
# @param body [String] Up to 300 user IDs separated by commas.
|
394
|
+
# @param [Hash] opts the optional parameters
|
395
|
+
# @option opts [Boolean] :with_current_games Include the already started games at the beginning of the stream. (default to false)
|
396
|
+
# @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
|
397
|
+
def games_by_users_with_http_info(body, opts = {})
|
398
|
+
if @api_client.config.debugging
|
399
|
+
@api_client.config.logger.debug 'Calling API: GamesApi.games_by_users ...'
|
400
|
+
end
|
401
|
+
# verify the required parameter 'body' is set
|
402
|
+
if @api_client.config.client_side_validation && body.nil?
|
403
|
+
fail ArgumentError, "Missing the required parameter 'body' when calling GamesApi.games_by_users"
|
404
|
+
end
|
405
|
+
# resource path
|
406
|
+
local_var_path = '/api/stream/games-by-users'
|
407
|
+
|
408
|
+
# query parameters
|
409
|
+
query_params = opts[:query_params] || {}
|
410
|
+
query_params[:'withCurrentGames'] = opts[:'with_current_games'] if !opts[:'with_current_games'].nil?
|
411
|
+
|
412
|
+
# header parameters
|
413
|
+
header_params = opts[:header_params] || {}
|
414
|
+
# HTTP header 'Accept' (if needed)
|
415
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/x-ndjson']) unless header_params['Accept']
|
416
|
+
# HTTP header 'Content-Type'
|
417
|
+
content_type = @api_client.select_header_content_type(['text/plain'])
|
418
|
+
if !content_type.nil?
|
419
|
+
header_params['Content-Type'] = content_type
|
420
|
+
end
|
421
|
+
|
422
|
+
# form parameters
|
423
|
+
form_params = opts[:form_params] || {}
|
424
|
+
|
425
|
+
# http body (model)
|
426
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
|
427
|
+
|
428
|
+
# return_type
|
429
|
+
return_type = opts[:debug_return_type] || 'Object'
|
430
|
+
|
431
|
+
# auth_names
|
432
|
+
auth_names = opts[:debug_auth_names] || []
|
433
|
+
|
434
|
+
new_options = opts.merge(
|
435
|
+
:operation => :"GamesApi.games_by_users",
|
436
|
+
:header_params => header_params,
|
437
|
+
:query_params => query_params,
|
438
|
+
:form_params => form_params,
|
439
|
+
:body => post_body,
|
440
|
+
:auth_names => auth_names,
|
441
|
+
:return_type => return_type
|
442
|
+
)
|
443
|
+
|
444
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
445
|
+
if @api_client.config.debugging
|
446
|
+
@api_client.config.logger.debug "API called: GamesApi#games_by_users\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
447
|
+
end
|
448
|
+
return data, status_code, headers
|
449
|
+
end
|
450
|
+
|
451
|
+
# Stream moves of a game
|
452
|
+
# 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.
|
453
|
+
# @param id [String]
|
454
|
+
# @param [Hash] opts the optional parameters
|
455
|
+
# @return [Object]
|
456
|
+
def stream_game(id, opts = {})
|
457
|
+
data, _status_code, _headers = stream_game_with_http_info(id, opts)
|
458
|
+
data
|
459
|
+
end
|
460
|
+
|
461
|
+
# Stream moves of a game
|
462
|
+
# 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.
|
463
|
+
# @param id [String]
|
464
|
+
# @param [Hash] opts the optional parameters
|
465
|
+
# @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
|
466
|
+
def stream_game_with_http_info(id, opts = {})
|
467
|
+
if @api_client.config.debugging
|
468
|
+
@api_client.config.logger.debug 'Calling API: GamesApi.stream_game ...'
|
469
|
+
end
|
470
|
+
# verify the required parameter 'id' is set
|
471
|
+
if @api_client.config.client_side_validation && id.nil?
|
472
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling GamesApi.stream_game"
|
473
|
+
end
|
474
|
+
# resource path
|
475
|
+
local_var_path = '/api/stream/game/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
476
|
+
|
477
|
+
# query parameters
|
478
|
+
query_params = opts[:query_params] || {}
|
479
|
+
|
480
|
+
# header parameters
|
481
|
+
header_params = opts[:header_params] || {}
|
482
|
+
# HTTP header 'Accept' (if needed)
|
483
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/x-ndjson']) unless header_params['Accept']
|
484
|
+
|
485
|
+
# form parameters
|
486
|
+
form_params = opts[:form_params] || {}
|
487
|
+
|
488
|
+
# http body (model)
|
489
|
+
post_body = opts[:debug_body]
|
490
|
+
|
491
|
+
# return_type
|
492
|
+
return_type = opts[:debug_return_type] || 'Object'
|
493
|
+
|
494
|
+
# auth_names
|
495
|
+
auth_names = opts[:debug_auth_names] || []
|
496
|
+
|
497
|
+
new_options = opts.merge(
|
498
|
+
:operation => :"GamesApi.stream_game",
|
499
|
+
:header_params => header_params,
|
500
|
+
:query_params => query_params,
|
501
|
+
:form_params => form_params,
|
502
|
+
:body => post_body,
|
503
|
+
:auth_names => auth_names,
|
504
|
+
:return_type => return_type
|
505
|
+
)
|
506
|
+
|
507
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
508
|
+
if @api_client.config.debugging
|
509
|
+
@api_client.config.logger.debug "API called: GamesApi#stream_game\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
510
|
+
end
|
511
|
+
return data, status_code, headers
|
512
|
+
end
|
513
|
+
end
|
514
|
+
end
|
@@ -0,0 +1,97 @@
|
|
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 'cgi'
|
14
|
+
|
15
|
+
module Lishogi
|
16
|
+
class MessagingApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Send a private message
|
23
|
+
# Send a private message to another player.
|
24
|
+
# @param username [String]
|
25
|
+
# @param text [String]
|
26
|
+
# @param [Hash] opts the optional parameters
|
27
|
+
# @return [Ok]
|
28
|
+
def inbox_username(username, text, opts = {})
|
29
|
+
data, _status_code, _headers = inbox_username_with_http_info(username, text, opts)
|
30
|
+
data
|
31
|
+
end
|
32
|
+
|
33
|
+
# Send a private message
|
34
|
+
# Send a private message to another player.
|
35
|
+
# @param username [String]
|
36
|
+
# @param text [String]
|
37
|
+
# @param [Hash] opts the optional parameters
|
38
|
+
# @return [Array<(Ok, Integer, Hash)>] Ok data, response status code and response headers
|
39
|
+
def inbox_username_with_http_info(username, text, opts = {})
|
40
|
+
if @api_client.config.debugging
|
41
|
+
@api_client.config.logger.debug 'Calling API: MessagingApi.inbox_username ...'
|
42
|
+
end
|
43
|
+
# verify the required parameter 'username' is set
|
44
|
+
if @api_client.config.client_side_validation && username.nil?
|
45
|
+
fail ArgumentError, "Missing the required parameter 'username' when calling MessagingApi.inbox_username"
|
46
|
+
end
|
47
|
+
# verify the required parameter 'text' is set
|
48
|
+
if @api_client.config.client_side_validation && text.nil?
|
49
|
+
fail ArgumentError, "Missing the required parameter 'text' when calling MessagingApi.inbox_username"
|
50
|
+
end
|
51
|
+
# resource path
|
52
|
+
local_var_path = '/inbox/{username}'.sub('{' + 'username' + '}', CGI.escape(username.to_s))
|
53
|
+
|
54
|
+
# query parameters
|
55
|
+
query_params = opts[:query_params] || {}
|
56
|
+
|
57
|
+
# header parameters
|
58
|
+
header_params = opts[:header_params] || {}
|
59
|
+
# HTTP header 'Accept' (if needed)
|
60
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
61
|
+
# HTTP header 'Content-Type'
|
62
|
+
content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])
|
63
|
+
if !content_type.nil?
|
64
|
+
header_params['Content-Type'] = content_type
|
65
|
+
end
|
66
|
+
|
67
|
+
# form parameters
|
68
|
+
form_params = opts[:form_params] || {}
|
69
|
+
form_params['text'] = text
|
70
|
+
|
71
|
+
# http body (model)
|
72
|
+
post_body = opts[:debug_body]
|
73
|
+
|
74
|
+
# return_type
|
75
|
+
return_type = opts[:debug_return_type] || 'Ok'
|
76
|
+
|
77
|
+
# auth_names
|
78
|
+
auth_names = opts[:debug_auth_names] || ['OAuth2']
|
79
|
+
|
80
|
+
new_options = opts.merge(
|
81
|
+
:operation => :"MessagingApi.inbox_username",
|
82
|
+
:header_params => header_params,
|
83
|
+
:query_params => query_params,
|
84
|
+
:form_params => form_params,
|
85
|
+
:body => post_body,
|
86
|
+
:auth_names => auth_names,
|
87
|
+
:return_type => return_type
|
88
|
+
)
|
89
|
+
|
90
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
91
|
+
if @api_client.config.debugging
|
92
|
+
@api_client.config.logger.debug "API called: MessagingApi#inbox_username\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
93
|
+
end
|
94
|
+
return data, status_code, headers
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|