Class: Algolia::CompositionClient

Inherits:
Object
  • Object
show all
Defined in:
lib/algolia/api/composition_client.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config = nil) ⇒ CompositionClient

Returns a new instance of CompositionClient.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/algolia/api/composition_client.rb', line 9

def initialize(config = nil)
  raise "`config` is missing." if config.nil?
  raise "`app_id` is missing." if config.app_id.nil? || config.app_id == ""
  raise "`api_key` is missing." if config.api_key.nil? || config.api_key == ""

  if config.connect_timeout.nil?
    config.connect_timeout = 2000
  end

  if config.read_timeout.nil?
    config.read_timeout = 5000
  end

  if config.write_timeout.nil?
    config.write_timeout = 30000
  end

  @api_client = Algolia::ApiClient.new(config)
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



7
8
9
# File 'lib/algolia/api/composition_client.rb', line 7

def api_client
  @api_client
end

Class Method Details

.create(app_id, api_key, opts = {}) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/algolia/api/composition_client.rb', line 29

def self.create(app_id, api_key, opts = {})
  hosts = []
  hosts << Transport::StatefulHost.new("#{app_id}-dsn.algolia.net", accept: CallType::READ)
  hosts << Transport::StatefulHost.new("#{app_id}.algolia.net", accept: CallType::WRITE)

  hosts += 1
    .upto(3)
    .map do |i|
      Transport::StatefulHost.new("#{app_id}-#{i}.algolianet.com", accept: CallType::READ | CallType::WRITE)
    end
    .shuffle

  config = Algolia::Configuration.new(app_id, api_key, hosts, "Composition", opts)
  new(config)
end

.create_with_config(config) ⇒ Object



45
46
47
# File 'lib/algolia/api/composition_client.rb', line 45

def self.create_with_config(config)
  new(config)
end

Instance Method Details

#add_user_agent_segment(segment, version = nil) ⇒ Object



59
60
61
62
63
# File 'lib/algolia/api/composition_client.rb', line 59

def add_user_agent_segment(segment, version = nil)
  @api_client.config.add_user_agent_segment(segment, version)

  self
end

#custom_delete(path, parameters = nil, request_options = {}) ⇒ Object

Parameters:

  • path (String)

    Path of the endpoint, for example ‘1/newFeature`. (required)

  • parameters (Hash<String, Object>) (defaults to: nil)

    Query parameters to apply to the current query.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (Object)


107
108
109
110
# File 'lib/algolia/api/composition_client.rb', line 107

def custom_delete(path, parameters = nil, request_options = {})
  response = custom_delete_with_http_info(path, parameters, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || "Object")
end

#custom_delete_with_http_info(path, parameters = nil, request_options = {}) ⇒ Http::Response

Returns the response.

Parameters:

  • path (String)

    Path of the endpoint, for example ‘1/newFeature`. (required)

  • parameters (Hash<String, Object>) (defaults to: nil)

    Query parameters to apply to the current query.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/algolia/api/composition_client.rb', line 71

def custom_delete_with_http_info(path, parameters = nil, request_options = {})
  # verify the required parameter 'path' is set
  if @api_client.config.client_side_validation && path.nil?
    raise ArgumentError, "Parameter `path` is required when calling `custom_delete`."
  end
  # verify the required parameter 'path' is not empty
  if @api_client.config.client_side_validation && path.empty?
    raise ArgumentError, "Parameter `path` is required when calling `custom_delete`."
  end

  path = "/{path}".sub("{" + "path" + "}", path.to_s)
  query_params = {}
  query_params = query_params.merge(parameters) unless parameters.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :"CompositionClient.custom_delete",
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:DELETE, path, new_options)
end

#custom_get(path, parameters = nil, request_options = {}) ⇒ Object

Parameters:

  • path (String)

    Path of the endpoint, for example ‘1/newFeature`. (required)

  • parameters (Hash<String, Object>) (defaults to: nil)

    Query parameters to apply to the current query.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (Object)


154
155
156
157
# File 'lib/algolia/api/composition_client.rb', line 154

def custom_get(path, parameters = nil, request_options = {})
  response = custom_get_with_http_info(path, parameters, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || "Object")
end

#custom_get_with_http_info(path, parameters = nil, request_options = {}) ⇒ Http::Response

Returns the response.

Parameters:

  • path (String)

    Path of the endpoint, for example ‘1/newFeature`. (required)

  • parameters (Hash<String, Object>) (defaults to: nil)

    Query parameters to apply to the current query.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



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
# File 'lib/algolia/api/composition_client.rb', line 118

def custom_get_with_http_info(path, parameters = nil, request_options = {})
  # verify the required parameter 'path' is set
  if @api_client.config.client_side_validation && path.nil?
    raise ArgumentError, "Parameter `path` is required when calling `custom_get`."
  end
  # verify the required parameter 'path' is not empty
  if @api_client.config.client_side_validation && path.empty?
    raise ArgumentError, "Parameter `path` is required when calling `custom_get`."
  end

  path = "/{path}".sub("{" + "path" + "}", path.to_s)
  query_params = {}
  query_params = query_params.merge(parameters) unless parameters.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :"CompositionClient.custom_get",
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#custom_post(path, parameters = nil, body = nil, request_options = {}) ⇒ Object

