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,42 @@
1
+ # Lishogi::ChallengeJson
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **id** | **String** | | |
8
+ | **url** | **String** | | |
9
+ | **status** | **String** | | |
10
+ | **challenger** | [**ChallengeUser**](ChallengeUser.md) | | |
11
+ | **dest_user** | [**ChallengeUser**](ChallengeUser.md) | | |
12
+ | **variant** | [**Variant**](Variant.md) | | |
13
+ | **rated** | **Boolean** | | |
14
+ | **speed** | [**Speed**](Speed.md) | | |
15
+ | **time_control** | [**ChallengeJsonTimeControl**](ChallengeJsonTimeControl.md) | | |
16
+ | **color** | **String** | | |
17
+ | **perf** | [**ChallengeJsonPerf**](ChallengeJsonPerf.md) | | |
18
+ | **direction** | **String** | | [optional] |
19
+ | **initial_sfen** | **String** | | [optional] |
20
+
21
+ ## Example
22
+
23
+ ```ruby
24
+ require 'lishogi'
25
+
26
+ instance = Lishogi::ChallengeJson.new(
27
+ id: null,
28
+ url: null,
29
+ status: null,
30
+ challenger: null,
31
+ dest_user: null,
32
+ variant: null,
33
+ rated: null,
34
+ speed: null,
35
+ time_control: null,
36
+ color: null,
37
+ perf: null,
38
+ direction: null,
39
+ initial_sfen: null
40
+ )
41
+ ```
42
+
@@ -0,0 +1,20 @@
1
+ # Lishogi::ChallengeJsonPerf
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **icon** | **String** | | [optional] |
8
+ | **name** | **String** | | [optional] |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'lishogi'
14
+
15
+ instance = Lishogi::ChallengeJsonPerf.new(
16
+ icon: null,
17
+ name: null
18
+ )
19
+ ```
20
+
@@ -0,0 +1,51 @@
1
+ # Lishogi::ChallengeJsonTimeControl
2
+
3
+ ## Class instance methods
4
+
5
+ ### `openapi_one_of`
6
+
7
+ Returns the list of classes defined in oneOf.
8
+
9
+ #### Example
10
+
11
+ ```ruby
12
+ require 'lishogi'
13
+
14
+ Lishogi::ChallengeJsonTimeControl.openapi_one_of
15
+ # =>
16
+ # [
17
+ # :'ChallengeJsonTimeControlOneOf',
18
+ # :'ChallengeJsonTimeControlOneOf1',
19
+ # :'ChallengeJsonTimeControlOneOf2'
20
+ # ]
21
+ ```
22
+
23
+ ### build
24
+
25
+ Find the appropriate object from the `openapi_one_of` list and casts the data into it.
26
+
27
+ #### Example
28
+
29
+ ```ruby
30
+ require 'lishogi'
31
+
32
+ Lishogi::ChallengeJsonTimeControl.build(data)
33
+ # => #<ChallengeJsonTimeControlOneOf:0x00007fdd4aab02a0>
34
+
35
+ Lishogi::ChallengeJsonTimeControl.build(data_that_doesnt_match)
36
+ # => nil
37
+ ```
38
+
39
+ #### Parameters
40
+
41
+ | Name | Type | Description |
42
+ | ---- | ---- | ----------- |
43
+ | **data** | **Mixed** | data to be matched against the list of oneOf items |
44
+
45
+ #### Return type
46
+
47
+ - `ChallengeJsonTimeControlOneOf`
48
+ - `ChallengeJsonTimeControlOneOf1`
49
+ - `ChallengeJsonTimeControlOneOf2`
50
+ - `nil` (if no type matches)
51
+
@@ -0,0 +1,28 @@
1
+ # Lishogi::ChallengeJsonTimeControlOneOf
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **type** | **String** | | [optional] |
8
+ | **limit** | **Float** | | [optional] |
9
+ | **increment** | **Float** | | [optional] |
10
+ | **byoyomi** | **Float** | | [optional] |
11
+ | **periods** | **Float** | | [optional] |
12
+ | **show** | **String** | | [optional] |
13
+
14
+ ## Example
15
+
16
+ ```ruby
17
+ require 'lishogi'
18
+
19
+ instance = Lishogi::ChallengeJsonTimeControlOneOf.new(
20
+ type: clock,
21
+ limit: null,
22
+ increment: null,
23
+ byoyomi: null,
24
+ periods: null,
25
+ show: 5+2
26
+ )
27
+ ```
28
+
@@ -0,0 +1,20 @@
1
+ # Lishogi::ChallengeJsonTimeControlOneOf1
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **type** | **String** | | [optional] |
8
+ | **days_per_turn** | **Float** | | [optional] |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'lishogi'
14
+
15
+ instance = Lishogi::ChallengeJsonTimeControlOneOf1.new(
16
+ type: correspondence,
17
+ days_per_turn: null
18
+ )
19
+ ```
20
+
@@ -0,0 +1,18 @@
1
+ # Lishogi::ChallengeJsonTimeControlOneOf2
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **type** | **String** | | [optional] |
8
+
9
+ ## Example
10
+
11
+ ```ruby
12
+ require 'lishogi'
13
+
14
+ instance = Lishogi::ChallengeJsonTimeControlOneOf2.new(
15
+ type: unlimited
16
+ )
17
+ ```
18
+
@@ -0,0 +1,30 @@
1
+ # Lishogi::ChallengeUser
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **rating** | **Float** | | [optional] |
8
+ | **provisional** | **Boolean** | | [optional] |
9
+ | **online** | **Boolean** | | [optional] |
10
+ | **name** | **String** | | [optional] |
11
+ | **title** | [**LightUserTitle**](LightUserTitle.md) | | [optional] |
12
+ | **patron** | **Boolean** | | [optional] |
13
+ | **id** | **String** | | [optional] |
14
+
15
+ ## Example
16
+
17
+ ```ruby
18
+ require 'lishogi'
19
+
20
+ instance = Lishogi::ChallengeUser.new(
21
+ rating: null,
22
+ provisional: null,
23
+ online: null,
24
+ name: Shogi_Harbour,
25
+ title: null,
26
+ patron: true,
27
+ id: shogi_harbour
28
+ )
29
+ ```
30
+
@@ -0,0 +1,414 @@
1
+ # Lishogi::ChallengesApi
2
+
3
+ All URIs are relative to *https://lishogi.org*
4
+
5
+ | Method | HTTP request | Description |
6
+ | ------ | ------------ | ----------- |
7
+ | [**challenge_accept**](ChallengesApi.md#challenge_accept) | **POST** /api/challenge/{challengeId}/accept | Accept a challenge |
8
+ | [**challenge_ai**](ChallengesApi.md#challenge_ai) | **POST** /api/challenge/ai | Challenge the AI |
9
+ | [**challenge_create**](ChallengesApi.md#challenge_create) | **POST** /api/challenge/{username} | Create a challenge |
10
+ | [**challenge_decline**](ChallengesApi.md#challenge_decline) | **POST** /api/challenge/{challengeId}/decline | Decline a challenge |
11
+ | [**challenge_open**](ChallengesApi.md#challenge_open) | **POST** /api/challenge/open | Open-ended challenge |
12
+
13
+
14
+ ## challenge_accept
15
+
16
+ > <Ok> challenge_accept(challenge_id)
17
+
18
+ Accept a challenge
19
+
20
+ Accept an incoming challenge. You should receive a `gameStart` event on the [incoming events stream](#operation/apiStreamEvent).
21
+
22
+ ### Examples
23
+
24
+ ```ruby
25
+ require 'time'
26
+ require 'lishogi'
27
+ # setup authorization
28
+ Lishogi.configure do |config|
29
+ # Configure OAuth2 access token for authorization: OAuth2
30
+ config.access_token = 'YOUR ACCESS TOKEN'
31
+ end
32
+
33
+ api_instance = Lishogi::ChallengesApi.new
34
+ challenge_id = '5IrD6Gzz' # String |
35
+
36
+ begin
37
+ # Accept a challenge
38
+ result = api_instance.challenge_accept(challenge_id)
39
+ p result
40
+ rescue Lishogi::ApiError => e
41
+ puts "Error when calling ChallengesApi->challenge_accept: #{e}"
42
+ end
43
+ ```
44
+
45
+ #### Using the challenge_accept_with_http_info variant
46
+
47
+ This returns an Array which contains the response data, status code and headers.
48
+
49
+ > <Array(<Ok>, Integer, Hash)> challenge_accept_with_http_info(challenge_id)
50
+
51
+ ```ruby
52
+ begin
53
+ # Accept a challenge
54
+ data, status_code, headers = api_instance.challenge_accept_with_http_info(challenge_id)
55
+ p status_code # => 2xx
56
+ p headers # => { ... }
57
+ p data # => <Ok>
58
+ rescue Lishogi::ApiError => e
59
+ puts "Error when calling ChallengesApi->challenge_accept_with_http_info: #{e}"
60
+ end
61
+ ```
62
+
63
+ ### Parameters
64
+
65
+ | Name | Type | Description | Notes |
66
+ | ---- | ---- | ----------- | ----- |
67
+ | **challenge_id** | **String** | | |
68
+
69
+ ### Return type
70
+
71
+ [**Ok**](Ok.md)
72
+
73
+ ### Authorization
74
+
75
+ [OAuth2](../README.md#OAuth2)
76
+
77
+ ### HTTP request headers
78
+
79
+ - **Content-Type**: Not defined
80
+ - **Accept**: application/json
81
+
82
+
83
+ ## challenge_ai
84
+
85
+ > <GameJson> challenge_ai(opts)
86
+
87
+ Challenge the AI
88
+
89
+ Start a game with Lishogi AI. You will be notified on the [event stream](#operation/apiStreamEvent) that a new game has started.
90
+
91
+ ### Examples
92
+
93
+ ```ruby
94
+ require 'time'
95
+ require 'lishogi'
96
+ # setup authorization
97
+ Lishogi.configure do |config|
98
+ # Configure OAuth2 access token for authorization: OAuth2
99
+ config.access_token = 'YOUR ACCESS TOKEN'
100
+ end
101
+
102
+ api_instance = Lishogi::ChallengesApi.new
103
+ opts = {
104
+ level: 8.14, # Float | AI strength
105
+ clock_limit: 8.14, # Float | Clock initial time in seconds. If empty, a correspondence game is created.
106
+ clock_increment: 56, # Integer | Clock increment in seconds. If empty, a correspondence game is created.
107
+ clock_byoyomi: 56, # Integer | Clock byoyomi in seconds. If empty, a correspondence game is created.
108
+ clock_periods: 56, # Integer | Clock periods for byoyomi in seconds. If empty, a correspondence game is created.
109
+ days: 1, # Integer | Days per move, for correspondence games. Clock settings must be omitted.
110
+ color: 'random', # String | Which color you get to play
111
+ variant: Lishogi::VariantKey::STANDARD, # VariantKey |
112
+ sfen: 'sfen_example' # String | Custom initial position (in SFEN). Variant must be standard, and the game cannot be rated.
113
+ }
114
+
115
+ begin
116
+ # Challenge the AI
117
+ result = api_instance.challenge_ai(opts)
118
+ p result
119
+ rescue Lishogi::ApiError => e
120
+ puts "Error when calling ChallengesApi->challenge_ai: #{e}"
121
+ end
122
+ ```
123
+
124
+ #### Using the challenge_ai_with_http_info variant
125
+
126
+ This returns an Array which contains the response data, status code and headers.
127
+
128
+ > <Array(<GameJson>, Integer, Hash)> challenge_ai_with_http_info(opts)
129
+
130
+ ```ruby
131
+ begin
132
+ # Challenge the AI
133
+ data, status_code, headers = api_instance.challenge_ai_with_http_info(opts)
134
+ p status_code # => 2xx
135
+ p headers # => { ... }
136
+ p data # => <GameJson>
137
+ rescue Lishogi::ApiError => e
138
+ puts "Error when calling ChallengesApi->challenge_ai_with_http_info: #{e}"
139
+ end
140
+ ```
141
+
142
+ ### Parameters
143
+
144
+ | Name | Type | Description | Notes |
145
+ | ---- | ---- | ----------- | ----- |
146
+ | **level** | **Float** | AI strength | [optional] |
147
+ | **clock_limit** | **Float** | Clock initial time in seconds. If empty, a correspondence game is created. | [optional] |
148
+ | **clock_increment** | **Integer** | Clock increment in seconds. If empty, a correspondence game is created. | [optional] |
149
+ | **clock_byoyomi** | **Integer** | Clock byoyomi in seconds. If empty, a correspondence game is created. | [optional] |
150
+ | **clock_periods** | **Integer** | Clock periods for byoyomi in seconds. If empty, a correspondence game is created. | [optional] |
151
+ | **days** | **Integer** | Days per move, for correspondence games. Clock settings must be omitted. | [optional] |
152
+ | **color** | **String** | Which color you get to play | [optional][default to &#39;random&#39;] |
153
+ | **variant** | [**VariantKey**](VariantKey.md) | | [optional][default to &#39;standard&#39;] |
154
+ | **sfen** | **String** | Custom initial position (in SFEN). Variant must be standard, and the game cannot be rated. | [optional][default to &#39;rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1&#39;] |
155
+
156
+ ### Return type
157
+
158
+ [**GameJson**](GameJson.md)
159
+
160
+ ### Authorization
161
+
162
+ [OAuth2](../README.md#OAuth2)
163
+
164
+ ### HTTP request headers
165
+
166
+ - **Content-Type**: application/x-www-form-urlencoded
167
+ - **Accept**: application/json
168
+
169
+
170
+ ## challenge_create
171
+
172
+ > <ChallengeJson> challenge_create(username, opts)
173
+
174
+ Create a challenge
175
+
176
+ Challenge someone to play. The targeted player can choose to accept or decline. If the challenge is accepted, you will be notified on the [event stream](#operation/apiStreamEvent) that a new game has started. The game ID will be the same as the challenge ID. If you also have an OAuth token with `challenge:write` scope for the receiving user, you can make them accept the challenge immediately by setting the `acceptByToken` field. Challenges for realtime games (not correspondence) expire after 20s if not accepted. To prevent that, use the `keepAliveStream` flag described below.
177
+
178
+ ### Examples
179
+
180
+ ```ruby
181
+ require 'time'
182
+ require 'lishogi'
183
+ # setup authorization
184
+ Lishogi.configure do |config|
185
+ # Configure OAuth2 access token for authorization: OAuth2
186
+ config.access_token = 'YOUR ACCESS TOKEN'
187
+ end
188
+
189
+ api_instance = Lishogi::ChallengesApi.new
190
+ username = 'YoBot_v2' # String |
191
+ opts = {
192
+ rated: true, # Boolean | Game is rated and impacts players ratings
193
+ clock_limit: 8.14, # Float | Clock initial time in seconds. If empty, a correspondence game is created.
194
+ clock_increment: 56, # Integer | Clock increment in seconds. If empty, a correspondence game is created.
195
+ clock_byoyomi: 56, # Integer | Clock byoyomi in seconds. If empty, a correspondence game is created.
196
+ clock_periods: 56, # Integer | Clock periods for byoyomi in seconds. If empty, a correspondence game is created.
197
+ days: 1, # Integer | Days per move, for correspondence games. Clock settings must be omitted.
198
+ color: 'random', # String | Which color you get to play
199
+ variant: Lishogi::VariantKey::STANDARD, # VariantKey |
200
+ sfen: 'sfen_example', # String | Custom initial position (in SFEN). Variant must be standard, and the game cannot be rated.
201
+ keep_alive_stream: true, # Boolean | If set, the response is streamed as [ndjson](#section/Introduction/Streaming-with-ND-JSON). The challenge is kept alive until the connection is closed by the client. When the challenge is accepted or declined, a message of the form `{\\\"done\\\":\\\"accepted\\\"}` is sent, then the connection is closed by the server. If not set, the response is not streamed, and the challenge expires after 20s if not accepted.
202
+ accept_by_token: 'accept_by_token_example', # String | Immediately accept the challenge and create the game. Pass in an OAuth token (with the `challenge:write` scope) for the receiving user. On success, the response will contain a `game` field instead of a `challenge` field.
203
+ message: 'message_example' # String | **Only if `acceptByToken` is set.** Message that is sent to each player, when the game is created. It is sent from your user account. `{opponent}`, `{player}` and `{game}` are placeholders that will be replaced with the opponent name, player name, and the game URLs. You can omit this field to send the default message, but if you set your own message, it must at least contain the `{game}` placeholder.
204
+ }
205
+
206
+ begin
207
+ # Create a challenge
208
+ result = api_instance.challenge_create(username, opts)
209
+ p result
210
+ rescue Lishogi::ApiError => e
211
+ puts "Error when calling ChallengesApi->challenge_create: #{e}"
212
+ end
213
+ ```
214
+
215
+ #### Using the challenge_create_with_http_info variant
216
+
217
+ This returns an Array which contains the response data, status code and headers.
218
+
219
+ > <Array(<ChallengeJson>, Integer, Hash)> challenge_create_with_http_info(username, opts)
220
+
221
+ ```ruby
222
+ begin
223
+ # Create a challenge
224
+ data, status_code, headers = api_instance.challenge_create_with_http_info(username, opts)
225
+ p status_code # => 2xx
226
+ p headers # => { ... }
227
+ p data # => <ChallengeJson>
228
+ rescue Lishogi::ApiError => e
229
+ puts "Error when calling ChallengesApi->challenge_create_with_http_info: #{e}"
230
+ end
231
+ ```
232
+
233
+ ### Parameters
234
+
235
+ | Name | Type | Description | Notes |
236
+ | ---- | ---- | ----------- | ----- |
237
+ | **username** | **String** | | |
238
+ | **rated** | **Boolean** | Game is rated and impacts players ratings | [optional] |
239
+ | **clock_limit** | **Float** | Clock initial time in seconds. If empty, a correspondence game is created. | [optional] |
240
+ | **clock_increment** | **Integer** | Clock increment in seconds. If empty, a correspondence game is created. | [optional] |
241
+ | **clock_byoyomi** | **Integer** | Clock byoyomi in seconds. If empty, a correspondence game is created. | [optional] |
242
+ | **clock_periods** | **Integer** | Clock periods for byoyomi in seconds. If empty, a correspondence game is created. | [optional] |
243
+ | **days** | **Integer** | Days per move, for correspondence games. Clock settings must be omitted. | [optional] |
244
+ | **color** | **String** | Which color you get to play | [optional][default to &#39;random&#39;] |
245
+ | **variant** | [**VariantKey**](VariantKey.md) | | [optional][default to &#39;standard&#39;] |
246
+ | **sfen** | **String** | Custom initial position (in SFEN). Variant must be standard, and the game cannot be rated. | [optional][default to &#39;rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1&#39;] |
247
+ | **keep_alive_stream** | **Boolean** | If set, the response is streamed as [ndjson](#section/Introduction/Streaming-with-ND-JSON). The challenge is kept alive until the connection is closed by the client. When the challenge is accepted or declined, a message of the form &#x60;{\\\&quot;done\\\&quot;:\\\&quot;accepted\\\&quot;}&#x60; is sent, then the connection is closed by the server. If not set, the response is not streamed, and the challenge expires after 20s if not accepted. | [optional] |
248
+ | **accept_by_token** | **String** | Immediately accept the challenge and create the game. Pass in an OAuth token (with the &#x60;challenge:write&#x60; scope) for the receiving user. On success, the response will contain a &#x60;game&#x60; field instead of a &#x60;challenge&#x60; field. | [optional] |
249
+ | **message** | **String** | **Only if &#x60;acceptByToken&#x60; is set.** Message that is sent to each player, when the game is created. It is sent from your user account. &#x60;{opponent}&#x60;, &#x60;{player}&#x60; and &#x60;{game}&#x60; are placeholders that will be replaced with the opponent name, player name, and the game URLs. You can omit this field to send the default message, but if you set your own message, it must at least contain the &#x60;{game}&#x60; placeholder. | [optional][default to &#39;Your game with {opponent} is ready: {game}.&#39;] |
250
+
251
+ ### Return type
252
+
253
+ [**ChallengeJson**](ChallengeJson.md)
254
+
255
+ ### Authorization
256
+
257
+ [OAuth2](../README.md#OAuth2)
258
+
259
+ ### HTTP request headers
260
+
261
+ - **Content-Type**: application/x-www-form-urlencoded
262
+ - **Accept**: application/json
263
+
264
+
265
+ ## challenge_decline
266
+
267
+ > <Ok> challenge_decline(challenge_id)
268
+
269
+ Decline a challenge
270
+
271
+ Decline an incoming challenge.
272
+
273
+ ### Examples
274
+
275
+ ```ruby
276
+ require 'time'
277
+ require 'lishogi'
278
+ # setup authorization
279
+ Lishogi.configure do |config|
280
+ # Configure OAuth2 access token for authorization: OAuth2
281
+ config.access_token = 'YOUR ACCESS TOKEN'
282
+ end
283
+
284
+ api_instance = Lishogi::ChallengesApi.new
285
+ challenge_id = '5IrD6Gzz' # String |
286
+
287
+ begin
288
+ # Decline a challenge
289
+ result = api_instance.challenge_decline(challenge_id)
290
+ p result
291
+ rescue Lishogi::ApiError => e
292
+ puts "Error when calling ChallengesApi->challenge_decline: #{e}"
293
+ end
294
+ ```
295
+
296
+ #### Using the challenge_decline_with_http_info variant
297
+
298
+ This returns an Array which contains the response data, status code and headers.
299
+
300
+ > <Array(<Ok>, Integer, Hash)> challenge_decline_with_http_info(challenge_id)
301
+
302
+ ```ruby
303
+ begin
304
+ # Decline a challenge
305
+ data, status_code, headers = api_instance.challenge_decline_with_http_info(challenge_id)
306
+ p status_code # => 2xx
307
+ p headers # => { ... }
308
+ p data # => <Ok>
309
+ rescue Lishogi::ApiError => e
310
+ puts "Error when calling ChallengesApi->challenge_decline_with_http_info: #{e}"
311
+ end
312
+ ```
313
+
314
+ ### Parameters
315
+
316
+ | Name | Type | Description | Notes |
317
+ | ---- | ---- | ----------- | ----- |
318
+ | **challenge_id** | **String** | | |
319
+
320
+ ### Return type
321
+
322
+ [**Ok**](Ok.md)
323
+
324
+ ### Authorization
325
+
326
+ [OAuth2](../README.md#OAuth2)
327
+
328
+ ### HTTP request headers
329
+
330
+ - **Content-Type**: Not defined
331
+ - **Accept**: application/json
332
+
333
+
334
+ ## challenge_open
335
+
336
+ > Object challenge_open(opts)
337
+
338
+ Open-ended challenge
339
+
340
+ Create a challenge that any 2 players can join. Share the URL of the challenge. the first 2 players to click it will be paired for a game. The response body also contains `senteUrl` and `goteUrl`. You can control which color each player gets by giving them these URLs, instead of the main challenge URL. Open challenges expire after 24h. To directly pair 2 known players, use [this endpoint](#operation/challengeCreate) instead, with the `acceptByToken` parameter.
341
+
342
+ ### Examples
343
+
344
+ ```ruby
345
+ require 'time'
346
+ require 'lishogi'
347
+
348
+ api_instance = Lishogi::ChallengesApi.new
349
+ opts = {
350
+ rated: true, # Boolean | Game is rated and impacts players ratings
351
+ clock_limit: 8.14, # Float | Clock initial time in seconds. If empty, a correspondence game is created.
352
+ clock_increment: 56, # Integer | Clock increment in seconds. If empty, a correspondence game is created.
353
+ clock_byoyomi: 56, # Integer | Clock byoyomi in seconds. If empty, a correspondence game is created.
354
+ clock_periods: 56, # Integer | Clock periods for byoyomi in seconds. If empty, a correspondence game is created.
355
+ days: 1, # Integer | Days per turn. For correspondence challenges.
356
+ variant: Lishogi::VariantKey::STANDARD, # VariantKey |
357
+ sfen: 'sfen_example', # String | Custom initial position (in SFEN). Variant must be standard, and the game cannot be rated.
358
+ name: 'name_example' # String | Optional name for the challenge, that players will see on the challenge page.
359
+ }
360
+
361
+ begin
362
+ # Open-ended challenge
363
+ result = api_instance.challenge_open(opts)
364
+ p result
365
+ rescue Lishogi::ApiError => e
366
+ puts "Error when calling ChallengesApi->challenge_open: #{e}"
367
+ end
368
+ ```
369
+
370
+ #### Using the challenge_open_with_http_info variant
371
+
372
+ This returns an Array which contains the response data, status code and headers.
373
+
374
+ > <Array(Object, Integer, Hash)> challenge_open_with_http_info(opts)
375
+
376
+ ```ruby
377
+ begin
378
+ # Open-ended challenge
379
+ data, status_code, headers = api_instance.challenge_open_with_http_info(opts)
380
+ p status_code # => 2xx
381
+ p headers # => { ... }
382
+ p data # => Object
383
+ rescue Lishogi::ApiError => e
384
+ puts "Error when calling ChallengesApi->challenge_open_with_http_info: #{e}"
385
+ end
386
+ ```
387
+
388
+ ### Parameters
389
+
390
+ | Name | Type | Description | Notes |
391
+ | ---- | ---- | ----------- | ----- |
392
+ | **rated** | **Boolean** | Game is rated and impacts players ratings | [optional] |
393
+ | **clock_limit** | **Float** | Clock initial time in seconds. If empty, a correspondence game is created. | [optional] |
394
+ | **clock_increment** | **Integer** | Clock increment in seconds. If empty, a correspondence game is created. | [optional] |
395
+ | **clock_byoyomi** | **Integer** | Clock byoyomi in seconds. If empty, a correspondence game is created. | [optional] |
396
+ | **clock_periods** | **Integer** | Clock periods for byoyomi in seconds. If empty, a correspondence game is created. | [optional] |
397
+ | **days** | **Integer** | Days per turn. For correspondence challenges. | [optional] |
398
+ | **variant** | [**VariantKey**](VariantKey.md) | | [optional][default to &#39;standard&#39;] |
399
+ | **sfen** | **String** | Custom initial position (in SFEN). Variant must be standard, and the game cannot be rated. | [optional][default to &#39;rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1&#39;] |
400
+ | **name** | **String** | Optional name for the challenge, that players will see on the challenge page. | [optional] |
401
+
402
+ ### Return type
403
+
404
+ **Object**
405
+
406
+ ### Authorization
407
+
408
+ No authorization required
409
+
410
+ ### HTTP request headers
411
+
412
+ - **Content-Type**: application/x-www-form-urlencoded
413
+ - **Accept**: application/json
414
+
@@ -0,0 +1,24 @@
1
+ # Lishogi::ChatLineEvent
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **type** | **String** | | |
8
+ | **room** | **String** | | |
9
+ | **username** | **String** | | |
10
+ | **text** | **String** | | |
11
+
12
+ ## Example
13
+
14
+ ```ruby
15
+ require 'lishogi'
16
+
17
+ instance = Lishogi::ChatLineEvent.new(
18
+ type: null,
19
+ room: null,
20
+ username: null,
21
+ text: null
22
+ )
23
+ ```
24
+
data/docs/Clock.md ADDED
@@ -0,0 +1,24 @@
1
+ # Lishogi::Clock
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **limit** | **Integer** | | [optional] |
8
+ | **increment** | **Integer** | | [optional] |
9
+ | **byoyomi** | **Integer** | | [optional] |
10
+ | **periods** | **Object** | | [optional] |
11
+
12
+ ## Example
13
+
14
+ ```ruby
15
+ require 'lishogi'
16
+
17
+ instance = Lishogi::Clock.new(
18
+ limit: null,
19
+ increment: null,
20
+ byoyomi: null,
21
+ periods: null
22
+ )
23
+ ```
24
+