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.
Files changed (248) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/LICENSE +661 -0
  4. data/LICENSE~ +1 -0
  5. data/Makefile +39 -0
  6. data/Makefile~ +7 -0
  7. data/README.md +276 -0
  8. data/Rakefile +10 -0
  9. data/docs/Account200Response.md +20 -0
  10. data/docs/AccountApi.md +345 -0
  11. data/docs/AccountEmail200Response.md +18 -0
  12. data/docs/AccountKid200Response.md +18 -0
  13. data/docs/AnalysisApi.md +77 -0
  14. data/docs/ApiStreamEvent200Response.md +53 -0
  15. data/docs/ApiUsersStatus200ResponseInner.md +30 -0
  16. data/docs/ArenaTournaments.md +22 -0
  17. data/docs/ArenaTournamentsApi.md +601 -0
  18. data/docs/BoardApi.md +659 -0
  19. data/docs/BoardGameStream200Response.md +51 -0
  20. data/docs/BoardGameTakebackAcceptParameter.md +15 -0
  21. data/docs/BotApi.md +634 -0
  22. data/docs/ChallengeDeclinedEvent.md +20 -0
  23. data/docs/ChallengeEvent.md +20 -0
  24. data/docs/ChallengeJson.md +42 -0
  25. data/docs/ChallengeJsonPerf.md +20 -0
  26. data/docs/ChallengeJsonTimeControl.md +51 -0
  27. data/docs/ChallengeJsonTimeControlOneOf.md +28 -0
  28. data/docs/ChallengeJsonTimeControlOneOf1.md +20 -0
  29. data/docs/ChallengeJsonTimeControlOneOf2.md +18 -0
  30. data/docs/ChallengeUser.md +30 -0
  31. data/docs/ChallengesApi.md +414 -0
  32. data/docs/ChatLineEvent.md +24 -0
  33. data/docs/Clock.md +24 -0
  34. data/docs/Count.md +38 -0
  35. data/docs/Error.md +18 -0
  36. data/docs/GameEventInfo.md +22 -0
  37. data/docs/GameEventInfoCompat.md +20 -0
  38. data/docs/GameEventPlayer.md +28 -0
  39. data/docs/GameFinishEvent.md +20 -0
  40. data/docs/GameFullEvent.md +42 -0
  41. data/docs/GameFullEventPerf.md +18 -0
  42. data/docs/GameJson.md +50 -0
  43. data/docs/GameJsonAnalysisInner.md +24 -0
  44. data/docs/GameJsonAnalysisInnerJudgment.md +20 -0
  45. data/docs/GameJsonClock.md +26 -0
  46. data/docs/GameJsonPlayers.md +20 -0
  47. data/docs/GameStartEvent.md +20 -0
  48. data/docs/GameStateEvent.md +38 -0
  49. data/docs/GameStatus.md +15 -0
  50. data/docs/GameUser.md +32 -0
  51. data/docs/GameUserAnalysis.md +24 -0
  52. data/docs/GamesApi.md +473 -0
  53. data/docs/LightUser.md +24 -0
  54. data/docs/LightUserTitle.md +49 -0
  55. data/docs/MessagingApi.md +79 -0
  56. data/docs/Move.md +28 -0
  57. data/docs/NotFound.md +18 -0
  58. data/docs/OAuthError.md +20 -0
  59. data/docs/Ok.md +18 -0
  60. data/docs/Perf.md +26 -0
  61. data/docs/PerfType.md +15 -0
  62. data/docs/Perfs.md +30 -0
  63. data/docs/PlayTime.md +20 -0
  64. data/docs/Profile.md +28 -0
  65. data/docs/PuzzleRoundJson.md +24 -0
  66. data/docs/PuzzlesApi.md +211 -0
  67. data/docs/SimulsApi.md +69 -0
  68. data/docs/Speed.md +15 -0
  69. data/docs/StudiesApi.md +233 -0
  70. data/docs/TVApi.md +208 -0
  71. data/docs/Team.md +32 -0
  72. data/docs/TeamAll200Response.md +30 -0
  73. data/docs/TeamRequest.md +24 -0
  74. data/docs/TeamRequestWithUser.md +20 -0
  75. data/docs/TeamsApi.md +702 -0
  76. data/docs/Title.md +15 -0
  77. data/docs/User.md +42 -0
  78. data/docs/UserExtended.md +60 -0
  79. data/docs/UserPreferences.md +72 -0
  80. data/docs/UsersApi.md +667 -0
  81. data/docs/Variant.md +22 -0
  82. data/docs/VariantKey.md +15 -0
  83. data/git_push.sh +57 -0
  84. data/lib/lishogi/api/account_api.rb +314 -0
  85. data/lib/lishogi/api/analysis_api.rb +92 -0
  86. data/lib/lishogi/api/arena_tournaments_api.rb +681 -0
  87. data/lib/lishogi/api/board_api.rb +685 -0
  88. data/lib/lishogi/api/bot_api.rb +608 -0
  89. data/lib/lishogi/api/challenges_api.rb +554 -0
  90. data/lib/lishogi/api/games_api.rb +514 -0
  91. data/lib/lishogi/api/messaging_api.rb +97 -0
  92. data/lib/lishogi/api/puzzles_api.rb +210 -0
  93. data/lib/lishogi/api/simuls_api.rb +79 -0
  94. data/lib/lishogi/api/studies_api.rb +244 -0
  95. data/lib/lishogi/api/teams_api.rb +678 -0
  96. data/lib/lishogi/api/tv_api.rb +222 -0
  97. data/lib/lishogi/api/users_api.rb +677 -0
  98. data/lib/lishogi/api_client.rb +437 -0
  99. data/lib/lishogi/api_error.rb +58 -0
  100. data/lib/lishogi/configuration.rb +392 -0
  101. data/lib/lishogi/models/account200_response.rb +223 -0
  102. data/lib/lishogi/models/account_email200_response.rb +214 -0
  103. data/lib/lishogi/models/account_kid200_response.rb +214 -0
  104. data/lib/lishogi/models/api_stream_event200_response.rb +107 -0
  105. data/lib/lishogi/models/api_users_status200_response_inner.rb +273 -0
  106. data/lib/lishogi/models/arena_tournaments.rb +238 -0
  107. data/lib/lishogi/models/board_game_stream200_response.rb +106 -0
  108. data/lib/lishogi/models/board_game_takeback_accept_parameter.rb +104 -0
  109. data/lib/lishogi/models/challenge_declined_event.rb +257 -0
  110. data/lib/lishogi/models/challenge_event.rb +257 -0
  111. data/lib/lishogi/models/challenge_json.rb +453 -0
  112. data/lib/lishogi/models/challenge_json_perf.rb +223 -0
  113. data/lib/lishogi/models/challenge_json_time_control.rb +106 -0
  114. data/lib/lishogi/models/challenge_json_time_control_one_of.rb +259 -0
  115. data/lib/lishogi/models/challenge_json_time_control_one_of1.rb +223 -0
  116. data/lib/lishogi/models/challenge_json_time_control_one_of2.rb +214 -0
  117. data/lib/lishogi/models/challenge_user.rb +275 -0
  118. data/lib/lishogi/models/chat_line_event.rb +315 -0
  119. data/lib/lishogi/models/clock.rb +242 -0
  120. data/lib/lishogi/models/count.rb +304 -0
  121. data/lib/lishogi/models/error.rb +215 -0
  122. data/lib/lishogi/models/game_event_info.rb +266 -0
  123. data/lib/lishogi/models/game_event_info_compat.rb +223 -0
  124. data/lib/lishogi/models/game_event_player.rb +260 -0
  125. data/lib/lishogi/models/game_finish_event.rb +257 -0
  126. data/lib/lishogi/models/game_full_event.rb +436 -0
  127. data/lib/lishogi/models/game_full_event_perf.rb +215 -0
  128. data/lib/lishogi/models/game_json.rb +457 -0
  129. data/lib/lishogi/models/game_json_analysis_inner.rb +251 -0
  130. data/lib/lishogi/models/game_json_analysis_inner_judgment.rb +258 -0
  131. data/lib/lishogi/models/game_json_clock.rb +250 -0
  132. data/lib/lishogi/models/game_json_players.rb +223 -0
  133. data/lib/lishogi/models/game_start_event.rb +257 -0
  134. data/lib/lishogi/models/game_state_event.rb +396 -0
  135. data/lib/lishogi/models/game_status.rb +52 -0
  136. data/lib/lishogi/models/game_user.rb +277 -0
  137. data/lib/lishogi/models/game_user_analysis.rb +269 -0
  138. data/lib/lishogi/models/light_user.rb +241 -0
  139. data/lib/lishogi/models/light_user_title.rb +105 -0
  140. data/lib/lishogi/models/move.rb +259 -0
  141. data/lib/lishogi/models/not_found.rb +214 -0
  142. data/lib/lishogi/models/o_auth_error.rb +225 -0
  143. data/lib/lishogi/models/ok.rb +214 -0
  144. data/lib/lishogi/models/perf.rb +250 -0
  145. data/lib/lishogi/models/perf_type.rb +49 -0
  146. data/lib/lishogi/models/perfs.rb +268 -0
  147. data/lib/lishogi/models/play_time.rb +223 -0
  148. data/lib/lishogi/models/profile.rb +259 -0
  149. data/lib/lishogi/models/puzzle_round_json.rb +241 -0
  150. data/lib/lishogi/models/speed.rb +44 -0
  151. data/lib/lishogi/models/team.rb +280 -0
  152. data/lib/lishogi/models/team_all200_response.rb +272 -0
  153. data/lib/lishogi/models/team_request.rb +241 -0
  154. data/lib/lishogi/models/team_request_with_user.rb +223 -0
  155. data/lib/lishogi/models/title.rb +64 -0
  156. data/lib/lishogi/models/user.rb +322 -0
  157. data/lib/lishogi/models/user_extended.rb +410 -0
  158. data/lib/lishogi/models/user_preferences.rb +515 -0
  159. data/lib/lishogi/models/variant.rb +256 -0
  160. data/lib/lishogi/models/variant_key.rb +44 -0
  161. data/lib/lishogi/version.rb +15 -0
  162. data/lib/lishogi.rb +112 -0
  163. data/lishogi-api.patched.yaml +5806 -0
  164. data/lishogi-api.yaml +5811 -0
  165. data/lishogi.gemspec +41 -0
  166. data/manifest.scm +1 -0
  167. data/manifest.scm~ +1 -0
  168. data/patch +5 -0
  169. data/patch~ +1 -0
  170. data/pkg/lishogi-0.1.0.gem +0 -0
  171. data/smoke +5 -0
  172. data/smoke~ +2 -0
  173. data/spec/api/account_api_spec.rb +91 -0
  174. data/spec/api/analysis_api_spec.rb +49 -0
  175. data/spec/api/arena_tournaments_api_spec.rb +160 -0
  176. data/spec/api/board_api_spec.rb +154 -0
  177. data/spec/api/bot_api_spec.rb +144 -0
  178. data/spec/api/challenges_api_spec.rb +123 -0
  179. data/spec/api/games_api_spec.rb +135 -0
  180. data/spec/api/messaging_api_spec.rb +48 -0
  181. data/spec/api/puzzles_api_spec.rb +70 -0
  182. data/spec/api/simuls_api_spec.rb +46 -0
  183. data/spec/api/studies_api_spec.rb +81 -0
  184. data/spec/api/teams_api_spec.rb +160 -0
  185. data/spec/api/tv_api_spec.rb +74 -0
  186. data/spec/api/users_api_spec.rb +157 -0
  187. data/spec/models/account200_response_spec.rb +42 -0
  188. data/spec/models/account_email200_response_spec.rb +36 -0
  189. data/spec/models/account_kid200_response_spec.rb +36 -0
  190. data/spec/models/api_stream_event200_response_spec.rb +32 -0
  191. data/spec/models/api_users_status200_response_inner_spec.rb +72 -0
  192. data/spec/models/arena_tournaments_spec.rb +48 -0
  193. data/spec/models/board_game_stream200_response_spec.rb +32 -0
  194. data/spec/models/board_game_takeback_accept_parameter_spec.rb +21 -0
  195. data/spec/models/challenge_declined_event_spec.rb +46 -0
  196. data/spec/models/challenge_event_spec.rb +46 -0
  197. data/spec/models/challenge_json_perf_spec.rb +42 -0
  198. data/spec/models/challenge_json_spec.rb +120 -0
  199. data/spec/models/challenge_json_time_control_one_of1_spec.rb +42 -0
  200. data/spec/models/challenge_json_time_control_one_of2_spec.rb +36 -0
  201. data/spec/models/challenge_json_time_control_one_of_spec.rb +66 -0
  202. data/spec/models/challenge_json_time_control_spec.rb +32 -0
  203. data/spec/models/challenge_user_spec.rb +72 -0
  204. data/spec/models/chat_line_event_spec.rb +62 -0
  205. data/spec/models/clock_spec.rb +54 -0
  206. data/spec/models/count_spec.rb +96 -0
  207. data/spec/models/error_spec.rb +36 -0
  208. data/spec/models/game_event_info_compat_spec.rb +42 -0
  209. data/spec/models/game_event_info_spec.rb +52 -0
  210. data/spec/models/game_event_player_spec.rb +66 -0
  211. data/spec/models/game_finish_event_spec.rb +46 -0
  212. data/spec/models/game_full_event_perf_spec.rb +36 -0
  213. data/spec/models/game_full_event_spec.rb +112 -0
  214. data/spec/models/game_json_analysis_inner_judgment_spec.rb +46 -0
  215. data/spec/models/game_json_analysis_inner_spec.rb +54 -0
  216. data/spec/models/game_json_clock_spec.rb +60 -0
  217. data/spec/models/game_json_players_spec.rb +42 -0
  218. data/spec/models/game_json_spec.rb +136 -0
  219. data/spec/models/game_start_event_spec.rb +46 -0
  220. data/spec/models/game_state_event_spec.rb +100 -0
  221. data/spec/models/game_status_spec.rb +30 -0
  222. data/spec/models/game_user_analysis_spec.rb +54 -0
  223. data/spec/models/game_user_spec.rb +78 -0
  224. data/spec/models/light_user_spec.rb +54 -0
  225. data/spec/models/light_user_title_spec.rb +32 -0
  226. data/spec/models/move_spec.rb +66 -0
  227. data/spec/models/not_found_spec.rb +36 -0
  228. data/spec/models/o_auth_error_spec.rb +42 -0
  229. data/spec/models/ok_spec.rb +36 -0
  230. data/spec/models/perf_spec.rb +60 -0
  231. data/spec/models/perf_type_spec.rb +30 -0
  232. data/spec/models/perfs_spec.rb +72 -0
  233. data/spec/models/play_time_spec.rb +42 -0
  234. data/spec/models/profile_spec.rb +66 -0
  235. data/spec/models/puzzle_round_json_spec.rb +54 -0
  236. data/spec/models/speed_spec.rb +30 -0
  237. data/spec/models/team_all200_response_spec.rb +72 -0
  238. data/spec/models/team_request_spec.rb +54 -0
  239. data/spec/models/team_request_with_user_spec.rb +42 -0
  240. data/spec/models/team_spec.rb +78 -0
  241. data/spec/models/title_spec.rb +30 -0
  242. data/spec/models/user_extended_spec.rb +162 -0
  243. data/spec/models/user_preferences_spec.rb +210 -0
  244. data/spec/models/user_spec.rb +108 -0
  245. data/spec/models/variant_key_spec.rb +30 -0
  246. data/spec/models/variant_spec.rb +48 -0
  247. data/spec/spec_helper.rb +111 -0
  248. metadata +446 -0