Parameters:

  • path (String)

    Path of the endpoint, for example ‘1/newFeature`. (required)

  • parameters (Hash<String, Object>) (defaults to: nil)

    Query parameters to apply to the current query.

  • body (Object) (defaults to: nil)

    Parameters to send with the custom request.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (Object)


203
204
205
206
# File 'lib/algolia/api/composition_client.rb', line 203

def custom_post(path, parameters = nil, body = nil, request_options = {})
  response = custom_post_with_http_info(path, parameters, body, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || "Object")
end

#custom_post_with_http_info(path, parameters = nil, body = nil, request_options = {}) ⇒ Http::Response

Returns the response.

Parameters:

  • path (String)

    Path of the endpoint, for example ‘1/newFeature`. (required)

  • parameters (Hash<String, Object>) (defaults to: nil)

    Query parameters to apply to the current query.

  • body (Object) (defaults to: nil)

    Parameters to send with the custom request.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'lib/algolia/api/composition_client.rb', line 166

def custom_post_with_http_info(path, parameters = nil, body = nil, request_options = {})
  # verify the required parameter 'path' is set
  if @api_client.config.client_side_validation && path.nil?
    raise ArgumentError, "Parameter `path` is required when calling `custom_post`."
  end
  # verify the required parameter 'path' is not empty
  if @api_client.config.client_side_validation && path.empty?
    raise ArgumentError, "Parameter `path` is required when calling `custom_post`."
  end

  path = "/{path}".sub("{" + "path" + "}", path.to_s)
  query_params = {}
  query_params = query_params.merge(parameters) unless parameters.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(body)

  new_options = request_options.merge(
    :operation => :"CompositionClient.custom_post",
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:POST, path, new_options)
end

#custom_put(path, parameters = nil, body = nil, request_options = {}) ⇒ Object

Parameters:

  • path (String)

    Path of the endpoint, for example ‘1/newFeature`. (required)

  • parameters (Hash<String, Object>) (defaults to: nil)

    Query parameters to apply to the current query.

  • body (Object) (defaults to: nil)

    Parameters to send with the custom request.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (Object)


252
253
254
255
# File 'lib/algolia/api/composition_client.rb', line 252

def custom_put(path, parameters = nil, body = nil, request_options = {})
  response = custom_put_with_http_info(path, parameters, body, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || "Object")
end

#custom_put_with_http_info(path, parameters = nil, body = nil, request_options = {}) ⇒ Http::Response

Returns the response.

Parameters:

  • path (String)

    Path of the endpoint, for example ‘1/newFeature`. (required)

  • parameters (Hash<String, Object>) (defaults to: nil)

    Query parameters to apply to the current query.

  • body (Object) (defaults to: nil)

    Parameters to send with the custom request.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



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
# File 'lib/algolia/api/composition_client.rb', line 215

def custom_put_with_http_info(path, parameters = nil, body = nil, request_options = {})
  # verify the required parameter 'path' is set
  if @api_client.config.client_side_validation && path.nil?
    raise ArgumentError, "Parameter `path` is required when calling `custom_put`."
  end
  # verify the required parameter 'path' is not empty
  if @api_client.config.client_side_validation && path.empty?
    raise ArgumentError, "Parameter `path` is required when calling `custom_put`."
  end

  path = "/{path}".sub("{" + "path" + "}", path.to_s)
  query_params = {}
  query_params = query_params.merge(parameters) unless parameters.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(body)

  new_options = request_options.merge(
    :operation => :"CompositionClient.custom_put",
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:PUT, path, new_options)
end

#delete_composition(composition_id, request_options = {}) ⇒ TaskIDResponse

Delete a composition from the current Algolia application.

Required API Key ACLs:

- editSettings

Parameters:

  • composition_id (String)

    Unique Composition ObjectID. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (TaskIDResponse)


303
304
305
306
# File 'lib/algolia/api/composition_client.rb', line 303

def delete_composition(composition_id, request_options = {})
  response = delete_composition_with_http_info(composition_id, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || "Composition::TaskIDResponse")
end

#delete_composition_rule(composition_id, algolia_object_id, request_options = {}) ⇒ TaskIDResponse

Delete a Composition Rule from the specified Composition ID.

Required API Key ACLs:

- editSettings

Parameters:

  • composition_id (String)

    Unique Composition ObjectID. (required)

  • algolia_object_id (String)

    Unique identifier of a rule object. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (TaskIDResponse)


363
364
365
366
# File 'lib/algolia/api/composition_client.rb', line 363

def delete_composition_rule(composition_id, algolia_object_id, request_options = {})
  response = delete_composition_rule_with_http_info(composition_id, algolia_object_id, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || "Composition::TaskIDResponse")
end

