Class: Lishogi::StudiesApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ StudiesApi

Returns a new instance of StudiesApi.



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

def api_client
  @api_client
end

Instance Method Details

#study_all_chapters_kif(study_id, opts = {}) ⇒ Object

Export all chapters Download all chapters of a study in KIF format.

Parameters:

  • study_id (String)

    The study ID (8 characters).

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

    the optional parameters

Options Hash (opts):

  • :clocks (Boolean)

    Include clock comments in the KIF moves, when available. Example: `22 同 玉(51) (00:02/00:00:13)` (default to true)

  • :comments (Boolean)

    Include analysis and annotator comments in the KIF moves, when available. Example: `1 3六歩(37) * Good move * 次に▲35歩で角道を遮る! * [%csl P3d,P2b][%cal P3f3e]` (default to true)

  • :variations (Boolean)

    Include non-mainline moves, when available. Example: `7 4八銀(39) * [%cal P4h3g,P3g4f,P3f3e]` (default to true)

Returns:

  • (Object)


30
31
32
33
# File 'lib/lishogi/api/studies_api.rb', line 30

def study_all_chapters_kif(study_id, opts = {})
  data, _status_code, _headers = study_all_chapters_kif_with_http_info(study_id, opts)
  data
end

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

Export all chapters Download all chapters of a study in KIF format.

Parameters:

  • study_id (String)

    The study ID (8 characters).

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

    the optional parameters

Options Hash (opts):

  • :clocks (Boolean)

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

  • :comments (Boolean)

    Include analysis and annotator comments in the KIF moves, when available. Example: &#x60;1 3六歩(37) * Good move * 次に▲35歩で角道を遮る! * [%csl P3d,P2b][%cal P3f3e]&#x60; (default to true)

  • :variations (Boolean)

    Include non-mainline moves, when available. Example: &#x60;7 4八銀(39) * [%cal P4h3g,P3g4f,P3f3e]&#x60; (default to true)

Returns:

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

    Object data, response status code and response headers



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/studies_api.rb', line 43

