Class: IndexeaClient::RecordsApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ RecordsApi

Returns a new instance of RecordsApi.



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

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

Instance Attribute Details

#api_client ⇒ Object

Returns the value of attribute api_client.



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

def api_client
  @api_client
end

Instance Method Details

#record_delete(app, index, _id, opts = {}) ⇒ BOOLEAN

删除记录数据

Parameters:

  • app —

    应用标识

  • index —

    索引编号

  • _id —

    主键字段值

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

    the optional parameters

Returns:

  • (BOOLEAN)


25
26
27
28
# File 'lib/indexea_client/api/records_api.rb', line 25

def record_delete(app, index, _id, opts = {})
  data, _status_code, _headers = record_delete_with_http_info(app, index, _id, opts)
  data
end

#record_delete_with_http_info(app, index, _id, opts = {}) ⇒ Array<(BOOLEAN, Integer, Hash)>

删除记录数据

Parameters:

  • app —

    应用标识

  • index —

    索引编号

  • _id —

    主键字段值

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

    the optional parameters

Returns:

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

    BOOLEAN data, response status code and response headers



36
37
38
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
# File 'lib/indexea_client/api/records_api.rb', line 36

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

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'_id'] = @api_client.build_collection_param(_id, :multi)

  # 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: RecordsApi#record_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#record_get(app, index, _id, opts = {}) ⇒ Object

获取单条记录详情

Parameters:

  • app —

    应用标识

  • index —

    索引编号

  • _id —

    记录 _id 值

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

    the optional parameters

Returns:

  • (Object)


92
93
94
95
# File 'lib/indexea_client/api/records_api.rb', line 92

def record_get(app, index, _id, opts = {})
  data, _status_code, _headers = record_get_with_http_info(app, index, _id, opts)
  data
end

#record_get_with_http_info(app, index, _id, opts = {}) ⇒ Array<(Object, Integer, Hash)>

获取单条记录详情

Parameters:

  • app —

    应用标识

  • index —

    索引编号

  • _id —

    记录 _id 值

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

    the optional parameters

Returns:

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

    Object data, response status code and response headers



103
104
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
148
149
150
151
152
# File 'lib/indexea_client/api/records_api.rb', line 103

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

  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: RecordsApi#record_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#record_list(app, index, opts = {}) ⇒ Array<Object>

获取索引记录列表

Parameters:

  • app —

    应用标识

  • index —

    索引编号

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

    the optional parameters

Options Hash (opts):

  • :body (RecordFilter)
  • :q (String) —

    搜索关键字

  • :field (String) —

    搜索字段

  • :from (Integer) —

    起始记录 (default to 0)

  • :size (Integer) —

    获取记录数 (default to 20)

  • :save_filter (BOOLEAN) —

    是否保存过滤器信息 (default to false)

Returns:

  • (Array<Object>)


164
165
166
167
# File 'lib/indexea_client/api/records_api.rb', line 164

def record_list(app, index, opts = {})
  data, _status_code, _headers = record_list_with_http_info(app, index, opts)
  data
end

#record_list_with_http_info(app, index, opts = {}) ⇒ Array<(Array<Object>, Integer, Hash)>

获取索引记录列表

Parameters:

  • app —

    应用标识

  • index —

    索引编号

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

    the optional parameters

Options Hash (opts):

  • :body (RecordFilter)
  • :q (String) —

    搜索关键字

  • :field (String) —

    搜索字段

  • :from (Integer) —

    起始记录

  • :size (Integer) —

    获取记录数

  • :save_filter (BOOLEAN) —

    是否保存过滤器信息