#delete_composition_rule_with_http_info(composition_id, algolia_object_id, request_options = {}) ⇒ Http::Response

Delete a Composition Rule from the specified Composition ID.

Required API Key ACLs:

- editSettings

Parameters:

  • composition_id (String)

    Unique Composition ObjectID. (required)

  • algolia_object_id (String)

    Unique identifier of a rule object. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



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
350
351
352
353
# File 'lib/algolia/api/composition_client.rb', line 316

def delete_composition_rule_with_http_info(composition_id, algolia_object_id, request_options = {})
  # verify the required parameter 'composition_id' is set
  if @api_client.config.client_side_validation && composition_id.nil?
    raise ArgumentError, "Parameter `composition_id` is required when calling `delete_composition_rule`."
  end
  # verify the required parameter 'composition_id' is not empty
  if @api_client.config.client_side_validation && composition_id.empty?
    raise ArgumentError, "Parameter `composition_id` is required when calling `delete_composition_rule`."
  end
  # verify the required parameter 'algolia_object_id' is set
  if @api_client.config.client_side_validation && algolia_object_id.nil?
    raise ArgumentError, "Parameter `algolia_object_id` is required when calling `delete_composition_rule`."
  end
  # verify the required parameter 'algolia_object_id' is not empty
  if @api_client.config.client_side_validation && algolia_object_id.empty?
    raise ArgumentError, "Parameter `algolia_object_id` is required when calling `delete_composition_rule`."
  end

  path = "/1/compositions/{compositionID}/rules/{objectID}"
    .sub("{" + "compositionID" + "}", Transport.encode_uri(composition_id.to_s))
    .sub("{" + "objectID" + "}", Transport.encode_uri(algolia_object_id.to_s))
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :"CompositionClient.delete_composition_rule",
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:DELETE, path, new_options)
end

#delete_composition_with_http_info(composition_id, request_options = {}) ⇒ Http::Response

Delete a composition from the current Algolia application.

Required API Key ACLs:

- editSettings

Parameters:

  • composition_id (String)

    Unique Composition ObjectID. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



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
# File 'lib/algolia/api/composition_client.rb', line 264

def delete_composition_with_http_info(composition_id, request_options = {})
  # verify the required parameter 'composition_id' is set
  if @api_client.config.client_side_validation && composition_id.nil?
    raise ArgumentError, "Parameter `composition_id` is required when calling `delete_composition`."
  end
  # verify the required parameter 'composition_id' is not empty
  if @api_client.config.client_side_validation && composition_id.empty?
    raise ArgumentError, "Parameter `composition_id` is required when calling `delete_composition`."
  end

  path = "/1/compositions/{compositionID}".sub(
    "{" + "compositionID" + "}",
    Transport.encode_uri(composition_id.to_s)
  )
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :"CompositionClient.delete_composition",
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:DELETE, path, new_options)
end

#get_composition(composition_id, request_options = {}) ⇒ Composition

Retrieve a single composition in the current Algolia application.

Required API Key ACLs:

- editSettings
- settings

Parameters:

  • composition_id (String)

    Unique Composition ObjectID. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



416
417
418
419
# File 'lib/algolia/api/composition_client.rb', line 416

def get_composition(composition_id, request_options = {})
  response = get_composition_with_http_info(composition_id, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || "Composition::Composition")
end

#get_composition_with_http_info(composition_id, request_options = {}) ⇒ Http::Response

Retrieve a single composition in the current Algolia application.

Required API Key ACLs:

- editSettings
- settings

Parameters:

  • composition_id (String)

    Unique Composition ObjectID. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



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
# File 'lib/algolia/api/composition_client.rb', line 376

def get_composition_with_http_info(composition_id, request_options = {})
  # verify the required parameter 'composition_id' is set
  if @api_client.config.client_side_validation && composition_id.nil?
    raise ArgumentError, "Parameter `composition_id` is required when calling `get_composition`."
  end
  # verify the required parameter 'composition_id' is not empty
  if @api_client.config.client_side_validation && composition_id.empty?
    raise ArgumentError, "Parameter `composition_id` is required when calling `get_composition`."
  end

  path = "/1/compositions/{compositionID}".sub(
    "{" + "compositionID" + "}",
    Transport.encode_uri(composition_id.to_s)
  )
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :"CompositionClient.get_composition",
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#get_rule(composition_id, algolia_object_id, request_options = {}) ⇒ CompositionRule

Retrieves a rule by its ID. To find the object ID of a rule, use the [‘search` operation](www.algolia.com/doc/rest-api/composition/search-composition-rules).

Required API Key ACLs:

- editSettings
- settings

Parameters:

  • composition_id (String)

    Unique Composition ObjectID. (required)

  • algolia_object_id (String)

    Unique identifier of a rule object. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (CompositionRule)


478
479
480
481
# File 'lib/algolia/api/composition_client.rb', line 478

def get_rule(composition_id, algolia_object_id, request_options = {})
  response = get_rule_with_http_info(composition_id, algolia_object_id, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || "Composition::CompositionRule")
end

#get_rule_with_http_info(composition_id, algolia_object_id, request_options = {}) ⇒ Http::Response

Retrieves a rule by its ID. To find the object ID of a rule, use the [‘search` operation](www.algolia.com/doc/rest-api/composition/search-composition-rules).

