Class: Lishogi::UsersApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ UsersApi

Returns a new instance of UsersApi.



19
20
21
# File 'lib/lishogi/api/users_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/users_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#api_crosstable(user1, user2, opts = {}) ⇒ Object

Get crosstable Get total number of games, and current score, of any two users. If the ‘matchup` flag is provided, and the users are currently playing, also gets the current match game number and scores.

Parameters:

  • user1 (String)
  • user2 (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :matchup (Boolean)

    Whether to get the current match data, if any

Returns:

  • (Object)


29
30
31
32
# File 'lib/lishogi/api/users_api.rb', line 29

def api_crosstable(user1, user2, opts = {})
  data, _status_code, _headers = api_crosstable_with_http_info(user1, user2, opts)
  data
end

#api_crosstable_with_http_info(user1, user2, opts = {}) ⇒ Array<(Object, Integer, Hash)>

Get crosstable Get total number of games, and current score, of any two users. If the &#x60;matchup&#x60; flag is provided, and the users are currently playing, also gets the current match game number and scores.

Parameters:

  • user1 (String)
  • user2 (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :matchup (Boolean)

    Whether to get the current match data, if any

Returns:

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

    Object data, response status code and response headers



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
91
92
# File 'lib/lishogi/api/users_api.rb', line 41

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

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'matchup'] = opts[:'matchup'] if !opts[:'matchup'].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 => :"UsersApi.api_crosstable",
    :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: UsersApi#api_crosstable\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#api_user(username, opts = {}) ⇒ UserExtended

Get user public data Read public data of a user.

Parameters:

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

    the optional parameters

Returns:



99
100
101
102
# File 'lib/lishogi/api/users_api.rb', line 99

def api_user(username, opts = {})
  data, _status_code, _headers = api_user_with_http_info(username, opts)
  data
end

#api_user_activity(username, opts = {}) ⇒ nil

Get user activity Read data to generate the activity feed of a user.

Parameters:

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

    the optional parameters

Returns:

  • (nil)


162
163
164
165
# File 'lib/lishogi/api/users_api.rb', line 162

def api_user_activity(username, opts = {})
  api_user_activity_with_http_info(username, opts)
  nil
end

#api_user_activity_with_http_info(username, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Get user activity Read data to generate the activity feed of a user.

Parameters:

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# File 'lib/lishogi/api/users_api.rb', line 172

def api_user_activity_with_http_info(username, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UsersApi.api_user_activity ...'
  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 UsersApi.api_user_activity"
  end
  # resource path
  local_var_path = '/api/user/{username}/activity'.sub('{' + 'username' + '}', CGI.escape(username.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]

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

  new_options = opts.merge(
    :operation => :"UsersApi.api_user_activity",
    :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: UsersApi#api_user_activity\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Get rating history of a user Read rating history of a user, for all perf types. There is at most one entry per day. Format of an entry is ‘[year, month, day, rating]`. `month` starts at zero (January).

Parameters:

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

    the optional parameters

Returns:

  • (Object)


225
226
227
228
# File 'lib/lishogi/api/users_api.rb', line 225

def api_user_rating_history(username, opts = {})
  data, _status_code, _headers = api_user_rating_history_with_http_info(username, opts)
  data
end

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

Get rating history of a user Read rating history of a user, for all perf types. There is at most one entry per day. Format of an entry is &#x60;[year, month, day, rating]&#x60;. &#x60;month&#x60; starts at zero (January).

Parameters:

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

    the optional parameters

Returns:

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

    Object data, response status code and response headers



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
# File 'lib/lishogi/api/users_api.rb', line 235

