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,685 @@
|
|
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 BoardApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Create a seek
|
23
|
+
# Create a public seek, to start a game with a random player. ### Real-time seek Specify the `time`, `increment`, `byoyomi` and `periods` clock values. The response is streamed but doesn't contain any information. **Keep the connection open to keep the seek active**. If the client closes the connection, the seek is canceled. This way, if the client terminates, the user won't be paired in a game they wouldn't play. When the seek is accepted, or expires, the server closes the connection. **Make sure to also have an [Event stream](#operation/apiStreamEvent) open**, to be notified when a game starts. We recommend opening the [Event stream](#operation/apiStreamEvent) first, then the seek stream. This way, you won't miss the game event if the seek is accepted immediately. ### Correspondence seek Specify the `days` per turn value. The response is not streamed, it immediately completes with the seek ID. The seek remains active on the server until it is joined by someone.
|
24
|
+
# @param [Hash] opts the optional parameters
|
25
|
+
# @option opts [Boolean] :rated Whether the game is rated and impacts players ratings. (default to false)
|
26
|
+
# @option opts [Float] :time Clock initial time in minutes. Required for real-time seeks.
|
27
|
+
# @option opts [Integer] :increment Clock increment in seconds. Required for real-time seeks.
|
28
|
+
# @option opts [Integer] :byoyomi Clock byoyomi in seconds. Required for real-time seeks.
|
29
|
+
# @option opts [Integer] :periods Clock periods for byoyomi in seconds. Required for real-time seeks.
|
30
|
+
# @option opts [Integer] :days Days per turn. Required for correspondence seeks.
|
31
|
+
# @option opts [VariantKey] :variant (default to 'standard')
|
32
|
+
# @option opts [String] :color The color to play. Better left empty to automatically get a random color. (default to 'random')
|
33
|
+
# @option opts [String] :rating_range The rating range of potential opponents. Better left empty. Example: 1500-1800
|
34
|
+
# @return [nil]
|
35
|
+
def api_board_seek(opts = {})
|
36
|
+
api_board_seek_with_http_info(opts)
|
37
|
+
nil
|
38
|
+
end
|
39
|
+
|
40
|
+
# Create a seek
|
41
|
+
# Create a public seek, to start a game with a random player. ### Real-time seek Specify the `time`, `increment`, `byoyomi` and `periods` clock values. The response is streamed but doesn't contain any information. **Keep the connection open to keep the seek active**. If the client closes the connection, the seek is canceled. This way, if the client terminates, the user won't be paired in a game they wouldn't play. When the seek is accepted, or expires, the server closes the connection. **Make sure to also have an [Event stream](#operation/apiStreamEvent) open**, to be notified when a game starts. We recommend opening the [Event stream](#operation/apiStreamEvent) first, then the seek stream. This way, you won't miss the game event if the seek is accepted immediately. ### Correspondence seek Specify the `days` per turn value. The response is not streamed, it immediately completes with the seek ID. The seek remains active on the server until it is joined by someone.
|
42
|
+
# @param [Hash] opts the optional parameters
|
43
|
+
# @option opts [Boolean] :rated Whether the game is rated and impacts players ratings. (default to false)
|
44
|
+
# @option opts [Float] :time Clock initial time in minutes. Required for real-time seeks.
|
45
|
+
# @option opts [Integer] :increment Clock increment in seconds. Required for real-time seeks.
|
46
|
+
# @option opts [Integer] :byoyomi Clock byoyomi in seconds. Required for real-time seeks.
|
47
|
+
# @option opts [Integer] :periods Clock periods for byoyomi in seconds. Required for real-time seeks.
|
48
|
+
# @option opts [Integer] :days Days per turn. Required for correspondence seeks.
|
49
|
+
# @option opts [VariantKey] :variant (default to 'standard')
|
50
|
+
# @option opts [String] :color The color to play. Better left empty to automatically get a random color. (default to 'random')
|
51
|
+
# @option opts [String] :rating_range The rating range of potential opponents. Better left empty. Example: 1500-1800
|
52
|
+
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
|
53
|
+
def api_board_seek_with_http_info(opts = {})
|
54
|
+
if @api_client.config.debugging
|
55
|
+
@api_client.config.logger.debug 'Calling API: BoardApi.api_board_seek ...'
|
56
|
+
end
|
57
|
+
if @api_client.config.client_side_validation && !opts[:'time'].nil? && opts[:'time'] > 180
|
58
|
+
fail ArgumentError, 'invalid value for "opts[:"time"]" when calling BoardApi.api_board_seek, must be smaller than or equal to 180.'
|
59
|
+
end
|
60
|
+
|
61
|
+
if @api_client.config.client_side_validation && !opts[:'time'].nil? && opts[:'time'] < 0
|
62
|
+
fail ArgumentError, 'invalid value for "opts[:"time"]" when calling BoardApi.api_board_seek, must be greater than or equal to 0.'
|
63
|
+
end
|
64
|
+
|
65
|
+
if @api_client.config.client_side_validation && !opts[:'increment'].nil? && opts[:'increment'] > 180
|
66
|
+
fail ArgumentError, 'invalid value for "opts[:"increment"]" when calling BoardApi.api_board_seek, must be smaller than or equal to 180.'
|
67
|
+
end
|
68
|
+
|
69
|
+
if @api_client.config.client_side_validation && !opts[:'increment'].nil? && opts[:'increment'] < 0
|
70
|
+
fail ArgumentError, 'invalid value for "opts[:"increment"]" when calling BoardApi.api_board_seek, must be greater than or equal to 0.'
|
71
|
+
end
|
72
|
+
|
73
|
+
if @api_client.config.client_side_validation && !opts[:'byoyomi'].nil? && opts[:'byoyomi'] > 180
|
74
|
+
fail ArgumentError, 'invalid value for "opts[:"byoyomi"]" when calling BoardApi.api_board_seek, must be smaller than or equal to 180.'
|
75
|
+
end
|
76
|
+
|
77
|
+
if @api_client.config.client_side_validation && !opts[:'byoyomi'].nil? && opts[:'byoyomi'] < 0
|
78
|
+
fail ArgumentError, 'invalid value for "opts[:"byoyomi"]" when calling BoardApi.api_board_seek, must be greater than or equal to 0.'
|
79
|
+
end
|
80
|
+
|
81
|
+
if @api_client.config.client_side_validation && !opts[:'periods'].nil? && opts[:'periods'] > 5
|
82
|
+
fail ArgumentError, 'invalid value for "opts[:"periods"]" when calling BoardApi.api_board_seek, must be smaller than or equal to 5.'
|
83
|
+
end
|
84
|
+
|
85
|
+
if @api_client.config.client_side_validation && !opts[:'periods'].nil? && opts[:'periods'] < 1
|
86
|
+
fail ArgumentError, 'invalid value for "opts[:"periods"]" when calling BoardApi.api_board_seek, must be greater than or equal to 1.'
|
87
|
+
end
|
88
|
+
|
89
|
+
allowable_values = [1, 2, 3, 5, 7, 10, 14]
|
90
|
+
if @api_client.config.client_side_validation && opts[:'days'] && !allowable_values.include?(opts[:'days'])
|
91
|
+
fail ArgumentError, "invalid value for \"days\", must be one of #{allowable_values}"
|
92
|
+
end
|
93
|
+
allowable_values = ["random", "sente", "gote"]
|
94
|
+
if @api_client.config.client_side_validation && opts[:'color'] && !allowable_values.include?(opts[:'color'])
|
95
|
+
fail ArgumentError, "invalid value for \"color\", must be one of #{allowable_values}"
|
96
|
+
end
|
97
|
+
# resource path
|
98
|
+
local_var_path = '/api/board/seek'
|
99
|
+
|
100
|
+
# query parameters
|
101
|
+
query_params = opts[:query_params] || {}
|
102
|
+
|
103
|
+
# header parameters
|
104
|
+
header_params = opts[:header_params] || {}
|
105
|
+
# HTTP header 'Accept' (if needed)
|
106
|
+
header_params['Accept'] = @api_client.select_header_accept(['text/plain', 'application/json']) unless header_params['Accept']
|
107
|
+
# HTTP header 'Content-Type'
|
108
|
+
content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])
|
109
|
+
if !content_type.nil?
|
110
|
+
header_params['Content-Type'] = content_type
|
111
|
+
end
|
112
|
+
|
113
|
+
# form parameters
|
114
|
+
form_params = opts[:form_params] || {}
|
115
|
+
form_params['rated'] = opts[:'rated'] if !opts[:'rated'].nil?
|
116
|
+
form_params['time'] = opts[:'time'] if !opts[:'time'].nil?
|
117
|
+
form_params['increment'] = opts[:'increment'] if !opts[:'increment'].nil?
|
118
|
+
form_params['byoyomi'] = opts[:'byoyomi'] if !opts[:'byoyomi'].nil?
|
119
|
+
form_params['periods'] = opts[:'periods'] if !opts[:'periods'].nil?
|
120
|
+
form_params['days'] = opts[:'days'] if !opts[:'days'].nil?
|
121
|
+
form_params['variant'] = opts[:'variant'] if !opts[:'variant'].nil?
|
122
|
+
form_params['color'] = opts[:'color'] if !opts[:'color'].nil?
|
123
|
+
form_params['ratingRange'] = opts[:'rating_range'] if !opts[:'rating_range'].nil?
|
124
|
+
|
125
|
+
# http body (model)
|
126
|
+
post_body = opts[:debug_body]
|
127
|
+
|
128
|
+
# return_type
|
129
|
+
return_type = opts[:debug_return_type]
|
130
|
+
|
131
|
+
# auth_names
|
132
|
+
auth_names = opts[:debug_auth_names] || ['OAuth2']
|
133
|
+
|
134
|
+
new_options = opts.merge(
|
135
|
+
:operation => :"BoardApi.api_board_seek",
|
136
|
+
:header_params => header_params,
|
137
|
+
:query_params => query_params,
|
138
|
+
:form_params => form_params,
|
139
|
+
:body => post_body,
|
140
|
+
:auth_names => auth_names,
|
141
|
+
:return_type => return_type
|
142
|
+
)
|
143
|
+
|
144
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
145
|
+
if @api_client.config.debugging
|
146
|
+
@api_client.config.logger.debug "API called: BoardApi#api_board_seek\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
147
|
+
end
|
148
|
+
return data, status_code, headers
|
149
|
+
end
|
150
|
+
|
151
|
+
# Stream incoming events
|
152
|
+
# 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.
|
153
|
+
# @param [Hash] opts the optional parameters
|
154
|
+
# @return [ApiStreamEvent200Response]
|
155
|
+
def api_stream_event(opts = {})
|
156
|
+
data, _status_code, _headers = api_stream_event_with_http_info(opts)
|
157
|
+
data
|
158
|
+
end
|
159
|
+
|
160
|
+
# Stream incoming events
|
161
|
+
# 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.
|
162
|
+
# @param [Hash] opts the optional parameters
|
163
|
+
# @return [Array<(ApiStreamEvent200Response, Integer, Hash)>] ApiStreamEvent200Response data, response status code and response headers
|
164
|
+
def api_stream_event_with_http_info(opts = {})
|
165
|
+
if @api_client.config.debugging
|
166
|
+
@api_client.config.logger.debug 'Calling API: BoardApi.api_stream_event ...'
|
167
|
+
end
|
168
|
+
# resource path
|
169
|
+
local_var_path = '/api/stream/event'
|
170
|
+
|
171
|
+
# query parameters
|
172
|
+
query_params = opts[:query_params] || {}
|
173
|
+
|
174
|
+
# header parameters
|
175
|
+
header_params = opts[:header_params] || {}
|
176
|
+
# HTTP header 'Accept' (if needed)
|
177
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/x-ndjson']) unless header_params['Accept']
|
178
|
+
|
179
|
+
# form parameters
|
180
|
+
form_params = opts[:form_params] || {}
|
181
|
+
|
182
|
+
# http body (model)
|
183
|
+
post_body = opts[:debug_body]
|
184
|
+
|
185
|
+
# return_type
|
186
|
+
return_type = opts[:debug_return_type] || 'ApiStreamEvent200Response'
|
187
|
+
|
188
|
+
# auth_names
|
189
|
+
auth_names = opts[:debug_auth_names] || ['OAuth2']
|
190
|
+
|
191
|
+
new_options = opts.merge(
|
192
|
+
:operation => :"BoardApi.api_stream_event",
|
193
|
+
:header_params => header_params,
|
194
|
+
:query_params => query_params,
|
195
|
+
:form_params => form_params,
|
196
|
+
:body => post_body,
|
197
|
+
:auth_names => auth_names,
|
198
|
+
:return_type => return_type
|
199
|
+
)
|
200
|
+
|
201
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
202
|
+
if @api_client.config.debugging
|
203
|
+
@api_client.config.logger.debug "API called: BoardApi#api_stream_event\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
204
|
+
end
|
205
|
+
return data, status_code, headers
|
206
|
+
end
|
207
|
+
|
208
|
+
# Abort a game
|
209
|
+
# Abort a game being played with the Board API.
|
210
|
+
# @param game_id [String]
|
211
|
+
# @param [Hash] opts the optional parameters
|
212
|
+
# @return [Ok]
|
213
|
+
def board_game_abort(game_id, opts = {})
|
214
|
+
data, _status_code, _headers = board_game_abort_with_http_info(game_id, opts)
|
215
|
+
data
|
216
|
+
end
|
217
|
+
|
218
|
+
# Abort a game
|
219
|
+
# Abort a game being played with the Board API.
|
220
|
+
# @param game_id [String]
|
221
|
+
# @param [Hash] opts the optional parameters
|
222
|
+
# @return [Array<(Ok, Integer, Hash)>] Ok data, response status code and response headers
|
223
|
+
def board_game_abort_with_http_info(game_id, opts = {})
|
224
|
+
if @api_client.config.debugging
|
225
|
+
@api_client.config.logger.debug 'Calling API: BoardApi.board_game_abort ...'
|
226
|
+
end
|
227
|
+
# verify the required parameter 'game_id' is set
|
228
|
+
if @api_client.config.client_side_validation && game_id.nil?
|
229
|
+
fail ArgumentError, "Missing the required parameter 'game_id' when calling BoardApi.board_game_abort"
|
230
|
+
end
|
231
|
+
# resource path
|
232
|
+
local_var_path = '/api/board/game/{gameId}/abort'.sub('{' + 'gameId' + '}', CGI.escape(game_id.to_s))
|
233
|
+
|
234
|
+
# query parameters
|
235
|
+
query_params = opts[:query_params] || {}
|
236
|
+
|
237
|
+
# header parameters
|
238
|
+
header_params = opts[:header_params] || {}
|
239
|
+
# HTTP header 'Accept' (if needed)
|
240
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
241
|
+
|
242
|
+
# form parameters
|
243
|
+
form_params = opts[:form_params] || {}
|
244
|
+
|
245
|
+
# http body (model)
|
246
|
+
post_body = opts[:debug_body]
|
247
|
+
|
248
|
+
# return_type
|
249
|
+
return_type = opts[:debug_return_type] || 'Ok'
|
250
|
+
|
251
|
+
# auth_names
|
252
|
+
auth_names = opts[:debug_auth_names] || ['OAuth2']
|
253
|
+
|
254
|
+
new_options = opts.merge(
|
255
|
+
:operation => :"BoardApi.board_game_abort",
|
256
|
+
:header_params => header_params,
|
257
|
+
:query_params => query_params,
|
258
|
+
:form_params => form_params,
|
259
|
+
:body => post_body,
|
260
|
+
:auth_names => auth_names,
|
261
|
+
:return_type => return_type
|
262
|
+
)
|
263
|
+
|
264
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
265
|
+
if @api_client.config.debugging
|
266
|
+
@api_client.config.logger.debug "API called: BoardApi#board_game_abort\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
267
|
+
end
|
268
|
+
return data, status_code, headers
|
269
|
+
end
|
270
|
+
|
271
|
+
# Fetch the game chat
|
272
|
+
# Get the messages posted in the game chat
|
273
|
+
# @param game_id [String]
|
274
|
+
# @param [Hash] opts the optional parameters
|
275
|
+
# @return [Object]
|
276
|
+
def board_game_chat_get(game_id, opts = {})
|
277
|
+
data, _status_code, _headers = board_game_chat_get_with_http_info(game_id, opts)
|
278
|
+
data
|
279
|
+
end
|
280
|
+
|
281
|
+
# Fetch the game chat
|
282
|
+
# Get the messages posted in the game chat
|
283
|
+
# @param game_id [String]
|
284
|
+
# @param [Hash] opts the optional parameters
|
285
|
+
# @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
|
286
|
+
def board_game_chat_get_with_http_info(game_id, opts = {})
|
287
|
+
if @api_client.config.debugging
|
288
|
+
@api_client.config.logger.debug 'Calling API: BoardApi.board_game_chat_get ...'
|
289
|
+
end
|
290
|
+
# verify the required parameter 'game_id' is set
|
291
|
+
if @api_client.config.client_side_validation && game_id.nil?
|
292
|
+
fail ArgumentError, "Missing the required parameter 'game_id' when calling BoardApi.board_game_chat_get"
|
293
|
+
end
|
294
|
+
# resource path
|
295
|
+
local_var_path = '/api/board/game/{gameId}/chat'.sub('{' + 'gameId' + '}', CGI.escape(game_id.to_s))
|
296
|
+
|
297
|
+
# query parameters
|
298
|
+
query_params = opts[:query_params] || {}
|
299
|
+
|
300
|
+
# header parameters
|
301
|
+
header_params = opts[:header_params] || {}
|
302
|
+
# HTTP header 'Accept' (if needed)
|
303
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/x-ndjson']) unless header_params['Accept']
|
304
|
+
|
305
|
+
# form parameters
|
306
|
+
form_params = opts[:form_params] || {}
|
307
|
+
|
308
|
+
# http body (model)
|
309
|
+
post_body = opts[:debug_body]
|
310
|
+
|
311
|
+
# return_type
|
312
|
+
return_type = opts[:debug_return_type] || 'Object'
|
313
|
+
|
314
|
+
# auth_names
|
315
|
+
auth_names = opts[:debug_auth_names] || ['OAuth2']
|
316
|
+
|
317
|
+
new_options = opts.merge(
|
318
|
+
:operation => :"BoardApi.board_game_chat_get",
|
319
|
+
:header_params => header_params,
|
320
|
+
:query_params => query_params,
|
321
|
+
:form_params => form_params,
|
322
|
+
:body => post_body,
|
323
|
+
:auth_names => auth_names,
|
324
|
+
:return_type => return_type
|
325
|
+
)
|
326
|
+
|
327
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
328
|
+
if @api_client.config.debugging
|
329
|
+
@api_client.config.logger.debug "API called: BoardApi#board_game_chat_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
330
|
+
end
|
331
|
+
return data, status_code, headers
|
332
|
+
end
|
333
|
+
|
334
|
+
# Write in the chat
|
335
|
+
# Post a message to the player or spectator chat, in a game being played with the Board API.
|
336
|
+
# @param game_id [String]
|
337
|
+
# @param room [String]
|
338
|
+
# @param text [String]
|
339
|
+
# @param [Hash] opts the optional parameters
|
340
|
+
# @return [Ok]
|
341
|
+
def board_game_chat_post(game_id, room, text, opts = {})
|
342
|
+
data, _status_code, _headers = board_game_chat_post_with_http_info(game_id, room, text, opts)
|
343
|
+
data
|
344
|
+
end
|
345
|
+
|
346
|
+
# Write in the chat
|
347
|
+
# Post a message to the player or spectator chat, in a game being played with the Board API.
|
348
|
+
# @param game_id [String]
|
349
|
+
# @param room [String]
|
350
|
+
# @param text [String]
|
351
|
+
# @param [Hash] opts the optional parameters
|
352
|
+
# @return [Array<(Ok, Integer, Hash)>] Ok data, response status code and response headers
|
353
|
+
def board_game_chat_post_with_http_info(game_id, room, text, opts = {})
|
354
|
+
if @api_client.config.debugging
|
355
|
+
@api_client.config.logger.debug 'Calling API: BoardApi.board_game_chat_post ...'
|
356
|
+
end
|
357
|
+
# verify the required parameter 'game_id' is set
|
358
|
+
if @api_client.config.client_side_validation && game_id.nil?
|
359
|
+
fail ArgumentError, "Missing the required parameter 'game_id' when calling BoardApi.board_game_chat_post"
|
360
|
+
end
|
361
|
+
# verify the required parameter 'room' is set
|
362
|
+
if @api_client.config.client_side_validation && room.nil?
|
363
|
+
fail ArgumentError, "Missing the required parameter 'room' when calling BoardApi.board_game_chat_post"
|
364
|
+
end
|
365
|
+
# verify enum value
|
366
|
+
allowable_values = ["player", "spectator"]
|
367
|
+
if @api_client.config.client_side_validation && !allowable_values.include?(room)
|
368
|
+
fail ArgumentError, "invalid value for \"room\", must be one of #{allowable_values}"
|
369
|
+
end
|
370
|
+
# verify the required parameter 'text' is set
|
371
|
+
if @api_client.config.client_side_validation && text.nil?
|
372
|
+
fail ArgumentError, "Missing the required parameter 'text' when calling BoardApi.board_game_chat_post"
|
373
|
+
end
|
374
|
+
# resource path
|
375
|
+
local_var_path = '/api/board/game/{gameId}/chat'.sub('{' + 'gameId' + '}', CGI.escape(game_id.to_s))
|
376
|
+
|
377
|
+
# query parameters
|
378
|
+
query_params = opts[:query_params] || {}
|
379
|
+
|
380
|
+
# header parameters
|
381
|
+
header_params = opts[:header_params] || {}
|
382
|
+
# HTTP header 'Accept' (if needed)
|
383
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
384
|
+
# HTTP header 'Content-Type'
|
385
|
+
content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])
|
386
|
+
if !content_type.nil?
|
387
|
+
header_params['Content-Type'] = content_type
|
388
|
+
end
|
389
|
+
|
390
|
+
# form parameters
|
391
|
+
form_params = opts[:form_params] || {}
|
392
|
+
form_params['room'] = room
|
393
|
+
form_params['text'] = text
|
394
|
+
|
395
|
+
# http body (model)
|
396
|
+
post_body = opts[:debug_body]
|
397
|
+
|
398
|
+
# return_type
|
399
|
+
return_type = opts[:debug_return_type] || 'Ok'
|
400
|
+
|
401
|
+
# auth_names
|
402
|
+
auth_names = opts[:debug_auth_names] || ['OAuth2']
|
403
|
+
|
404
|
+
new_options = opts.merge(
|
405
|
+
:operation => :"BoardApi.board_game_chat_post",
|
406
|
+
:header_params => header_params,
|
407
|
+
:query_params => query_params,
|
408
|
+
:form_params => form_params,
|
409
|
+
:body => post_body,
|
410
|
+
:auth_names => auth_names,
|
411
|
+
:return_type => return_type
|
412
|
+
)
|
413
|
+
|
414
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
415
|
+
if @api_client.config.debugging
|
416
|
+
@api_client.config.logger.debug "API called: BoardApi#board_game_chat_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
417
|
+
end
|
418
|
+
return data, status_code, headers
|
419
|
+
end
|
420
|
+
|
421
|
+
# Make a Board move
|
422
|
+
# Make a move in a game being played with the Board API.
|
423
|
+
# @param game_id [String]
|
424
|
+
# @param move [String] The move to play, in USI format
|
425
|
+
# @param [Hash] opts the optional parameters
|
426
|
+
# @return [Ok]
|
427
|
+
def board_game_move(game_id, move, opts = {})
|
428
|
+
data, _status_code, _headers = board_game_move_with_http_info(game_id, move, opts)
|
429
|
+
data
|
430
|
+
end
|
431
|
+
|
432
|
+
# Make a Board move
|
433
|
+
# Make a move in a game being played with the Board API.
|
434
|
+
# @param game_id [String]
|
435
|
+
# @param move [String] The move to play, in USI format
|
436
|
+
# @param [Hash] opts the optional parameters
|
437
|
+
# @return [Array<(Ok, Integer, Hash)>] Ok data, response status code and response headers
|
438
|
+
def board_game_move_with_http_info(game_id, move, opts = {})
|
439
|
+
if @api_client.config.debugging
|
440
|
+
@api_client.config.logger.debug 'Calling API: BoardApi.board_game_move ...'
|
441
|
+
end
|
442
|
+
# verify the required parameter 'game_id' is set
|
443
|
+
if @api_client.config.client_side_validation && game_id.nil?
|
444
|
+
fail ArgumentError, "Missing the required parameter 'game_id' when calling BoardApi.board_game_move"
|
445
|
+
end
|
446
|
+
# verify the required parameter 'move' is set
|
447
|
+
if @api_client.config.client_side_validation && move.nil?
|
448
|
+
fail ArgumentError, "Missing the required parameter 'move' when calling BoardApi.board_game_move"
|
449
|
+
end
|
450
|
+
# resource path
|
451
|
+
local_var_path = '/api/board/game/{gameId}/move/{move}'.sub('{' + 'gameId' + '}', CGI.escape(game_id.to_s)).sub('{' + 'move' + '}', CGI.escape(move.to_s))
|
452
|
+
|
453
|
+
# query parameters
|
454
|
+
query_params = opts[:query_params] || {}
|
455
|
+
|
456
|
+
# header parameters
|
457
|
+
header_params = opts[:header_params] || {}
|
458
|
+
# HTTP header 'Accept' (if needed)
|
459
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
460
|
+
|
461
|
+
# form parameters
|
462
|
+
form_params = opts[:form_params] || {}
|
463
|
+
|
464
|
+
# http body (model)
|
465
|
+
post_body = opts[:debug_body]
|
466
|
+
|
467
|
+
# return_type
|
468
|
+
return_type = opts[:debug_return_type] || 'Ok'
|
469
|
+
|
470
|
+
# auth_names
|
471
|
+
auth_names = opts[:debug_auth_names] || ['OAuth2']
|
472
|
+
|
473
|
+
new_options = opts.merge(
|
474
|
+
:operation => :"BoardApi.board_game_move",
|
475
|
+
:header_params => header_params,
|
476
|
+
:query_params => query_params,
|
477
|
+
:form_params => form_params,
|
478
|
+
:body => post_body,
|
479
|
+
:auth_names => auth_names,
|
480
|
+
:return_type => return_type
|
481
|
+
)
|
482
|
+
|
483
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
484
|
+
if @api_client.config.debugging
|
485
|
+
@api_client.config.logger.debug "API called: BoardApi#board_game_move\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
486
|
+
end
|
487
|
+
return data, status_code, headers
|
488
|
+
end
|
489
|
+
|
490
|
+
# Resign a game
|
491
|
+
# Resign a game being played with the Board API.
|
492
|
+
# @param game_id [String]
|
493
|
+
# @param [Hash] opts the optional parameters
|
494
|
+
# @return [Ok]
|
495
|
+
def board_game_resign(game_id, opts = {})
|
496
|
+
data, _status_code, _headers = board_game_resign_with_http_info(game_id, opts)
|
497
|
+
data
|
498
|
+
end
|
499
|
+
|
500
|
+
# Resign a game
|
501
|
+
# Resign a game being played with the Board API.
|
502
|
+
# @param game_id [String]
|
503
|
+
# @param [Hash] opts the optional parameters
|
504
|
+
# @return [Array<(Ok, Integer, Hash)>] Ok data, response status code and response headers
|
505
|
+
def board_game_resign_with_http_info(game_id, opts = {})
|
506
|
+
if @api_client.config.debugging
|
507
|
+
@api_client.config.logger.debug 'Calling API: BoardApi.board_game_resign ...'
|
508
|
+
end
|
509
|
+
# verify the required parameter 'game_id' is set
|
510
|
+
if @api_client.config.client_side_validation && game_id.nil?
|
511
|
+
fail ArgumentError, "Missing the required parameter 'game_id' when calling BoardApi.board_game_resign"
|
512
|
+
end
|
513
|
+
# resource path
|
514
|
+
local_var_path = '/api/board/game/{gameId}/resign'.sub('{' + 'gameId' + '}', CGI.escape(game_id.to_s))
|
515
|
+
|
516
|
+
# query parameters
|
517
|
+
query_params = opts[:query_params] || {}
|
518
|
+
|
519
|
+
# header parameters
|
520
|
+
header_params = opts[:header_params] || {}
|
521
|
+
# HTTP header 'Accept' (if needed)
|
522
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
523
|
+
|
524
|
+
# form parameters
|
525
|
+
form_params = opts[:form_params] || {}
|
526
|
+
|
527
|
+
# http body (model)
|
528
|
+
post_body = opts[:debug_body]
|
529
|
+
|
530
|
+
# return_type
|
531
|
+
return_type = opts[:debug_return_type] || 'Ok'
|
532
|
+
|
533
|
+
# auth_names
|
534
|
+
auth_names = opts[:debug_auth_names] || ['OAuth2']
|
535
|
+
|
536
|
+
new_options = opts.merge(
|
537
|
+
:operation => :"BoardApi.board_game_resign",
|
538
|
+
:header_params => header_params,
|
539
|
+
:query_params => query_params,
|
540
|
+
:form_params => form_params,
|
541
|
+
:body => post_body,
|
542
|
+
:auth_names => auth_names,
|
543
|
+
:return_type => return_type
|
544
|
+
)
|
545
|
+
|
546
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
547
|
+
if @api_client.config.debugging
|
548
|
+
@api_client.config.logger.debug "API called: BoardApi#board_game_resign\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
549
|
+
end
|
550
|
+
return data, status_code, headers
|
551
|
+
end
|
552
|
+
|
553
|
+
# Stream Board game state
|
554
|
+
# Stream the state of a game being played with the Board 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. Sent when a move is played, or when the game ends. - `chatLine` Chat message sent by a user in the `room` \"player\" or \"spectator\". The first line is always of type `gameFull`. The server closes the stream when the game ends, or if the game has already ended.
|
555
|
+
# @param game_id [String]
|
556
|
+
# @param [Hash] opts the optional parameters
|
557
|
+
# @return [BoardGameStream200Response]
|
558
|
+
def board_game_stream(game_id, opts = {})
|
559
|
+
data, _status_code, _headers = board_game_stream_with_http_info(game_id, opts)
|
560
|
+
data
|
561
|
+
end
|
562
|
+
|
563
|
+
# Stream Board game state
|
564
|
+
# Stream the state of a game being played with the Board 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. Sent when a move is played, or when the game ends. - `chatLine` Chat message sent by a user in the `room` \"player\" or \"spectator\". The first line is always of type `gameFull`. The server closes the stream when the game ends, or if the game has already ended.
|
565
|
+
# @param game_id [String]
|
566
|
+
# @param [Hash] opts the optional parameters
|
567
|
+
# @return [Array<(BoardGameStream200Response, Integer, Hash)>] BoardGameStream200Response data, response status code and response headers
|
568
|
+
def board_game_stream_with_http_info(game_id, opts = {})
|
569
|
+
if @api_client.config.debugging
|
570
|
+
@api_client.config.logger.debug 'Calling API: BoardApi.board_game_stream ...'
|
571
|
+
end
|
572
|
+
# verify the required parameter 'game_id' is set
|
573
|
+
if @api_client.config.client_side_validation && game_id.nil?
|
574
|
+
fail ArgumentError, "Missing the required parameter 'game_id' when calling BoardApi.board_game_stream"
|
575
|
+
end
|
576
|
+
# resource path
|
577
|
+
local_var_path = '/api/board/game/stream/{gameId}'.sub('{' + 'gameId' + '}', CGI.escape(game_id.to_s))
|
578
|
+
|
579
|
+
# query parameters
|
580
|
+
query_params = opts[:query_params] || {}
|
581
|
+
|
582
|
+
# header parameters
|
583
|
+
header_params = opts[:header_params] || {}
|
584
|
+
# HTTP header 'Accept' (if needed)
|
585
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/x-ndjson', 'application/json']) unless header_params['Accept']
|
586
|
+
|
587
|
+
# form parameters
|
588
|
+
form_params = opts[:form_params] || {}
|
589
|
+
|
590
|
+
# http body (model)
|
591
|
+
post_body = opts[:debug_body]
|
592
|
+
|
593
|
+
# return_type
|
594
|
+
return_type = opts[:debug_return_type] || 'BoardGameStream200Response'
|
595
|
+
|
596
|
+
# auth_names
|
597
|
+
auth_names = opts[:debug_auth_names] || ['OAuth2']
|
598
|
+
|
599
|
+
new_options = opts.merge(
|
600
|
+
:operation => :"BoardApi.board_game_stream",
|
601
|
+
:header_params => header_params,
|
602
|
+
:query_params => query_params,
|
603
|
+
:form_params => form_params,
|
604
|
+
:body => post_body,
|
605
|
+
:auth_names => auth_names,
|
606
|
+
:return_type => return_type
|
607
|
+
)
|
608
|
+
|
609
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
610
|
+
if @api_client.config.debugging
|
611
|
+
@api_client.config.logger.debug "API called: BoardApi#board_game_stream\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
612
|
+
end
|
613
|
+
return data, status_code, headers
|
614
|
+
end
|
615
|
+
|
616
|
+
# Handle takeback offers
|
617
|
+
# Create/accept/decline takebacks. - `yes`: Propose a takeback, or accept the opponent's takeback offer. - `no`: Decline a takeback offer from the opponent.
|
618
|
+
# @param game_id [String]
|
619
|
+
# @param accept [BoardGameTakebackAcceptParameter]
|
620
|
+
# @param [Hash] opts the optional parameters
|
621
|
+
# @return [Ok]
|
622
|
+
def board_game_takeback(game_id, accept, opts = {})
|
623
|
+
data, _status_code, _headers = board_game_takeback_with_http_info(game_id, accept, opts)
|
624
|
+
data
|
625
|
+
end
|
626
|
+
|
627
|
+
# Handle takeback offers
|
628
|
+
# Create/accept/decline takebacks. - `yes`: Propose a takeback, or accept the opponent's takeback offer. - `no`: Decline a takeback offer from the opponent.
|
629
|
+
# @param game_id [String]
|
630
|
+
# @param accept [BoardGameTakebackAcceptParameter]
|
631
|
+
# @param [Hash] opts the optional parameters
|
632
|
+
# @return [Array<(Ok, Integer, Hash)>] Ok data, response status code and response headers
|
633
|
+
def board_game_takeback_with_http_info(game_id, accept, opts = {})
|
634
|
+
if @api_client.config.debugging
|
635
|
+
@api_client.config.logger.debug 'Calling API: BoardApi.board_game_takeback ...'
|
636
|
+
end
|
637
|
+
# verify the required parameter 'game_id' is set
|
638
|
+
if @api_client.config.client_side_validation && game_id.nil?
|
639
|
+
fail ArgumentError, "Missing the required parameter 'game_id' when calling BoardApi.board_game_takeback"
|
640
|
+
end
|
641
|
+
# verify the required parameter 'accept' is set
|
642
|
+
if @api_client.config.client_side_validation && accept.nil?
|
643
|
+
fail ArgumentError, "Missing the required parameter 'accept' when calling BoardApi.board_game_takeback"
|
644
|
+
end
|
645
|
+
# resource path
|
646
|
+
local_var_path = '/api/board/game/{gameId}/takeback/{accept}'.sub('{' + 'gameId' + '}', CGI.escape(game_id.to_s)).sub('{' + 'accept' + '}', CGI.escape(accept.to_s))
|
647
|
+
|
648
|
+
# query parameters
|
649
|
+
query_params = opts[:query_params] || {}
|
650
|
+
|
651
|
+
# header parameters
|
652
|
+
header_params = opts[:header_params] || {}
|
653
|
+
# HTTP header 'Accept' (if needed)
|
654
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
655
|
+
|
656
|
+
# form parameters
|
657
|
+
form_params = opts[:form_params] || {}
|
658
|
+
|
659
|
+
# http body (model)
|
660
|
+
post_body = opts[:debug_body]
|
661
|
+
|
662
|
+
# return_type
|
663
|
+
return_type = opts[:debug_return_type] || 'Ok'
|
664
|
+
|
665
|
+
# auth_names
|
666
|
+
auth_names = opts[:debug_auth_names] || ['OAuth2']
|
667
|
+
|
668
|
+
new_options = opts.merge(
|
669
|
+
:operation => :"BoardApi.board_game_takeback",
|
670
|
+
:header_params => header_params,
|
671
|
+
:query_params => query_params,
|
672
|
+
:form_params => form_params,
|
673
|
+
:body => post_body,
|
674
|
+
:auth_names => auth_names,
|
675
|
+
:return_type => return_type
|
676
|
+
)
|
677
|
+
|
678
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
679
|
+
if @api_client.config.debugging
|
680
|
+
@api_client.config.logger.debug "API called: BoardApi#board_game_takeback\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
681
|
+
end
|
682
|
+
return data, status_code, headers
|
683
|
+
end
|
684
|
+
end
|
685
|
+
end
|