lishogi 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/LICENSE +661 -0
- data/LICENSE~ +1 -0
- data/Makefile +39 -0
- data/Makefile~ +7 -0
- data/README.md +276 -0
- data/Rakefile +10 -0
- data/docs/Account200Response.md +20 -0
- data/docs/AccountApi.md +345 -0
- data/docs/AccountEmail200Response.md +18 -0
- data/docs/AccountKid200Response.md +18 -0
- data/docs/AnalysisApi.md +77 -0
- data/docs/ApiStreamEvent200Response.md +53 -0
- data/docs/ApiUsersStatus200ResponseInner.md +30 -0
- data/docs/ArenaTournaments.md +22 -0
- data/docs/ArenaTournamentsApi.md +601 -0
- data/docs/BoardApi.md +659 -0
- data/docs/BoardGameStream200Response.md +51 -0
- data/docs/BoardGameTakebackAcceptParameter.md +15 -0
- data/docs/BotApi.md +634 -0
- data/docs/ChallengeDeclinedEvent.md +20 -0
- data/docs/ChallengeEvent.md +20 -0
- data/docs/ChallengeJson.md +42 -0
- data/docs/ChallengeJsonPerf.md +20 -0
- data/docs/ChallengeJsonTimeControl.md +51 -0
- data/docs/ChallengeJsonTimeControlOneOf.md +28 -0
- data/docs/ChallengeJsonTimeControlOneOf1.md +20 -0
- data/docs/ChallengeJsonTimeControlOneOf2.md +18 -0
- data/docs/ChallengeUser.md +30 -0
- data/docs/ChallengesApi.md +414 -0
- data/docs/ChatLineEvent.md +24 -0
- data/docs/Clock.md +24 -0
- data/docs/Count.md +38 -0
- data/docs/Error.md +18 -0
- data/docs/GameEventInfo.md +22 -0
- data/docs/GameEventInfoCompat.md +20 -0
- data/docs/GameEventPlayer.md +28 -0
- data/docs/GameFinishEvent.md +20 -0
- data/docs/GameFullEvent.md +42 -0
- data/docs/GameFullEventPerf.md +18 -0
- data/docs/GameJson.md +50 -0
- data/docs/GameJsonAnalysisInner.md +24 -0
- data/docs/GameJsonAnalysisInnerJudgment.md +20 -0
- data/docs/GameJsonClock.md +26 -0
- data/docs/GameJsonPlayers.md +20 -0
- data/docs/GameStartEvent.md +20 -0
- data/docs/GameStateEvent.md +38 -0
- data/docs/GameStatus.md +15 -0
- data/docs/GameUser.md +32 -0
- data/docs/GameUserAnalysis.md +24 -0
- data/docs/GamesApi.md +473 -0
- data/docs/LightUser.md +24 -0
- data/docs/LightUserTitle.md +49 -0
- data/docs/MessagingApi.md +79 -0
- data/docs/Move.md +28 -0
- data/docs/NotFound.md +18 -0
- data/docs/OAuthError.md +20 -0
- data/docs/Ok.md +18 -0
- data/docs/Perf.md +26 -0
- data/docs/PerfType.md +15 -0
- data/docs/Perfs.md +30 -0
- data/docs/PlayTime.md +20 -0
- data/docs/Profile.md +28 -0
- data/docs/PuzzleRoundJson.md +24 -0
- data/docs/PuzzlesApi.md +211 -0
- data/docs/SimulsApi.md +69 -0
- data/docs/Speed.md +15 -0
- data/docs/StudiesApi.md +233 -0
- data/docs/TVApi.md +208 -0
- data/docs/Team.md +32 -0
- data/docs/TeamAll200Response.md +30 -0
- data/docs/TeamRequest.md +24 -0
- data/docs/TeamRequestWithUser.md +20 -0
- data/docs/TeamsApi.md +702 -0
- data/docs/Title.md +15 -0
- data/docs/User.md +42 -0
- data/docs/UserExtended.md +60 -0
- data/docs/UserPreferences.md +72 -0
- data/docs/UsersApi.md +667 -0
- data/docs/Variant.md +22 -0
- data/docs/VariantKey.md +15 -0
- data/git_push.sh +57 -0
- data/lib/lishogi/api/account_api.rb +314 -0
- data/lib/lishogi/api/analysis_api.rb +92 -0
- data/lib/lishogi/api/arena_tournaments_api.rb +681 -0
- data/lib/lishogi/api/board_api.rb +685 -0
- data/lib/lishogi/api/bot_api.rb +608 -0
- data/lib/lishogi/api/challenges_api.rb +554 -0
- data/lib/lishogi/api/games_api.rb +514 -0
- data/lib/lishogi/api/messaging_api.rb +97 -0
- data/lib/lishogi/api/puzzles_api.rb +210 -0
- data/lib/lishogi/api/simuls_api.rb +79 -0
- data/lib/lishogi/api/studies_api.rb +244 -0
- data/lib/lishogi/api/teams_api.rb +678 -0
- data/lib/lishogi/api/tv_api.rb +222 -0
- data/lib/lishogi/api/users_api.rb +677 -0
- data/lib/lishogi/api_client.rb +437 -0
- data/lib/lishogi/api_error.rb +58 -0
- data/lib/lishogi/configuration.rb +392 -0
- data/lib/lishogi/models/account200_response.rb +223 -0
- data/lib/lishogi/models/account_email200_response.rb +214 -0
- data/lib/lishogi/models/account_kid200_response.rb +214 -0
- data/lib/lishogi/models/api_stream_event200_response.rb +107 -0
- data/lib/lishogi/models/api_users_status200_response_inner.rb +273 -0
- data/lib/lishogi/models/arena_tournaments.rb +238 -0
- data/lib/lishogi/models/board_game_stream200_response.rb +106 -0
- data/lib/lishogi/models/board_game_takeback_accept_parameter.rb +104 -0
- data/lib/lishogi/models/challenge_declined_event.rb +257 -0
- data/lib/lishogi/models/challenge_event.rb +257 -0
- data/lib/lishogi/models/challenge_json.rb +453 -0
- data/lib/lishogi/models/challenge_json_perf.rb +223 -0
- data/lib/lishogi/models/challenge_json_time_control.rb +106 -0
- data/lib/lishogi/models/challenge_json_time_control_one_of.rb +259 -0
- data/lib/lishogi/models/challenge_json_time_control_one_of1.rb +223 -0
- data/lib/lishogi/models/challenge_json_time_control_one_of2.rb +214 -0
- data/lib/lishogi/models/challenge_user.rb +275 -0
- data/lib/lishogi/models/chat_line_event.rb +315 -0
- data/lib/lishogi/models/clock.rb +242 -0
- data/lib/lishogi/models/count.rb +304 -0
- data/lib/lishogi/models/error.rb +215 -0
- data/lib/lishogi/models/game_event_info.rb +266 -0
- data/lib/lishogi/models/game_event_info_compat.rb +223 -0
- data/lib/lishogi/models/game_event_player.rb +260 -0
- data/lib/lishogi/models/game_finish_event.rb +257 -0
- data/lib/lishogi/models/game_full_event.rb +436 -0
- data/lib/lishogi/models/game_full_event_perf.rb +215 -0
- data/lib/lishogi/models/game_json.rb +457 -0
- data/lib/lishogi/models/game_json_analysis_inner.rb +251 -0
- data/lib/lishogi/models/game_json_analysis_inner_judgment.rb +258 -0
- data/lib/lishogi/models/game_json_clock.rb +250 -0
- data/lib/lishogi/models/game_json_players.rb +223 -0
- data/lib/lishogi/models/game_start_event.rb +257 -0
- data/lib/lishogi/models/game_state_event.rb +396 -0
- data/lib/lishogi/models/game_status.rb +52 -0
- data/lib/lishogi/models/game_user.rb +277 -0
- data/lib/lishogi/models/game_user_analysis.rb +269 -0
- data/lib/lishogi/models/light_user.rb +241 -0
- data/lib/lishogi/models/light_user_title.rb +105 -0
- data/lib/lishogi/models/move.rb +259 -0
- data/lib/lishogi/models/not_found.rb +214 -0
- data/lib/lishogi/models/o_auth_error.rb +225 -0
- data/lib/lishogi/models/ok.rb +214 -0
- data/lib/lishogi/models/perf.rb +250 -0
- data/lib/lishogi/models/perf_type.rb +49 -0
- data/lib/lishogi/models/perfs.rb +268 -0
- data/lib/lishogi/models/play_time.rb +223 -0
- data/lib/lishogi/models/profile.rb +259 -0
- data/lib/lishogi/models/puzzle_round_json.rb +241 -0
- data/lib/lishogi/models/speed.rb +44 -0
- data/lib/lishogi/models/team.rb +280 -0
- data/lib/lishogi/models/team_all200_response.rb +272 -0
- data/lib/lishogi/models/team_request.rb +241 -0
- data/lib/lishogi/models/team_request_with_user.rb +223 -0
- data/lib/lishogi/models/title.rb +64 -0
- data/lib/lishogi/models/user.rb +322 -0
- data/lib/lishogi/models/user_extended.rb +410 -0
- data/lib/lishogi/models/user_preferences.rb +515 -0
- data/lib/lishogi/models/variant.rb +256 -0
- data/lib/lishogi/models/variant_key.rb +44 -0
- data/lib/lishogi/version.rb +15 -0
- data/lib/lishogi.rb +112 -0
- data/lishogi-api.patched.yaml +5806 -0
- data/lishogi-api.yaml +5811 -0
- data/lishogi.gemspec +41 -0
- data/manifest.scm +1 -0
- data/manifest.scm~ +1 -0
- data/patch +5 -0
- data/patch~ +1 -0
- data/pkg/lishogi-0.1.0.gem +0 -0
- data/smoke +5 -0
- data/smoke~ +2 -0
- data/spec/api/account_api_spec.rb +91 -0
- data/spec/api/analysis_api_spec.rb +49 -0
- data/spec/api/arena_tournaments_api_spec.rb +160 -0
- data/spec/api/board_api_spec.rb +154 -0
- data/spec/api/bot_api_spec.rb +144 -0
- data/spec/api/challenges_api_spec.rb +123 -0
- data/spec/api/games_api_spec.rb +135 -0
- data/spec/api/messaging_api_spec.rb +48 -0
- data/spec/api/puzzles_api_spec.rb +70 -0
- data/spec/api/simuls_api_spec.rb +46 -0
- data/spec/api/studies_api_spec.rb +81 -0
- data/spec/api/teams_api_spec.rb +160 -0
- data/spec/api/tv_api_spec.rb +74 -0
- data/spec/api/users_api_spec.rb +157 -0
- data/spec/models/account200_response_spec.rb +42 -0
- data/spec/models/account_email200_response_spec.rb +36 -0
- data/spec/models/account_kid200_response_spec.rb +36 -0
- data/spec/models/api_stream_event200_response_spec.rb +32 -0
- data/spec/models/api_users_status200_response_inner_spec.rb +72 -0
- data/spec/models/arena_tournaments_spec.rb +48 -0
- data/spec/models/board_game_stream200_response_spec.rb +32 -0
- data/spec/models/board_game_takeback_accept_parameter_spec.rb +21 -0
- data/spec/models/challenge_declined_event_spec.rb +46 -0
- data/spec/models/challenge_event_spec.rb +46 -0
- data/spec/models/challenge_json_perf_spec.rb +42 -0
- data/spec/models/challenge_json_spec.rb +120 -0
- data/spec/models/challenge_json_time_control_one_of1_spec.rb +42 -0
- data/spec/models/challenge_json_time_control_one_of2_spec.rb +36 -0
- data/spec/models/challenge_json_time_control_one_of_spec.rb +66 -0
- data/spec/models/challenge_json_time_control_spec.rb +32 -0
- data/spec/models/challenge_user_spec.rb +72 -0
- data/spec/models/chat_line_event_spec.rb +62 -0
- data/spec/models/clock_spec.rb +54 -0
- data/spec/models/count_spec.rb +96 -0
- data/spec/models/error_spec.rb +36 -0
- data/spec/models/game_event_info_compat_spec.rb +42 -0
- data/spec/models/game_event_info_spec.rb +52 -0
- data/spec/models/game_event_player_spec.rb +66 -0
- data/spec/models/game_finish_event_spec.rb +46 -0
- data/spec/models/game_full_event_perf_spec.rb +36 -0
- data/spec/models/game_full_event_spec.rb +112 -0
- data/spec/models/game_json_analysis_inner_judgment_spec.rb +46 -0
- data/spec/models/game_json_analysis_inner_spec.rb +54 -0
- data/spec/models/game_json_clock_spec.rb +60 -0
- data/spec/models/game_json_players_spec.rb +42 -0
- data/spec/models/game_json_spec.rb +136 -0
- data/spec/models/game_start_event_spec.rb +46 -0
- data/spec/models/game_state_event_spec.rb +100 -0
- data/spec/models/game_status_spec.rb +30 -0
- data/spec/models/game_user_analysis_spec.rb +54 -0
- data/spec/models/game_user_spec.rb +78 -0
- data/spec/models/light_user_spec.rb +54 -0
- data/spec/models/light_user_title_spec.rb +32 -0
- data/spec/models/move_spec.rb +66 -0
- data/spec/models/not_found_spec.rb +36 -0
- data/spec/models/o_auth_error_spec.rb +42 -0
- data/spec/models/ok_spec.rb +36 -0
- data/spec/models/perf_spec.rb +60 -0
- data/spec/models/perf_type_spec.rb +30 -0
- data/spec/models/perfs_spec.rb +72 -0
- data/spec/models/play_time_spec.rb +42 -0
- data/spec/models/profile_spec.rb +66 -0
- data/spec/models/puzzle_round_json_spec.rb +54 -0
- data/spec/models/speed_spec.rb +30 -0
- data/spec/models/team_all200_response_spec.rb +72 -0
- data/spec/models/team_request_spec.rb +54 -0
- data/spec/models/team_request_with_user_spec.rb +42 -0
- data/spec/models/team_spec.rb +78 -0
- data/spec/models/title_spec.rb +30 -0
- data/spec/models/user_extended_spec.rb +162 -0
- data/spec/models/user_preferences_spec.rb +210 -0
- data/spec/models/user_spec.rb +108 -0
- data/spec/models/variant_key_spec.rb +30 -0
- data/spec/models/variant_spec.rb +48 -0
- data/spec/spec_helper.rb +111 -0
- metadata +446 -0
data/docs/BoardApi.md
ADDED
@@ -0,0 +1,659 @@
|
|
1
|
+
# Lishogi::BoardApi
|
2
|
+
|
3
|
+
All URIs are relative to *https://lishogi.org*
|
4
|
+
|
5
|
+
| Method | HTTP request | Description |
|
6
|
+
| ------ | ------------ | ----------- |
|
7
|
+
| [**api_board_seek**](BoardApi.md#api_board_seek) | **POST** /api/board/seek | Create a seek |
|
8
|
+
| [**api_stream_event**](BoardApi.md#api_stream_event) | **GET** /api/stream/event | Stream incoming events |
|
9
|
+
| [**board_game_abort**](BoardApi.md#board_game_abort) | **POST** /api/board/game/{gameId}/abort | Abort a game |
|
10
|
+
| [**board_game_chat_get**](BoardApi.md#board_game_chat_get) | **GET** /api/board/game/{gameId}/chat | Fetch the game chat |
|
11
|
+
| [**board_game_chat_post**](BoardApi.md#board_game_chat_post) | **POST** /api/board/game/{gameId}/chat | Write in the chat |
|
12
|
+
| [**board_game_move**](BoardApi.md#board_game_move) | **POST** /api/board/game/{gameId}/move/{move} | Make a Board move |
|
13
|
+
| [**board_game_resign**](BoardApi.md#board_game_resign) | **POST** /api/board/game/{gameId}/resign | Resign a game |
|
14
|
+
| [**board_game_stream**](BoardApi.md#board_game_stream) | **GET** /api/board/game/stream/{gameId} | Stream Board game state |
|
15
|
+
| [**board_game_takeback**](BoardApi.md#board_game_takeback) | **POST** /api/board/game/{gameId}/takeback/{accept} | Handle takeback offers |
|
16
|
+
|
17
|
+
|
18
|
+
## api_board_seek
|
19
|
+
|
20
|
+
> api_board_seek(opts)
|
21
|
+
|
22
|
+
Create a seek
|
23
|
+
|
24
|
+
Create a public seek, to start a game with a random player. ### Real-time seek Specify the `time`, `increment`, `byoyomi` and `periods` clock values. The response is streamed but doesn't contain any information. **Keep the connection open to keep the seek active**. If the client closes the connection, the seek is canceled. This way, if the client terminates, the user won't be paired in a game they wouldn't play. When the seek is accepted, or expires, the server closes the connection. **Make sure to also have an [Event stream](#operation/apiStreamEvent) open**, to be notified when a game starts. We recommend opening the [Event stream](#operation/apiStreamEvent) first, then the seek stream. This way, you won't miss the game event if the seek is accepted immediately. ### Correspondence seek Specify the `days` per turn value. The response is not streamed, it immediately completes with the seek ID. The seek remains active on the server until it is joined by someone.
|
25
|
+
|
26
|
+
### Examples
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
require 'time'
|
30
|
+
require 'lishogi'
|
31
|
+
# setup authorization
|
32
|
+
Lishogi.configure do |config|
|
33
|
+
# Configure OAuth2 access token for authorization: OAuth2
|
34
|
+
config.access_token = 'YOUR ACCESS TOKEN'
|
35
|
+
end
|
36
|
+
|
37
|
+
api_instance = Lishogi::BoardApi.new
|
38
|
+
opts = {
|
39
|
+
rated: true, # Boolean | Whether the game is rated and impacts players ratings.
|
40
|
+
time: 8.14, # Float | Clock initial time in minutes. Required for real-time seeks.
|
41
|
+
increment: 56, # Integer | Clock increment in seconds. Required for real-time seeks.
|
42
|
+
byoyomi: 56, # Integer | Clock byoyomi in seconds. Required for real-time seeks.
|
43
|
+
periods: 56, # Integer | Clock periods for byoyomi in seconds. Required for real-time seeks.
|
44
|
+
days: 1, # Integer | Days per turn. Required for correspondence seeks.
|
45
|
+
variant: Lishogi::VariantKey::STANDARD, # VariantKey |
|
46
|
+
color: 'random', # String | The color to play. Better left empty to automatically get a random color.
|
47
|
+
rating_range: 'rating_range_example' # String | The rating range of potential opponents. Better left empty. Example: 1500-1800
|
48
|
+
}
|
49
|
+
|
50
|
+
begin
|
51
|
+
# Create a seek
|
52
|
+
api_instance.api_board_seek(opts)
|
53
|
+
rescue Lishogi::ApiError => e
|
54
|
+
puts "Error when calling BoardApi->api_board_seek: #{e}"
|
55
|
+
end
|
56
|
+
```
|
57
|
+
|
58
|
+
#### Using the api_board_seek_with_http_info variant
|
59
|
+
|
60
|
+
This returns an Array which contains the response data (`nil` in this case), status code and headers.
|
61
|
+
|
62
|
+
> <Array(nil, Integer, Hash)> api_board_seek_with_http_info(opts)
|
63
|
+
|
64
|
+
```ruby
|
65
|
+
begin
|
66
|
+
# Create a seek
|
67
|
+
data, status_code, headers = api_instance.api_board_seek_with_http_info(opts)
|
68
|
+
p status_code # => 2xx
|
69
|
+
p headers # => { ... }
|
70
|
+
p data # => nil
|
71
|
+
rescue Lishogi::ApiError => e
|
72
|
+
puts "Error when calling BoardApi->api_board_seek_with_http_info: #{e}"
|
73
|
+
end
|
74
|
+
```
|
75
|
+
|
76
|
+
### Parameters
|
77
|
+
|
78
|
+
| Name | Type | Description | Notes |
|
79
|
+
| ---- | ---- | ----------- | ----- |
|
80
|
+
| **rated** | **Boolean** | Whether the game is rated and impacts players ratings. | [optional][default to false] |
|
81
|
+
| **time** | **Float** | Clock initial time in minutes. Required for real-time seeks. | [optional] |
|
82
|
+
| **increment** | **Integer** | Clock increment in seconds. Required for real-time seeks. | [optional] |
|
83
|
+
| **byoyomi** | **Integer** | Clock byoyomi in seconds. Required for real-time seeks. | [optional] |
|
84
|
+
| **periods** | **Integer** | Clock periods for byoyomi in seconds. Required for real-time seeks. | [optional] |
|
85
|
+
| **days** | **Integer** | Days per turn. Required for correspondence seeks. | [optional] |
|
86
|
+
| **variant** | [**VariantKey**](VariantKey.md) | | [optional][default to 'standard'] |
|
87
|
+
| **color** | **String** | The color to play. Better left empty to automatically get a random color. | [optional][default to 'random'] |
|
88
|
+
| **rating_range** | **String** | The rating range of potential opponents. Better left empty. Example: 1500-1800 | [optional] |
|
89
|
+
|
90
|
+
### Return type
|
91
|
+
|
92
|
+
nil (empty response body)
|
93
|
+
|
94
|
+
### Authorization
|
95
|
+
|
96
|
+
[OAuth2](../README.md#OAuth2)
|
97
|
+
|
98
|
+
### HTTP request headers
|
99
|
+
|
100
|
+
- **Content-Type**: application/x-www-form-urlencoded
|
101
|
+
- **Accept**: text/plain, application/json
|
102
|
+
|
103
|
+
|
104
|
+
## api_stream_event
|
105
|
+
|
106
|
+
> <ApiStreamEvent200Response> api_stream_event
|
107
|
+
|
108
|
+
Stream incoming events
|
109
|
+
|
110
|
+
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.
|
111
|
+
|
112
|
+
### Examples
|
113
|
+
|
114
|
+
```ruby
|
115
|
+
require 'time'
|
116
|
+
require 'lishogi'
|
117
|
+
# setup authorization
|
118
|
+
Lishogi.configure do |config|
|
119
|
+
# Configure OAuth2 access token for authorization: OAuth2
|
120
|
+
config.access_token = 'YOUR ACCESS TOKEN'
|
121
|
+
end
|
122
|
+
|
123
|
+
api_instance = Lishogi::BoardApi.new
|
124
|
+
|
125
|
+
begin
|
126
|
+
# Stream incoming events
|
127
|
+
result = api_instance.api_stream_event
|
128
|
+
p result
|
129
|
+
rescue Lishogi::ApiError => e
|
130
|
+
puts "Error when calling BoardApi->api_stream_event: #{e}"
|
131
|
+
end
|
132
|
+
```
|
133
|
+
|
134
|
+
#### Using the api_stream_event_with_http_info variant
|
135
|
+
|
136
|
+
This returns an Array which contains the response data, status code and headers.
|
137
|
+
|
138
|
+
> <Array(<ApiStreamEvent200Response>, Integer, Hash)> api_stream_event_with_http_info
|
139
|
+
|
140
|
+
```ruby
|
141
|
+
begin
|
142
|
+
# Stream incoming events
|
143
|
+
data, status_code, headers = api_instance.api_stream_event_with_http_info
|
144
|
+
p status_code # => 2xx
|
145
|
+
p headers # => { ... }
|
146
|
+
p data # => <ApiStreamEvent200Response>
|
147
|
+
rescue Lishogi::ApiError => e
|
148
|
+
puts "Error when calling BoardApi->api_stream_event_with_http_info: #{e}"
|
149
|
+
end
|
150
|
+
```
|
151
|
+
|
152
|
+
### Parameters
|
153
|
+
|
154
|
+
This endpoint does not need any parameter.
|
155
|
+
|
156
|
+
### Return type
|
157
|
+
|
158
|
+
[**ApiStreamEvent200Response**](ApiStreamEvent200Response.md)
|
159
|
+
|
160
|
+
### Authorization
|
161
|
+
|
162
|
+
[OAuth2](../README.md#OAuth2)
|
163
|
+
|
164
|
+
### HTTP request headers
|
165
|
+
|
166
|
+
- **Content-Type**: Not defined
|
167
|
+
- **Accept**: application/x-ndjson
|
168
|
+
|
169
|
+
|
170
|
+
## board_game_abort
|
171
|
+
|
172
|
+
> <Ok> board_game_abort(game_id)
|
173
|
+
|
174
|
+
Abort a game
|
175
|
+
|
176
|
+
Abort a game being played with the Board API.
|
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::BoardApi.new
|
190
|
+
game_id = '5IrD6Gzz' # String |
|
191
|
+
|
192
|
+
begin
|
193
|
+
# Abort a game
|
194
|
+
result = api_instance.board_game_abort(game_id)
|
195
|
+
p result
|
196
|
+
rescue Lishogi::ApiError => e
|
197
|
+
puts "Error when calling BoardApi->board_game_abort: #{e}"
|
198
|
+
end
|
199
|
+
```
|
200
|
+
|
201
|
+
#### Using the board_game_abort_with_http_info variant
|
202
|
+
|
203
|
+
This returns an Array which contains the response data, status code and headers.
|
204
|
+
|
205
|
+
> <Array(<Ok>, Integer, Hash)> board_game_abort_with_http_info(game_id)
|
206
|
+
|
207
|
+
```ruby
|
208
|
+
begin
|
209
|
+
# Abort a game
|
210
|
+
data, status_code, headers = api_instance.board_game_abort_with_http_info(game_id)
|
211
|
+
p status_code # => 2xx
|
212
|
+
p headers # => { ... }
|
213
|
+
p data # => <Ok>
|
214
|
+
rescue Lishogi::ApiError => e
|
215
|
+
puts "Error when calling BoardApi->board_game_abort_with_http_info: #{e}"
|
216
|
+
end
|
217
|
+
```
|
218
|
+
|
219
|
+
### Parameters
|
220
|
+
|
221
|
+
| Name | Type | Description | Notes |
|
222
|
+
| ---- | ---- | ----------- | ----- |
|
223
|
+
| **game_id** | **String** | | |
|
224
|
+
|
225
|
+
### Return type
|
226
|
+
|
227
|
+
[**Ok**](Ok.md)
|
228
|
+
|
229
|
+
### Authorization
|
230
|
+
|
231
|
+
[OAuth2](../README.md#OAuth2)
|
232
|
+
|
233
|
+
### HTTP request headers
|
234
|
+
|
235
|
+
- **Content-Type**: Not defined
|
236
|
+
- **Accept**: application/json
|
237
|
+
|
238
|
+
|
239
|
+
## board_game_chat_get
|
240
|
+
|
241
|
+
> Object board_game_chat_get(game_id)
|
242
|
+
|
243
|
+
Fetch the game chat
|
244
|
+
|
245
|
+
Get the messages posted in the game chat
|
246
|
+
|
247
|
+
### Examples
|
248
|
+
|
249
|
+
```ruby
|
250
|
+
require 'time'
|
251
|
+
require 'lishogi'
|
252
|
+
# setup authorization
|
253
|
+
Lishogi.configure do |config|
|
254
|
+
# Configure OAuth2 access token for authorization: OAuth2
|
255
|
+
config.access_token = 'YOUR ACCESS TOKEN'
|
256
|
+
end
|
257
|
+
|
258
|
+
api_instance = Lishogi::BoardApi.new
|
259
|
+
game_id = '5IrD6Gzz' # String |
|
260
|
+
|
261
|
+
begin
|
262
|
+
# Fetch the game chat
|
263
|
+
result = api_instance.board_game_chat_get(game_id)
|
264
|
+
p result
|
265
|
+
rescue Lishogi::ApiError => e
|
266
|
+
puts "Error when calling BoardApi->board_game_chat_get: #{e}"
|
267
|
+
end
|
268
|
+
```
|
269
|
+
|
270
|
+
#### Using the board_game_chat_get_with_http_info variant
|
271
|
+
|
272
|
+
This returns an Array which contains the response data, status code and headers.
|
273
|
+
|
274
|
+
> <Array(Object, Integer, Hash)> board_game_chat_get_with_http_info(game_id)
|
275
|
+
|
276
|
+
```ruby
|
277
|
+
begin
|
278
|
+
# Fetch the game chat
|
279
|
+
data, status_code, headers = api_instance.board_game_chat_get_with_http_info(game_id)
|
280
|
+
p status_code # => 2xx
|
281
|
+
p headers # => { ... }
|
282
|
+
p data # => Object
|
283
|
+
rescue Lishogi::ApiError => e
|
284
|
+
puts "Error when calling BoardApi->board_game_chat_get_with_http_info: #{e}"
|
285
|
+
end
|
286
|
+
```
|
287
|
+
|
288
|
+
### Parameters
|
289
|
+
|
290
|
+
| Name | Type | Description | Notes |
|
291
|
+
| ---- | ---- | ----------- | ----- |
|
292
|
+
| **game_id** | **String** | | |
|
293
|
+
|
294
|
+
### Return type
|
295
|
+
|
296
|
+
**Object**
|
297
|
+
|
298
|
+
### Authorization
|
299
|
+
|
300
|
+
[OAuth2](../README.md#OAuth2)
|
301
|
+
|
302
|
+
### HTTP request headers
|
303
|
+
|
304
|
+
- **Content-Type**: Not defined
|
305
|
+
- **Accept**: application/x-ndjson
|
306
|
+
|
307
|
+
|
308
|
+
## board_game_chat_post
|
309
|
+
|
310
|
+
> <Ok> board_game_chat_post(game_id, room, text)
|
311
|
+
|
312
|
+
Write in the chat
|
313
|
+
|
314
|
+
Post a message to the player or spectator chat, in a game being played with the Board API.
|
315
|
+
|
316
|
+
### Examples
|
317
|
+
|
318
|
+
```ruby
|
319
|
+
require 'time'
|
320
|
+
require 'lishogi'
|
321
|
+
# setup authorization
|
322
|
+
Lishogi.configure do |config|
|
323
|
+
# Configure OAuth2 access token for authorization: OAuth2
|
324
|
+
config.access_token = 'YOUR ACCESS TOKEN'
|
325
|
+
end
|
326
|
+
|
327
|
+
api_instance = Lishogi::BoardApi.new
|
328
|
+
game_id = '5IrD6Gzz' # String |
|
329
|
+
room = 'player' # String |
|
330
|
+
text = 'text_example' # String |
|
331
|
+
|
332
|
+
begin
|
333
|
+
# Write in the chat
|
334
|
+
result = api_instance.board_game_chat_post(game_id, room, text)
|
335
|
+
p result
|
336
|
+
rescue Lishogi::ApiError => e
|
337
|
+
puts "Error when calling BoardApi->board_game_chat_post: #{e}"
|
338
|
+
end
|
339
|
+
```
|
340
|
+
|
341
|
+
#### Using the board_game_chat_post_with_http_info variant
|
342
|
+
|
343
|
+
This returns an Array which contains the response data, status code and headers.
|
344
|
+
|
345
|
+
> <Array(<Ok>, Integer, Hash)> board_game_chat_post_with_http_info(game_id, room, text)
|
346
|
+
|
347
|
+
```ruby
|
348
|
+
begin
|
349
|
+
# Write in the chat
|
350
|
+
data, status_code, headers = api_instance.board_game_chat_post_with_http_info(game_id, room, text)
|
351
|
+
p status_code # => 2xx
|
352
|
+
p headers # => { ... }
|
353
|
+
p data # => <Ok>
|
354
|
+
rescue Lishogi::ApiError => e
|
355
|
+
puts "Error when calling BoardApi->board_game_chat_post_with_http_info: #{e}"
|
356
|
+
end
|
357
|
+
```
|
358
|
+
|
359
|
+
### Parameters
|
360
|
+
|
361
|
+
| Name | Type | Description | Notes |
|
362
|
+
| ---- | ---- | ----------- | ----- |
|
363
|
+
| **game_id** | **String** | | |
|
364
|
+
| **room** | **String** | | |
|
365
|
+
| **text** | **String** | | |
|
366
|
+
|
367
|
+
### Return type
|
368
|
+
|
369
|
+
[**Ok**](Ok.md)
|
370
|
+
|
371
|
+
### Authorization
|
372
|
+
|
373
|
+
[OAuth2](../README.md#OAuth2)
|
374
|
+
|
375
|
+
### HTTP request headers
|
376
|
+
|
377
|
+
- **Content-Type**: application/x-www-form-urlencoded
|
378
|
+
- **Accept**: application/json
|
379
|
+
|
380
|
+
|
381
|
+
## board_game_move
|
382
|
+
|
383
|
+
> <Ok> board_game_move(game_id, move)
|
384
|
+
|
385
|
+
Make a Board move
|
386
|
+
|
387
|
+
Make a move in a game being played with the Board API.
|
388
|
+
|
389
|
+
### Examples
|
390
|
+
|
391
|
+
```ruby
|
392
|
+
require 'time'
|
393
|
+
require 'lishogi'
|
394
|
+
# setup authorization
|
395
|
+
Lishogi.configure do |config|
|
396
|
+
# Configure OAuth2 access token for authorization: OAuth2
|
397
|
+
config.access_token = 'YOUR ACCESS TOKEN'
|
398
|
+
end
|
399
|
+
|
400
|
+
api_instance = Lishogi::BoardApi.new
|
401
|
+
game_id = '5IrD6Gzz' # String |
|
402
|
+
move = '7g7f' # String | The move to play, in USI format
|
403
|
+
|
404
|
+
begin
|
405
|
+
# Make a Board move
|
406
|
+
result = api_instance.board_game_move(game_id, move)
|
407
|
+
p result
|
408
|
+
rescue Lishogi::ApiError => e
|
409
|
+
puts "Error when calling BoardApi->board_game_move: #{e}"
|
410
|
+
end
|
411
|
+
```
|
412
|
+
|
413
|
+
#### Using the board_game_move_with_http_info variant
|
414
|
+
|
415
|
+
This returns an Array which contains the response data, status code and headers.
|
416
|
+
|
417
|
+
> <Array(<Ok>, Integer, Hash)> board_game_move_with_http_info(game_id, move)
|
418
|
+
|
419
|
+
```ruby
|
420
|
+
begin
|
421
|
+
# Make a Board move
|
422
|
+
data, status_code, headers = api_instance.board_game_move_with_http_info(game_id, move)
|
423
|
+
p status_code # => 2xx
|
424
|
+
p headers # => { ... }
|
425
|
+
p data # => <Ok>
|
426
|
+
rescue Lishogi::ApiError => e
|
427
|
+
puts "Error when calling BoardApi->board_game_move_with_http_info: #{e}"
|
428
|
+
end
|
429
|
+
```
|
430
|
+
|
431
|
+
### Parameters
|
432
|
+
|
433
|
+
| Name | Type | Description | Notes |
|
434
|
+
| ---- | ---- | ----------- | ----- |
|
435
|
+
| **game_id** | **String** | | |
|
436
|
+
| **move** | **String** | The move to play, in USI format | |
|
437
|
+
|
438
|
+
### Return type
|
439
|
+
|
440
|
+
[**Ok**](Ok.md)
|
441
|
+
|
442
|
+
### Authorization
|
443
|
+
|
444
|
+
[OAuth2](../README.md#OAuth2)
|
445
|
+
|
446
|
+
### HTTP request headers
|
447
|
+
|
448
|
+
- **Content-Type**: Not defined
|
449
|
+
- **Accept**: application/json
|
450
|
+
|
451
|
+
|
452
|
+
## board_game_resign
|
453
|
+
|
454
|
+
> <Ok> board_game_resign(game_id)
|
455
|
+
|
456
|
+
Resign a game
|
457
|
+
|
458
|
+
Resign a game being played with the Board API.
|
459
|
+
|
460
|
+
### Examples
|
461
|
+
|
462
|
+
```ruby
|
463
|
+
require 'time'
|
464
|
+
require 'lishogi'
|
465
|
+
# setup authorization
|
466
|
+
Lishogi.configure do |config|
|
467
|
+
# Configure OAuth2 access token for authorization: OAuth2
|
468
|
+
config.access_token = 'YOUR ACCESS TOKEN'
|
469
|
+
end
|
470
|
+
|
471
|
+
api_instance = Lishogi::BoardApi.new
|
472
|
+
game_id = '5IrD6Gzz' # String |
|
473
|
+
|
474
|
+
begin
|
475
|
+
# Resign a game
|
476
|
+
result = api_instance.board_game_resign(game_id)
|
477
|
+
p result
|
478
|
+
rescue Lishogi::ApiError => e
|
479
|
+
puts "Error when calling BoardApi->board_game_resign: #{e}"
|
480
|
+
end
|
481
|
+
```
|
482
|
+
|
483
|
+
#### Using the board_game_resign_with_http_info variant
|
484
|
+
|
485
|
+
This returns an Array which contains the response data, status code and headers.
|
486
|
+
|
487
|
+
> <Array(<Ok>, Integer, Hash)> board_game_resign_with_http_info(game_id)
|
488
|
+
|
489
|
+
```ruby
|
490
|
+
begin
|
491
|
+
# Resign a game
|
492
|
+
data, status_code, headers = api_instance.board_game_resign_with_http_info(game_id)
|
493
|
+
p status_code # => 2xx
|
494
|
+
p headers # => { ... }
|
495
|
+
p data # => <Ok>
|
496
|
+
rescue Lishogi::ApiError => e
|
497
|
+
puts "Error when calling BoardApi->board_game_resign_with_http_info: #{e}"
|
498
|
+
end
|
499
|
+
```
|
500
|
+
|
501
|
+
### Parameters
|
502
|
+
|
503
|
+
| Name | Type | Description | Notes |
|
504
|
+
| ---- | ---- | ----------- | ----- |
|
505
|
+
| **game_id** | **String** | | |
|
506
|
+
|
507
|
+
### Return type
|
508
|
+
|
509
|
+
[**Ok**](Ok.md)
|
510
|
+
|
511
|
+
### Authorization
|
512
|
+
|
513
|
+
[OAuth2](../README.md#OAuth2)
|
514
|
+
|
515
|
+
### HTTP request headers
|
516
|
+
|
517
|
+
- **Content-Type**: Not defined
|
518
|
+
- **Accept**: application/json
|
519
|
+
|
520
|
+
|
521
|
+
## board_game_stream
|
522
|
+
|
523
|
+
> <BoardGameStream200Response> board_game_stream(game_id)
|
524
|
+
|
525
|
+
Stream Board game state
|
526
|
+
|
527
|
+
Stream the state of a game being played with the Board API, as [ndjson](#section/Introduction/Streaming-with-ND-JSON). Use this endpoint to get updates about the game in real-time, with a single request. Each line is a JSON object containing a `type` field. Possible values are: - `gameFull` Full game data. All values are immutable, except for the `state` field. - `gameState` Current state of the game. Immutable values not included. Sent when a move is played, or when the game ends. - `chatLine` Chat message sent by a user in the `room` \"player\" or \"spectator\". The first line is always of type `gameFull`. The server closes the stream when the game ends, or if the game has already ended.
|
528
|
+
|
529
|
+
### Examples
|
530
|
+
|
531
|
+
```ruby
|
532
|
+
require 'time'
|
533
|
+
require 'lishogi'
|
534
|
+
# setup authorization
|
535
|
+
Lishogi.configure do |config|
|
536
|
+
# Configure OAuth2 access token for authorization: OAuth2
|
537
|
+
config.access_token = 'YOUR ACCESS TOKEN'
|
538
|
+
end
|
539
|
+
|
540
|
+
api_instance = Lishogi::BoardApi.new
|
541
|
+
game_id = '5IrD6Gzz' # String |
|
542
|
+
|
543
|
+
begin
|
544
|
+
# Stream Board game state
|
545
|
+
result = api_instance.board_game_stream(game_id)
|
546
|
+
p result
|
547
|
+
rescue Lishogi::ApiError => e
|
548
|
+
puts "Error when calling BoardApi->board_game_stream: #{e}"
|
549
|
+
end
|
550
|
+
```
|
551
|
+
|
552
|
+
#### Using the board_game_stream_with_http_info variant
|
553
|
+
|
554
|
+
This returns an Array which contains the response data, status code and headers.
|
555
|
+
|
556
|
+
> <Array(<BoardGameStream200Response>, Integer, Hash)> board_game_stream_with_http_info(game_id)
|
557
|
+
|
558
|
+
```ruby
|
559
|
+
begin
|
560
|
+
# Stream Board game state
|
561
|
+
data, status_code, headers = api_instance.board_game_stream_with_http_info(game_id)
|
562
|
+
p status_code # => 2xx
|
563
|
+
p headers # => { ... }
|
564
|
+
p data # => <BoardGameStream200Response>
|
565
|
+
rescue Lishogi::ApiError => e
|
566
|
+
puts "Error when calling BoardApi->board_game_stream_with_http_info: #{e}"
|
567
|
+
end
|
568
|
+
```
|
569
|
+
|
570
|
+
### Parameters
|
571
|
+
|
572
|
+
| Name | Type | Description | Notes |
|
573
|
+
| ---- | ---- | ----------- | ----- |
|
574
|
+
| **game_id** | **String** | | |
|
575
|
+
|
576
|
+
### Return type
|
577
|
+
|
578
|
+
[**BoardGameStream200Response**](BoardGameStream200Response.md)
|
579
|
+
|
580
|
+
### Authorization
|
581
|
+
|
582
|
+
[OAuth2](../README.md#OAuth2)
|
583
|
+
|
584
|
+
### HTTP request headers
|
585
|
+
|
586
|
+
- **Content-Type**: Not defined
|
587
|
+
- **Accept**: application/x-ndjson, application/json
|
588
|
+
|
589
|
+
|
590
|
+
## board_game_takeback
|
591
|
+
|
592
|
+
> <Ok> board_game_takeback(game_id, accept)
|
593
|
+
|
594
|
+
Handle takeback offers
|
595
|
+
|
596
|
+
Create/accept/decline takebacks. - `yes`: Propose a takeback, or accept the opponent's takeback offer. - `no`: Decline a takeback offer from the opponent.
|
597
|
+
|
598
|
+
### Examples
|
599
|
+
|
600
|
+
```ruby
|
601
|
+
require 'time'
|
602
|
+
require 'lishogi'
|
603
|
+
# setup authorization
|
604
|
+
Lishogi.configure do |config|
|
605
|
+
# Configure OAuth2 access token for authorization: OAuth2
|
606
|
+
config.access_token = 'YOUR ACCESS TOKEN'
|
607
|
+
end
|
608
|
+
|
609
|
+
api_instance = Lishogi::BoardApi.new
|
610
|
+
game_id = '5IrD6Gzz' # String |
|
611
|
+
accept = Lishogi::BoardGameTakebackAcceptParameter.new # BoardGameTakebackAcceptParameter |
|
612
|
+
|
613
|
+
begin
|
614
|
+
# Handle takeback offers
|
615
|
+
result = api_instance.board_game_takeback(game_id, accept)
|
616
|
+
p result
|
617
|
+
rescue Lishogi::ApiError => e
|
618
|
+
puts "Error when calling BoardApi->board_game_takeback: #{e}"
|
619
|
+
end
|
620
|
+
```
|
621
|
+
|
622
|
+
#### Using the board_game_takeback_with_http_info variant
|
623
|
+
|
624
|
+
This returns an Array which contains the response data, status code and headers.
|
625
|
+
|
626
|
+
> <Array(<Ok>, Integer, Hash)> board_game_takeback_with_http_info(game_id, accept)
|
627
|
+
|
628
|
+
```ruby
|
629
|
+
begin
|
630
|
+
# Handle takeback offers
|
631
|
+
data, status_code, headers = api_instance.board_game_takeback_with_http_info(game_id, accept)
|
632
|
+
p status_code # => 2xx
|
633
|
+
p headers # => { ... }
|
634
|
+
p data # => <Ok>
|
635
|
+
rescue Lishogi::ApiError => e
|
636
|
+
puts "Error when calling BoardApi->board_game_takeback_with_http_info: #{e}"
|
637
|
+
end
|
638
|
+
```
|
639
|
+
|
640
|
+
### Parameters
|
641
|
+
|
642
|
+
| Name | Type | Description | Notes |
|
643
|
+
| ---- | ---- | ----------- | ----- |
|
644
|
+
| **game_id** | **String** | | |
|
645
|
+
| **accept** | [**BoardGameTakebackAcceptParameter**](.md) | | |
|
646
|
+
|
647
|
+
### Return type
|
648
|
+
|
649
|
+
[**Ok**](Ok.md)
|
650
|
+
|
651
|
+
### Authorization
|
652
|
+
|
653
|
+
[OAuth2](../README.md#OAuth2)
|
654
|
+
|
655
|
+
### HTTP request headers
|
656
|
+
|
657
|
+
- **Content-Type**: Not defined
|
658
|
+
- **Accept**: application/json
|
659
|
+
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# Lishogi::BoardGameStream200Response
|
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::BoardGameStream200Response.openapi_one_of
|
15
|
+
# =>
|
16
|
+
# [
|
17
|
+
# :'ChatLineEvent',
|
18
|
+
# :'GameFullEvent',
|
19
|
+
# :'GameStateEvent'
|
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::BoardGameStream200Response.build(data)
|
33
|
+
# => #<ChatLineEvent:0x00007fdd4aab02a0>
|
34
|
+
|
35
|
+
Lishogi::BoardGameStream200Response.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
|
+
- `ChatLineEvent`
|
48
|
+
- `GameFullEvent`
|
49
|
+
- `GameStateEvent`
|
50
|
+
- `nil` (if no type matches)
|
51
|
+
|