Class: IndexeaClient::RecommendApi

Inherits:
Object
  • Object
show all
Defined in:
lib/indexea_client/api/recommend_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ RecommendApi

Returns a new instance of RecommendApi.



16
17
18
# File 'lib/indexea_client/api/recommend_api.rb', line 16

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



14
15
16
# File 'lib/indexea_client/api/recommend_api.rb', line 14

def api_client
  @api_client
end

Instance Method Details

#recommend_click(ident, action_id, doc_id, opts = {}) ⇒ BOOLEAN

推荐结果点击行为收集 该接口主要用于记录用户对推荐结果的点击行为

Parameters:

  • ident

    推荐的唯一标识

  • action_id

    对应推荐行为编号

  • doc_id

    对应索引中的内部记录编号

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

    the optional parameters

Options Hash (opts):

  • :userid (String)

    搜索者的唯一标识,该标识由搜索前端生成,长度不超过64

  • :x_token (String)

    如果要使用非发布的组件,需要组件作者授权

Returns:

  • (BOOLEAN)


28
29
30
31
# File 'lib/indexea_client/api/recommend_api.rb', line 28

def recommend_click(ident, action_id, doc_id, opts = {})
  data, _status_code, _headers = recommend_click_with_http_info(ident, action_id, doc_id, opts)
  data
end

#recommend_click_with_http_info(ident, action_id, doc_id, opts = {}) ⇒ Array<(BOOLEAN, Integer, Hash)>

推荐结果点击行为收集 该接口主要用于记录用户对推荐结果的点击行为

Parameters:

  • ident

    推荐的唯一标识

  • action_id

    对应推荐行为编号

  • doc_id

    对应索引中的内部记录编号

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

    the optional parameters

Options Hash (opts):

  • :userid (String)

    搜索者的唯一标识,该标识由搜索前端生成,长度不超过64

  • :x_token (String)

    如果要使用非发布的组件,需要组件作者授权

Returns:

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

    BOOLEAN data, response status code and response headers



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
93
94
# File 'lib/indexea_client/api/recommend_api.rb', line 42