Returns:

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

    Array data, response status code and response headers

    
    
    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
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    # File 'lib/indexea_client/api/records_api.rb', line 180
    
    def record_list_with_http_info(app, index, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: RecordsApi.record_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 RecordsApi.record_list"
      end
      # verify the required parameter 'index' is set
      if @api_client.config.client_side_validation && index.nil?
        fail ArgumentError, "Missing the required parameter 'index' when calling RecordsApi.record_list"
      end
      # resource path
      local_var_path = '/records/{app}/{index}'.sub('{' + 'app' + '}', app.to_s).sub('{' + 'index' + '}', index.to_s)
    
      # query parameters
      query_params = opts[:query_params] || {}
      query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?
      query_params[:'field'] = opts[:'field'] if !opts[:'field'].nil?
      query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?
      query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?
      query_params[:'saveFilter'] = opts[:'save_filter'] if !opts[:'save_filter'].nil?
    
      # 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(opts[:'body']) 
    
      return_type = opts[:return_type] || 'Array<Object>' 
    
      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: RecordsApi#record_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

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

    插入或者更新索引数据

    Parameters:

    • body
    • app —

      应用标识

    • index —

      索引编号

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

      the optional parameters

    Options Hash (opts):

    • :combine (BOOLEAN) —

      更新策略:合并还是替换,combine=true 为合并模式 (default to false)

    Returns:

    • (BOOLEAN)
    
    
    239
    240
    241
    242
    # File 'lib/indexea_client/api/records_api.rb', line 239
    
    def record_push(body, app, index, opts = {})
      data, _status_code, _headers = record_push_with_http_info(body, app, index, opts)
      data
    end

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

    插入或者更新索引数据

    Parameters:

    • body
    • app —

      应用标识

    • index —

      索引编号

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

      the optional parameters

    Options Hash (opts):

    • :combine (BOOLEAN) —

      更新策略:合并还是替换,combine=true 为合并模式

    Returns:

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

      BOOLEAN data, response status code and response headers

    
    
    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
    # File 'lib/indexea_client/api/records_api.rb', line 251
    
    def record_push_with_http_info(body, app, index, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: RecordsApi.record_push ...'
      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 RecordsApi.record_push"
      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 RecordsApi.record_push"
      end
      # verify the required parameter 'index' is set
      if @api_client.config.client_side_validation && index.nil?
        fail ArgumentError, "Missing the required parameter 'index' when calling RecordsApi.record_push"
      end
      # resource path
      local_var_path = '/records/{app}/{index}'.sub('{' + 'app' + '}', app.to_s).sub('{' + 'index' + '}', index.to_s)
    
      # query parameters
      query_params = opts[:query_params] || {}
      query_params[:'combine'] = opts[:'combine'] if !opts[:'combine'].nil?
    
      # 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: RecordsApi#record_push\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    #record_upload(app, index, opts = {}) ⇒ Object

    上传记录

    Parameters:

    • app —

      应用标识

    • index —

      索引编号

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

      the optional parameters

    Options Hash (opts):

    • :files (Array<String>)
    • :combine (BOOLEAN) —

      更新策略:合并还是替换,combine=true 为合并模式 (default to false)

    • :use_id_as_id_value (BOOLEAN) —

      使用数据中的 id 值作为记录 _id, 如果没有 id 字段则自动生成 (default to true)

    Returns:

    • (Object)
    
    
    311
    312
    313
    314
    # File 'lib/indexea_client/api/records_api.rb', line 311
    
    def record_upload(app, index, opts = {})
      data, _status_code, _headers = record_upload_with_http_info(app, index, opts)
      data
    end

    #record_upload_with_http_info(app, index, opts = {}) ⇒ Array<(Object, Integer, Hash)>

    上传记录

    Parameters:

    • app —

      应用标识

    • index —

      索引编号

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

      the optional parameters

    Options Hash (opts):

    • :files (Array<String>)
    • :combine (BOOLEAN) —

      更新策略:合并还是替换,combine=true 为合并模式

    • :use_id_as_id_value (BOOLEAN) —

      使用数据中的 id 值作为记录 _id, 如果没有 id 字段则自动生成

    Returns:

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

      Object data, response status code and response headers

    
    
    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
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    # File 'lib/indexea_client/api/records_api.rb', line 324
    
    def record_upload_with_http_info(app, index, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: RecordsApi.record_upload ...'
      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 RecordsApi.record_upload"
      end
      # verify the required parameter 'index' is set
      if @api_client.config.client_side_validation && index.nil?
        fail ArgumentError, "Missing the required parameter 'index' when calling RecordsApi.record_upload"
      end
      # resource path
      local_var_path = '/records/{app}/{index}/upload'.sub('{' + 'app' + '}', app.to_s).sub('{' + 'index' + '}', index.to_s)
    
      # query parameters
      query_params = opts[:query_params] || {}
      query_params[:'combine'] = opts[:'combine'] if !opts[:'combine'].nil?
      query_params[:'useIdAsIdValue'] = opts[:'use_id_as_id_value'] if !opts[:'use_id_as_id_value'].nil?
    
      # 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(['multipart/form-data'])
    
      # form parameters
      form_params = opts[:form_params] || {}
      form_params['files'] = @api_client.build_collection_param(opts[:'files'], :multi) if !opts[:'files'].nil?
    
      # http body (model)
      post_body = opts[:body] 
    
      return_type = opts[:return_type] || 'Object' 
    
      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: RecordsApi#record_upload\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end