Required API Key ACLs:

- editSettings
- settings

Parameters:

  • composition_id (String)

    Unique Composition ObjectID. (required)

  • algolia_object_id (String)

    Unique identifier of a rule object. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



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
# File 'lib/algolia/api/composition_client.rb', line 430

def get_rule_with_http_info(composition_id, algolia_object_id, request_options = {})
  # verify the required parameter 'composition_id' is set
  if @api_client.config.client_side_validation && composition_id.nil?
    raise ArgumentError, "Parameter `composition_id` is required when calling `get_rule`."
  end
  # verify the required parameter 'composition_id' is not empty
  if @api_client.config.client_side_validation && composition_id.empty?
    raise ArgumentError, "Parameter `composition_id` is required when calling `get_rule`."
  end
  # verify the required parameter 'algolia_object_id' is set
  if @api_client.config.client_side_validation && algolia_object_id.nil?
    raise ArgumentError, "Parameter `algolia_object_id` is required when calling `get_rule`."
  end
  # verify the required parameter 'algolia_object_id' is not empty
  if @api_client.config.client_side_validation && algolia_object_id.empty?
    raise ArgumentError, "Parameter `algolia_object_id` is required when calling `get_rule`."
  end

  path = "/1/compositions/{compositionID}/rules/{objectID}"
    .sub("{" + "compositionID" + "}", Transport.encode_uri(composition_id.to_s))
    .sub("{" + "objectID" + "}", Transport.encode_uri(algolia_object_id.to_s))
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :"CompositionClient.get_rule",
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#get_task(composition_id, task_id, request_options = {}) ⇒ GetTaskResponse

Checks the status of a given task.

Required API Key ACLs:

- editSettings
- settings
- addObject
- deleteObject
- deleteIndex

Parameters:

  • composition_id (String)

    Unique Composition ObjectID. (required)

  • task_id (Integer)

    Unique task identifier. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (GetTaskResponse)


542
543
544
545
# File 'lib/algolia/api/composition_client.rb', line 542

def get_task(composition_id, task_id, request_options = {})
  response = get_task_with_http_info(composition_id, task_id, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || "Composition::GetTaskResponse")
end

#get_task_with_http_info(composition_id, task_id, request_options = {}) ⇒ Http::Response

Checks the status of a given task.

Required API Key ACLs:

- editSettings
- settings
- addObject
- deleteObject
- deleteIndex

Parameters:

  • composition_id (String)

    Unique Composition ObjectID. (required)

  • task_id (Integer)

    Unique task identifier. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



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
# File 'lib/algolia/api/composition_client.rb', line 495

def get_task_with_http_info(composition_id, task_id, request_options = {})
  # verify the required parameter 'composition_id' is set
  if @api_client.config.client_side_validation && composition_id.nil?
    raise ArgumentError, "Parameter `composition_id` is required when calling `get_task`."
  end
  # verify the required parameter 'composition_id' is not empty
  if @api_client.config.client_side_validation && composition_id.empty?
    raise ArgumentError, "Parameter `composition_id` is required when calling `get_task`."
  end
  # verify the required parameter 'task_id' is set
  if @api_client.config.client_side_validation && task_id.nil?
    raise ArgumentError, "Parameter `task_id` is required when calling `get_task`."
  end

  path = "/1/compositions/{compositionID}/task/{taskID}"
    .sub("{" + "compositionID" + "}", Transport.encode_uri(composition_id.to_s))
    .sub("{" + "taskID" + "}", Transport.encode_uri(task_id.to_s))
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :"CompositionClient.get_task",
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#list_compositions(page = nil, hits_per_page = nil, request_options = {}) ⇒ ListCompositionsResponse

Lists all compositions in the current Algolia application.

Required API Key ACLs:

- editSettings
- settings

Parameters:

  • page (Integer) (defaults to: nil)

    Requested page of the API response. If ‘null`, the API response is not paginated.

  • hits_per_page (Integer) (defaults to: nil)

    Number of hits per page. (default to 100)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (ListCompositionsResponse)


587
588
589
590
591
592
593
# File 'lib/algolia/api/composition_client.rb', line 587

def list_compositions(page = nil, hits_per_page = nil, request_options = {})
  response = list_compositions_with_http_info(page, hits_per_page, request_options)
  @api_client.deserialize(
    response.body,
    request_options[:debug_return_type] || "Composition::ListCompositionsResponse"
  )
end

#list_compositions_with_http_info(page = nil, hits_per_page = nil, request_options = {}) ⇒ Http::Response

Lists all compositions in the current Algolia application.

Required API Key ACLs:

- editSettings
- settings

Parameters:

  • page (Integer) (defaults to: nil)

    Requested page of the API response. If ‘null`, the API response is not paginated.

  • hits_per_page (Integer) (defaults to: nil)

    Number of hits per page. (default to 100)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
