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,608 @@
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 BotApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Get online bots
23
+ # Stream the [online bot users](https://lishogi.org/player/bots), as [ndjson](#section/Introduction/Streaming-with-ND-JSON). Throttled to 50 bot users per second.
24
+ # @param [Hash] opts the optional parameters
25
+ # @option opts [Integer] :nb How many bot users to fetch
26
+ # @return [User]
27
+ def api_bot_online(opts = {})
28
+ data, _status_code, _headers = api_bot_online_with_http_info(opts)
29
+ data
30
+ end
31
+
32
+ # Get online bots
33
+ # Stream the [online bot users](https://lishogi.org/player/bots), as [ndjson](#section/Introduction/Streaming-with-ND-JSON). Throttled to 50 bot users per second.
34
+ # @param [Hash] opts the optional parameters
35
+ # @option opts [Integer] :nb How many bot users to fetch
36
+ # @return [Array<(User, Integer, Hash)>] User data, response status code and response headers
37
+ def api_bot_online_with_http_info(opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: BotApi.api_bot_online ...'
40
+ end
41
+ if @api_client.config.client_side_validation && !opts[:'nb'].nil? && opts[:'nb'] < 1
42
+ fail ArgumentError, 'invalid value for "opts[:"nb"]" when calling BotApi.api_bot_online, must be greater than or equal to 1.'
43
+ end
44
+
45
+ # resource path
46
+ local_var_path = '/api/bot/online'
47
+
48
+ # query parameters
49
+ query_params = opts[:query_params] || {}
50
+ query_params[:'nb'] = opts[:'nb'] if !opts[:'nb'].nil?
51
+
52
+ # header parameters
53
+ header_params = opts[:header_params] || {}
54
+ # HTTP header 'Accept' (if needed)
55
+ header_params['Accept'] = @api_client.select_header_accept(['application/x-ndjson']) unless header_params['Accept']
56
+
57
+ # form parameters
58
+ form_params = opts[:form_params] || {}
59
+
60
+ # http body (model)
61
+ post_body = opts[:debug_body]
62
+
63
+ # return_type
64
+ return_type = opts[:debug_return_type] || 'User'
65
+
66
+ # auth_names
67
+ auth_names = opts[:debug_auth_names] || []
68
+
69
+ new_options = opts.merge(
70
+ :operation => :"BotApi.api_bot_online",
71
+ :header_params => header_params,
72
+ :query_params => query_params,
73
+ :form_params => form_params,
74
+ :body => post_body,
75
+ :auth_names => auth_names,
76
+ :return_type => return_type
77
+ )
78
+
79
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
80
+ if @api_client.config.debugging
81
+ @api_client.config.logger.debug "API called: BotApi#api_bot_online\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
82
+ end
83
+ return data, status_code, headers
84
+ end
85
+
86
+ # Stream incoming events
87
+ # 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.
88
+ # @param [Hash] opts the optional parameters
89
+ # @return [ApiStreamEvent200Response]
90
+ def api_stream_event(opts = {})
91
+ data, _status_code, _headers = api_stream_event_with_http_info(opts)
92
+ data
93
+ end
94
+
95
+ # Stream incoming events
96
+ # 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 &#x60;type&#x60; field. Possible values are: - &#x60;gameStart&#x60; Start of a game - &#x60;gameFinish&#x60; Completion of a game - &#x60;challenge&#x60; A player sends you a challenge or you challenge someone - &#x60;challengeDeclined&#x60; The opponent declines your challenge When the stream opens, all current challenges and games are sent.
97
+ # @param [Hash] opts the optional parameters
98
+ # @return [Array<(ApiStreamEvent200Response, Integer, Hash)>] ApiStreamEvent200Response data, response status code and response headers
99
+ def api_stream_event_with_http_info(opts = {})
100
+ if @api_client.config.debugging
101
+ @api_client.config.logger.debug 'Calling API: BotApi.api_stream_event ...'
102
+ end
103
+ # resource path
104
+ local_var_path = '/api/stream/event'
105
+
106
+ # query parameters
107
+ query_params = opts[:query_params] || {}
108
+
109
+ # header parameters
110
+ header_params = opts[:header_params] || {}
111
+ # HTTP header 'Accept' (if needed)
112
+ header_params['Accept'] = @api_client.select_header_accept(['application/x-ndjson']) unless header_params['Accept']
113
+
114
+ # form parameters
115
+ form_params = opts[:form_params] || {}
116
+
117
+ # http body (model)
118
+ post_body = opts[:debug_body]
119
+
120
+ # return_type
121
+ return_type = opts[:debug_return_type] || 'ApiStreamEvent200Response'
122
+
123
+ # auth_names
124
+ auth_names = opts[:debug_auth_names] || ['OAuth2']
125
+
126
+ new_options = opts.merge(
127
+ :operation => :"BotApi.api_stream_event",
128
+ :header_params => header_params,
129
+ :query_params => query_params,
130
+ :form_params => form_params,
131
+ :body => post_body,
132
+ :auth_names => auth_names,
133
+ :return_type => return_type
134
+ )
135
+
136
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
137
+ if @api_client.config.debugging
138
+ @api_client.config.logger.debug "API called: BotApi#api_stream_event\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
139
+ end
140
+ return data, status_code, headers
141
+ end
142
+
143
+ # Upgrade to Bot account
144
+ # Upgrade a lishogi player account into a Bot account. Only Bot accounts can use the Bot API. The account **cannot have played any game** before becoming a Bot account. The upgrade is **irreversible**. The account will only be able to play as a Bot. To upgrade an account to Bot, use the [official lishogi-bot client](https://github.com/ShailChoksi/lishogi-bot), or follow these steps: - Create an [API access token](https://lishogi.org/account/oauth/token/create?scopes[]=bot:play) with \"Play bot moves\" permission. - `curl -d '' https://lishogi.org/api/bot/account/upgrade -H \"Authorization: Bearer <yourTokenHere>\"` To know if an account has already been upgraded, use the [Get my profile API](#operation/accountMe): the `title` field should be set to `BOT`.
145
+ # @param [Hash] opts the optional parameters
146
+ # @return [Ok]
147
+ def bot_account_upgrade(opts = {})
148
+ data, _status_code, _headers = bot_account_upgrade_with_http_info(opts)
149
+ data
150
+ end
151
+
152
+ # Upgrade to Bot account
153
+ # Upgrade a lishogi player account into a Bot account. Only Bot accounts can use the Bot API. The account **cannot have played any game** before becoming a Bot account. The upgrade is **irreversible**. The account will only be able to play as a Bot. To upgrade an account to Bot, use the [official lishogi-bot client](https://github.com/ShailChoksi/lishogi-bot), or follow these steps: - Create an [API access token](https://lishogi.org/account/oauth/token/create?scopes[]&#x3D;bot:play) with \&quot;Play bot moves\&quot; permission. - &#x60;curl -d &#39;&#39; https://lishogi.org/api/bot/account/upgrade -H \&quot;Authorization: Bearer &lt;yourTokenHere&gt;\&quot;&#x60; To know if an account has already been upgraded, use the [Get my profile API](#operation/accountMe): the &#x60;title&#x60; field should be set to &#x60;BOT&#x60;.
154
+ # @param [Hash] opts the optional parameters
155
+ # @return [Array<(Ok, Integer, Hash)>] Ok data, response status code and response headers
156
+ def bot_account_upgrade_with_http_info(opts = {})
157
+ if @api_client.config.debugging
158
+ @api_client.config.logger.debug 'Calling API: BotApi.bot_account_upgrade ...'
159
+ end
160
+ # resource path
161
+ local_var_path = '/api/bot/account/upgrade'
162
+
163
+ # query parameters
164
+ query_params = opts[:query_params] || {}
165
+
166
+ # header parameters
167
+ header_params = opts[:header_params] || {}
168
+ # HTTP header 'Accept' (if needed)
169
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
170
+
171
+ # form parameters
172
+ form_params = opts[:form_params] || {}
173
+
174
+ # http body (model)
175
+ post_body = opts[:debug_body]
176
+
177
+ # return_type
178
+ return_type = opts[:debug_return_type] || 'Ok'
179
+
180
+ # auth_names
181
+ auth_names = opts[:debug_auth_names] || ['OAuth2']
182
+
183
+ new_options = opts.merge(
184
+ :operation => :"BotApi.bot_account_upgrade",
185
+ :header_params => header_params,
186
+ :query_params => query_params,
187
+ :form_params => form_params,
188
+ :body => post_body,
189
+ :auth_names => auth_names,
190
+ :return_type => return_type
191
+ )
192
+
193
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
194
+ if @api_client.config.debugging
195
+ @api_client.config.logger.debug "API called: BotApi#bot_account_upgrade\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
196
+ end
197
+ return data, status_code, headers
198
+ end
199
+
200
+ # Abort a game
201
+ # Abort a game being played with the Bot API.
202
+ # @param game_id [String]
203
+ # @param [Hash] opts the optional parameters
204
+ # @return [Ok]
205
+ def bot_game_abort(game_id, opts = {})
206
+ data, _status_code, _headers = bot_game_abort_with_http_info(game_id, opts)
207
+ data
208
+ end
209
+
210
+ # Abort a game
211
+ # Abort a game being played with the Bot API.
212
+ # @param game_id [String]
213
+ # @param [Hash] opts the optional parameters
214
+ # @return [Array<(Ok, Integer, Hash)>] Ok data, response status code and response headers
215
+ def bot_game_abort_with_http_info(game_id, opts = {})
216
+ if @api_client.config.debugging
217
+ @api_client.config.logger.debug 'Calling API: BotApi.bot_game_abort ...'
218
+ end
219
+ # verify the required parameter 'game_id' is set
220
+ if @api_client.config.client_side_validation && game_id.nil?
221
+ fail ArgumentError, "Missing the required parameter 'game_id' when calling BotApi.bot_game_abort"
222
+ end
223
+ # resource path
224
+ local_var_path = '/api/bot/game/{gameId}/abort'.sub('{' + 'gameId' + '}', CGI.escape(game_id.to_s))
225
+
226
+ # query parameters
227
+ query_params = opts[:query_params] || {}
228
+
229
+ # header parameters
230
+ header_params = opts[:header_params] || {}
231
+ # HTTP header 'Accept' (if needed)
232
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
233
+
234
+ # form parameters
235
+ form_params = opts[:form_params] || {}
236
+
237
+ # http body (model)
238
+ post_body = opts[:debug_body]
239
+
240
+ # return_type
241
+ return_type = opts[:debug_return_type] || 'Ok'
242
+
243
+ # auth_names
244
+ auth_names = opts[:debug_auth_names] || ['OAuth2']
245
+
246
+ new_options = opts.merge(
247
+ :operation => :"BotApi.bot_game_abort",
248
+ :header_params => header_params,
249
+ :query_params => query_params,
250
+ :form_params => form_params,
251
+ :body => post_body,
252
+ :auth_names => auth_names,
253
+ :return_type => return_type
254
+ )
255
+
256
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
257
+ if @api_client.config.debugging
258
+ @api_client.config.logger.debug "API called: BotApi#bot_game_abort\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
259
+ end
260
+ return data, status_code, headers
261
+ end
262
+
263
+ # Write in the chat
264
+ # Post a message to the player or spectator chat, in a game being played with the Bot API.
265
+ # @param game_id [String]
266
+ # @param room [String]
267
+ # @param text [String]
268
+ # @param [Hash] opts the optional parameters
269
+ # @return [Ok]
270
+ def bot_game_chat(game_id, room, text, opts = {})
271
+ data, _status_code, _headers = bot_game_chat_with_http_info(game_id, room, text, opts)
272
+ data
273
+ end
274
+
275
+ # Write in the chat
276
+ # Post a message to the player or spectator chat, in a game being played with the Bot API.
277
+ # @param game_id [String]
278
+ # @param room [String]
279
+ # @param text [String]
280
+ # @param [Hash] opts the optional parameters
281
+ # @return [Array<(Ok, Integer, Hash)>] Ok data, response status code and response headers
282
+ def bot_game_chat_with_http_info(game_id, room, text, opts = {})
283
+ if @api_client.config.debugging
284
+ @api_client.config.logger.debug 'Calling API: BotApi.bot_game_chat ...'
285
+ end
286
+ # verify the required parameter 'game_id' is set
287
+ if @api_client.config.client_side_validation && game_id.nil?
288
+ fail ArgumentError, "Missing the required parameter 'game_id' when calling BotApi.bot_game_chat"
289
+ end
290
+ # verify the required parameter 'room' is set
291
+ if @api_client.config.client_side_validation && room.nil?
292
+ fail ArgumentError, "Missing the required parameter 'room' when calling BotApi.bot_game_chat"
293
+ end
294
+ # verify enum value
295
+ allowable_values = ["player", "spectator"]
296
+ if @api_client.config.client_side_validation && !allowable_values.include?(room)
297
+ fail ArgumentError, "invalid value for \"room\", must be one of #{allowable_values}"
298
+ end
299
+ # verify the required parameter 'text' is set
300
+ if @api_client.config.client_side_validation && text.nil?
301
+ fail ArgumentError, "Missing the required parameter 'text' when calling BotApi.bot_game_chat"
302
+ end
303
+ # resource path
304
+ local_var_path = '/api/bot/game/{gameId}/chat'.sub('{' + 'gameId' + '}', CGI.escape(game_id.to_s))
305
+
306
+ # query parameters
307
+ query_params = opts[:query_params] || {}
308
+
309
+ # header parameters
310
+ header_params = opts[:header_params] || {}
311
+ # HTTP header 'Accept' (if needed)
312
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
313
+ # HTTP header 'Content-Type'
314
+ content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])
315
+ if !content_type.nil?
316
+ header_params['Content-Type'] = content_type
317
+ end
318
+
319
+ # form parameters
320
+ form_params = opts[:form_params] || {}
321
+ form_params['room'] = room
322
+ form_params['text'] = text
323
+
324
+ # http body (model)
325
+ post_body = opts[:debug_body]
326
+
327
+ # return_type
328
+ return_type = opts[:debug_return_type] || 'Ok'
329
+
330
+ # auth_names
331
+ auth_names = opts[:debug_auth_names] || ['OAuth2']
332
+
333
+ new_options = opts.merge(
334
+ :operation => :"BotApi.bot_game_chat",
335
+ :header_params => header_params,
336
+ :query_params => query_params,
337
+ :form_params => form_params,
338
+ :body => post_body,
339
+ :auth_names => auth_names,
340
+ :return_type => return_type
341
+ )
342
+
343
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
344
+ if @api_client.config.debugging
345
+ @api_client.config.logger.debug "API called: BotApi#bot_game_chat\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
346
+ end
347
+ return data, status_code, headers
348
+ end
349
+
350
+ # Fetch the game chat
351
+ # Get the messages posted in the game chat
352
+ # @param game_id [String]
353
+ # @param [Hash] opts the optional parameters
354
+ # @return [Object]
355
+ def bot_game_chat_get(game_id, opts = {})
356
+ data, _status_code, _headers = bot_game_chat_get_with_http_info(game_id, opts)
357
+ data
358
+ end
359
+
360
+ # Fetch the game chat
361
+ # Get the messages posted in the game chat
362
+ # @param game_id [String]
363
+ # @param [Hash] opts the optional parameters
364
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
365
+ def bot_game_chat_get_with_http_info(game_id, opts = {})
366
+ if @api_client.config.debugging
367
+ @api_client.config.logger.debug 'Calling API: BotApi.bot_game_chat_get ...'
368
+ end
369
+ # verify the required parameter 'game_id' is set
370
+ if @api_client.config.client_side_validation && game_id.nil?
371
+ fail ArgumentError, "Missing the required parameter 'game_id' when calling BotApi.bot_game_chat_get"
372
+ end
373
+ # resource path
374
+ local_var_path = '/api/bot/game/{gameId}/chat'.sub('{' + 'gameId' + '}', CGI.escape(game_id.to_s))
375
+
376
+ # query parameters
377
+ query_params = opts[:query_params] || {}
378
+
379
+ # header parameters
380
+ header_params = opts[:header_params] || {}
381
+ # HTTP header 'Accept' (if needed)
382
+ header_params['Accept'] = @api_client.select_header_accept(['application/x-ndjson']) unless header_params['Accept']
383
+
384
+ # form parameters
385
+ form_params = opts[:form_params] || {}
386
+
387
+ # http body (model)
388
+ post_body = opts[:debug_body]
389
+
390
+ # return_type
391
+ return_type = opts[:debug_return_type] || 'Object'
392
+
393
+ # auth_names
394
+ auth_names = opts[:debug_auth_names] || ['OAuth2']
395
+
396
+ new_options = opts.merge(
397
+ :operation => :"BotApi.bot_game_chat_get",
398
+ :header_params => header_params,
399
+ :query_params => query_params,
400
+ :form_params => form_params,
401
+ :body => post_body,
402
+ :auth_names => auth_names,
403
+ :return_type => return_type
404
+ )
405
+
406
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
407
+ if @api_client.config.debugging
408
+ @api_client.config.logger.debug "API called: BotApi#bot_game_chat_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
409
+ end
410
+ return data, status_code, headers
411
+ end
412
+
413
+ # Make a Bot move
414
+ # Make a move in a game being played with the Bot API.
415
+ # @param game_id [String]
416
+ # @param move [String] The move to play, in USI format
417
+ # @param [Hash] opts the optional parameters
418
+ # @return [Ok]
419
+ def bot_game_move(game_id, move, opts = {})
420
+ data, _status_code, _headers = bot_game_move_with_http_info(game_id, move, opts)
421
+ data
422
+ end
423
+
424
+ # Make a Bot move
425
+ # Make a move in a game being played with the Bot API.
426
+ # @param game_id [String]
427
+ # @param move [String] The move to play, in USI format
428
+ # @param [Hash] opts the optional parameters
429
+ # @return [Array<(Ok, Integer, Hash)>] Ok data, response status code and response headers
430
+ def bot_game_move_with_http_info(game_id, move, opts = {})
431
+ if @api_client.config.debugging
432
+ @api_client.config.logger.debug 'Calling API: BotApi.bot_game_move ...'
433
+ end
434
+ # verify the required parameter 'game_id' is set
435
+ if @api_client.config.client_side_validation && game_id.nil?
436
+ fail ArgumentError, "Missing the required parameter 'game_id' when calling BotApi.bot_game_move"
437
+ end
438
+ # verify the required parameter 'move' is set
439
+ if @api_client.config.client_side_validation && move.nil?
440
+ fail ArgumentError, "Missing the required parameter 'move' when calling BotApi.bot_game_move"
441
+ end
442
+ # resource path
443
+ local_var_path = '/api/bot/game/{gameId}/move/{move}'.sub('{' + 'gameId' + '}', CGI.escape(game_id.to_s)).sub('{' + 'move' + '}', CGI.escape(move.to_s))
444
+
445
+ # query parameters
446
+ query_params = opts[:query_params] || {}
447
+
448
+ # header parameters
449
+ header_params = opts[:header_params] || {}
450
+ # HTTP header 'Accept' (if needed)
451
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
452
+
453
+ # form parameters
454
+ form_params = opts[:form_params] || {}
455
+
456
+ # http body (model)
457
+ post_body = opts[:debug_body]
458
+
459
+ # return_type
460
+ return_type = opts[:debug_return_type] || 'Ok'
461
+
462
+ # auth_names
463
+ auth_names = opts[:debug_auth_names] || ['OAuth2']
464
+
465
+ new_options = opts.merge(
466
+ :operation => :"BotApi.bot_game_move",
467
+ :header_params => header_params,
468
+ :query_params => query_params,
469
+ :form_params => form_params,
470
+ :body => post_body,
471
+ :auth_names => auth_names,
472
+ :return_type => return_type
473
+ )
474
+
475
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
476
+ if @api_client.config.debugging
477
+ @api_client.config.logger.debug "API called: BotApi#bot_game_move\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
478
+ end
479
+ return data, status_code, headers
480
+ end
481
+
482
+ # Resign a game
483
+ # Resign a game being played with the Bot API.
484
+ # @param game_id [String]
485
+ # @param [Hash] opts the optional parameters
486
+ # @return [Ok]
487
+ def bot_game_resign(game_id, opts = {})
488
+ data, _status_code, _headers = bot_game_resign_with_http_info(game_id, opts)
489
+ data
490
+ end
491
+
492
+ # Resign a game
493
+ # Resign a game being played with the Bot API.
494
+ # @param game_id [String]
495
+ # @param [Hash] opts the optional parameters
496
+ # @return [Array<(Ok, Integer, Hash)>] Ok data, response status code and response headers
497
+ def bot_game_resign_with_http_info(game_id, opts = {})
498
+ if @api_client.config.debugging
499
+ @api_client.config.logger.debug 'Calling API: BotApi.bot_game_resign ...'
500
+ end
501
+ # verify the required parameter 'game_id' is set
502
+ if @api_client.config.client_side_validation && game_id.nil?
503
+ fail ArgumentError, "Missing the required parameter 'game_id' when calling BotApi.bot_game_resign"
504
+ end
505
+ # resource path
506
+ local_var_path = '/api/bot/game/{gameId}/resign'.sub('{' + 'gameId' + '}', CGI.escape(game_id.to_s))
507
+
508
+ # query parameters
509
+ query_params = opts[:query_params] || {}
510
+
511
+ # header parameters
512
+ header_params = opts[:header_params] || {}
513
+ # HTTP header 'Accept' (if needed)
514
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
515
+
516
+ # form parameters
517
+ form_params = opts[:form_params] || {}
518
+
519
+ # http body (model)
520
+ post_body = opts[:debug_body]
521
+
522
+ # return_type
523
+ return_type = opts[:debug_return_type] || 'Ok'
524
+
525
+ # auth_names
526
+ auth_names = opts[:debug_auth_names] || ['OAuth2']
527
+
528
+ new_options = opts.merge(
529
+ :operation => :"BotApi.bot_game_resign",
530
+ :header_params => header_params,
531
+ :query_params => query_params,
532
+ :form_params => form_params,
533
+ :body => post_body,
534
+ :auth_names => auth_names,
535
+ :return_type => return_type
536
+ )
537
+
538
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
539
+ if @api_client.config.debugging
540
+ @api_client.config.logger.debug "API called: BotApi#bot_game_resign\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
541
+ end
542
+ return data, status_code, headers
543
+ end
544
+
545
+ # Stream Bot game state
546
+ # Stream the state of a game being played with the Bot API, as [ndjson](#section/Introduction/Streaming-with-ND-JSON). Use this endpoint to get updates about the game in real-time, with a single request. Each line is a JSON object containing a `type` field. Possible values are: - `gameFull` Full game data. All values are immutable, except for the `state` field. - `gameState` Current state of the game. Immutable values not included. - `chatLine` Chat message sent by a user (or the bot itself) in the `room` \"player\" or \"spectator\". The first line is always of type `gameFull`.
547
+ # @param game_id [String]
548
+ # @param [Hash] opts the optional parameters
549
+ # @return [BoardGameStream200Response]
550
+ def bot_game_stream(game_id, opts = {})
551
+ data, _status_code, _headers = bot_game_stream_with_http_info(game_id, opts)
552
+ data
553
+ end
554
+
555
+ # Stream Bot game state
556
+ # Stream the state of a game being played with the Bot API, as [ndjson](#section/Introduction/Streaming-with-ND-JSON). Use this endpoint to get updates about the game in real-time, with a single request. Each line is a JSON object containing a &#x60;type&#x60; field. Possible values are: - &#x60;gameFull&#x60; Full game data. All values are immutable, except for the &#x60;state&#x60; field. - &#x60;gameState&#x60; Current state of the game. Immutable values not included. - &#x60;chatLine&#x60; Chat message sent by a user (or the bot itself) in the &#x60;room&#x60; \&quot;player\&quot; or \&quot;spectator\&quot;. The first line is always of type &#x60;gameFull&#x60;.
557
+ # @param game_id [String]
558
+ # @param [Hash] opts the optional parameters
559
+ # @return [Array<(BoardGameStream200Response, Integer, Hash)>] BoardGameStream200Response data, response status code and response headers
560
+ def bot_game_stream_with_http_info(game_id, opts = {})
561
+ if @api_client.config.debugging
562
+ @api_client.config.logger.debug 'Calling API: BotApi.bot_game_stream ...'
563
+ end
564
+ # verify the required parameter 'game_id' is set
565
+ if @api_client.config.client_side_validation && game_id.nil?
566
+ fail ArgumentError, "Missing the required parameter 'game_id' when calling BotApi.bot_game_stream"
567
+ end
568
+ # resource path
569
+ local_var_path = '/api/bot/game/stream/{gameId}'.sub('{' + 'gameId' + '}', CGI.escape(game_id.to_s))
570
+
571
+ # query parameters
572
+ query_params = opts[:query_params] || {}
573
+
574
+ # header parameters
575
+ header_params = opts[:header_params] || {}
576
+ # HTTP header 'Accept' (if needed)
577
+ header_params['Accept'] = @api_client.select_header_accept(['application/x-ndjson', 'application/json']) unless header_params['Accept']
578
+
579
+ # form parameters
580
+ form_params = opts[:form_params] || {}
581
+
582
+ # http body (model)
583
+ post_body = opts[:debug_body]
584
+
585
+ # return_type
586
+ return_type = opts[:debug_return_type] || 'BoardGameStream200Response'
587
+
588
+ # auth_names
589
+ auth_names = opts[:debug_auth_names] || ['OAuth2']
590
+
591
+ new_options = opts.merge(
592
+ :operation => :"BotApi.bot_game_stream",
593
+ :header_params => header_params,
594
+ :query_params => query_params,
595
+ :form_params => form_params,
596
+ :body => post_body,
597
+ :auth_names => auth_names,
598
+ :return_type => return_type
599
+ )
600
+
601
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
602
+ if @api_client.config.debugging
603
+ @api_client.config.logger.debug "API called: BotApi#bot_game_stream\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
604
+ end
605
+ return data, status_code, headers
606
+ end
607
+ end
608
+ end