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,677 @@
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 UsersApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Get crosstable
23
+ # Get total number of games, and current score, of any two users. If the `matchup` flag is provided, and the users are currently playing, also gets the current match game number and scores.
24
+ # @param user1 [String]
25
+ # @param user2 [String]
26
+ # @param [Hash] opts the optional parameters
27
+ # @option opts [Boolean] :matchup Whether to get the current match data, if any
28
+ # @return [Object]
29
+ def api_crosstable(user1, user2, opts = {})
30
+ data, _status_code, _headers = api_crosstable_with_http_info(user1, user2, opts)
31
+ data
32
+ end
33
+
34
+ # Get crosstable
35
+ # Get total number of games, and current score, of any two users. If the `matchup` flag is provided, and the users are currently playing, also gets the current match game number and scores.
36
+ # @param user1 [String]
37
+ # @param user2 [String]
38
+ # @param [Hash] opts the optional parameters
39
+ # @option opts [Boolean] :matchup Whether to get the current match data, if any
40
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
41
+ def api_crosstable_with_http_info(user1, user2, opts = {})
42
+ if @api_client.config.debugging
43
+ @api_client.config.logger.debug 'Calling API: UsersApi.api_crosstable ...'
44
+ end
45
+ # verify the required parameter 'user1' is set
46
+ if @api_client.config.client_side_validation && user1.nil?
47
+ fail ArgumentError, "Missing the required parameter 'user1' when calling UsersApi.api_crosstable"
48
+ end
49
+ # verify the required parameter 'user2' is set
50
+ if @api_client.config.client_side_validation && user2.nil?
51
+ fail ArgumentError, "Missing the required parameter 'user2' when calling UsersApi.api_crosstable"
52
+ end
53
+ # resource path
54
+ local_var_path = '/api/crosstable/{user1}/{user2}'.sub('{' + 'user1' + '}', CGI.escape(user1.to_s)).sub('{' + 'user2' + '}', CGI.escape(user2.to_s))
55
+
56
+ # query parameters
57
+ query_params = opts[:query_params] || {}
58
+ query_params[:'matchup'] = opts[:'matchup'] if !opts[:'matchup'].nil?
59
+
60
+ # header parameters
61
+ header_params = opts[:header_params] || {}
62
+ # HTTP header 'Accept' (if needed)
63
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
64
+
65
+ # form parameters
66
+ form_params = opts[:form_params] || {}
67
+
68
+ # http body (model)
69
+ post_body = opts[:debug_body]
70
+
71
+ # return_type
72
+ return_type = opts[:debug_return_type] || 'Object'
73
+
74
+ # auth_names
75
+ auth_names = opts[:debug_auth_names] || []
76
+
77
+ new_options = opts.merge(
78
+ :operation => :"UsersApi.api_crosstable",
79
+ :header_params => header_params,
80
+ :query_params => query_params,
81
+ :form_params => form_params,
82
+ :body => post_body,
83
+ :auth_names => auth_names,
84
+ :return_type => return_type
85
+ )
86
+
87
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
88
+ if @api_client.config.debugging
89
+ @api_client.config.logger.debug "API called: UsersApi#api_crosstable\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
90
+ end
91
+ return data, status_code, headers
92
+ end
93
+
94
+ # Get user public data
95
+ # Read public data of a user.
96
+ # @param username [String]
97
+ # @param [Hash] opts the optional parameters
98
+ # @return [UserExtended]
99
+ def api_user(username, opts = {})
100
+ data, _status_code, _headers = api_user_with_http_info(username, opts)
101
+ data
102
+ end
103
+
104
+ # Get user public data
105
+ # Read public data of a user.
106
+ # @param username [String]
107
+ # @param [Hash] opts the optional parameters
108
+ # @return [Array<(UserExtended, Integer, Hash)>] UserExtended data, response status code and response headers
109
+ def api_user_with_http_info(username, opts = {})
110
+ if @api_client.config.debugging
111
+ @api_client.config.logger.debug 'Calling API: UsersApi.api_user ...'
112
+ end
113
+ # verify the required parameter 'username' is set
114
+ if @api_client.config.client_side_validation && username.nil?
115
+ fail ArgumentError, "Missing the required parameter 'username' when calling UsersApi.api_user"
116
+ end
117
+ # resource path
118
+ local_var_path = '/api/user/{username}'.sub('{' + 'username' + '}', CGI.escape(username.to_s))
119
+
120
+ # query parameters
121
+ query_params = opts[:query_params] || {}
122
+
123
+ # header parameters
124
+ header_params = opts[:header_params] || {}
125
+ # HTTP header 'Accept' (if needed)
126
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
127
+
128
+ # form parameters
129
+ form_params = opts[:form_params] || {}
130
+
131
+ # http body (model)
132
+ post_body = opts[:debug_body]
133
+
134
+ # return_type
135
+ return_type = opts[:debug_return_type] || 'UserExtended'
136
+
137
+ # auth_names
138
+ auth_names = opts[:debug_auth_names] || []
139
+
140
+ new_options = opts.merge(
141
+ :operation => :"UsersApi.api_user",
142
+ :header_params => header_params,
143
+ :query_params => query_params,
144
+ :form_params => form_params,
145
+ :body => post_body,
146
+ :auth_names => auth_names,
147
+ :return_type => return_type
148
+ )
149
+
150
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
151
+ if @api_client.config.debugging
152
+ @api_client.config.logger.debug "API called: UsersApi#api_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
153
+ end
154
+ return data, status_code, headers
155
+ end
156
+
157
+ # Get user activity
158
+ # Read data to generate the activity feed of a user.
159
+ # @param username [String]
160
+ # @param [Hash] opts the optional parameters
161
+ # @return [nil]
162
+ def api_user_activity(username, opts = {})
163
+ api_user_activity_with_http_info(username, opts)
164
+ nil
165
+ end
166
+
167
+ # Get user activity
168
+ # Read data to generate the activity feed of a user.
169
+ # @param username [String]
170
+ # @param [Hash] opts the optional parameters
171
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
172
+ def api_user_activity_with_http_info(username, opts = {})
173
+ if @api_client.config.debugging
174
+ @api_client.config.logger.debug 'Calling API: UsersApi.api_user_activity ...'
175
+ end
176
+ # verify the required parameter 'username' is set
177
+ if @api_client.config.client_side_validation && username.nil?
178
+ fail ArgumentError, "Missing the required parameter 'username' when calling UsersApi.api_user_activity"
179
+ end
180
+ # resource path
181
+ local_var_path = '/api/user/{username}/activity'.sub('{' + 'username' + '}', CGI.escape(username.to_s))
182
+
183
+ # query parameters
184
+ query_params = opts[:query_params] || {}
185
+
186
+ # header parameters
187
+ header_params = opts[:header_params] || {}
188
+ # HTTP header 'Accept' (if needed)
189
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
190
+
191
+ # form parameters
192
+ form_params = opts[:form_params] || {}
193
+
194
+ # http body (model)
195
+ post_body = opts[:debug_body]
196
+
197
+ # return_type
198
+ return_type = opts[:debug_return_type]
199
+
200
+ # auth_names
201
+ auth_names = opts[:debug_auth_names] || []
202
+
203
+ new_options = opts.merge(
204
+ :operation => :"UsersApi.api_user_activity",
205
+ :header_params => header_params,
206
+ :query_params => query_params,
207
+ :form_params => form_params,
208
+ :body => post_body,
209
+ :auth_names => auth_names,
210
+ :return_type => return_type
211
+ )
212
+
213
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
214
+ if @api_client.config.debugging
215
+ @api_client.config.logger.debug "API called: UsersApi#api_user_activity\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
216
+ end
217
+ return data, status_code, headers
218
+ end
219
+
220
+ # Get rating history of a user
221
+ # Read rating history of a user, for all perf types. There is at most one entry per day. Format of an entry is `[year, month, day, rating]`. `month` starts at zero (January).
222
+ # @param username [String]
223
+ # @param [Hash] opts the optional parameters
224
+ # @return [Object]
225
+ def api_user_rating_history(username, opts = {})
226
+ data, _status_code, _headers = api_user_rating_history_with_http_info(username, opts)
227
+ data
228
+ end
229
+
230
+ # Get rating history of a user
231
+ # Read rating history of a user, for all perf types. There is at most one entry per day. Format of an entry is &#x60;[year, month, day, rating]&#x60;. &#x60;month&#x60; starts at zero (January).
232
+ # @param username [String]
233
+ # @param [Hash] opts the optional parameters
234
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
235
+ def api_user_rating_history_with_http_info(username, opts = {})
236
+ if @api_client.config.debugging
237
+ @api_client.config.logger.debug 'Calling API: UsersApi.api_user_rating_history ...'
238
+ end
239
+ # verify the required parameter 'username' is set
240
+ if @api_client.config.client_side_validation && username.nil?
241
+ fail ArgumentError, "Missing the required parameter 'username' when calling UsersApi.api_user_rating_history"
242
+ end
243
+ # resource path
244
+ local_var_path = '/api/user/{username}/rating-history'.sub('{' + 'username' + '}', CGI.escape(username.to_s))
245
+
246
+ # query parameters
247
+ query_params = opts[:query_params] || {}
248
+
249
+ # header parameters
250
+ header_params = opts[:header_params] || {}
251
+ # HTTP header 'Accept' (if needed)
252
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
253
+
254
+ # form parameters
255
+ form_params = opts[:form_params] || {}
256
+
257
+ # http body (model)
258
+ post_body = opts[:debug_body]
259
+
260
+ # return_type
261
+ return_type = opts[:debug_return_type] || 'Object'
262
+
263
+ # auth_names
264
+ auth_names = opts[:debug_auth_names] || []
265
+
266
+ new_options = opts.merge(
267
+ :operation => :"UsersApi.api_user_rating_history",
268
+ :header_params => header_params,
269
+ :query_params => query_params,
270
+ :form_params => form_params,
271
+ :body => post_body,
272
+ :auth_names => auth_names,
273
+ :return_type => return_type
274
+ )
275
+
276
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
277
+ if @api_client.config.debugging
278
+ @api_client.config.logger.debug "API called: UsersApi#api_user_rating_history\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
279
+ end
280
+ return data, status_code, headers
281
+ end
282
+
283
+ # Get users by ID
284
+ # Get up to 300 users by their IDs. Users are returned in the same order as the IDs. The method is `POST` so a longer list of IDs can be sent in the request body.
285
+ # @param body [String] User IDs separated by commas.
286
+ # @param [Hash] opts the optional parameters
287
+ # @return [Array<User>]
288
+ def api_users(body, opts = {})
289
+ data, _status_code, _headers = api_users_with_http_info(body, opts)
290
+ data
291
+ end
292
+
293
+ # Get users by ID
294
+ # Get up to 300 users by their IDs. Users are returned in the same order as the IDs. The method is &#x60;POST&#x60; so a longer list of IDs can be sent in the request body.
295
+ # @param body [String] User IDs separated by commas.
296
+ # @param [Hash] opts the optional parameters
297
+ # @return [Array<(Array<User>, Integer, Hash)>] Array<User> data, response status code and response headers
298
+ def api_users_with_http_info(body, opts = {})
299
+ if @api_client.config.debugging
300
+ @api_client.config.logger.debug 'Calling API: UsersApi.api_users ...'
301
+ end
302
+ # verify the required parameter 'body' is set
303
+ if @api_client.config.client_side_validation && body.nil?
304
+ fail ArgumentError, "Missing the required parameter 'body' when calling UsersApi.api_users"
305
+ end
306
+ # resource path
307
+ local_var_path = '/api/users'
308
+
309
+ # query parameters
310
+ query_params = opts[:query_params] || {}
311
+
312
+ # header parameters
313
+ header_params = opts[:header_params] || {}
314
+ # HTTP header 'Accept' (if needed)
315
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
316
+ # HTTP header 'Content-Type'
317
+ content_type = @api_client.select_header_content_type(['text/plain'])
318
+ if !content_type.nil?
319
+ header_params['Content-Type'] = content_type
320
+ end
321
+
322
+ # form parameters
323
+ form_params = opts[:form_params] || {}
324
+
325
+ # http body (model)
326
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
327
+
328
+ # return_type
329
+ return_type = opts[:debug_return_type] || 'Array<User>'
330
+
331
+ # auth_names
332
+ auth_names = opts[:debug_auth_names] || []
333
+
334
+ new_options = opts.merge(
335
+ :operation => :"UsersApi.api_users",
336
+ :header_params => header_params,
337
+ :query_params => query_params,
338
+ :form_params => form_params,
339
+ :body => post_body,
340
+ :auth_names => auth_names,
341
+ :return_type => return_type
342
+ )
343
+
344
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
345
+ if @api_client.config.debugging
346
+ @api_client.config.logger.debug "API called: UsersApi#api_users\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
347
+ end
348
+ return data, status_code, headers
349
+ end
350
+
351
+ # Get real-time users status
352
+ # Read the `online`, `playing` and `streaming` flags of several users. This API is very fast and cheap on lishogi side. So you can call it quite often (like once every 5 seconds). Use it to track players and know when they're connected on lishogi and playing games.
353
+ # @param ids [String] User IDs separated by commas. Up to 100 IDs.
354
+ # @param [Hash] opts the optional parameters
355
+ # @option opts [Boolean] :with_game_ids Also return the ID of the game being played, if any, for each player, in a &#x60;playingId&#x60; field. Defaults to &#x60;false&#x60; to preserve server resources.
356
+ # @return [Array<ApiUsersStatus200ResponseInner>]
357
+ def api_users_status(ids, opts = {})
358
+ data, _status_code, _headers = api_users_status_with_http_info(ids, opts)
359
+ data
360
+ end
361
+
362
+ # Get real-time users status
363
+ # Read the &#x60;online&#x60;, &#x60;playing&#x60; and &#x60;streaming&#x60; flags of several users. This API is very fast and cheap on lishogi side. So you can call it quite often (like once every 5 seconds). Use it to track players and know when they&#39;re connected on lishogi and playing games.
364
+ # @param ids [String] User IDs separated by commas. Up to 100 IDs.
365
+ # @param [Hash] opts the optional parameters
366
+ # @option opts [Boolean] :with_game_ids Also return the ID of the game being played, if any, for each player, in a &#x60;playingId&#x60; field. Defaults to &#x60;false&#x60; to preserve server resources.
367
+ # @return [Array<(Array<ApiUsersStatus200ResponseInner>, Integer, Hash)>] Array<ApiUsersStatus200ResponseInner> data, response status code and response headers
368
+ def api_users_status_with_http_info(ids, opts = {})
369
+ if @api_client.config.debugging
370
+ @api_client.config.logger.debug 'Calling API: UsersApi.api_users_status ...'
371
+ end
372
+ # verify the required parameter 'ids' is set
373
+ if @api_client.config.client_side_validation && ids.nil?
374
+ fail ArgumentError, "Missing the required parameter 'ids' when calling UsersApi.api_users_status"
375
+ end
376
+ # resource path
377
+ local_var_path = '/api/users/status'
378
+
379
+ # query parameters
380
+ query_params = opts[:query_params] || {}
381
+ query_params[:'ids'] = ids
382
+ query_params[:'withGameIds'] = opts[:'with_game_ids'] if !opts[:'with_game_ids'].nil?
383
+
384
+ # header parameters
385
+ header_params = opts[:header_params] || {}
386
+ # HTTP header 'Accept' (if needed)
387
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
388
+
389
+ # form parameters
390
+ form_params = opts[:form_params] || {}
391
+
392
+ # http body (model)
393
+ post_body = opts[:debug_body]
394
+
395
+ # return_type
396
+ return_type = opts[:debug_return_type] || 'Array<ApiUsersStatus200ResponseInner>'
397
+
398
+ # auth_names
399
+ auth_names = opts[:debug_auth_names] || []
400
+
401
+ new_options = opts.merge(
402
+ :operation => :"UsersApi.api_users_status",
403
+ :header_params => header_params,
404
+ :query_params => query_params,
405
+ :form_params => form_params,
406
+ :body => post_body,
407
+ :auth_names => auth_names,
408
+ :return_type => return_type
409
+ )
410
+
411
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
412
+ if @api_client.config.debugging
413
+ @api_client.config.logger.debug "API called: UsersApi#api_users_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
414
+ end
415
+ return data, status_code, headers
416
+ end
417
+
418
+ # Get all top 10
419
+ # Get the top 10 players for each speed and variant. See <https://lishogi.org/player>.
420
+ # @param [Hash] opts the optional parameters
421
+ # @return [Object]
422
+ def player(opts = {})
423
+ data, _status_code, _headers = player_with_http_info(opts)
424
+ data
425
+ end
426
+
427
+ # Get all top 10
428
+ # Get the top 10 players for each speed and variant. See &lt;https://lishogi.org/player&gt;.
429
+ # @param [Hash] opts the optional parameters
430
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
431
+ def player_with_http_info(opts = {})
432
+ if @api_client.config.debugging
433
+ @api_client.config.logger.debug 'Calling API: UsersApi.player ...'
434
+ end
435
+ # resource path
436
+ local_var_path = '/player'
437
+
438
+ # query parameters
439
+ query_params = opts[:query_params] || {}
440
+
441
+ # header parameters
442
+ header_params = opts[:header_params] || {}
443
+ # HTTP header 'Accept' (if needed)
444
+ header_params['Accept'] = @api_client.select_header_accept(['application/vnd.lishogi.v3+json']) unless header_params['Accept']
445
+
446
+ # form parameters
447
+ form_params = opts[:form_params] || {}
448
+
449
+ # http body (model)
450
+ post_body = opts[:debug_body]
451
+
452
+ # return_type
453
+ return_type = opts[:debug_return_type] || 'Object'
454
+
455
+ # auth_names
456
+ auth_names = opts[:debug_auth_names] || []
457
+
458
+ new_options = opts.merge(
459
+ :operation => :"UsersApi.player",
460
+ :header_params => header_params,
461
+ :query_params => query_params,
462
+ :form_params => form_params,
463
+ :body => post_body,
464
+ :auth_names => auth_names,
465
+ :return_type => return_type
466
+ )
467
+
468
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
469
+ if @api_client.config.debugging
470
+ @api_client.config.logger.debug "API called: UsersApi#player\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
471
+ end
472
+ return data, status_code, headers
473
+ end
474
+
475
+ # Get one leaderboard
476
+ # Get the leaderboard for a single speed or variant (a.k.a. `perfType`). There is no leaderboard for correspondence or puzzles. See <https://lishogi.org/player/top/200/bullet>.
477
+ # @param nb [Integer] How many users to fetch
478
+ # @param perf_type [String] The speed or variant
479
+ # @param [Hash] opts the optional parameters
480
+ # @return [Object]
481
+ def player_top_nb_perf_type(nb, perf_type, opts = {})
482
+ data, _status_code, _headers = player_top_nb_perf_type_with_http_info(nb, perf_type, opts)
483
+ data
484
+ end
485
+
486
+ # Get one leaderboard
487
+ # Get the leaderboard for a single speed or variant (a.k.a. &#x60;perfType&#x60;). There is no leaderboard for correspondence or puzzles. See &lt;https://lishogi.org/player/top/200/bullet&gt;.
488
+ # @param nb [Integer] How many users to fetch
489
+ # @param perf_type [String] The speed or variant
490
+ # @param [Hash] opts the optional parameters
491
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
492
+ def player_top_nb_perf_type_with_http_info(nb, perf_type, opts = {})
493
+ if @api_client.config.debugging
494
+ @api_client.config.logger.debug 'Calling API: UsersApi.player_top_nb_perf_type ...'
495
+ end
496
+ # verify the required parameter 'nb' is set
497
+ if @api_client.config.client_side_validation && nb.nil?
498
+ fail ArgumentError, "Missing the required parameter 'nb' when calling UsersApi.player_top_nb_perf_type"
499
+ end
500
+ if @api_client.config.client_side_validation && nb > 200
501
+ fail ArgumentError, 'invalid value for "nb" when calling UsersApi.player_top_nb_perf_type, must be smaller than or equal to 200.'
502
+ end
503
+
504
+ if @api_client.config.client_side_validation && nb < 1
505
+ fail ArgumentError, 'invalid value for "nb" when calling UsersApi.player_top_nb_perf_type, must be greater than or equal to 1.'
506
+ end
507
+
508
+ # verify the required parameter 'perf_type' is set
509
+ if @api_client.config.client_side_validation && perf_type.nil?
510
+ fail ArgumentError, "Missing the required parameter 'perf_type' when calling UsersApi.player_top_nb_perf_type"
511
+ end
512
+ # verify enum value
513
+ allowable_values = ["ultraBullet", "bullet", "blitz", "rapid", "classical", "minishogi", "chushogi", "annanshogi", "kyotoshogi", "checkshogi"]
514
+ if @api_client.config.client_side_validation && !allowable_values.include?(perf_type)
515
+ fail ArgumentError, "invalid value for \"perf_type\", must be one of #{allowable_values}"
516
+ end
517
+ # resource path
518
+ local_var_path = '/player/top/{nb}/{perfType}'.sub('{' + 'nb' + '}', CGI.escape(nb.to_s)).sub('{' + 'perfType' + '}', CGI.escape(perf_type.to_s))
519
+
520
+ # query parameters
521
+ query_params = opts[:query_params] || {}
522
+
523
+ # header parameters
524
+ header_params = opts[:header_params] || {}
525
+ # HTTP header 'Accept' (if needed)
526
+ header_params['Accept'] = @api_client.select_header_accept(['application/vnd.lishogi.v3+json']) unless header_params['Accept']
527
+
528
+ # form parameters
529
+ form_params = opts[:form_params] || {}
530
+
531
+ # http body (model)
532
+ post_body = opts[:debug_body]
533
+
534
+ # return_type
535
+ return_type = opts[:debug_return_type] || 'Object'
536
+
537
+ # auth_names
538
+ auth_names = opts[:debug_auth_names] || []
539
+
540
+ new_options = opts.merge(
541
+ :operation => :"UsersApi.player_top_nb_perf_type",
542
+ :header_params => header_params,
543
+ :query_params => query_params,
544
+ :form_params => form_params,
545
+ :body => post_body,
546
+ :auth_names => auth_names,
547
+ :return_type => return_type
548
+ )
549
+
550
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
551
+ if @api_client.config.debugging
552
+ @api_client.config.logger.debug "API called: UsersApi#player_top_nb_perf_type\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
553
+ end
554
+ return data, status_code, headers
555
+ end
556
+
557
+ # Get live streamers
558
+ # Get basic info about currently streaming users. This API is very fast and cheap on lishogi side. So you can call it quite often (like once every 5 seconds).
559
+ # @param [Hash] opts the optional parameters
560
+ # @return [Array<LightUser>]
561
+ def streamer_live(opts = {})
562
+ data, _status_code, _headers = streamer_live_with_http_info(opts)
563
+ data
564
+ end
565
+
566
+ # Get live streamers
567
+ # Get basic info about currently streaming users. This API is very fast and cheap on lishogi side. So you can call it quite often (like once every 5 seconds).
568
+ # @param [Hash] opts the optional parameters
569
+ # @return [Array<(Array<LightUser>, Integer, Hash)>] Array<LightUser> data, response status code and response headers
570
+ def streamer_live_with_http_info(opts = {})
571
+ if @api_client.config.debugging
572
+ @api_client.config.logger.debug 'Calling API: UsersApi.streamer_live ...'
573
+ end
574
+ # resource path
575
+ local_var_path = '/streamer/live'
576
+
577
+ # query parameters
578
+ query_params = opts[:query_params] || {}
579
+
580
+ # header parameters
581
+ header_params = opts[:header_params] || {}
582
+ # HTTP header 'Accept' (if needed)
583
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
584
+
585
+ # form parameters
586
+ form_params = opts[:form_params] || {}
587
+
588
+ # http body (model)
589
+ post_body = opts[:debug_body]
590
+
591
+ # return_type
592
+ return_type = opts[:debug_return_type] || 'Array<LightUser>'
593
+
594
+ # auth_names
595
+ auth_names = opts[:debug_auth_names] || []
596
+
597
+ new_options = opts.merge(
598
+ :operation => :"UsersApi.streamer_live",
599
+ :header_params => header_params,
600
+ :query_params => query_params,
601
+ :form_params => form_params,
602
+ :body => post_body,
603
+ :auth_names => auth_names,
604
+ :return_type => return_type
605
+ )
606
+
607
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
608
+ if @api_client.config.debugging
609
+ @api_client.config.logger.debug "API called: UsersApi#streamer_live\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
610
+ end
611
+ return data, status_code, headers
612
+ end
613
+
614
+ # Get members of a team
615
+ # Members are sorted by reverse chronological order of joining the team (most recent first). OAuth only required if the list of members is private. Members are streamed as [ndjson](#section/Introduction/Streaming-with-ND-JSON).
616
+ # @param team_id [String]
617
+ # @param [Hash] opts the optional parameters
618
+ # @return [UserExtended]
619
+ def team_id_users(team_id, opts = {})
620
+ data, _status_code, _headers = team_id_users_with_http_info(team_id, opts)
621
+ data
622
+ end
623
+
624
+ # Get members of a team
625
+ # Members are sorted by reverse chronological order of joining the team (most recent first). OAuth only required if the list of members is private. Members are streamed as [ndjson](#section/Introduction/Streaming-with-ND-JSON).
626
+ # @param team_id [String]
627
+ # @param [Hash] opts the optional parameters
628
+ # @return [Array<(UserExtended, Integer, Hash)>] UserExtended data, response status code and response headers
629
+ def team_id_users_with_http_info(team_id, opts = {})
630
+ if @api_client.config.debugging
631
+ @api_client.config.logger.debug 'Calling API: UsersApi.team_id_users ...'
632
+ end
633
+ # verify the required parameter 'team_id' is set
634
+ if @api_client.config.client_side_validation && team_id.nil?
635
+ fail ArgumentError, "Missing the required parameter 'team_id' when calling UsersApi.team_id_users"
636
+ end
637
+ # resource path
638
+ local_var_path = '/api/team/{teamId}/users'.sub('{' + 'teamId' + '}', CGI.escape(team_id.to_s))
639
+
640
+ # query parameters
641
+ query_params = opts[:query_params] || {}
642
+
643
+ # header parameters
644
+ header_params = opts[:header_params] || {}
645
+ # HTTP header 'Accept' (if needed)
646
+ header_params['Accept'] = @api_client.select_header_accept(['application/x-ndjson']) unless header_params['Accept']
647
+
648
+ # form parameters
649
+ form_params = opts[:form_params] || {}
650
+
651
+ # http body (model)
652
+ post_body = opts[:debug_body]
653
+
654
+ # return_type
655
+ return_type = opts[:debug_return_type] || 'UserExtended'
656
+
657
+ # auth_names
658
+ auth_names = opts[:debug_auth_names] || ['OAuth2']
659
+
660
+ new_options = opts.merge(
661
+ :operation => :"UsersApi.team_id_users",
662
+ :header_params => header_params,
663
+ :query_params => query_params,
664
+ :form_params => form_params,
665
+ :body => post_body,
666
+ :auth_names => auth_names,
667
+ :return_type => return_type
668
+ )
669
+
670
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
671
+ if @api_client.config.debugging
672
+ @api_client.config.logger.debug "API called: UsersApi#team_id_users\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
673
+ end
674
+ return data, status_code, headers
675
+ end
676
+ end
677
+ end