def api_user_rating_history_with_http_info(username, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UsersApi.api_user_rating_history ...'
  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 UsersApi.api_user_rating_history"
  end
  # resource path
  local_var_path = '/api/user/{username}/rating-history'.sub('{' + 'username' + '}', CGI.escape(username.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 => :"UsersApi.api_user_rating_history",
    :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: UsersApi#api_user_rating_history\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#api_user_with_http_info(username, opts = {}) ⇒ Array<(UserExtended, Integer, Hash)>

Get user public data Read public data of a user.

Parameters:

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

    the optional parameters

Returns:

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

    UserExtended data, response status code and response headers



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
148
149
150
151
152
153
154
155
# File 'lib/lishogi/api/users_api.rb', line 109

def api_user_with_http_info(username, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UsersApi.api_user ...'
  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 UsersApi.api_user"
  end
  # resource path
  local_var_path = '/api/user/{username}'.sub('{' + 'username' + '}', CGI.escape(username.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] || 'UserExtended'

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

  new_options = opts.merge(
    :operation => :"UsersApi.api_user",
    :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: UsersApi#api_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#api_users(body, opts = {}) ⇒ Array<User>

Get users by ID Get up to 300 users by their IDs. Users are returned in the same order as the IDs. The method is ‘POST` so a longer list of IDs can be sent in the request body.

Parameters:

  • body (String)

    User IDs separated by commas.

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

    the optional parameters

Returns:



288
289
290
291
# File 'lib/lishogi/api/users_api.rb', line 288

def api_users(body, opts = {})
  data, _status_code, _headers = api_users_with_http_info(body, opts)
  data
end

#api_users_status(ids, opts = {}) ⇒ Array<ApiUsersStatus200ResponseInner>

Get real-time users status Read the ‘online`, `playing` and `streaming` flags of several users. This API is very fast and cheap on lishogi side. So you can call it quite often (like once every 5 seconds). Use it to track players and know when they’re connected on lishogi and playing games.

Parameters:

  • ids (String)

    User IDs separated by commas. Up to 100 IDs.

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

    the optional parameters

Options Hash (opts):

  • :with_game_ids (Boolean)

    Also return the ID of the game being played, if any, for each player, in a &#x60;playingId&#x60; field. Defaults to &#x60;false&#x60; to preserve server resources.

Returns:



357
358
359
360
# File 'lib/lishogi/api/users_api.rb', line 357

def api_users_status(ids, opts = {})
  data, _status_code, _headers = api_users_status_with_http_info(ids, opts)
  data
end

#api_users_status_with_http_info(ids, opts = {}) ⇒ Array<(Array<ApiUsersStatus200ResponseInner>, Integer, Hash)>

Get real-time users status Read the &#x60;online&#x60;, &#x60;playing&#x60; and &#x60;streaming&#x60; flags of several users. This API is very fast and cheap on lishogi side. So you can call it quite often (like once every 5 seconds). Use it to track players and know when they&#39;re connected on lishogi and playing games.

Parameters:

  • ids (String)

    User IDs separated by commas. Up to 100 IDs.

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

    the optional parameters

Options Hash (opts):

  • :with_game_ids (Boolean)

    Also return the ID of the game being played, if any, for each player, in a &#x60;playingId&#x60; field. Defaults to &#x60;false&#x60; to preserve server resources.

Returns:

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

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



368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
# File 'lib/lishogi/api/users_api.rb', line 368

def api_users_status_with_http_info(ids, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UsersApi.api_users_status ...'
  end
  # verify the required parameter 'ids' is set
  if @api_client.config.client_side_validation && ids.nil?
    fail ArgumentError, "Missing the required parameter 'ids' when calling UsersApi.api_users_status"
  end
  # resource path
  local_var_path = '/api/users/status'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'ids'] = ids
  query_params[:'withGameIds'] = opts[:'with_game_ids'] if !opts[:'with_game_ids'].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<ApiUsersStatus200ResponseInner>'

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

  new_options = opts.merge(
    :operation => :"UsersApi.api_users_status",
    :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: UsersApi#api_users_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#api_users_with_http_info(body, opts = {}) ⇒ Array<(Array<User>, Integer, Hash)>

Get users by ID Get up to 300 users by their IDs. Users are returned in the same order as the IDs. The method is &#x60;POST&#x60; so a longer list of IDs can be sent in the request body.

Parameters:

  • body (String)

    User IDs separated by commas.

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

    the optional parameters

Returns:

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

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



298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
# File 'lib/lishogi/api/users_api.rb', line 298

def api_users_with_http_info(body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UsersApi.api_users ...'
  end
  # verify the required parameter 'body' is set
  if @api_client.config.client_side_validation && body.nil?
    fail ArgumentError, "Missing the required parameter 'body' when calling UsersApi.api_users"
  end
  # resource path
  local_var_path = '/api/users'

  # 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(['text/plain'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

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

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(body)

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

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

  new_options = opts.merge(
    :operation => :"UsersApi.api_users",
    :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: UsersApi#api_users\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#player(opts = {}) ⇒ Object

Get all top 10 Get the top 10 players for each speed and variant. See <lishogi.org/player>.

Parameters:

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

    the optional parameters

Returns:

  • (Object)


422
423
424
425
# File 'lib/lishogi/api/users_api.rb', line 422

def player(opts = {})
  data, _status_code, _headers = player_with_http_info(opts)
  data
end

#player_top_nb_perf_type(nb, perf_type, opts = {}) ⇒ Object

Get one leaderboard Get the leaderboard for a single speed or variant (a.k.a. ‘perfType`). There is no leaderboard for correspondence or puzzles. See <lishogi.org/player/top/200/bullet>.

Parameters:

  • nb (Integer)

    How many users to fetch

  • perf_type (String)

    The speed or variant

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

    the optional parameters

Returns:

  • (Object)


481
482
483
484
# File 'lib/lishogi/api/users_api.rb', line 481

def player_top_nb_perf_type(nb, perf_type, opts = {})
  data, _status_code, _headers = player_top_nb_perf_type_with_http_info(nb, perf_type, opts)
  data
end

#player_top_nb_perf_type_with_http_info(nb, perf_type, opts = {}) ⇒ Array<(Object, Integer, Hash)>

Get one leaderboard Get the leaderboard for a single speed or variant (a.k.a. &#x60;perfType&#x60;). There is no leaderboard for correspondence or puzzles. See &lt;lishogi.org/player/top/200/bullet&gt;.

Parameters:

  • nb (Integer)

    How many users to fetch

  • perf_type (String)

    The speed or variant

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

    the optional parameters

Returns:

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

    Object data, response status code and response headers



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
543
544
545
546
547
548
549
550
551
552
553
554
555
# File 'lib/lishogi/api/users_api.rb', line 492

def player_top_nb_perf_type_with_http_info(nb, perf_type, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UsersApi.player_top_nb_perf_type ...'
  end
  # verify the required parameter 'nb' is set
  if @api_client.config.client_side_validation && nb.nil?
    fail ArgumentError, "Missing the required parameter 'nb' when calling UsersApi.player_top_nb_perf_type"
  end
  if @api_client.config.client_side_validation && nb > 200
    fail ArgumentError, 'invalid value for "nb" when calling UsersApi.player_top_nb_perf_type, must be smaller than or equal to 200.'
  end

  if @api_client.config.client_side_validation && nb < 1
    fail ArgumentError, 'invalid value for "nb" when calling UsersApi.player_top_nb_perf_type, must be greater than or equal to 1.'
  end

  # verify the required parameter 'perf_type' is set
  if @api_client.config.client_side_validation && perf_type.nil?
    fail ArgumentError, "Missing the required parameter 'perf_type' when calling UsersApi.player_top_nb_perf_type"
  end
  # verify enum value
  allowable_values = ["ultraBullet", "bullet", "blitz", "rapid", "classical", "minishogi", "chushogi", "annanshogi", "kyotoshogi", "checkshogi"]
  if @api_client.config.client_side_validation && !allowable_values.include?(perf_type)
    fail ArgumentError, "invalid value for \"perf_type\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/player/top/{nb}/{perfType}'.sub('{' + 'nb' + '}', CGI.escape(nb.to_s)).sub('{' + 'perfType' + '}', CGI.escape(perf_type.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/vnd.lishogi.v3+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 => :"UsersApi.player_top_nb_perf_type",
    :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: UsersApi#player_top_nb_perf_type\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Get all top 10 Get the top 10 players for each speed and variant. See &lt;lishogi.org/player&gt;.

Parameters:

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

    the optional parameters

Returns:

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

    Object data, response status code and response headers



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
473
# File 'lib/lishogi/api/users_api.rb', line 431

def player_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UsersApi.player ...'
  end
  # resource path
  local_var_path = '/player'

  # 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/vnd.lishogi.v3+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 => :"UsersApi.player",
    :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: UsersApi#player\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#streamer_live(opts = {}) ⇒ Array<LightUser>

Get live streamers Get basic info about currently streaming users. This API is very fast and cheap on lishogi side. So you can call it quite often (like once every 5 seconds).

Parameters:

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

    the optional parameters

Returns:



561
562
563
564
# File 'lib/lishogi/api/users_api.rb', line 561

def streamer_live(opts = {})
  data, _status_code, _headers = streamer_live_with_http_info(opts)
  data
end

#streamer_live_with_http_info(opts = {}) ⇒ Array<(Array<LightUser>, Integer, Hash)>

Get live streamers Get basic info about currently streaming users. This API is very fast and cheap on lishogi side. So you can call it quite often (like once every 5 seconds).

Parameters:

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

    the optional parameters

Returns:

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

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



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
606
607
608
609
610
611
612
# File 'lib/lishogi/api/users_api.rb', line 570

def streamer_live_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UsersApi.streamer_live ...'
  end
  # resource path
  local_var_path = '/streamer/live'

  # 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] || 'Array<LightUser>'

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

  new_options = opts.merge(
    :operation => :"UsersApi.streamer_live",
    :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: UsersApi#streamer_live\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#team_id_users(team_id, opts = {}) ⇒ UserExtended

Get members of a team Members are sorted by reverse chronological order of joining the team (most recent first). OAuth only required if the list of members is private. Members are streamed as [ndjson](#section/Introduction/Streaming-with-ND-JSON).

Parameters:

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

    the optional parameters

Returns:



619
620
621
622
# File 'lib/lishogi/api/users_api.rb', line 619

def team_id_users(team_id, opts = {})
  data, _status_code, _headers = team_id_users_with_http_info(team_id, opts)
  data
end

#team_id_users_with_http_info(team_id, opts = {}) ⇒ Array<(UserExtended, Integer, Hash)>

Get members of a team Members are sorted by reverse chronological order of joining the team (most recent first). OAuth only required if the list of members is private. Members are streamed as [ndjson](#section/Introduction/Streaming-with-ND-JSON).

Parameters:

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

    the optional parameters

Returns:

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

    UserExtended data, response status code and response headers



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
# File 'lib/lishogi/api/users_api.rb', line 629

def team_id_users_with_http_info(team_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UsersApi.team_id_users ...'
  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 UsersApi.team_id_users"
  end
  # resource path
  local_var_path = '/api/team/{teamId}/users'.sub('{' + 'teamId' + '}', CGI.escape(team_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/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] || 'UserExtended'

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

  new_options = opts.merge(
    :operation => :"UsersApi.team_id_users",
    :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: UsersApi#team_id_users\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end