# File 'lib/algolia/api/composition_client.rb', line 556

def list_compositions_with_http_info(page = nil, hits_per_page = nil, request_options = {})
  path = "/1/compositions"
  query_params = {}
  query_params[:page] = page unless page.nil?
  query_params[:hitsPerPage] = hits_per_page unless hits_per_page.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :"CompositionClient.list_compositions",
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#multiple_batch(batch_params, request_options = {}) ⇒ MultipleBatchResponse

Adds, updates, or deletes compositions with a single API request.

Required API Key ACLs:

- editSettings

Parameters:

  • batch_params (BatchParams)

    (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (MultipleBatchResponse)


634
635
636
637
638
639
640
# File 'lib/algolia/api/composition_client.rb', line 634

def multiple_batch(batch_params, request_options = {})
  response = multiple_batch_with_http_info(batch_params, request_options)
  @api_client.deserialize(
    response.body,
    request_options[:debug_return_type] || "Composition::MultipleBatchResponse"
  )
end

#multiple_batch_with_http_info(batch_params, request_options = {}) ⇒ Http::Response

Adds, updates, or deletes compositions with a single API request.

Required API Key ACLs:

- editSettings

Parameters:

  • batch_params (BatchParams)

    (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
# File 'lib/algolia/api/composition_client.rb', line 602

def multiple_batch_with_http_info(batch_params, request_options = {})
  # verify the required parameter 'batch_params' is set
  if @api_client.config.client_side_validation && batch_params.nil?
    raise ArgumentError, "Parameter `batch_params` is required when calling `multiple_batch`."
  end

  path = "/1/compositions/*/batch"
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(batch_params)

  new_options = request_options.merge(
    :operation => :"CompositionClient.multiple_batch",
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:POST, path, new_options)
end

#put_composition(composition_id, composition, request_options = {}) ⇒ TaskIDResponse

Update and insert a composition in the current Algolia application.

Required API Key ACLs:

- editSettings

Parameters:

  • composition_id (String)

    Unique Composition ObjectID. (required)

  • composition (Composition)

    (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (TaskIDResponse)


694
695
696
697
# File 'lib/algolia/api/composition_client.rb', line 694

def put_composition(composition_id, composition, request_options = {})
  response = put_composition_with_http_info(composition_id, composition, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || "Composition::TaskIDResponse")
end

#put_composition_rule(composition_id, algolia_object_id, composition_rule, request_options = {}) ⇒ TaskIDResponse

If a composition rule with the provided ID already exists, it’s replaced. Otherwise, a new one is added.

Required API Key ACLs:

- editSettings

Parameters:

  • composition_id (String)

    Unique Composition ObjectID. (required)

  • algolia_object_id (String)

    Unique identifier of a rule object. (required)

  • composition_rule (CompositionRule)

    (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (TaskIDResponse)


760
761
762
763
764
765
766
767
768
# File 'lib/algolia/api/composition_client.rb', line 760

def put_composition_rule(composition_id, algolia_object_id, composition_rule, request_options = {})
  response = put_composition_rule_with_http_info(
    composition_id,
    algolia_object_id,
    composition_rule,
    request_options
  )
  @api_client.deserialize(response.body, request_options[:debug_return_type] || "Composition::TaskIDResponse")
end

#put_composition_rule_with_http_info(composition_id, algolia_object_id, composition_rule, request_options = {}) ⇒ Http::Response

If a composition rule with the provided ID already exists, it’s replaced. Otherwise, a new one is added.

Required API Key ACLs:

- editSettings

Parameters:

  • composition_id (String)

    Unique Composition ObjectID. (required)

  • algolia_object_id (String)

    Unique identifier of a rule object. (required)

  • composition_rule (CompositionRule)

    (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
# File 'lib/algolia/api/composition_client.rb', line 708

def put_composition_rule_with_http_info(composition_id, algolia_object_id, composition_rule, request_options = {})
  # verify the required parameter 'composition_id' is set
  if @api_client.config.client_side_validation && composition_id.nil?
    raise ArgumentError, "Parameter `composition_id` is required when calling `put_composition_rule`."
  end
  # verify the required parameter 'composition_id' is not empty
  if @api_client.config.client_side_validation && composition_id.empty?
    raise ArgumentError, "Parameter `composition_id` is required when calling `put_composition_rule`."
  end
  # verify the required parameter 'algolia_object_id' is set
  if @api_client.config.client_side_validation && algolia_object_id.nil?
    raise ArgumentError, "Parameter `algolia_object_id` is required when calling `put_composition_rule`."
  end
  # verify the required parameter 'algolia_object_id' is not empty
  if @api_client.config.client_side_validation && algolia_object_id.empty?
    raise ArgumentError, "Parameter `algolia_object_id` is required when calling `put_composition_rule`."
  end
  # verify the required parameter 'composition_rule' is set
  if @api_client.config.client_side_validation && composition_rule.nil?
    raise ArgumentError, "Parameter `composition_rule` is required when calling `put_composition_rule`."
  end

  path = "/1/compositions/{compositionID}/rules/{objectID}"
    .sub("{" + "compositionID" + "}", Transport.encode_uri(composition_id.to_s))
    .sub("{" + "objectID" + "}", Transport.encode_uri(algolia_object_id.to_s))
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(composition_rule)

  new_options = request_options.merge(
    :operation => :"CompositionClient.put_composition_rule",
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:PUT, path, new_options)
end

#put_composition_with_http_info(composition_id, composition, request_options = {}) ⇒ Http::Response

Update and insert a composition in the current Algolia application.

Required API Key ACLs:

- editSettings

Parameters:

  • composition_id (String)

    Unique Composition ObjectID. (required)

  • composition (Composition)

    (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



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
680
681
682
683
684
# File 'lib/algolia/api/composition_client.rb', line 650

def put_composition_with_http_info(composition_id, composition, request_options = {})
  # verify the required parameter 'composition_id' is set
  if @api_client.config.client_side_validation && composition_id.nil?
    raise ArgumentError, "Parameter `composition_id` is required when calling `put_composition`."
  end
  # verify the required parameter 'composition_id' is not empty
  if @api_client.config.client_side_validation && composition_id.empty?
    raise ArgumentError, "Parameter `composition_id` is required when calling `put_composition`."
  end
  # verify the required parameter 'composition' is set
  if @api_client.config.client_side_validation && composition.nil?
    raise ArgumentError, "Parameter `composition` is required when calling `put_composition`."
  end

  path = "/1/compositions/{compositionID}".sub(
    "{" + "compositionID" + "}",
    Transport.encode_uri(composition_id.to_s)
  )
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(composition)

  new_options = request_options.merge(
    :operation => :"CompositionClient.put_composition",
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:PUT, path, new_options)
end

#save_rules(composition_id, rules, request_options = {}) ⇒ RulesMultipleBatchResponse

Create or update or delete multiple composition rules.

Required API Key ACLs:

- editSettings

Parameters:

  • composition_id (String)

    Unique Composition ObjectID. (required)

  • rules (CompositionRulesBatchParams)

    (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (RulesMultipleBatchResponse)


822
823
824
825
826
827
828
# File 'lib/algolia/api/composition_client.rb', line 822

def save_rules(composition_id, rules, request_options = {})
  response = save_rules_with_http_info(composition_id, rules, request_options)
  @api_client.deserialize(
    response.body,
    request_options[:debug_return_type] || "Composition::RulesMultipleBatchResponse"
  )
end

#save_rules_with_http_info(composition_id, rules, request_options = {}) ⇒ Http::Response

Create or update or delete multiple composition rules.

Required API Key ACLs:

- editSettings

Parameters:

  • composition_id (String)

    Unique Composition ObjectID. (required)

  • rules (CompositionRulesBatchParams)

    (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
# File 'lib/algolia/api/composition_client.rb', line 778

def save_rules_with_http_info(composition_id, rules, request_options = {})
  # verify the required parameter 'composition_id' is set
  if @api_client.config.client_side_validation && composition_id.nil?
    raise ArgumentError, "Parameter `composition_id` is required when calling `save_rules`."
  end
  # verify the required parameter 'composition_id' is not empty
  if @api_client.config.client_side_validation && composition_id.empty?
    raise ArgumentError, "Parameter `composition_id` is required when calling `save_rules`."
  end
  # verify the required parameter 'rules' is set
  if @api_client.config.client_side_validation && rules.nil?
    raise ArgumentError, "Parameter `rules` is required when calling `save_rules`."
  end

  path = "/1/compositions/{compositionID}/rules/batch".sub(
    "{" + "compositionID" + "}",
    Transport.encode_uri(composition_id.to_s)
  )
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(rules)

  new_options = request_options.merge(
    :operation => :"CompositionClient.save_rules",
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:POST, path, new_options)
end

#search(composition_id, request_body, request_options = {}) ⇒ SearchResponse

Runs a query on a single composition and returns matching results.

Required API Key ACLs:

- search

Parameters:

  • composition_id (String)

    Unique Composition ObjectID. (required)

  • request_body (RequestBody)

    (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (SearchResponse)


882
883
884
885
# File 'lib/algolia/api/composition_client.rb', line 882

def search(composition_id, request_body, request_options = {})
  response = search_with_http_info(composition_id, request_body, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || "Composition::SearchResponse")
end

#search_composition_rules(composition_id, search_composition_rules_params = nil, request_options = {}) ⇒ SearchCompositionRulesResponse

Searches for composition rules in your index.

Required API Key ACLs:

- settings

Parameters:

  • composition_id (String)

    Unique Composition ObjectID. (required)

  • search_composition_rules_params (SearchCompositionRulesParams) (defaults to: nil)
  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (SearchCompositionRulesResponse)


939
940
941
942
943
944
945
946
947
948
949
# File 'lib/algolia/api/composition_client.rb', line 939

def search_composition_rules(composition_id, search_composition_rules_params = nil, request_options = {})
  response = search_composition_rules_with_http_info(
    composition_id,
    search_composition_rules_params,
    request_options
  )
  @api_client.deserialize(
    response.body,
    request_options[:debug_return_type] || "Composition::SearchCompositionRulesResponse"
  )
end

#search_composition_rules_with_http_info(composition_id, search_composition_rules_params = nil, request_options = {}) ⇒ Http::Response

Searches for composition rules in your index.

Required API Key ACLs:

- settings

Parameters:

  • composition_id (String)

    Unique Composition ObjectID. (required)

  • search_composition_rules_params (SearchCompositionRulesParams) (defaults to: nil)
  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
# File 'lib/algolia/api/composition_client.rb', line 895

def search_composition_rules_with_http_info(
  composition_id,
  search_composition_rules_params = nil,
  request_options = {}
)
  # verify the required parameter 'composition_id' is set
  if @api_client.config.client_side_validation && composition_id.nil?
    raise ArgumentError, "Parameter `composition_id` is required when calling `search_composition_rules`."
  end
  # verify the required parameter 'composition_id' is not empty
  if @api_client.config.client_side_validation && composition_id.empty?
    raise ArgumentError, "Parameter `composition_id` is required when calling `search_composition_rules`."
  end

  path = "/1/compositions/{compositionID}/rules/search".sub(
    "{" + "compositionID" + "}",
    Transport.encode_uri(composition_id.to_s)
  )
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(search_composition_rules_params)

  new_options = request_options.merge(
    :operation => :"CompositionClient.search_composition_rules",
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:POST, path, new_options)
end

#search_for_facet_values(composition_id, facet_name, search_for_facet_values_request = nil, request_options = {}) ⇒ SearchForFacetValuesResponse

Searches for values of a specified facet attribute on the composition’s main source’s index. - By default, facet values are sorted by decreasing count. You can adjust this with the ‘sortFacetValueBy` parameter. - Searching for facet values doesn’t work if you have **more than 65 searchable facets and searchable attributes combined**.

Required API Key ACLs:

- search

Parameters:

  • composition_id (String)

    Unique Composition ObjectID. (required)

  • facet_name (String)

    Facet attribute in which to search for values. This attribute must be included in the ‘attributesForFaceting` index setting with the `searchable()` modifier. (required)

  • search_for_facet_values_request (SearchForFacetValuesRequest) (defaults to: nil)
  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (SearchForFacetValuesResponse)


1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
# File 'lib/algolia/api/composition_client.rb', line 1013

def search_for_facet_values(composition_id, facet_name, search_for_facet_values_request = nil, request_options = {})
  response = search_for_facet_values_with_http_info(
    composition_id,
    facet_name,
    search_for_facet_values_request,
    request_options
  )
  @api_client.deserialize(
    response.body,
    request_options[:debug_return_type] || "Composition::SearchForFacetValuesResponse"
  )
end

#search_for_facet_values_with_http_info(composition_id, facet_name, search_for_facet_values_request = nil, request_options = {}) ⇒ Http::Response

Searches for values of a specified facet attribute on the composition’s main source’s index. - By default, facet values are sorted by decreasing count. You can adjust this with the ‘sortFacetValueBy` parameter. - Searching for facet values doesn’t work if you have **more than 65 searchable facets and searchable attributes combined**.

Required API Key ACLs:

- search

Parameters:

  • composition_id (String)

    Unique Composition ObjectID. (required)

  • facet_name (String)

    Facet attribute in which to search for values. This attribute must be included in the ‘attributesForFaceting` index setting with the `searchable()` modifier. (required)

  • search_for_facet_values_request (SearchForFacetValuesRequest) (defaults to: nil)
  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
# File 'lib/algolia/api/composition_client.rb', line 960

def search_for_facet_values_with_http_info(
  composition_id,
  facet_name,
  search_for_facet_values_request = nil,
  request_options = {}
)
  # verify the required parameter 'composition_id' is set
  if @api_client.config.client_side_validation && composition_id.nil?
    raise ArgumentError, "Parameter `composition_id` is required when calling `search_for_facet_values`."
  end
  # verify the required parameter 'composition_id' is not empty
  if @api_client.config.client_side_validation && composition_id.empty?
    raise ArgumentError, "Parameter `composition_id` is required when calling `search_for_facet_values`."
  end
  # verify the required parameter 'facet_name' is set
  if @api_client.config.client_side_validation && facet_name.nil?
    raise ArgumentError, "Parameter `facet_name` is required when calling `search_for_facet_values`."
  end
  # verify the required parameter 'facet_name' is not empty
  if @api_client.config.client_side_validation && facet_name.empty?
    raise ArgumentError, "Parameter `facet_name` is required when calling `search_for_facet_values`."
  end

  path = "/1/compositions/{compositionID}/facets/{facetName}/query"
    .sub("{" + "compositionID" + "}", Transport.encode_uri(composition_id.to_s))
    .sub("{" + "facetName" + "}", Transport.encode_uri(facet_name.to_s))
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(search_for_facet_values_request)

  new_options = request_options.merge(
    :operation => :"CompositionClient.search_for_facet_values",
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => true
  )

  @api_client.call_api(:POST, path, new_options)
end

#search_with_http_info(composition_id, request_body, request_options = {}) ⇒ Http::Response

Runs a query on a single composition and returns matching results.

Required API Key ACLs:

- search

Parameters:

  • composition_id (String)

    Unique Composition ObjectID. (required)

  • request_body (RequestBody)

    (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
# File 'lib/algolia/api/composition_client.rb', line 838

def search_with_http_info(composition_id, request_body, request_options = {})
  # verify the required parameter 'composition_id' is set
  if @api_client.config.client_side_validation && composition_id.nil?
    raise ArgumentError, "Parameter `composition_id` is required when calling `search`."
  end
  # verify the required parameter 'composition_id' is not empty
  if @api_client.config.client_side_validation && composition_id.empty?
    raise ArgumentError, "Parameter `composition_id` is required when calling `search`."
  end
  # verify the required parameter 'request_body' is set
  if @api_client.config.client_side_validation && request_body.nil?
    raise ArgumentError, "Parameter `request_body` is required when calling `search`."
  end

  path = "/1/compositions/{compositionID}/run".sub(
    "{" + "compositionID" + "}",
    Transport.encode_uri(composition_id.to_s)
  )
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(request_body)

  new_options = request_options.merge(
    :operation => :"CompositionClient.search",
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => true
  )

  @api_client.call_api(:POST, path, new_options)
end

#set_client_api_key(api_key) ⇒ void

This method returns an undefined value.

Helper method to switch the API key used to authenticate the requests.

Parameters:

  • api_key (String)

    the new API key to use.



53
54
55
56
57
# File 'lib/algolia/api/composition_client.rb', line 53

def set_client_api_key(api_key)
  @api_client.set_client_api_key(api_key)

  self
end

#update_sorting_strategy_composition(composition_id, request_body, request_options = {}) ⇒ TaskIDResponse

Updates the "sortingStrategy" field of an existing composition. This endpoint lets you create a new sorting strategy mapping or replace the configured one. The provided sorting indices must be associated indices or replicas of the main targeted index. This endpoint can’t validate whether the sort index is related to the composition’s main index. Validation fails at runtime if the index you updated isn’t related. The update is applied to the specified composition within the current Algolia application and returns a taskID that can be used to track the operation’s completion.

Required API Key ACLs:

- editSettings

Parameters:

  • composition_id (String)

    Unique Composition ObjectID. (required)

  • request_body (Hash<String, String>)

    (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (TaskIDResponse)


1084
1085
1086
1087
# File 'lib/algolia/api/composition_client.rb', line 1084

def update_sorting_strategy_composition(composition_id, request_body, request_options = {})
  response = update_sorting_strategy_composition_with_http_info(composition_id, request_body, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || "Composition::TaskIDResponse")
end

#update_sorting_strategy_composition_with_http_info(composition_id, request_body, request_options = {}) ⇒ Http::Response

Updates the "sortingStrategy" field of an existing composition. This endpoint lets you create a new sorting strategy mapping or replace the configured one. The provided sorting indices must be associated indices or replicas of the main targeted index. This endpoint can’t validate whether the sort index is related to the composition’s main index. Validation fails at runtime if the index you updated isn’t related. The update is applied to the specified composition within the current Algolia application and returns a taskID that can be used to track the operation’s completion.

Required API Key ACLs:

- editSettings

Parameters:

  • composition_id (String)

    Unique Composition ObjectID. (required)

  • request_body (Hash<String, String>)

    (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
# File 'lib/algolia/api/composition_client.rb', line 1034

def update_sorting_strategy_composition_with_http_info(composition_id, request_body, request_options = {})
  # verify the required parameter 'composition_id' is set
  if @api_client.config.client_side_validation && composition_id.nil?
    raise(
      ArgumentError,
      "Parameter `composition_id` is required when calling `update_sorting_strategy_composition`."
    )
  end
  # verify the required parameter 'composition_id' is not empty
  if @api_client.config.client_side_validation && composition_id.empty?
    raise(
      ArgumentError,
      "Parameter `composition_id` is required when calling `update_sorting_strategy_composition`."
    )
  end
  # verify the required parameter 'request_body' is set
  if @api_client.config.client_side_validation && request_body.nil?
    raise ArgumentError, "Parameter `request_body` is required when calling `update_sorting_strategy_composition`."
  end

  path = "/1/compositions/{compositionID}/sortingStrategy".sub(
    "{" + "compositionID" + "}",
    Transport.encode_uri(composition_id.to_s)
  )
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(request_body)

  new_options = request_options.merge(
    :operation => :"CompositionClient.update_sorting_strategy_composition",
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:POST, path, new_options)
end