Class: Lishogi::ArenaTournamentsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/lishogi/api/arena_tournaments_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ArenaTournamentsApi

Returns a new instance of ArenaTournamentsApi.



19
20
21
# File 'lib/lishogi/api/arena_tournaments_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/lishogi/api/arena_tournaments_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#api_team_arena(team_id, opts = {}) ⇒ Array<Object>

Get team Arena tournaments Get all Arena tournaments relevant to a team. Tournaments are sorted by reverse chronological order of start date (last starting first). Tournaments are streamed as [ndjson](#section/Introduction/Streaming-with-ND-JSON).

Parameters:

  • team_id (String)

    ID of the team

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :max (Integer)

    How many tournaments to download. (default to 100)

Returns:

  • (Array<Object>)


28
29
30
31
# File 'lib/lishogi/api/arena_tournaments_api.rb', line 28

def api_team_arena(team_id, opts = {})
  data, _status_code, _headers = api_team_arena_with_http_info(team_id, opts)
  data
end

#api_team_arena_with_http_info(team_id, opts = {}) ⇒ Array<(Array<Object>, Integer, Hash)>

Get team Arena tournaments Get all Arena tournaments relevant to a team. Tournaments are sorted by reverse chronological order of start date (last starting first). Tournaments are streamed as [ndjson](#section/Introduction/Streaming-with-ND-JSON).

Parameters:

  • team_id (String)

    ID of the team

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :max (Integer)

    How many tournaments to download. (default to 100)

Returns:

  • (Array<(Array<Object>, Integer, Hash)>)

    Array<Object> data, response status code and response headers



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/lishogi/api/arena_tournaments_api.rb', line 39

def api_team_arena_with_http_info(team_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ArenaTournamentsApi.api_team_arena ...'
  end
  # verify the required parameter 'team_id' is set
  if @api_client.config.client_side_validation && team_id.nil?
    fail ArgumentError, "Missing the required parameter 'team_id' when calling ArenaTournamentsApi.api_team_arena"
  end
  if @api_client.config.client_side_validation && !opts[:'max'].nil? && opts[:'max'] < 1
    fail ArgumentError, 'invalid value for "opts[:"max"]" when calling ArenaTournamentsApi.api_team_arena, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/api/team/{teamId}/arena'.sub('{' + 'teamId' + '}', CGI.escape(team_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'max'] = opts[:'max'] if !opts[:'max'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Array<Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"ArenaTournamentsApi.api_team_arena",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ArenaTournamentsApi#api_team_arena\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#api_tournament(opts = {}) ⇒ ArenaTournaments

Get current tournaments Get recently finished, ongoing, and upcoming tournaments. This API is used to display the [Lishogi tournament schedule](lishogi.org/tournament).

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



96
97
98
99
# File 'lib/lishogi/api/arena_tournaments_api.rb', line 96

def api_tournament(opts = {})
  data, _status_code, _headers = api_tournament_with_http_info(opts)
  data
end

#api_tournament_post(clock_time, clock_increment, clock_byoyomi, periods, minutes, opts = {}) ⇒ Object

Create a new Arena tournament Create a public or private Arena tournament. This endpoint mirrors the form on <lishogi.org/tournament/new>. You can create up to 12 public tournaments per day, or 24 private tournaments. A team battle can be created by specifying the ‘teambBattleByTeam` argument.

Parameters:

  • clock_time (Float)

    Clock initial time in minutes

  • clock_increment (Integer)

    Clock increment in seconds

  • clock_byoyomi (Integer)

    Clock byoyomi in seconds

  • periods (Integer)

    Clock periods for byoyomi

  • minutes (Integer)

    How long the tournament lasts, in minutes

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :name (String)

    The tournament name. Leave empty to get a random Grandmaster name

  • :wait_minutes (Integer)

    How long to wait before starting the tournament, from now, in minutes (default to 5)

  • :start_date (Integer)

    Timestamp to start the tournament at a given date and time. Overrides the &#x60;waitMinutes&#x60; setting

  • :variant (VariantKey) — default: default to 'standard'
  • :rated (Boolean)

    Games are rated and impact players ratings (default to true)

  • :position (String)

    Custom initial position (in SFEN) for all games of the tournament. Must be a legal shogi position. Only works with standard shogi, not variants.

  • :berserkable (Boolean)

    Whether the players can use berserk (default to true)

  • :streakable (Boolean)

    After 2 wins, consecutive wins grant 4 points instead of 2. (default to true)

  • :has_chat (Boolean)

    Whether the players can discuss in a chat (default to true)

  • :description (String)

    Anything you want to tell players about the tournament

  • :password (String)

    Make the tournament private, and restrict access with a password. You can also [generate user-specific entry codes](github.com/lishogi-org/api/tree/master/example/tournament-entry-code) based on this password.

  • :team_battle_by_team (String)

    Set the ID of a team you lead to create a team battle. The other teams can be added using the [team battle edit endpoint](#operation/apiTournamentTeamBattlePost).

  • :conditions_team_member_team_id (String)

    Restrict entry to members of a team. The teamId is the last part of a team URL, e.g. &#x60;lishogi.org/team/shogi-is-hard&#x60; has teamId &#x3D; &#x60;shogi-is-hard&#x60;. Leave empty to let everyone join the tournament. Do not use this to create team battles, use &#x60;teamBattleByTeam&#x60; instead.

  • :conditions_min_rating_rating (Integer)

    Minimum rating to join. Leave empty to let everyone join the tournament.

  • :conditions_max_rating_rating (Integer)

    Maximum rating to join. Based on best rating reached in the last 7 days. Leave empty to let everyone join the tournament.

  • :conditions_nb_rated_game_nb (Integer)

    Minimum number of rated games required to join.

Returns:

  • (Object)


174
175
176
177
# File 'lib/lishogi/api/arena_tournaments_api.rb', line 174

def api_tournament_post(clock_time, clock_increment, clock_byoyomi, periods, minutes, opts = {})
  data, _status_code, _headers = api_tournament_post_with_http_info(clock_time, clock_increment, clock_byoyomi, periods, minutes, opts)
  data
end

#api_tournament_post_with_http_info(clock_time, clock_increment, clock_byoyomi, periods, minutes, opts = {}) ⇒ Array<(Object, Integer, Hash)>

Create a new Arena tournament Create a public or private Arena tournament. This endpoint mirrors the form on &lt;lishogi.org/tournament/new&gt;. You can create up to 12 public tournaments per day, or 24 private tournaments. A team battle can be created by specifying the &#x60;teambBattleByTeam&#x60; argument.

Parameters:

  • clock_time (Float)

    Clock initial time in minutes

  • clock_increment (Integer)

    Clock increment in seconds

  • clock_byoyomi (Integer)

    Clock byoyomi in seconds

  • periods (Integer)

    Clock periods for byoyomi

  • minutes (Integer)

    How long the tournament lasts, in minutes

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :name (String)

    The tournament name. Leave empty to get a random Grandmaster name

  • :wait_minutes (Integer)

    How long to wait before starting the tournament, from now, in minutes (default to 5)

  • :start_date (Integer)

    Timestamp to start the tournament at a given date and time. Overrides the &#x60;waitMinutes&#x60; setting

  • :variant (VariantKey) — default: default to 'standard'
  • :rated (Boolean)

    Games are rated and impact players ratings (default to true)

  • :position (String)

    Custom initial position (in SFEN) for all games of the tournament. Must be a legal shogi position. Only works with standard shogi, not variants.

  • :berserkable (Boolean)

    Whether the players can use berserk (default to true)

  • :streakable (Boolean)

    After 2 wins, consecutive wins grant 4 points instead of 2. (default to true)

  • :has_chat (Boolean)

    Whether the players can discuss in a chat (default to true)

  • :description (String)

    Anything you want to tell players about the tournament

  • :password (String)

    Make the tournament private, and restrict access with a password. You can also [generate user-specific entry codes](github.com/lishogi-org/api/tree/master/example/tournament-entry-code) based on this password.

  • :team_battle_by_team (String)

    Set the ID of a team you lead to create a team battle. The other teams can be added using the [team battle edit endpoint](#operation/apiTournamentTeamBattlePost).

  • :conditions_team_member_team_id (String)

    Restrict entry to members of a team. The teamId is the last part of a team URL, e.g. &#x60;lishogi.org/team/shogi-is-hard&#x60; has teamId &#x3D; &#x60;shogi-is-hard&#x60;. Leave empty to let everyone join the tournament. Do not use this to create team battles, use &#x60;teamBattleByTeam&#x60; instead.

  • :conditions_min_rating_rating (Integer)

    Minimum rating to join. Leave empty to let everyone join the tournament.

  • :conditions_max_rating_rating (Integer)

    Maximum rating to join. Based on best rating reached in the last 7 days. Leave empty to let everyone join the tournament.

  • :conditions_nb_rated_game_nb (Integer)

    Minimum number of rated games required to join.

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
# File 'lib/lishogi/api/arena_tournaments_api.rb', line 204

def api_tournament_post_with_http_info(clock_time, clock_increment, clock_byoyomi, periods, minutes, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ArenaTournamentsApi.api_tournament_post ...'
  end
  # verify the required parameter 'clock_time' is set
  if @api_client.config.client_side_validation && clock_time.nil?
    fail ArgumentError, "Missing the required parameter 'clock_time' when calling ArenaTournamentsApi.api_tournament_post"
  end
  # verify enum value
  allowable_values = [0, 0.25, 0.5, 0.75, 1, 1.5, 2, 3, 4, 5, 6, 7, 10, 15, 20, 25, 30, 40, 50, 60]
  if @api_client.config.client_side_validation && !allowable_values.include?(clock_time)
    fail ArgumentError, "invalid value for \"clock_time\", must be one of #{allowable_values}"
  end
  # verify the required parameter 'clock_increment' is set
  if @api_client.config.client_side_validation && clock_increment.nil?
    fail ArgumentError, "Missing the required parameter 'clock_increment' when calling ArenaTournamentsApi.api_tournament_post"
  end
  # verify enum value
  allowable_values = [0, 1, 2, 3, 4, 5, 6, 7, 10, 15, 20, 25, 30, 40, 50, 60]
  if @api_client.config.client_side_validation && !allowable_values.include?(clock_increment)
    fail ArgumentError, "invalid value for \"clock_increment\", must be one of #{allowable_values}"
  end
  # verify the required parameter 'clock_byoyomi' is set
  if @api_client.config.client_side_validation && clock_byoyomi.nil?
    fail ArgumentError, "Missing the required parameter 'clock_byoyomi' when calling ArenaTournamentsApi.api_tournament_post"
  end
  # verify enum value
  allowable_values = [0, 1, 2, 3, 4, 5, 6, 7, 10, 15, 20, 25, 30, 40, 50, 60]
  if @api_client.config.client_side_validation && !allowable_values.include?(clock_byoyomi)
    fail ArgumentError, "invalid value for \"clock_byoyomi\", must be one of #{allowable_values}"
  end
  # verify the required parameter 'periods' is set
  if @api_client.config.client_side_validation && periods.nil?
    fail ArgumentError, "Missing the required parameter 'periods' when calling ArenaTournamentsApi.api_tournament_post"
  end
  # verify enum value
  allowable_values = [0, 1, 2, 3, 4, 5]
  if @api_client.config.client_side_validation && !allowable_values.include?(periods)
    fail ArgumentError, "invalid value for \"periods\", must be one of #{allowable_values}"
  end
  # verify the required parameter 'minutes' is set
  if @api_client.config.client_side_validation && minutes.nil?
    fail ArgumentError, "Missing the required parameter 'minutes' when calling ArenaTournamentsApi.api_tournament_post"
  end
  # verify enum value
  allowable_values = [20, 25, 30, 35, 40, 45, 50, 55, 60, 70, 80, 90, 100, 110, 120, 150, 180, 210, 240, 270, 300, 330, 360, 420, 480, 540, 600, 720]
  if @api_client.config.client_side_validation && !allowable_values.include?(minutes)
    fail ArgumentError, "invalid value for \"minutes\", must be one of #{allowable_values}"
  end
  allowable_values = [1, 2, 3, 5, 10, 15, 20, 30, 45, 60]
  if @api_client.config.client_side_validation && opts[:'wait_minutes'] && !allowable_values.include?(opts[:'wait_minutes'])
    fail ArgumentError, "invalid value for \"wait_minutes\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/tournament'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}
  form_params['clockTime'] = clock_time
  form_params['clockIncrement'] = clock_increment
  form_params['clockByoyomi'] = clock_byoyomi
  form_params['periods'] = periods
  form_params['minutes'] = minutes
  form_params['name'] = opts[:'name'] if !opts[:'name'].nil?
  form_params['waitMinutes'] = opts[:'wait_minutes'] if !opts[:'wait_minutes'].nil?
  form_params['startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil?
  form_params['variant'] = opts[:'variant'] if !opts[:'variant'].nil?
  form_params['rated'] = opts[:'rated'] if !opts[:'rated'].nil?
  form_params['position'] = opts[:'position'] if !opts[:'position'].nil?
  form_params['berserkable'] = opts[:'berserkable'] if !opts[:'berserkable'].nil?
  form_params['streakable'] = opts[:'streakable'] if !opts[:'streakable'].nil?
  form_params['hasChat'] = opts[:'has_chat'] if !opts[:'has_chat'].nil?
  form_params['description'] = opts[:'description'] if !opts[:'description'].nil?
  form_params['password'] = opts[:'password'] if !opts[:'password'].nil?
  form_params['teamBattleByTeam'] = opts[:'team_battle_by_team'] if !opts[:'team_battle_by_team'].nil?
  form_params['conditions.teamMember.teamId'] = opts[:'conditions_team_member_team_id'] if !opts[:'conditions_team_member_team_id'].nil?
  form_params['conditions.minRating.rating'] = opts[:'conditions_min_rating_rating'] if !opts[:'conditions_min_rating_rating'].nil?
  form_params['conditions.maxRating.rating'] = opts[:'conditions_max_rating_rating'] if !opts[:'conditions_max_rating_rating'].nil?
  form_params['conditions.nbRatedGame.nb'] = opts[:'conditions_nb_rated_game_nb'] if !opts[:'conditions_nb_rated_game_nb'].nil?

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Object'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['OAuth2']

  new_options = opts.merge(
    :operation => :"ArenaTournamentsApi.api_tournament_post",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ArenaTournamentsApi#api_tournament_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#api_tournament_with_http_info(opts = {}) ⇒ Array<(ArenaTournaments, Integer, Hash)>

Get current tournaments Get recently finished, ongoing, and upcoming tournaments. This API is used to display the [Lishogi tournament schedule](lishogi.org/tournament).

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(ArenaTournaments, Integer, Hash)>)

    ArenaTournaments data, response status code and response headers



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/lishogi/api/arena_tournaments_api.rb', line 105

def api_tournament_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ArenaTournamentsApi.api_tournament ...'
  end
  # resource path
  local_var_path = '/api/tournament'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ArenaTournaments'

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"ArenaTournamentsApi.api_tournament",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ArenaTournamentsApi#api_tournament\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#api_user_name_tournament_created(username, opts = {}) ⇒ Object

Get tournaments created by a user Get all tournaments created by a given user. Tournaments are sorted by reverse chronological order of start date (last starting first). Tournaments are streamed as [ndjson](#section/Introduction/Streaming-with-ND-JSON).

Parameters:

  • username (String)

    The user whose created tournaments to fetch

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :status (Integer)

    Include tournaments in the given status: &quot;Created&quot; (10), &quot;Started&quot; (20), &quot;Finished&quot; (30) You can add this parameter more than once to include tournaments in different statuses. Example: &#x60;?status&#x3D;10&amp;status&#x3D;20&#x60;

Returns:

  • (Object)


329
330
331
332
# File 'lib/lishogi/api/arena_tournaments_api.rb', line 329

def api_user_name_tournament_created(username, opts = {})
  data, _status_code, _headers = api_user_name_tournament_created_with_http_info(username, opts)
  data
end

#api_user_name_tournament_created_with_http_info(username, opts = {}) ⇒ Array<(Object, Integer, Hash)>

Get tournaments created by a user Get all tournaments created by a given user. Tournaments are sorted by reverse chronological order of start date (last starting first). Tournaments are streamed as [ndjson](#section/Introduction/Streaming-with-ND-JSON).

Parameters:

  • username (String)

    The user whose created tournaments to fetch

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :status (Integer)

    Include tournaments in the given status: &quot;Created&quot; (10), &quot;Started&quot; (20), &quot;Finished&quot; (30) You can add this parameter more than once to include tournaments in different statuses. Example: &#x60;?status&#x3D;10&amp;status&#x3D;20&#x60;

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
# File 'lib/lishogi/api/arena_tournaments_api.rb', line 340

def api_user_name_tournament_created_with_http_info(username, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ArenaTournamentsApi.api_user_name_tournament_created ...'
  end
  # verify the required parameter 'username' is set
  if @api_client.config.client_side_validation && username.nil?
    fail ArgumentError, "Missing the required parameter 'username' when calling ArenaTournamentsApi.api_user_name_tournament_created"
  end
  allowable_values = [10, 20, 30]
  if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
    fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/user/{username}/tournament/created'.sub('{' + 'username' + '}', CGI.escape(username.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/x-ndjson']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Object'

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"ArenaTournamentsApi.api_user_name_tournament_created",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ArenaTournamentsApi#api_user_name_tournament_created\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#games_by_tournament(id, opts = {}) ⇒ Object

Export games of an Arena tournament Download games of a tournament in KIF or [ndjson](#section/Introduction/Streaming-with-ND-JSON) format. Games are sorted by reverse chronological order (most recent first). The game stream is throttled, depending on who is making the request: - Anonymous request: 20 games per second - [OAuth2 authenticated](#section/Authentication) request: 30 games per second

Parameters:

  • id (String)

    The tournament ID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :player (String)

    Only games of a particular player. Leave empty to fetch games of all players.

  • :moves (Boolean)

    Include the KIF moves. (default to true)

  • :pgn_in_json (Boolean)

    Include the full KIF within the JSON response, in a &#x60;notation&#x60; field. (default to false)

  • :tags (Boolean)

    Include the KIF tags. (default to true)

  • :clocks (Boolean)

    Include clock comments in the KIF moves, when available. Example: &#x60;22 同 玉(51) (00:02/00:00:13)&#x60; (default to false)

  • :evals (Boolean)

    Include analysis evaluation comments in the KIF, when available. Example: &#x60;9 7八銀(79) * [%eval -1.48]&#x60; (default to false)

Returns:

  • (Object)


404
405
406
407
# File 'lib/lishogi/api/arena_tournaments_api.rb', line 404

def games_by_tournament(id, opts = {})
  data, _status_code, _headers = games_by_tournament_with_http_info(id, opts)
  data
end

#games_by_tournament_with_http_info(id, opts = {}) ⇒ Array<(Object, Integer, Hash)>

Export games of an Arena tournament Download games of a tournament in KIF or [ndjson](#section/Introduction/Streaming-with-ND-JSON) format. Games are sorted by reverse chronological order (most recent first). The game stream is throttled, depending on who is making the request: - Anonymous request: 20 games per second - [OAuth2 authenticated](#section/Authentication) request: 30 games per second

Parameters:

  • id (String)

    The tournament ID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :player (String)

    Only games of a particular player. Leave empty to fetch games of all players.

  • :moves (Boolean)

    Include the KIF moves. (default to true)

  • :pgn_in_json (Boolean)

    Include the full KIF within the JSON response, in a &#x60;notation&#x60; field. (default to false)

  • :tags (Boolean)

    Include the KIF tags. (default to true)

  • :clocks (Boolean)

    Include clock comments in the KIF moves, when available. Example: &#x60;22 同 玉(51) (00:02/00:00:13)&#x60; (default to false)

  • :evals (Boolean)

    Include analysis evaluation comments in the KIF, when available. Example: &#x60;9 7八銀(79) * [%eval -1.48]&#x60; (default to false)

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
# File 'lib/lishogi/api/arena_tournaments_api.rb', line 420

def games_by_tournament_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ArenaTournamentsApi.games_by_tournament ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ArenaTournamentsApi.games_by_tournament"
  end
  # resource path
  local_var_path = '/api/tournament/{id}/games'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'player'] = opts[:'player'] if !opts[:'player'].nil?
  query_params[:'moves'] = opts[:'moves'] if !opts[:'moves'].nil?
  query_params[:'pgnInJson'] = opts[:'pgn_in_json'] if !opts[:'pgn_in_json'].nil?
  query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?
  query_params[:'clocks'] = opts[:'clocks'] if !opts[:'clocks'].nil?
  query_params[:'evals'] = opts[:'evals'] if !opts[:'evals'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['text/plain', 'application/x-ndjson']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Object'

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"ArenaTournamentsApi.games_by_tournament",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ArenaTournamentsApi#games_by_tournament\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#results_by_tournament(id, opts = {}) ⇒ Object

Get results of an Arena tournament Players of an Arena tournament, with their score and performance, sorted by rank (best first). **Players are streamed as [ndjson](#section/Introduction/Streaming-with-ND-JSON)**, i.e. one JSON object per line. If called on an ongoing tournament, results can be inconsistent due to ranking changes while the players are being streamed. Use on finished tournaments for guaranteed consistency.

Parameters:

  • id (String)

    The tournament ID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :nb (Integer)

    Max number of players to fetch

Returns:

  • (Object)


480
481
482
483
# File 'lib/lishogi/api/arena_tournaments_api.rb', line 480

def results_by_tournament(id, opts = {})
  data, _status_code, _headers = results_by_tournament_with_http_info(id, opts)
  data
end

#results_by_tournament_with_http_info(id, opts = {}) ⇒ Array<(Object, Integer, Hash)>

Get results of an Arena tournament Players of an Arena tournament, with their score and performance, sorted by rank (best first). **Players are streamed as [ndjson](#section/Introduction/Streaming-with-ND-JSON)**, i.e. one JSON object per line. If called on an ongoing tournament, results can be inconsistent due to ranking changes while the players are being streamed. Use on finished tournaments for guaranteed consistency.

Parameters:

  • id (String)

    The tournament ID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :nb (Integer)

    Max number of players to fetch

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
# File 'lib/lishogi/api/arena_tournaments_api.rb', line 491

def results_by_tournament_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ArenaTournamentsApi.results_by_tournament ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ArenaTournamentsApi.results_by_tournament"
  end
  if @api_client.config.client_side_validation && !opts[:'nb'].nil? && opts[:'nb'] < 1
    fail ArgumentError, 'invalid value for "opts[:"nb"]" when calling ArenaTournamentsApi.results_by_tournament, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/api/tournament/{id}/results'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'nb'] = opts[:'nb'] if !opts[:'nb'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/x-ndjson']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Object'

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"ArenaTournamentsApi.results_by_tournament",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ArenaTournamentsApi#results_by_tournament\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#teams_by_tournament(id, opts = {}) ⇒ Object

Get team standing of a team battle Teams of a team battle tournament, with top players, sorted by rank (best first).

Parameters:

  • id (String)

    The tournament ID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Object)


549
550
551
552
# File 'lib/lishogi/api/arena_tournaments_api.rb', line 549

def teams_by_tournament(id, opts = {})
  data, _status_code, _headers = teams_by_tournament_with_http_info(id, opts)
  data
end

#teams_by_tournament_with_http_info(id, opts = {}) ⇒ Array<(Object, Integer, Hash)>

Get team standing of a team battle Teams of a team battle tournament, with top players, sorted by rank (best first).

Parameters:

  • id (String)

    The tournament ID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
# File 'lib/lishogi/api/arena_tournaments_api.rb', line 559

def teams_by_tournament_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ArenaTournamentsApi.teams_by_tournament ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ArenaTournamentsApi.teams_by_tournament"
  end
  # resource path
  local_var_path = '/api/tournament/{id}/teams'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Object'

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"ArenaTournamentsApi.teams_by_tournament",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ArenaTournamentsApi#teams_by_tournament\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#tournament(id, opts = {}) ⇒ Object

Get info about an Arena tournament Get detailed info about recently finished, current, or upcoming tournament’s duels, player standings, and other info.

Parameters:

  • id (String)

    The tournament ID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :page (Float)

    Specify which page of player standings to view. (default to 1)

Returns:

  • (Object)


613
614
615
616
# File 'lib/lishogi/api/arena_tournaments_api.rb', line 613

def tournament(id, opts = {})
  data, _status_code, _headers = tournament_with_http_info(id, opts)
  data
end

#tournament_with_http_info(id, opts = {}) ⇒ Array<(Object, Integer, Hash)>

Get info about an Arena tournament Get detailed info about recently finished, current, or upcoming tournament&#39;s duels, player standings, and other info.

Parameters:

  • id (String)

    The tournament ID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :page (Float)

    Specify which page of player standings to view. (default to 1)

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
# File 'lib/lishogi/api/arena_tournaments_api.rb', line 624

def tournament_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ArenaTournamentsApi.tournament ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ArenaTournamentsApi.tournament"
  end
  if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] > 200
    fail ArgumentError, 'invalid value for "opts[:"page"]" when calling ArenaTournamentsApi.tournament, must be smaller than or equal to 200.'
  end

  if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
    fail ArgumentError, 'invalid value for "opts[:"page"]" when calling ArenaTournamentsApi.tournament, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/api/tournament/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Object'

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"ArenaTournamentsApi.tournament",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ArenaTournamentsApi#tournament\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end