def study_all_chapters_kif_with_http_info(study_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: StudiesApi.study_all_chapters_kif ...'
  end
  # verify the required parameter 'study_id' is set
  if @api_client.config.client_side_validation && study_id.nil?
    fail ArgumentError, "Missing the required parameter 'study_id' when calling StudiesApi.study_all_chapters_kif"
  end
  # resource path
  local_var_path = '/api/study/{studyId}.kif'.sub('{' + 'studyId' + '}', CGI.escape(study_id.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['text/plain']) 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 => :"StudiesApi.study_all_chapters_kif",
    :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: StudiesApi#study_all_chapters_kif\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#study_chapter_kif(study_id, chapter_id, opts = {}) ⇒ Object

Export one study chapter Download one study chapter in KIF format.

Parameters:

  • study_id (String)

    The study ID (8 characters).

  • chapter_id (String)

    The chapter ID (8 characters).

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

    the optional parameters

Options Hash (opts):

  • :clocks (Boolean)

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

  • :comments (Boolean)

    Include analysis and annotator comments in the KIF moves, when available. Example: &#x60;1 3六歩(37) * Good move * 次に▲35歩で角道を遮る! * [%csl P3d,P2b][%cal P3f3e]&#x60; (default to true)

  • :variations (Boolean)

    Include non-mainline moves, when available. Example: &#x60;7 4八銀(39) * [%cal P4h3g,P3g4f,P3f3e]&#x60; (default to true)

Returns:

  • (Object)


103
104
105
106
# File 'lib/lishogi/api/studies_api.rb', line 103

def study_chapter_kif(study_id, chapter_id, opts = {})
  data, _status_code, _headers = study_chapter_kif_with_http_info(study_id, chapter_id, opts)
  data
end

#study_chapter_kif_with_http_info(study_id, chapter_id, opts = {}) ⇒ Array<(Object, Integer, Hash)>

Export one study chapter Download one study chapter in KIF format.

Parameters:

  • study_id (String)

    The study ID (8 characters).

  • chapter_id (String)

    The chapter ID (8 characters).

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

    the optional parameters

Options Hash (opts):

  • :clocks (Boolean)

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

  • :comments (Boolean)

    Include analysis and annotator comments in the KIF moves, when available. Example: &#x60;1 3六歩(37) * Good move * 次に▲35歩で角道を遮る! * [%csl P3d,P2b][%cal P3f3e]&#x60; (default to true)

  • :variations (Boolean)

    Include non-mainline moves, when available. Example: &#x60;7 4八銀(39) * [%cal P4h3g,P3g4f,P3f3e]&#x60; (default to true)

Returns:

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

    Object data, response status code and response headers



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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/lishogi/api/studies_api.rb', line 117

def study_chapter_kif_with_http_info(study_id, chapter_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: StudiesApi.study_chapter_kif ...'
  end
  # verify the required parameter 'study_id' is set
  if @api_client.config.client_side_validation && study_id.nil?
    fail ArgumentError, "Missing the required parameter 'study_id' when calling StudiesApi.study_chapter_kif"
  end
  # verify the required parameter 'chapter_id' is set
  if @api_client.config.client_side_validation && chapter_id.nil?
    fail ArgumentError, "Missing the required parameter 'chapter_id' when calling StudiesApi.study_chapter_kif"
  end
  # resource path
  local_var_path = '/study/{studyId}/{chapterId}.kif'.sub('{' + 'studyId' + '}', CGI.escape(study_id.to_s)).sub('{' + 'chapterId' + '}', CGI.escape(chapter_id.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['text/plain']) 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 => :"StudiesApi.study_chapter_kif",
    :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: StudiesApi#study_chapter_kif\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Export all studies of a user Download all chapters of all studies of a user in KIF format. If authenticated, then all public, unlisted, and private studies are included. If not, only public, listed studies are included.

Parameters:

  • username (String)

    The user whose studies we export

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

    the optional parameters

Options Hash (opts):

  • :clocks (Boolean)

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

  • :comments (Boolean)

    Include analysis and annotator comments in the KIF moves, when available. Example: &#x60;1 3六歩(37) * Good move * 次に▲35歩で角道を遮る * [%csl P3d,P2b][%cal P3f3e]&#x60; (default to true)

  • :variations (Boolean)

    Include non-mainline moves, when available. Example: &#x60;7 4八銀(39) * [%cal P4h3g,P3g4f,P3f3e]&#x60; (default to true)

Returns:

  • (Object)


180
181
182
183
# File 'lib/lishogi/api/studies_api.rb', line 180

def study_export_all_kif(username, opts = {})
  data, _status_code, _headers = study_export_all_kif_with_http_info(username, opts)
  data
end

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

Export all studies of a user Download all chapters of all studies of a user in KIF format. If authenticated, then all public, unlisted, and private studies are included. If not, only public, listed studies are included.

Parameters:

  • username (String)

    The user whose studies we export

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

    the optional parameters

Options Hash (opts):

  • :clocks (Boolean)

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

  • :comments (Boolean)

    Include analysis and annotator comments in the KIF moves, when available. Example: &#x60;1 3六歩(37) * Good move * 次に▲35歩で角道を遮る * [%csl P3d,P2b][%cal P3f3e]&#x60; (default to true)

  • :variations (Boolean)

    Include non-mainline moves, when available. Example: &#x60;7 4八銀(39) * [%cal P4h3g,P3g4f,P3f3e]&#x60; (default to true)

Returns:

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

    Object data, response status code and response headers



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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# File 'lib/lishogi/api/studies_api.rb', line 193

def study_export_all_kif_with_http_info(username, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: StudiesApi.study_export_all_kif ...'
  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 StudiesApi.study_export_all_kif"
  end
  # resource path
  local_var_path = '/study/by/{username}/export.kif'.sub('{' + 'username' + '}', CGI.escape(username.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['text/plain']) 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] || ['OAuth2']

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