@@ -0,0 +1,681 @@
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 ArenaTournamentsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Get team Arena tournaments
23
+ # Get all Arena tournaments relevant to a team. Tournaments are sorted by reverse chronological order of start date (last starting first). Tournaments are streamed as [ndjson](#section/Introduction/Streaming-with-ND-JSON).
24
+ # @param team_id [String] ID of the team
25
+ # @param [Hash] opts the optional parameters
26
+ # @option opts [Integer] :max How many tournaments to download. (default to 100)
27
+ # @return [Array<Object>]
28
+ def api_team_arena(team_id, opts = {})
29
+ data, _status_code, _headers = api_team_arena_with_http_info(team_id, opts)
30
+ data
31
+ end
32
+
33
+ # Get team Arena tournaments
34
+ # Get all Arena tournaments relevant to a team. Tournaments are sorted by reverse chronological order of start date (last starting first). Tournaments are streamed as [ndjson](#section/Introduction/Streaming-with-ND-JSON).
35
+ # @param team_id [String] ID of the team
36
+ # @param [Hash] opts the optional parameters
37
+ # @option opts [Integer] :max How many tournaments to download. (default to 100)
38
+ # @return [Array<(Array<Object>, Integer, Hash)>] Array<Object> data, response status code and response headers
39
+ def api_team_arena_with_http_info(team_id, opts = {})
40
+ if @api_client.config.debugging
41
+ @api_client.config.logger.debug 'Calling API: ArenaTournamentsApi.api_team_arena ...'
42
+ end
43
+ # verify the required parameter 'team_id' is set
44
+ if @api_client.config.client_side_validation && team_id.nil?
45
+ fail ArgumentError, "Missing the required parameter 'team_id' when calling ArenaTournamentsApi.api_team_arena"
46
+ end
47
+ if @api_client.config.client_side_validation && !opts[:'max'].nil? && opts[:'max'] < 1
48
+ fail ArgumentError, 'invalid value for "opts[:"max"]" when calling ArenaTournamentsApi.api_team_arena, must be greater than or equal to 1.'
49
+ end
50
+
51
+ # resource path
52
+ local_var_path = '/api/team/{teamId}/arena'.sub('{' + 'teamId' + '}', CGI.escape(team_id.to_s))
53
+
54
+ # query parameters
55
+ query_params = opts[:query_params] || {}
56
+ query_params[:'max'] = opts[:'max'] if !opts[:'max'].nil?
57
+
58
+ # header parameters
59
+ header_params = opts[:header_params] || {}
60
+ # HTTP header 'Accept' (if needed)
61
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
62
+
63
+ # form parameters
64
+ form_params = opts[:form_params] || {}
65
+
66
+ # http body (model)
67
+ post_body = opts[:debug_body]
68
+
69
+ # return_type
70
+ return_type = opts[:debug_return_type] || 'Array<Object>'
71
+
72
+ # auth_names
73
+ auth_names = opts[:debug_auth_names] || []
74
+
75
+ new_options = opts.merge(
76
+ :operation => :"ArenaTournamentsApi.api_team_arena",
77
+ :header_params => header_params,
78
+ :query_params => query_params,
79
+ :form_params => form_params,
80
+ :body => post_body,
81
+ :auth_names => auth_names,
82
+ :return_type => return_type
83
+ )
84
+
85
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
86
+ if @api_client.config.debugging
87
+ @api_client.config.logger.debug "API called: ArenaTournamentsApi#api_team_arena\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
88
+ end
89
+ return data, status_code, headers
90
+ end
91
+
92
+ # Get current tournaments
93
+ # Get recently finished, ongoing, and upcoming tournaments. This API is used to display the [Lishogi tournament schedule](https://lishogi.org/tournament).
94
+ # @param [Hash] opts the optional parameters
95
+ # @return [ArenaTournaments]
96
+ def api_tournament(opts = {})
97
+ data, _status_code, _headers = api_tournament_with_http_info(opts)
98
+ data
99
+ end
100
+
101
+ # Get current tournaments
102
+ # Get recently finished, ongoing, and upcoming tournaments. This API is used to display the [Lishogi tournament schedule](https://lishogi.org/tournament).
103
+ # @param [Hash] opts the optional parameters
104
+ # @return [Array<(ArenaTournaments, Integer, Hash)>] ArenaTournaments data, response status code and response headers
105
+ def api_tournament_with_http_info(opts = {})
106
+ if @api_client.config.debugging
107
+ @api_client.config.logger.debug 'Calling API: ArenaTournamentsApi.api_tournament ...'
108
+ end
109
+ # resource path
110
+ local_var_path = '/api/tournament'
111
+
112
+ # query parameters
113
+ query_params = opts[:query_params] || {}
114
+
115
+ # header parameters
116
+ header_params = opts[:header_params] || {}
117
+ # HTTP header 'Accept' (if needed)
118
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
119
+
120
+ # form parameters
121
+ form_params = opts[:form_params] || {}
122
+
123
+ # http body (model)
124
+ post_body = opts[:debug_body]
125
+
126
+ # return_type
127
+ return_type = opts[:debug_return_type] || 'ArenaTournaments'
128
+
129
+ # auth_names
130
+ auth_names = opts[:debug_auth_names] || []
131
+
132
+ new_options = opts.merge(
133
+ :operation => :"ArenaTournamentsApi.api_tournament",
134
+ :header_params => header_params,
135
+ :query_params => query_params,
136
+ :form_params => form_params,
137
+ :body => post_body,
138
+ :auth_names => auth_names,
139
+ :return_type => return_type
140
+ )
141
+
142
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
143
+ if @api_client.config.debugging
144
+ @api_client.config.logger.debug "API called: ArenaTournamentsApi#api_tournament\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
145
+ end
146
+ return data, status_code, headers
147
+ end
148
+
149
+ # Create a new Arena tournament
150
+ # Create a public or private Arena tournament. This endpoint mirrors the form on <https://lishogi.org/tournament/new>. You can create up to 12 public tournaments per day, or 24 private tournaments. A team battle can be created by specifying the `teambBattleByTeam` argument.
151
+ # @param clock_time [Float] Clock initial time in minutes
152
+ # @param clock_increment [Integer] Clock increment in seconds
153
+ # @param clock_byoyomi [Integer] Clock byoyomi in seconds
154
+ # @param periods [Integer] Clock periods for byoyomi
155
+ # @param minutes [Integer] How long the tournament lasts, in minutes
156
+ # @param [Hash] opts the optional parameters
157
+ # @option opts [String] :name The tournament name. Leave empty to get a random Grandmaster name
158
+ # @option opts [Integer] :wait_minutes How long to wait before starting the tournament, from now, in minutes (default to 5)
159
+ # @option opts [Integer] :start_date Timestamp to start the tournament at a given date and time. Overrides the &#x60;waitMinutes&#x60; setting
160
+ # @option opts [VariantKey] :variant (default to 'standard')
161
+ # @option opts [Boolean] :rated Games are rated and impact players ratings (default to true)
162
+ # @option opts [String] :position Custom initial position (in SFEN) for all games of the tournament. Must be a legal shogi position. Only works with standard shogi, not variants.
163
+ # @option opts [Boolean] :berserkable Whether the players can use berserk (default to true)
164
+ # @option opts [Boolean] :streakable After 2 wins, consecutive wins grant 4 points instead of 2. (default to true)
165
+ # @option opts [Boolean] :has_chat Whether the players can discuss in a chat (default to true)
166
+ # @option opts [String] :description Anything you want to tell players about the tournament
167
+ # @option opts [String] :password Make the tournament private, and restrict access with a password. You can also [generate user-specific entry codes](https://github.com/lishogi-org/api/tree/master/example/tournament-entry-code) based on this password.
168
+ # @option opts [String] :team_battle_by_team Set the ID of a team you lead to create a team battle. The other teams can be added using the [team battle edit endpoint](#operation/apiTournamentTeamBattlePost).
169
+ # @option opts [String] :conditions_team_member_team_id Restrict entry to members of a team. The teamId is the last part of a team URL, e.g. &#x60;https://lishogi.org/team/shogi-is-hard&#x60; has teamId &#x3D; &#x60;shogi-is-hard&#x60;. Leave empty to let everyone join the tournament. Do not use this to create team battles, use &#x60;teamBattleByTeam&#x60; instead.
170
+ # @option opts [Integer] :conditions_min_rating_rating Minimum rating to join. Leave empty to let everyone join the tournament.
171
+ # @option opts [Integer] :conditions_max_rating_rating Maximum rating to join. Based on best rating reached in the last 7 days. Leave empty to let everyone join the tournament.
172
+ # @option opts [Integer] :conditions_nb_rated_game_nb Minimum number of rated games required to join.
173
+ # @return [Object]
174
+ def api_tournament_post(clock_time, clock_increment, clock_byoyomi, periods, minutes, opts = {})
175
+ data, _status_code, _headers = api_tournament_post_with_http_info(clock_time, clock_increment, clock_byoyomi, periods, minutes, opts)
176
+ data
177
+ end
178
+
179
+ # Create a new Arena tournament
180
+ # Create a public or private Arena tournament. This endpoint mirrors the form on &lt;https://lishogi.org/tournament/new&gt;. You can create up to 12 public tournaments per day, or 24 private tournaments. A team battle can be created by specifying the &#x60;teambBattleByTeam&#x60; argument.
181
+ # @param clock_time [Float] Clock initial time in minutes
182
+ # @param clock_increment [Integer] Clock increment in seconds
183
+ # @param clock_byoyomi [Integer] Clock byoyomi in seconds
184
+ # @param periods [Integer] Clock periods for byoyomi
185
+ # @param minutes [Integer] How long the tournament lasts, in minutes
186
+ # @param [Hash] opts the optional parameters
187
+ # @option opts [String] :name The tournament name. Leave empty to get a random Grandmaster name
188
+ # @option opts [Integer] :wait_minutes How long to wait before starting the tournament, from now, in minutes (default to 5)
189
+ # @option opts [Integer] :start_date Timestamp to start the tournament at a given date and time. Overrides the &#x60;waitMinutes&#x60; setting
190
+ # @option opts [VariantKey] :variant (default to 'standard')
191
+ # @option opts [Boolean] :rated Games are rated and impact players ratings (default to true)
192
+ # @option opts [String] :position Custom initial position (in SFEN) for all games of the tournament. Must be a legal shogi position. Only works with standard shogi, not variants.
193
+ # @option opts [Boolean] :berserkable Whether the players can use berserk (default to true)
194
+ # @option opts [Boolean] :streakable After 2 wins, consecutive wins grant 4 points instead of 2. (default to true)
195
+ # @option opts [Boolean] :has_chat Whether the players can discuss in a chat (default to true)
196
+ # @option opts [String] :description Anything you want to tell players about the tournament
197
+ # @option opts [String] :password Make the tournament private, and restrict access with a password. You can also [generate user-specific entry codes](https://github.com/lishogi-org/api/tree/master/example/tournament-entry-code) based on this password.
198
+ # @option opts [String] :team_battle_by_team Set the ID of a team you lead to create a team battle. The other teams can be added using the [team battle edit endpoint](#operation/apiTournamentTeamBattlePost).
199
+ # @option opts [String] :conditions_team_member_team_id Restrict entry to members of a team. The teamId is the last part of a team URL, e.g. &#x60;https://lishogi.org/team/shogi-is-hard&#x60; has teamId &#x3D; &#x60;shogi-is-hard&#x60;. Leave empty to let everyone join the tournament. Do not use this to create team battles, use &#x60;teamBattleByTeam&#x60; instead.
200
+ # @option opts [Integer] :conditions_min_rating_rating Minimum rating to join. Leave empty to let everyone join the tournament.
201
+ # @option opts [Integer] :conditions_max_rating_rating Maximum rating to join. Based on best rating reached in the last 7 days. Leave empty to let everyone join the tournament.
202
+ # @option opts [Integer] :conditions_nb_rated_game_nb Minimum number of rated games required to join.
203
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
204
+ def api_tournament_post_with_http_info(clock_time, clock_increment, clock_byoyomi, periods, minutes, opts = {})
205
+ if @api_client.config.debugging
206
+ @api_client.config.logger.debug 'Calling API: ArenaTournamentsApi.api_tournament_post ...'
207
+ end
208
+ # verify the required parameter 'clock_time' is set
209
+ if @api_client.config.client_side_validation && clock_time.nil?
210
+ fail ArgumentError, "Missing the required parameter 'clock_time' when calling ArenaTournamentsApi.api_tournament_post"
211
+ end
212
+ # verify enum value
213
+ allowable_values = [0, 0.25, 0.5, 0.75, 1, 1.5, 2, 3, 4, 5, 6, 7, 10, 15, 20, 25, 30, 40, 50, 60]
214
+ if @api_client.config.client_side_validation && !allowable_values.include?(clock_time)
215
+ fail ArgumentError, "invalid value for \"clock_time\", must be one of #{allowable_values}"
216
+ end
217
+ # verify the required parameter 'clock_increment' is set
218
+ if @api_client.config.client_side_validation && clock_increment.nil?
219
+ fail ArgumentError, "Missing the required parameter 'clock_increment' when calling ArenaTournamentsApi.api_tournament_post"
220
+ end
221
+ # verify enum value
222
+ allowable_values = [0, 1, 2, 3, 4, 5, 6, 7, 10, 15, 20, 25, 30, 40, 50, 60]
223
+ if @api_client.config.client_side_validation && !allowable_values.include?(clock_increment)
224
+ fail ArgumentError, "invalid value for \"clock_increment\", must be one of #{allowable_values}"
225
+ end
226
+ # verify the required parameter 'clock_byoyomi' is set
227
+ if @api_client.config.client_side_validation && clock_byoyomi.nil?
228
+ fail ArgumentError, "Missing the required parameter 'clock_byoyomi' when calling ArenaTournamentsApi.api_tournament_post"
229
+ end
230
+ # verify enum value
231
+ allowable_values = [0, 1, 2, 3, 4, 5, 6, 7, 10, 15, 20, 25, 30, 40, 50, 60]
232
+ if @api_client.config.client_side_validation && !allowable_values.include?(clock_byoyomi)
233
+ fail ArgumentError, "invalid value for \"clock_byoyomi\", must be one of #{allowable_values}"
234
+ end
235
+ # verify the required parameter 'periods' is set
236
+ if @api_client.config.client_side_validation && periods.nil?
237
+ fail ArgumentError, "Missing the required parameter 'periods' when calling ArenaTournamentsApi.api_tournament_post"
238
+ end
239
+ # verify enum value
240
+ allowable_values = [0, 1, 2, 3, 4, 5]
241
+ if @api_client.config.client_side_validation && !allowable_values.include?(periods)
242
+ fail ArgumentError, "invalid value for \"periods\", must be one of #{allowable_values}"
243
+ end
244
+ # verify the required parameter 'minutes' is set
245
+ if @api_client.config.client_side_validation && minutes.nil?
246
+ fail ArgumentError, "Missing the required parameter 'minutes' when calling ArenaTournamentsApi.api_tournament_post"
247
+ end
248
+ # verify enum value
249
+ allowable_values = [20, 25, 30, 35, 40, 45, 50, 55, 60, 70, 80, 90, 100, 110, 120, 150, 180, 210, 240, 270, 300, 330, 360, 420, 480, 540, 600, 720]
250
+ if @api_client.config.client_side_validation && !allowable_values.include?(minutes)
251
+ fail ArgumentError, "invalid value for \"minutes\", must be one of #{allowable_values}"
252
+ end
253
+ allowable_values = [1, 2, 3, 5, 10, 15, 20, 30, 45, 60]
254
+ if @api_client.config.client_side_validation && opts[:'wait_minutes'] && !allowable_values.include?(opts[:'wait_minutes'])
255
+ fail ArgumentError, "invalid value for \"wait_minutes\", must be one of #{allowable_values}"
256
+ end
257
+ # resource path
258
+ local_var_path = '/api/tournament'
259
+
260
+ # query parameters
261
+ query_params = opts[:query_params] || {}
262
+
263
+ # header parameters
264
+ header_params = opts[:header_params] || {}
265
+ # HTTP header 'Accept' (if needed)
266
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
267
+ # HTTP header 'Content-Type'
268
+ content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])
269
+ if !content_type.nil?
270
+ header_params['Content-Type'] = content_type
271
+ end
272
+
273
+ # form parameters
274
+ form_params = opts[:form_params] || {}
275
+ form_params['clockTime'] = clock_time
276
+ form_params['clockIncrement'] = clock_increment
277
+ form_params['clockByoyomi'] = clock_byoyomi
278
+ form_params['periods'] = periods
279
+ form_params['minutes'] = minutes
280
+ form_params['name'] = opts[:'name'] if !opts[:'name'].nil?
281
+ form_params['waitMinutes'] = opts[:'wait_minutes'] if !opts[:'wait_minutes'].nil?
282
+ form_params['startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil?
283
+ form_params['variant'] = opts[:'variant'] if !opts[:'variant'].nil?
284
+ form_params['rated'] = opts[:'rated'] if !opts[:'rated'].nil?
285
+ form_params['position'] = opts[:'position'] if !opts[:'position'].nil?
286
+ form_params['berserkable'] = opts[:'berserkable'] if !opts[:'berserkable'].nil?
287
+ form_params['streakable'] = opts[:'streakable'] if !opts[:'streakable'].nil?
288
+ form_params['hasChat'] = opts[:'has_chat'] if !opts[:'has_chat'].nil?
289
+ form_params['description'] = opts[:'description'] if !opts[:'description'].nil?
290
+ form_params['password'] = opts[:'password'] if !opts[:'password'].nil?
291
+ form_params['teamBattleByTeam'] = opts[:'team_battle_by_team'] if !opts[:'team_battle_by_team'].nil?
292
+ form_params['conditions.teamMember.teamId'] = opts[:'conditions_team_member_team_id'] if !opts[:'conditions_team_member_team_id'].nil?
293
+ form_params['conditions.minRating.rating'] = opts[:'conditions_min_rating_rating'] if !opts[:'conditions_min_rating_rating'].nil?
294
+ form_params['conditions.maxRating.rating'] = opts[:'conditions_max_rating_rating'] if !opts[:'conditions_max_rating_rating'].nil?
295
+ form_params['conditions.nbRatedGame.nb'] = opts[:'conditions_nb_rated_game_nb'] if !opts[:'conditions_nb_rated_game_nb'].nil?
296
+
297
+ # http body (model)
298
+ post_body = opts[:debug_body]
299
+
300
+ # return_type
301
+ return_type = opts[:debug_return_type] || 'Object'
302
+
303
+ # auth_names
304
+ auth_names = opts[:debug_auth_names] || ['OAuth2']
305
+
306
+ new_options = opts.merge(
307
+ :operation => :"ArenaTournamentsApi.api_tournament_post",
308
+ :header_params => header_params,
309
+ :query_params => query_params,
310
+ :form_params => form_params,
311
+ :body => post_body,
312
+ :auth_names => auth_names,
313
+ :return_type => return_type
314
+ )
315
+
316
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
317
+ if @api_client.config.debugging
318
+ @api_client.config.logger.debug "API called: ArenaTournamentsApi#api_tournament_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
319
+ end
320
+ return data, status_code, headers
321
+ end
322
+
323
+ # Get tournaments created by a user
324
+ # Get all tournaments created by a given user. Tournaments are sorted by reverse chronological order of start date (last starting first). Tournaments are streamed as [ndjson](#section/Introduction/Streaming-with-ND-JSON).
325
+ # @param username [String] The user whose created tournaments to fetch
326
+ # @param [Hash] opts the optional parameters
327
+ # @option opts [Integer] :status Include tournaments in the given status: \&quot;Created\&quot; (10), \&quot;Started\&quot; (20), \&quot;Finished\&quot; (30) You can add this parameter more than once to include tournaments in different statuses. Example: &#x60;?status&#x3D;10&amp;status&#x3D;20&#x60;
328
+ # @return [Object]
329
+ def api_user_name_tournament_created(username, opts = {})
330
+ data, _status_code, _headers = api_user_name_tournament_created_with_http_info(username, opts)
331
+ data
332
+ end
333
+
334
+ # Get tournaments created by a user
335
+ # Get all tournaments created by a given user. Tournaments are sorted by reverse chronological order of start date (last starting first). Tournaments are streamed as [ndjson](#section/Introduction/Streaming-with-ND-JSON).
336
+ # @param username [String] The user whose created tournaments to fetch
337
+ # @param [Hash] opts the optional parameters
338
+ # @option opts [Integer] :status Include tournaments in the given status: \&quot;Created\&quot; (10), \&quot;Started\&quot; (20), \&quot;Finished\&quot; (30) You can add this parameter more than once to include tournaments in different statuses. Example: &#x60;?status&#x3D;10&amp;status&#x3D;20&#x60;
339
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
340
+ def api_user_name_tournament_created_with_http_info(username, opts = {})
341
+ if @api_client.config.debugging
342
+ @api_client.config.logger.debug 'Calling API: ArenaTournamentsApi.api_user_name_tournament_created ...'
343
+ end
344
+ # verify the required parameter 'username' is set
345
+ if @api_client.config.client_side_validation && username.nil?
346
+ fail ArgumentError, "Missing the required parameter 'username' when calling ArenaTournamentsApi.api_user_name_tournament_created"
347
+ end
348
+ allowable_values = [10, 20, 30]
349
+ if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
350
+ fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
351
+ end
352
+ # resource path
353
+ local_var_path = '/api/user/{username}/tournament/created'.sub('{' + 'username' + '}', CGI.escape(username.to_s))
354
+
355
+ # query parameters
356
+ query_params = opts[:query_params] || {}
357
+ query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
358
+
359
+ # header parameters
360
+ header_params = opts[:header_params] || {}
361
+ # HTTP header 'Accept' (if needed)
362
+ header_params['Accept'] = @api_client.select_header_accept(['application/x-ndjson']) unless header_params['Accept']
363
+
364
+ # form parameters
365
+ form_params = opts[:form_params] || {}
366
+
367
+ # http body (model)
368
+ post_body = opts[:debug_body]
369
+
370
+ # return_type
371
+ return_type = opts[:debug_return_type] || 'Object'
372
+
373
+ # auth_names
374
+ auth_names = opts[:debug_auth_names] || []
375
+
376
+ new_options = opts.merge(
377
+ :operation => :"ArenaTournamentsApi.api_user_name_tournament_created",
378
+ :header_params => header_params,
379
+ :query_params => query_params,
380
+ :form_params => form_params,
381
+ :body => post_body,
382
+ :auth_names => auth_names,
383
+ :return_type => return_type
384
+ )
385
+
386
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
387
+ if @api_client.config.debugging
388
+ @api_client.config.logger.debug "API called: ArenaTournamentsApi#api_user_name_tournament_created\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
389
+ end
390
+ return data, status_code, headers
391
+ end
392
+
393
+ # Export games of an Arena tournament
394
+ # Download games of a tournament in KIF or [ndjson](#section/Introduction/Streaming-with-ND-JSON) format. Games are sorted by reverse chronological order (most recent first). 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
395
+ # @param id [String] The tournament ID.
396
+ # @param [Hash] opts the optional parameters
397
+ # @option opts [String] :player Only games of a particular player. Leave empty to fetch games of all players.
398
+ # @option opts [Boolean] :moves Include the KIF moves. (default to true)
399
+ # @option opts [Boolean] :pgn_in_json Include the full KIF within the JSON response, in a &#x60;notation&#x60; field. (default to false)
400
+ # @option opts [Boolean] :tags Include the KIF tags. (default to true)
401
+ # @option opts [Boolean] :clocks Include clock comments in the KIF moves, when available. Example: &#x60;22 同 玉(51) (00:02/00:00:13)&#x60; (default to false)
402
+ # @option opts [Boolean] :evals Include analysis evaluation comments in the KIF, when available. Example: &#x60;9 7八銀(79) * [%eval -1.48]&#x60; (default to false)
403
+ # @return [Object]
404
+ def games_by_tournament(id, opts = {})
405
+ data, _status_code, _headers = games_by_tournament_with_http_info(id, opts)
406
+ data
407
+ end
408
+
409
+ # Export games of an Arena tournament
410
+ # Download games of a tournament in KIF or [ndjson](#section/Introduction/Streaming-with-ND-JSON) format. Games are sorted by reverse chronological order (most recent first). 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
411
+ # @param id [String] The tournament ID.
412
+ # @param [Hash] opts the optional parameters
413
+ # @option opts [String] :player Only games of a particular player. Leave empty to fetch games of all players.
414
+ # @option opts [Boolean] :moves Include the KIF moves. (default to true)
415
+ # @option opts [Boolean] :pgn_in_json Include the full KIF within the JSON response, in a &#x60;notation&#x60; field. (default to false)
416
+ # @option opts [Boolean] :tags Include the KIF tags. (default to true)
417
+ # @option opts [Boolean] :clocks Include clock comments in the KIF moves, when available. Example: &#x60;22 同 玉(51) (00:02/00:00:13)&#x60; (default to false)
418
+ # @option opts [Boolean] :evals Include analysis evaluation comments in the KIF, when available. Example: &#x60;9 7八銀(79) * [%eval -1.48]&#x60; (default to false)
419
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
420
+ def games_by_tournament_with_http_info(id, opts = {})
421
+ if @api_client.config.debugging
422
+ @api_client.config.logger.debug 'Calling API: ArenaTournamentsApi.games_by_tournament ...'
423
+ end
424
+ # verify the required parameter 'id' is set
425
+ if @api_client.config.client_side_validation && id.nil?
426
+ fail ArgumentError, "Missing the required parameter 'id' when calling ArenaTournamentsApi.games_by_tournament"
427
+ end
428
+ # resource path
429
+ local_var_path = '/api/tournament/{id}/games'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
430
+
431
+ # query parameters
432
+ query_params = opts[:query_params] || {}
433
+ query_params[:'player'] = opts[:'player'] if !opts[:'player'].nil?
434
+ query_params[:'moves'] = opts[:'moves'] if !opts[:'moves'].nil?
435
+ query_params[:'pgnInJson'] = opts[:'pgn_in_json'] if !opts[:'pgn_in_json'].nil?
436
+ query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?
437
+ query_params[:'clocks'] = opts[:'clocks'] if !opts[:'clocks'].nil?
438
+ query_params[:'evals'] = opts[:'evals'] if !opts[:'evals'].nil?
439
+
440
+ # header parameters
441
+ header_params = opts[:header_params] || {}
442
+ # HTTP header 'Accept' (if needed)
443
+ header_params['Accept'] = @api_client.select_header_accept(['text/plain', 'application/x-ndjson']) unless header_params['Accept']
444
+
445
+ # form parameters
446
+ form_params = opts[:form_params] || {}
447
+
448
+ # http body (model)
449
+ post_body = opts[:debug_body]
450
+
451
+ # return_type
452
+ return_type = opts[:debug_return_type] || 'Object'
453
+
454
+ # auth_names
455
+ auth_names = opts[:debug_auth_names] || []
456
+
457
+ new_options = opts.merge(
458
+ :operation => :"ArenaTournamentsApi.games_by_tournament",
459
+ :header_params => header_params,
460
+ :query_params => query_params,
461
+ :form_params => form_params,
462
+ :body => post_body,
463
+ :auth_names => auth_names,
464
+ :return_type => return_type
465
+ )
466
+
467
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
468
+ if @api_client.config.debugging
469
+ @api_client.config.logger.debug "API called: ArenaTournamentsApi#games_by_tournament\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
470
+ end
471
+ return data, status_code, headers
472
+ end
473
+
474
+ # Get results of an Arena tournament
475
+ # Players of an Arena tournament, with their score and performance, sorted by rank (best first). **Players are streamed as [ndjson](#section/Introduction/Streaming-with-ND-JSON)**, i.e. one JSON object per line. If called on an ongoing tournament, results can be inconsistent due to ranking changes while the players are being streamed. Use on finished tournaments for guaranteed consistency.
476
+ # @param id [String] The tournament ID.
477
+ # @param [Hash] opts the optional parameters
478
+ # @option opts [Integer] :nb Max number of players to fetch
479
+ # @return [Object]
480
+ def results_by_tournament(id, opts = {})
481
+ data, _status_code, _headers = results_by_tournament_with_http_info(id, opts)
482
+ data
483
+ end
484
+
485
+ # Get results of an Arena tournament
486
+ # Players of an Arena tournament, with their score and performance, sorted by rank (best first). **Players are streamed as [ndjson](#section/Introduction/Streaming-with-ND-JSON)**, i.e. one JSON object per line. If called on an ongoing tournament, results can be inconsistent due to ranking changes while the players are being streamed. Use on finished tournaments for guaranteed consistency.
487
+ # @param id [String] The tournament ID.
488
+ # @param [Hash] opts the optional parameters
489
+ # @option opts [Integer] :nb Max number of players to fetch
490
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
491
+ def results_by_tournament_with_http_info(id, opts = {})
492
+ if @api_client.config.debugging
493
+ @api_client.config.logger.debug 'Calling API: ArenaTournamentsApi.results_by_tournament ...'
494
+ end
495
+ # verify the required parameter 'id' is set
496
+ if @api_client.config.client_side_validation && id.nil?
497
+ fail ArgumentError, "Missing the required parameter 'id' when calling ArenaTournamentsApi.results_by_tournament"
498
+ end
499
+ if @api_client.config.client_side_validation && !opts[:'nb'].nil? && opts[:'nb'] < 1
500
+ fail ArgumentError, 'invalid value for "opts[:"nb"]" when calling ArenaTournamentsApi.results_by_tournament, must be greater than or equal to 1.'
501
+ end
502
+
503
+ # resource path
504
+ local_var_path = '/api/tournament/{id}/results'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
505
+
506
+ # query parameters
507
+ query_params = opts[:query_params] || {}
508
+ query_params[:'nb'] = opts[:'nb'] if !opts[:'nb'].nil?
509
+
510
+ # header parameters
511
+ header_params = opts[:header_params] || {}
512
+ # HTTP header 'Accept' (if needed)
513
+ header_params['Accept'] = @api_client.select_header_accept(['application/x-ndjson']) unless header_params['Accept']
514
+
515
+ # form parameters
516
+ form_params = opts[:form_params] || {}
517
+
518
+ # http body (model)
519
+ post_body = opts[:debug_body]
520
+
521
+ # return_type
522
+ return_type = opts[:debug_return_type] || 'Object'
523
+
524
+ # auth_names
525
+ auth_names = opts[:debug_auth_names] || []
526
+
527
+ new_options = opts.merge(
528
+ :operation => :"ArenaTournamentsApi.results_by_tournament",
529
+ :header_params => header_params,
530
+ :query_params => query_params,
531
+ :form_params => form_params,
532
+ :body => post_body,
533
+ :auth_names => auth_names,
534
+ :return_type => return_type
535
+ )
536
+
537
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
538
+ if @api_client.config.debugging
539
+ @api_client.config.logger.debug "API called: ArenaTournamentsApi#results_by_tournament\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
540
+ end
541
+ return data, status_code, headers
542
+ end
543
+
544
+ # Get team standing of a team battle
545
+ # Teams of a team battle tournament, with top players, sorted by rank (best first).
546
+ # @param id [String] The tournament ID.
547
+ # @param [Hash] opts the optional parameters
548
+ # @return [Object]
549
+ def teams_by_tournament(id, opts = {})
550
+ data, _status_code, _headers = teams_by_tournament_with_http_info(id, opts)
551
+ data
552
+ end
553
+
554
+ # Get team standing of a team battle
555
+ # Teams of a team battle tournament, with top players, sorted by rank (best first).
556
+ # @param id [String] The tournament ID.
557
+ # @param [Hash] opts the optional parameters
558
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
559
+ def teams_by_tournament_with_http_info(id, opts = {})
560
+ if @api_client.config.debugging
561
+ @api_client.config.logger.debug 'Calling API: ArenaTournamentsApi.teams_by_tournament ...'
562
+ end
563
+ # verify the required parameter 'id' is set
564
+ if @api_client.config.client_side_validation && id.nil?
565
+ fail ArgumentError, "Missing the required parameter 'id' when calling ArenaTournamentsApi.teams_by_tournament"
566
+ end
567
+ # resource path
568
+ local_var_path = '/api/tournament/{id}/teams'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
569
+
570
+ # query parameters
571
+ query_params = opts[:query_params] || {}
572
+
573
+ # header parameters
574
+ header_params = opts[:header_params] || {}
575
+ # HTTP header 'Accept' (if needed)
576
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
577
+
578
+ # form parameters
579
+ form_params = opts[:form_params] || {}
580
+
581
+ # http body (model)
582
+ post_body = opts[:debug_body]
583
+
584
+ # return_type
585
+ return_type = opts[:debug_return_type] || 'Object'
586
+
587
+ # auth_names
588
+ auth_names = opts[:debug_auth_names] || []
589
+
590
+ new_options = opts.merge(
591
+ :operation => :"ArenaTournamentsApi.teams_by_tournament",
592
+ :header_params => header_params,
593
+ :query_params => query_params,
594
+ :form_params => form_params,
595
+ :body => post_body,
596
+ :auth_names => auth_names,
597
+ :return_type => return_type
598
+ )
599
+
600
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
601
+ if @api_client.config.debugging
602
+ @api_client.config.logger.debug "API called: ArenaTournamentsApi#teams_by_tournament\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
603
+ end
604
+ return data, status_code, headers
605
+ end
606
+
607
+ # Get info about an Arena tournament
608
+ # Get detailed info about recently finished, current, or upcoming tournament's duels, player standings, and other info.
609
+ # @param id [String] The tournament ID.
610
+ # @param [Hash] opts the optional parameters
611
+ # @option opts [Float] :page Specify which page of player standings to view. (default to 1)
612
+ # @return [Object]
613
+ def tournament(id, opts = {})
614
+ data, _status_code, _headers = tournament_with_http_info(id, opts)
615
+ data
616
+ end
617
+
618
+ # Get info about an Arena tournament
619
+ # Get detailed info about recently finished, current, or upcoming tournament&#39;s duels, player standings, and other info.
620
+ # @param id [String] The tournament ID.
621
+ # @param [Hash] opts the optional parameters
622
+ # @option opts [Float] :page Specify which page of player standings to view. (default to 1)
623
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
624
+ def tournament_with_http_info(id, opts = {})
625
+ if @api_client.config.debugging
626
+ @api_client.config.logger.debug 'Calling API: ArenaTournamentsApi.tournament ...'
627
+ end
628
+ # verify the required parameter 'id' is set
629
+ if @api_client.config.client_side_validation && id.nil?
630
+ fail ArgumentError, "Missing the required parameter 'id' when calling ArenaTournamentsApi.tournament"
631
+ end
632
+ if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] > 200
633
+ fail ArgumentError, 'invalid value for "opts[:"page"]" when calling ArenaTournamentsApi.tournament, must be smaller than or equal to 200.'
634
+ end
635
+
636
+ if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
637
+ fail ArgumentError, 'invalid value for "opts[:"page"]" when calling ArenaTournamentsApi.tournament, must be greater than or equal to 1.'
638
+ end
639
+
640
+ # resource path
641
+ local_var_path = '/api/tournament/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
642
+
643
+ # query parameters
644
+ query_params = opts[:query_params] || {}
645
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
646
+
647
+ # header parameters
648
+ header_params = opts[:header_params] || {}
649
+ # HTTP header 'Accept' (if needed)
650
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
651
+
652
+ # form parameters
653
+ form_params = opts[:form_params] || {}
654
+
655
+ # http body (model)
656
+ post_body = opts[:debug_body]
657
+
658
+ # return_type
659
+ return_type = opts[:debug_return_type] || 'Object'
660
+
661
+ # auth_names
662
+ auth_names = opts[:debug_auth_names] || []
663
+
664
+ new_options = opts.merge(
665
+ :operation => :"ArenaTournamentsApi.tournament",
666
+ :header_params => header_params,
667
+ :query_params => query_params,
668
+ :form_params => form_params,
669
+ :body => post_body,
670
+ :auth_names => auth_names,
671
+ :return_type => return_type
672
+ )
673
+
674
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
675
+ if @api_client.config.debugging
676
+ @api_client.config.logger.debug "API called: ArenaTournamentsApi#tournament\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
677
+ end
678
+ return data, status_code, headers
679
+ end
680
+ end
681
+ end