def recommend_click_with_http_info(ident, action_id, doc_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RecommendApi.recommend_click ...'
  end
  # verify the required parameter 'ident' is set
  if @api_client.config.client_side_validation && ident.nil?
    fail ArgumentError, "Missing the required parameter 'ident' when calling RecommendApi.recommend_click"
  end
  # verify the required parameter 'action_id' is set
  if @api_client.config.client_side_validation && action_id.nil?
    fail ArgumentError, "Missing the required parameter 'action_id' when calling RecommendApi.recommend_click"
  end
  # verify the required parameter 'doc_id' is set
  if @api_client.config.client_side_validation && doc_id.nil?
    fail ArgumentError, "Missing the required parameter 'doc_id' when calling RecommendApi.recommend_click"
  end
  # resource path
  local_var_path = '/recommend/{ident}/click'.sub('{' + 'ident' + '}', ident.to_s)

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  header_params[:'userid'] = opts[:'userid'] if !opts[:'userid'].nil?
  header_params[:'x-token'] = opts[:'x_token'] if !opts[:'x_token'].nil?

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

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

  return_type = opts[:return_type] || 'BOOLEAN' 

  auth_names = opts[:auth_names] || []
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RecommendApi#recommend_click\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#recommend_create(body, app, opts = {}) ⇒ RecommendBean

创建新的推荐

Parameters:

  • body

    推荐信息

  • app

    应用标识

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

    the optional parameters

Returns:



100
101
102
103
# File 'lib/indexea_client/api/recommend_api.rb', line 100

def recommend_create(body, app, opts = {})
  data, _status_code, _headers = recommend_create_with_http_info(body, app, opts)
  data
end

#recommend_create_with_http_info(body, app, opts = {}) ⇒ Array<(RecommendBean, Integer, Hash)>

创建新的推荐

Parameters:

  • body

    推荐信息

  • app

    应用标识

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

    the optional parameters

Returns:

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

    RecommendBean data, response status code and response headers



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
156
# File 'lib/indexea_client/api/recommend_api.rb', line 110

def recommend_create_with_http_info(body, app, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RecommendApi.recommend_create ...'
  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 RecommendApi.recommend_create"
  end
  # verify the required parameter 'app' is set
  if @api_client.config.client_side_validation && app.nil?
    fail ArgumentError, "Missing the required parameter 'app' when calling RecommendApi.recommend_create"
  end
  # resource path
  local_var_path = '/recommends/{app}'.sub('{' + 'app' + '}', app.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'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

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

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

  return_type = opts[:return_type] || 'RecommendBean' 

  auth_names = opts[:auth_names] || ['TokenAuth']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RecommendApi#recommend_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#recommend_delete(app, id, opts = {}) ⇒ BOOLEAN

删除推荐

Parameters:

  • app

    应用标识

  • id

    推荐编号

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

    the optional parameters

Returns:

  • (BOOLEAN)


162
163
164
165
# File 'lib/indexea_client/api/recommend_api.rb', line 162

def recommend_delete(app, id, opts = {})
  data, _status_code, _headers = recommend_delete_with_http_info(app, id, opts)
  data
end

#recommend_delete_with_http_info(app, id, opts = {}) ⇒ Array<(BOOLEAN, Integer, Hash)>

删除推荐

Parameters:

  • app

    应用标识

  • id

    推荐编号

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

    the optional parameters

Returns:

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

    BOOLEAN data, 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
# File 'lib/indexea_client/api/recommend_api.rb', line 172

def recommend_delete_with_http_info(app, id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RecommendApi.recommend_delete ...'
  end
  # verify the required parameter 'app' is set
  if @api_client.config.client_side_validation && app.nil?
    fail ArgumentError, "Missing the required parameter 'app' when calling RecommendApi.recommend_delete"
  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 RecommendApi.recommend_delete"
  end
  # resource path
  local_var_path = '/recommends/{app}'.sub('{' + 'app' + '}', app.to_s)

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

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

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

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

  return_type = opts[:return_type] || 'BOOLEAN' 

  auth_names = opts[:auth_names] || ['TokenAuth']
  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RecommendApi#recommend_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#recommend_detail(ident, opts = {}) ⇒ RecommendBean

获取推荐的记录列表

Parameters:

  • ident

    推荐定义的标识

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

    the optional parameters

Options Hash (opts):

  • :x_token (String)

    如果要使用非发布的组件,需要组件作者授权

Returns:



223
224
225
226
# File 'lib/indexea_client/api/recommend_api.rb', line 223

def recommend_detail(ident, opts = {})
  data, _status_code, _headers = recommend_detail_with_http_info(ident, opts)
  data
end

#recommend_detail_with_http_info(ident, opts = {}) ⇒ Array<(RecommendBean, Integer, Hash)>

获取推荐的记录列表

Parameters:

  • ident

    推荐定义的标识

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

    the optional parameters

Options Hash (opts):

  • :x_token (String)

    如果要使用非发布的组件,需要组件作者授权

Returns:

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

    RecommendBean data, response status code and response headers



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
# File 'lib/indexea_client/api/recommend_api.rb', line 233

def recommend_detail_with_http_info(ident, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RecommendApi.recommend_detail ...'
  end
  # verify the required parameter 'ident' is set
  if @api_client.config.client_side_validation && ident.nil?
    fail ArgumentError, "Missing the required parameter 'ident' when calling RecommendApi.recommend_detail"
  end
  # resource path
  local_var_path = '/recommend/{ident}'.sub('{' + 'ident' + '}', ident.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'])
  header_params[:'x-token'] = opts[:'x_token'] if !opts[:'x_token'].nil?

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

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

  return_type = opts[:return_type] || 'RecommendBean' 

  auth_names = opts[:auth_names] || []
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RecommendApi#recommend_detail\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#recommend_fetch(ident, opts = {}) ⇒ Object

获取推荐的记录列表

Parameters:

  • ident

    推荐定义的标识

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

    the optional parameters

Options Hash (opts):

  • :x_token (String)

    如果要使用非发布的组件,需要组件作者授权

  • :userid (String)

    访客的唯一标识,该标识由搜索前端生成,长度不超过64

  • :condition (Hash<String, String>)

    获取某个记录的参数,例如 id&#x3D;11223(后端将使用 term query 进行匹配)

  • :from (Integer)

    起始值 (default to 0)

  • :count (Integer)

    推荐的记录数 (default to 10)

Returns:

  • (Object)


284
285
286
287
# File 'lib/indexea_client/api/recommend_api.rb', line 284

def recommend_fetch(ident, opts = {})
  data, _status_code, _headers = recommend_fetch_with_http_info(ident, opts)
  data
end

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

获取推荐的记录列表

Parameters:

  • ident

    推荐定义的标识

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

    the optional parameters

Options Hash (opts):

  • :x_token (String)

    如果要使用非发布的组件,需要组件作者授权

  • :userid (String)

    访客的唯一标识,该标识由搜索前端生成,长度不超过64

  • :condition (Hash<String, String>)

    获取某个记录的参数,例如 id&#x3D;11223(后端将使用 term query 进行匹配)

  • :from (Integer)

    起始值

  • :count (Integer)

    推荐的记录数

Returns:

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

    Object 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
# File 'lib/indexea_client/api/recommend_api.rb', line 298

def recommend_fetch_with_http_info(ident, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RecommendApi.recommend_fetch ...'
  end
  # verify the required parameter 'ident' is set
  if @api_client.config.client_side_validation && ident.nil?
    fail ArgumentError, "Missing the required parameter 'ident' when calling RecommendApi.recommend_fetch"
  end
  # resource path
  local_var_path = '/recommend/{ident}'.sub('{' + 'ident' + '}', ident.to_s)

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'condition'] = @api_client.build_collection_param(opts[:'condition'], :multi) if !opts[:'condition'].nil?
  query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?
  query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  header_params[:'x-token'] = opts[:'x_token'] if !opts[:'x_token'].nil?
  header_params[:'userid'] = opts[:'userid'] if !opts[:'userid'].nil?

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

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

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

  auth_names = opts[:auth_names] || []
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RecommendApi#recommend_fetch\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#recommend_list(app, opts = {}) ⇒ Array<RecommendBean>

获取已定义的推荐列表

Parameters:

  • app

    应用标识

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

    the optional parameters

Returns:



348
349
350
351
# File 'lib/indexea_client/api/recommend_api.rb', line 348

def recommend_list(app, opts = {})
  data, _status_code, _headers = recommend_list_with_http_info(app, opts)
  data
end

#recommend_list_with_http_info(app, opts = {}) ⇒ Array<(Array<RecommendBean>, Integer, Hash)>

获取已定义的推荐列表

Parameters:

  • app

    应用标识

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

    the optional parameters

Returns:

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

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



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
392
393
394
395
396
397
# File 'lib/indexea_client/api/recommend_api.rb', line 357

def recommend_list_with_http_info(app, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RecommendApi.recommend_list ...'
  end
  # verify the required parameter 'app' is set
  if @api_client.config.client_side_validation && app.nil?
    fail ArgumentError, "Missing the required parameter 'app' when calling RecommendApi.recommend_list"
  end
  # resource path
  local_var_path = '/recommends/{app}'.sub('{' + 'app' + '}', app.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'])

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

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

  return_type = opts[:return_type] || 'Array<RecommendBean>' 

  auth_names = opts[:auth_names] || ['TokenAuth']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RecommendApi#recommend_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#recommend_update(body, app, opts = {}) ⇒ BOOLEAN

更新推荐信息

Parameters:

  • body

    推荐信息

  • app

    应用标识

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

    the optional parameters

Returns:

  • (BOOLEAN)


403
404
405
406
# File 'lib/indexea_client/api/recommend_api.rb', line 403

def recommend_update(body, app, opts = {})
  data, _status_code, _headers = recommend_update_with_http_info(body, app, opts)
  data
end

#recommend_update_with_http_info(body, app, opts = {}) ⇒ Array<(BOOLEAN, Integer, Hash)>

更新推荐信息

Parameters:

  • body

    推荐信息

  • app

    应用标识

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

    the optional parameters

Returns:

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

    BOOLEAN data, response status code and response headers



413
414
415
416
417
418
419
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
# File 'lib/indexea_client/api/recommend_api.rb', line 413

def recommend_update_with_http_info(body, app, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RecommendApi.recommend_update ...'
  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 RecommendApi.recommend_update"
  end
  # verify the required parameter 'app' is set
  if @api_client.config.client_side_validation && app.nil?
    fail ArgumentError, "Missing the required parameter 'app' when calling RecommendApi.recommend_update"
  end
  # resource path
  local_var_path = '/recommends/{app}'.sub('{' + 'app' + '}', app.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'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

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

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

  return_type = opts[:return_type] || 'BOOLEAN' 

  auth_names = opts[:auth_names] || ['TokenAuth']
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RecommendApi#recommend_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end