Class: Brevo::ContactsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/brevo/api/contacts_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ContactsApi

Returns a new instance of ContactsApi.



19
20
21
# File 'lib/brevo/api/contacts_api.rb', line 19

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/brevo/api/contacts_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#add_contact_to_list(list_id, contact_emails, opts = {}) ⇒ PostContactInfo

Add existing contacts to a list

Parameters:

  • list_id

    Id of the list

  • contact_emails

    Emails addresses OR IDs OR EXT_ID attributes of the contacts

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

    the optional parameters

Returns:



37
38
39
40
# File 'lib/brevo/api/contacts_api.rb', line 37

def add_contact_to_list(list_id, contact_emails, opts = {})
  data, _status_code, _headers = add_contact_to_list_with_http_info(list_id, contact_emails, opts)
  data
end

#add_contact_to_list_with_http_info(list_id, contact_emails, opts = {}) ⇒ Array<(PostContactInfo, Fixnum, Hash)>

Add existing contacts to a list

Parameters:

  • list_id

    Id of the list

  • contact_emails

    Emails addresses OR IDs OR EXT_ID attributes of the contacts

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

    the optional parameters

Returns:

  • (Array<(PostContactInfo, Fixnum, Hash)>)

    PostContactInfo data, response status code and response headers



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
# File 'lib/brevo/api/contacts_api.rb', line 47

def add_contact_to_list_with_http_info(list_id, contact_emails, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactsApi.add_contact_to_list ...'
  end
  # verify the required parameter 'list_id' is set
  if @api_client.config.client_side_validation && list_id.nil?
    fail ArgumentError, "Missing the required parameter 'list_id' when calling ContactsApi.add_contact_to_list"
  end
  # verify the required parameter 'contact_emails' is set
  if @api_client.config.client_side_validation && contact_emails.nil?
    fail ArgumentError, "Missing the required parameter 'contact_emails' when calling ContactsApi.add_contact_to_list"
  end
  # resource path
  local_var_path = '/contacts/lists/{listId}/contacts/add'.sub('{' + 'listId' + '}', list_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  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 = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(contact_emails)
  auth_names = ['api-key', 'partner-key']
  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 => 'PostContactInfo')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#add_contact_to_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_attribute(attribute_category, attribute_name, create_attribute, opts = {}) ⇒ nil

Create contact attribute

Parameters:

  • attribute_category

    Category of the attribute

  • attribute_name

    Name of the attribute

  • create_attribute

    Values to create an attribute

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

    the optional parameters

Returns:

  • (nil)


96
97
98
99
# File 'lib/brevo/api/contacts_api.rb', line 96

def create_attribute(attribute_category, attribute_name, create_attribute, opts = {})
  create_attribute_with_http_info(attribute_category, attribute_name, create_attribute, opts)
  nil
end

#create_attribute_with_http_info(attribute_category, attribute_name, create_attribute, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Create contact attribute

Parameters:

  • attribute_category

    Category of the attribute

  • attribute_name

    Name of the attribute

  • create_attribute

    Values to create an attribute

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
153
154
155
156
# File 'lib/brevo/api/contacts_api.rb', line 107

def create_attribute_with_http_info(attribute_category, attribute_name, create_attribute, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactsApi.create_attribute ...'
  end
  # verify the required parameter 'attribute_category' is set
  if @api_client.config.client_side_validation && attribute_category.nil?
    fail ArgumentError, "Missing the required parameter 'attribute_category' when calling ContactsApi.create_attribute"
  end
  # verify enum value
  if @api_client.config.client_side_validation && !['normal', 'transactional', 'category', 'calculated', 'global'].include?(attribute_category)
    fail ArgumentError, "invalid value for 'attribute_category', must be one of normal, transactional, category, calculated, global"
  end
  # verify the required parameter 'attribute_name' is set
  if @api_client.config.client_side_validation && attribute_name.nil?
    fail ArgumentError, "Missing the required parameter 'attribute_name' when calling ContactsApi.create_attribute"
  end
  # verify the required parameter 'create_attribute' is set
  if @api_client.config.client_side_validation && create_attribute.nil?
    fail ArgumentError, "Missing the required parameter 'create_attribute' when calling ContactsApi.create_attribute"
  end
  # resource path
  local_var_path = '/contacts/attributes/{attributeCategory}/{attributeName}'.sub('{' + 'attributeCategory' + '}', attribute_category.to_s).sub('{' + 'attributeName' + '}', attribute_name.to_s)

  # query parameters
  query_params = {}

  # header parameters
  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 = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(create_attribute)
  auth_names = ['api-key', 'partner-key']
  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)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#create_attribute\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_contact(create_contact, opts = {}) ⇒ CreateUpdateContactModel

Create a contact Creates new contacts on Brevo. Contacts can be created by passing either -
1. email address of the contact (email_id),
2. phone number of the contact (to be passed as "SMS" field in "attributes" along with proper country code), For example- "SMS":"+91xxxxxxxxxx" or "SMS":"0091xxxxxxxxxx"
3. ext_id

Parameters:

  • create_contact

    Values to create a contact

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

    the optional parameters

Returns:



162
163
164
165
# File 'lib/brevo/api/contacts_api.rb', line 162

def create_contact(create_contact, opts = {})
  data, _status_code, _headers = create_contact_with_http_info(create_contact, opts)
  data
end

#create_contact_with_http_info(create_contact, opts = {}) ⇒ Array<(CreateUpdateContactModel, Fixnum, Hash)>

Create a contact Creates new contacts on Brevo. Contacts can be created by passing either - &lt;br&gt;&lt;br&gt; 1. email address of the contact (email_id), &lt;br&gt; 2. phone number of the contact (to be passed as &quot;SMS&quot; field in &quot;attributes&quot; along with proper country code), For example- &quot;SMS&quot;:&quot;+91xxxxxxxxxx&quot; or &quot;SMS&quot;:&quot;0091xxxxxxxxxx&quot; &lt;br&gt; 3. ext_id &lt;br&gt;

Parameters:

  • create_contact

    Values to create a contact

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

    the optional parameters

Returns:

  • (Array<(CreateUpdateContactModel, Fixnum, Hash)>)

    CreateUpdateContactModel 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
# File 'lib/brevo/api/contacts_api.rb', line 172

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

  # query parameters
  query_params = {}

  # header parameters
  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 = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(create_contact)
  auth_names = ['api-key', 'partner-key']
  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 => 'CreateUpdateContactModel')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#create_contact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_doi_contact(create_doi_contact, opts = {}) ⇒ nil

Create Contact via DOI (Double-Opt-In) Flow

Parameters:

  • create_doi_contact

    Values to create the Double opt-in (DOI) contact

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

    the optional parameters

Returns:

  • (nil)


215
216
217
218
# File 'lib/brevo/api/contacts_api.rb', line 215

def create_doi_contact(create_doi_contact, opts = {})
  create_doi_contact_with_http_info(create_doi_contact, opts)
  nil
end

#create_doi_contact_with_http_info(create_doi_contact, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Create Contact via DOI (Double-Opt-In) Flow

Parameters:

  • create_doi_contact

    Values to create the Double opt-in (DOI) contact

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



224
225
226
227
228
229
230
231
232
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
# File 'lib/brevo/api/contacts_api.rb', line 224

def create_doi_contact_with_http_info(create_doi_contact, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactsApi.create_doi_contact ...'
  end
  # verify the required parameter 'create_doi_contact' is set
  if @api_client.config.client_side_validation && create_doi_contact.nil?
    fail ArgumentError, "Missing the required parameter 'create_doi_contact' when calling ContactsApi.create_doi_contact"
  end
  # resource path
  local_var_path = '/contacts/doubleOptinConfirmation'

  # query parameters
  query_params = {}

  # header parameters
  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 = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(create_doi_contact)
  auth_names = ['api-key', 'partner-key']
  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)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#create_doi_contact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_folder(create_folder, opts = {}) ⇒ CreateModel

Create a folder

Parameters:

  • create_folder

    Name of the folder

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

    the optional parameters

Returns:



266
267
268
269
# File 'lib/brevo/api/contacts_api.rb', line 266

def create_folder(create_folder, opts = {})
  data, _status_code, _headers = create_folder_with_http_info(create_folder, opts)
  data
end

#create_folder_with_http_info(create_folder, opts = {}) ⇒ Array<(CreateModel, Fixnum, Hash)>

Create a folder

Parameters:

  • create_folder

    Name of the folder

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

    the optional parameters

Returns:

  • (Array<(CreateModel, Fixnum, Hash)>)

    CreateModel data, response status code and response headers



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
303
304
305
306
307
308
309
310
311
312
313
# File 'lib/brevo/api/contacts_api.rb', line 275

def create_folder_with_http_info(create_folder, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactsApi.create_folder ...'
  end
  # verify the required parameter 'create_folder' is set
  if @api_client.config.client_side_validation && create_folder.nil?
    fail ArgumentError, "Missing the required parameter 'create_folder' when calling ContactsApi.create_folder"
  end
  # resource path
  local_var_path = '/contacts/folders'

  # query parameters
  query_params = {}

  # header parameters
  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 = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(create_folder)
  auth_names = ['api-key', 'partner-key']
  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 => 'CreateModel')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#create_folder\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_list(create_list, opts = {}) ⇒ CreateModel

Create a list

Parameters:

  • create_list

    Values to create a list

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

    the optional parameters

Returns:



318
319
320
321
# File 'lib/brevo/api/contacts_api.rb', line 318

def create_list(create_list, opts = {})
  data, _status_code, _headers = create_list_with_http_info(create_list, opts)
  data
end

#create_list_with_http_info(create_list, opts = {}) ⇒ Array<(CreateModel, Fixnum, Hash)>

Create a list

Parameters:

  • create_list

    Values to create a list

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

    the optional parameters

Returns:

  • (Array<(CreateModel, Fixnum, Hash)>)

    CreateModel data, response status code and response headers



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
# File 'lib/brevo/api/contacts_api.rb', line 327

def create_list_with_http_info(create_list, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactsApi.create_list ...'
  end
  # verify the required parameter 'create_list' is set
  if @api_client.config.client_side_validation && create_list.nil?
    fail ArgumentError, "Missing the required parameter 'create_list' when calling ContactsApi.create_list"
  end
  # resource path
  local_var_path = '/contacts/lists'

  # query parameters
  query_params = {}

  # header parameters
  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 = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(create_list)
  auth_names = ['api-key', 'partner-key']
  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 => 'CreateModel')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#create_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_attribute(attribute_category, attribute_name, opts = {}) ⇒ nil

Delete an attribute

Parameters:

  • attribute_category

    Category of the attribute

  • attribute_name

    Name of the existing attribute

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

    the optional parameters

Returns:

  • (nil)


371
372
373
374
# File 'lib/brevo/api/contacts_api.rb', line 371

def delete_attribute(attribute_category, attribute_name, opts = {})
  delete_attribute_with_http_info(attribute_category, attribute_name, opts)
  nil
end

#delete_attribute_with_http_info(attribute_category, attribute_name, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Delete an attribute

Parameters:

  • attribute_category

    Category of the attribute

  • attribute_name

    Name of the existing attribute

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
# File 'lib/brevo/api/contacts_api.rb', line 381

def delete_attribute_with_http_info(attribute_category, attribute_name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactsApi.delete_attribute ...'
  end
  # verify the required parameter 'attribute_category' is set
  if @api_client.config.client_side_validation && attribute_category.nil?
    fail ArgumentError, "Missing the required parameter 'attribute_category' when calling ContactsApi.delete_attribute"
  end
  # verify enum value
  if @api_client.config.client_side_validation && !['normal', 'transactional', 'category', 'calculated', 'global'].include?(attribute_category)
    fail ArgumentError, "invalid value for 'attribute_category', must be one of normal, transactional, category, calculated, global"
  end
  # verify the required parameter 'attribute_name' is set
  if @api_client.config.client_side_validation && attribute_name.nil?
    fail ArgumentError, "Missing the required parameter 'attribute_name' when calling ContactsApi.delete_attribute"
  end
  # resource path
  local_var_path = '/contacts/attributes/{attributeCategory}/{attributeName}'.sub('{' + 'attributeCategory' + '}', attribute_category.to_s).sub('{' + 'attributeName' + '}', attribute_name.to_s)

  # query parameters
  query_params = {}

  # header parameters
  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 = {}

  # http body (model)
  post_body = nil
  auth_names = ['api-key', 'partner-key']
  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)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#delete_attribute\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_contact(identifier, opts = {}) ⇒ nil

Delete a contact There are 2 ways to delete a contact
Option 1- api.brevo.com/v3/contacts/identifier
Option 2- api.brevo.com/v3/contacts/identifier?identifierType={}

Option 1 only works if identifierType is email_id (for EMAIL) or contact_id (for ID of the contact),where you can directly pass the value of EMAIL and ID of the contact.
Option 2 works for all identifierType, use email_id for EMAIL attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute.

Parameters:

  • identifier

    Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded)

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

    the optional parameters

Options Hash (opts):

  • :identifier_type (String)

    email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute

Returns:

  • (nil)


433
434
435
436
# File 'lib/brevo/api/contacts_api.rb', line 433

def delete_contact(identifier, opts = {})
  delete_contact_with_http_info(identifier, opts)
  nil
end

#delete_contact_with_http_info(identifier, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Delete a contact There are 2 ways to delete a contact &lt;br&gt;&lt;br&gt; Option 1- api.brevo.com/v3/contacts/identifier &lt;br&gt;&lt;br&gt; Option 2- api.brevo.com/v3/contacts/identifier?identifierType&#x3D;{} &lt;br&gt; &lt;br&gt; Option 1 only works if identifierType is email_id (for EMAIL) or contact_id (for ID of the contact),where you can directly pass the value of EMAIL and ID of the contact. &lt;br&gt;&lt;br&gt; Option 2 works for all identifierType, use email_id for EMAIL attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute.

Parameters:

  • identifier

    Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded)

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

    the optional parameters

Options Hash (opts):

  • :identifier_type (String)

    email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute

Returns:

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

    nil, response status code and response headers



444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
# File 'lib/brevo/api/contacts_api.rb', line 444

def delete_contact_with_http_info(identifier, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactsApi.delete_contact ...'
  end
  # verify the required parameter 'identifier' is set
  if @api_client.config.client_side_validation && identifier.nil?
    fail ArgumentError, "Missing the required parameter 'identifier' when calling ContactsApi.delete_contact"
  end
  if @api_client.config.client_side_validation && opts[:'identifier_type'] && !['email_id', 'contact_id', 'ext_id', 'phone_id', 'whatsapp_id', 'landline_number_id'].include?(opts[:'identifier_type'])
    fail ArgumentError, 'invalid value for "identifier_type", must be one of email_id, contact_id, ext_id, phone_id, whatsapp_id, landline_number_id'
  end
  # resource path
  local_var_path = '/contacts/{identifier}'.sub('{' + 'identifier' + '}', identifier.to_s)

  # query parameters
  query_params = {}
  query_params[:'identifierType'] = opts[:'identifier_type'] if !opts[:'identifier_type'].nil?

  # header parameters
  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 = {}

  # http body (model)
  post_body = nil
  auth_names = ['api-key', 'partner-key']
  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)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#delete_contact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_folder(folder_id, opts = {}) ⇒ nil

Delete a folder (and all its lists)

Parameters:

  • folder_id

    Id of the folder

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

    the optional parameters

Returns:

  • (nil)


490
491
492
493
# File 'lib/brevo/api/contacts_api.rb', line 490

def delete_folder(folder_id, opts = {})
  delete_folder_with_http_info(folder_id, opts)
  nil
end

#delete_folder_with_http_info(folder_id, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Delete a folder (and all its lists)

Parameters:

  • folder_id

    Id of the folder

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
# File 'lib/brevo/api/contacts_api.rb', line 499

def delete_folder_with_http_info(folder_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactsApi.delete_folder ...'
  end
  # verify the required parameter 'folder_id' is set
  if @api_client.config.client_side_validation && folder_id.nil?
    fail ArgumentError, "Missing the required parameter 'folder_id' when calling ContactsApi.delete_folder"
  end
  # resource path
  local_var_path = '/contacts/folders/{folderId}'.sub('{' + 'folderId' + '}', folder_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  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 = {}

  # http body (model)
  post_body = nil
  auth_names = ['api-key', 'partner-key']
  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)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#delete_folder\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_list(list_id, opts = {}) ⇒ nil

Delete a list

Parameters:

  • list_id

    Id of the list

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

    the optional parameters

Returns:

  • (nil)


541
542
543
544
# File 'lib/brevo/api/contacts_api.rb', line 541

def delete_list(list_id, opts = {})
  delete_list_with_http_info(list_id, opts)
  nil
end

#delete_list_with_http_info(list_id, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Delete a list

Parameters:

  • list_id

    Id of the list

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
# File 'lib/brevo/api/contacts_api.rb', line 550

def delete_list_with_http_info(list_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactsApi.delete_list ...'
  end
  # verify the required parameter 'list_id' is set
  if @api_client.config.client_side_validation && list_id.nil?
    fail ArgumentError, "Missing the required parameter 'list_id' when calling ContactsApi.delete_list"
  end
  # resource path
  local_var_path = '/contacts/lists/{listId}'.sub('{' + 'listId' + '}', list_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  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 = {}

  # http body (model)
  post_body = nil
  auth_names = ['api-key', 'partner-key']
  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)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#delete_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_multi_attribute_options(attribute_type, multiple_choice_attribute, multiple_choice_attribute_option, opts = {}) ⇒ nil

Delete a multiple-choice attribute option

Parameters:

  • attribute_type

    Type of the attribute

  • multiple_choice_attribute

    Name of the existing multiple-choice attribute

  • multiple_choice_attribute_option

    Name of the existing multiple-choice attribute option that you want to delete

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

    the optional parameters

Returns:

  • (nil)


594
595
596
597
# File 'lib/brevo/api/contacts_api.rb', line 594

def delete_multi_attribute_options(attribute_type, multiple_choice_attribute, multiple_choice_attribute_option, opts = {})
  delete_multi_attribute_options_with_http_info(attribute_type, multiple_choice_attribute, multiple_choice_attribute_option, opts)
  nil
end

#delete_multi_attribute_options_with_http_info(attribute_type, multiple_choice_attribute, multiple_choice_attribute_option, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Delete a multiple-choice attribute option

Parameters:

  • attribute_type

    Type of the attribute

  • multiple_choice_attribute

    Name of the existing multiple-choice attribute

  • multiple_choice_attribute_option

    Name of the existing multiple-choice attribute option that you want to delete

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
# File 'lib/brevo/api/contacts_api.rb', line 605

def delete_multi_attribute_options_with_http_info(attribute_type, multiple_choice_attribute, multiple_choice_attribute_option, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactsApi.delete_multi_attribute_options ...'
  end
  # verify the required parameter 'attribute_type' is set
  if @api_client.config.client_side_validation && attribute_type.nil?
    fail ArgumentError, "Missing the required parameter 'attribute_type' when calling ContactsApi.delete_multi_attribute_options"
  end
  # verify enum value
  if @api_client.config.client_side_validation && !['multiple-choice'].include?(attribute_type)
    fail ArgumentError, "invalid value for 'attribute_type', must be one of multiple-choice"
  end
  # verify the required parameter 'multiple_choice_attribute' is set
  if @api_client.config.client_side_validation && multiple_choice_attribute.nil?
    fail ArgumentError, "Missing the required parameter 'multiple_choice_attribute' when calling ContactsApi.delete_multi_attribute_options"
  end
  # verify the required parameter 'multiple_choice_attribute_option' is set
  if @api_client.config.client_side_validation && multiple_choice_attribute_option.nil?
    fail ArgumentError, "Missing the required parameter 'multiple_choice_attribute_option' when calling ContactsApi.delete_multi_attribute_options"
  end
  # resource path
  local_var_path = '/contacts/attributes/{attributeType}/{multipleChoiceAttribute}/{multipleChoiceAttributeOption}'.sub('{' + 'attributeType' + '}', attribute_type.to_s).sub('{' + 'multipleChoiceAttribute' + '}', multiple_choice_attribute.to_s).sub('{' + 'multipleChoiceAttributeOption' + '}', multiple_choice_attribute_option.to_s)

  # query parameters
  query_params = {}

  # header parameters
  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 = {}

  # http body (model)
  post_body = nil
  auth_names = ['api-key', 'partner-key']
  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)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#delete_multi_attribute_options\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_attributes(opts = {}) ⇒ GetAttributes

List all attributes

Parameters:

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

    the optional parameters

Returns:



658
659
660
661
# File 'lib/brevo/api/contacts_api.rb', line 658

def get_attributes(opts = {})
  data, _status_code, _headers = get_attributes_with_http_info(opts)
  data
end

#get_attributes_with_http_info(opts = {}) ⇒ Array<(GetAttributes, Fixnum, Hash)>

List all attributes

Parameters:

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

    the optional parameters

Returns:

  • (Array<(GetAttributes, Fixnum, Hash)>)

    GetAttributes data, response status code and response headers



666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
# File 'lib/brevo/api/contacts_api.rb', line 666

def get_attributes_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactsApi.get_attributes ...'
  end
  # resource path
  local_var_path = '/contacts/attributes'

  # query parameters
  query_params = {}

  # header parameters
  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 = {}

  # http body (model)
  post_body = nil
  auth_names = ['api-key', 'partner-key']
  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 => 'GetAttributes')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#get_attributes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_contact_info(identifier, opts = {}) ⇒ GetExtendedContactDetails

Get a contact’s details There are 2 ways to get a contact
Option 1- api.brevo.com/v3/contacts/identifier
Option 2- api.brevo.com/v3/contacts/identifier?identifierType={}

Option 1 only works if identifierType is email_id (for EMAIL), phone_id (for SMS) or contact_id (for ID of the contact),where you can directly pass the value of EMAIL, SMS and ID of the contact.
Option 2 works for all identifierType, use email_id for EMAIL attribute, phone_id for SMS attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute
Along with the contact details, this endpoint will show the statistics of contact for the recent 90 days by default. To fetch the earlier statistics, please use Get contact campaign stats “developers.brevo.com/reference/contacts-7#getcontactstats“ endpoint with the appropriate date ranges.

Parameters:

  • identifier

    Email (urlencoded) OR ID of the contact OR its SMS attribute value OR EXT_ID attribute (urlencoded)

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

    the optional parameters

Options Hash (opts):

  • :identifier_type (String)

    email_id for Email, phone_id for SMS attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute

  • :start_date (String)

    **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate

  • :end_date (String)

    **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate.

Returns:



709
710
711
712
# File 'lib/brevo/api/contacts_api.rb', line 709

def get_contact_info(identifier, opts = {})
  data, _status_code, _headers = get_contact_info_with_http_info(identifier, opts)
  data
end

#get_contact_info_with_http_info(identifier, opts = {}) ⇒ Array<(GetExtendedContactDetails, Fixnum, Hash)>

Get a contact&#39;s details There are 2 ways to get a contact &lt;br&gt;&lt;br&gt; Option 1- api.brevo.com/v3/contacts/identifier &lt;br&gt;&lt;br&gt; Option 2- api.brevo.com/v3/contacts/identifier?identifierType&#x3D;{} &lt;br&gt; &lt;br&gt; Option 1 only works if identifierType is email_id (for EMAIL), phone_id (for SMS) or contact_id (for ID of the contact),where you can directly pass the value of EMAIL, SMS and ID of the contact. &lt;br&gt;&lt;br&gt; Option 2 works for all identifierType, use email_id for EMAIL attribute, phone_id for SMS attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute &lt;br&gt;&lt;br&gt;Along with the contact details, this endpoint will show the statistics of contact for the recent 90 days by default. To fetch the earlier statistics, please use Get contact campaign stats &#x60;&#x60;developers.brevo.com/reference/contacts-7#getcontactstats&#x60;&#x60; endpoint with the appropriate date ranges.

Parameters:

  • identifier

    Email (urlencoded) OR ID of the contact OR its SMS attribute value OR EXT_ID attribute (urlencoded)

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

    the optional parameters

Options Hash (opts):

  • :identifier_type (String)

    email_id for Email, phone_id for SMS attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute

  • :start_date (String)

    **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate

  • :end_date (String)

    **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate.

Returns:

  • (Array<(GetExtendedContactDetails, Fixnum, Hash)>)

    GetExtendedContactDetails data, response status code and response headers



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
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
# File 'lib/brevo/api/contacts_api.rb', line 722

def get_contact_info_with_http_info(identifier, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactsApi.get_contact_info ...'
  end
  # verify the required parameter 'identifier' is set
  if @api_client.config.client_side_validation && identifier.nil?
    fail ArgumentError, "Missing the required parameter 'identifier' when calling ContactsApi.get_contact_info"
  end
  if @api_client.config.client_side_validation && opts[:'identifier_type'] && !['email_id', 'phone_id', 'contact_id', 'ext_id', 'whatsapp_id', 'landline_number_id'].include?(opts[:'identifier_type'])
    fail ArgumentError, 'invalid value for "identifier_type", must be one of email_id, phone_id, contact_id, ext_id, whatsapp_id, landline_number_id'
  end
  # resource path
  local_var_path = '/contacts/{identifier}'.sub('{' + 'identifier' + '}', identifier.to_s)

  # query parameters
  query_params = {}
  query_params[:'identifierType'] = opts[:'identifier_type'] if !opts[:'identifier_type'].nil?
  query_params[:'startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil?
  query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil?

  # header parameters
  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 = {}

  # http body (model)
  post_body = nil
  auth_names = ['api-key', 'partner-key']
  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 => 'GetExtendedContactDetails')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#get_contact_info\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_contact_stats(identifier, opts = {}) ⇒ GetContactCampaignStats

Get email campaigns’ statistics for a contact

Parameters:

  • identifier

    Email (urlencoded) OR ID of the contact

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

    the optional parameters

Options Hash (opts):

  • :start_date (String)

    Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate

  • :end_date (String)

    Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. Maximum difference between startDate and endDate should not be greater than 90 days

Returns:



773
774
775
776
# File 'lib/brevo/api/contacts_api.rb', line 773

def get_contact_stats(identifier, opts = {})
  data, _status_code, _headers = get_contact_stats_with_http_info(identifier, opts)
  data
end

#get_contact_stats_with_http_info(identifier, opts = {}) ⇒ Array<(GetContactCampaignStats, Fixnum, Hash)>

Get email campaigns&#39; statistics for a contact

Parameters:

  • identifier

    Email (urlencoded) OR ID of the contact

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

    the optional parameters

Options Hash (opts):

  • :start_date (String)

    Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate

  • :end_date (String)

    Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. Maximum difference between startDate and endDate should not be greater than 90 days

Returns:

  • (Array<(GetContactCampaignStats, Fixnum, Hash)>)

    GetContactCampaignStats data, response status code and response headers



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
813
814
815
816
817
818
819
820
821
822
823
824
# File 'lib/brevo/api/contacts_api.rb', line 784

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

  # query parameters
  query_params = {}
  query_params[:'startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil?
  query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil?

  # header parameters
  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 = {}

  # http body (model)
  post_body = nil
  auth_names = ['api-key', 'partner-key']
  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 => 'GetContactCampaignStats')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#get_contact_stats\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_contacts(opts = {}) ⇒ GetContacts

Get all the contacts

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Number of documents per page (default to 50)

  • :offset (Integer)

    Index of the first document of the page (default to 0)

  • :modified_since (String)

    Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result.

  • :created_since (String)

    Filter (urlencoded) the contacts created after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result.

  • :sort (String)

    Sort the results in the ascending/descending order of record creation. Default order is descending if &#x60;sort&#x60; is not passed (default to desc)

  • :segment_id (Integer)

    Id of the segment. **Either listIds or segmentId can be passed.**

  • :list_ids (Array<Integer>)

    Ids of the list. **Either listIds or segmentId can be passed.**

  • :filter (String)

    Filter the contacts on the basis of attributes. **Allowed operator: equals. For multiple-choice options, the filter will apply an AND condition between the options. For category attributes, the filter will work with both id and value. (e.g. filter&#x3D;equals(FIRSTNAME,&quot;Antoine&quot;), filter&#x3D;equals(B1, true), filter&#x3D;equals(DOB, &quot;1989-11-23&quot;), filter&#x3D;equals(GENDER, &quot;1&quot;), filter&#x3D;equals(GENDER, &quot;MALE&quot;), filter&#x3D;equals(COUNTRY,&quot;USA, INDIA&quot;)**

Returns:



836
837
838
839
# File 'lib/brevo/api/contacts_api.rb', line 836

def get_contacts(opts = {})
  data, _status_code, _headers = get_contacts_with_http_info(opts)
  data
end

#get_contacts_from_list(list_id, opts = {}) ⇒ GetContacts

Get contacts in a list

Parameters:

  • list_id

    Id of the list

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

    the optional parameters

Options Hash (opts):

  • :modified_since (String)

    Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result.

  • :limit (Integer)

    Number of documents per page (default to 50)

  • :offset (Integer)

    Index of the first document of the page (default to 0)

  • :sort (String)

    Sort the results in the ascending/descending order of record creation. Default order is descending if &#x60;sort&#x60; is not passed (default to desc)

Returns:



914
915
916
917
# File 'lib/brevo/api/contacts_api.rb', line 914

def get_contacts_from_list(list_id, opts = {})
  data, _status_code, _headers = get_contacts_from_list_with_http_info(list_id, opts)
  data
end

#get_contacts_from_list_with_http_info(list_id, opts = {}) ⇒ Array<(GetContacts, Fixnum, Hash)>

Get contacts in a list

Parameters:

  • list_id

    Id of the list

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

    the optional parameters

Options Hash (opts):

  • :modified_since (String)

    Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result.

  • :limit (Integer)

    Number of documents per page

  • :offset (Integer)

    Index of the first document of the page

  • :sort (String)

    Sort the results in the ascending/descending order of record creation. Default order is descending if &#x60;sort&#x60; is not passed

Returns:

  • (Array<(GetContacts, Fixnum, Hash)>)

    GetContacts data, response status code and response headers



927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
# File 'lib/brevo/api/contacts_api.rb', line 927

def get_contacts_from_list_with_http_info(list_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactsApi.get_contacts_from_list ...'
  end
  # verify the required parameter 'list_id' is set
  if @api_client.config.client_side_validation && list_id.nil?
    fail ArgumentError, "Missing the required parameter 'list_id' when calling ContactsApi.get_contacts_from_list"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 500
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ContactsApi.get_contacts_from_list, must be smaller than or equal to 500.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 0
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ContactsApi.get_contacts_from_list, must be greater than or equal to 0.'
  end

  if @api_client.config.client_side_validation && opts[:'sort'] && !['asc', 'desc'].include?(opts[:'sort'])
    fail ArgumentError, 'invalid value for "sort", must be one of asc, desc'
  end
  # resource path
  local_var_path = '/contacts/lists/{listId}/contacts'.sub('{' + 'listId' + '}', list_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'modifiedSince'] = opts[:'modified_since'] if !opts[:'modified_since'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?

  # header parameters
  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 = {}

  # http body (model)
  post_body = nil
  auth_names = ['api-key', 'partner-key']
  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 => 'GetContacts')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#get_contacts_from_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_contacts_with_http_info(opts = {}) ⇒ Array<(GetContacts, Fixnum, Hash)>

Get all the contacts

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Number of documents per page

  • :offset (Integer)

    Index of the first document of the page

  • :modified_since (String)

    Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result.

  • :created_since (String)

    Filter (urlencoded) the contacts created after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result.

  • :sort (String)

    Sort the results in the ascending/descending order of record creation. Default order is descending if &#x60;sort&#x60; is not passed

  • :segment_id (Integer)

    Id of the segment. **Either listIds or segmentId can be passed.**

  • :list_ids (Array<Integer>)

    Ids of the list. **Either listIds or segmentId can be passed.**

  • :filter (String)

    Filter the contacts on the basis of attributes. **Allowed operator: equals. For multiple-choice options, the filter will apply an AND condition between the options. For category attributes, the filter will work with both id and value. (e.g. filter&#x3D;equals(FIRSTNAME,&quot;Antoine&quot;), filter&#x3D;equals(B1, true), filter&#x3D;equals(DOB, &quot;1989-11-23&quot;), filter&#x3D;equals(GENDER, &quot;1&quot;), filter&#x3D;equals(GENDER, &quot;MALE&quot;), filter&#x3D;equals(COUNTRY,&quot;USA, INDIA&quot;)**

Returns:

  • (Array<(GetContacts, Fixnum, Hash)>)

    GetContacts data, response status code and response headers



852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
# File 'lib/brevo/api/contacts_api.rb', line 852

def get_contacts_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactsApi.get_contacts ...'
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ContactsApi.get_contacts, must be smaller than or equal to 1000.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 0
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ContactsApi.get_contacts, must be greater than or equal to 0.'
  end

  if @api_client.config.client_side_validation && opts[:'sort'] && !['asc', 'desc'].include?(opts[:'sort'])
    fail ArgumentError, 'invalid value for "sort", must be one of asc, desc'
  end
  # resource path
  local_var_path = '/contacts'

  # query parameters
  query_params = {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'modifiedSince'] = opts[:'modified_since'] if !opts[:'modified_since'].nil?
  query_params[:'createdSince'] = opts[:'created_since'] if !opts[:'created_since'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'segmentId'] = opts[:'segment_id'] if !opts[:'segment_id'].nil?
  query_params[:'listIds'] = @api_client.build_collection_param(opts[:'list_ids'], :csv) if !opts[:'list_ids'].nil?
  query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?

  # header parameters
  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 = {}

  # http body (model)
  post_body = nil
  auth_names = ['api-key', 'partner-key']
  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 => 'GetContacts')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#get_contacts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_folder(folder_id, opts = {}) ⇒ GetFolder

Returns a folder’s details

Parameters:

  • folder_id

    id of the folder

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

    the optional parameters

Returns:



985
986
987
988
# File 'lib/brevo/api/contacts_api.rb', line 985

def get_folder(folder_id, opts = {})
  data, _status_code, _headers = get_folder_with_http_info(folder_id, opts)
  data
end

#get_folder_lists(folder_id, opts = {}) ⇒ GetFolderLists

Get lists in a folder

Parameters:

  • folder_id

    Id of the folder

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Number of documents per page (default to 10)

  • :offset (Integer)

    Index of the first document of the page (default to 0)

  • :sort (String)

    Sort the results in the ascending/descending order of record creation. Default order is descending if &#x60;sort&#x60; is not passed (default to desc)

Returns:



1040
1041
1042
1043
# File 'lib/brevo/api/contacts_api.rb', line 1040

def get_folder_lists(folder_id, opts = {})
  data, _status_code, _headers = get_folder_lists_with_http_info(folder_id, opts)
  data
end

#get_folder_lists_with_http_info(folder_id, opts = {}) ⇒ Array<(GetFolderLists, Fixnum, Hash)>

Get lists in a folder

Parameters:

  • folder_id

    Id of the folder

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Number of documents per page

  • :offset (Integer)

    Index of the first document of the page

  • :sort (String)

    Sort the results in the ascending/descending order of record creation. Default order is descending if &#x60;sort&#x60; is not passed

Returns:

  • (Array<(GetFolderLists, Fixnum, Hash)>)

    GetFolderLists data, response status code and response headers



1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
# File 'lib/brevo/api/contacts_api.rb', line 1052

def get_folder_lists_with_http_info(folder_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactsApi.get_folder_lists ...'
  end
  # verify the required parameter 'folder_id' is set
  if @api_client.config.client_side_validation && folder_id.nil?
    fail ArgumentError, "Missing the required parameter 'folder_id' when calling ContactsApi.get_folder_lists"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 50
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ContactsApi.get_folder_lists, must be smaller than or equal to 50.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 0
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ContactsApi.get_folder_lists, must be greater than or equal to 0.'
  end

  if @api_client.config.client_side_validation && opts[:'sort'] && !['asc', 'desc'].include?(opts[:'sort'])
    fail ArgumentError, 'invalid value for "sort", must be one of asc, desc'
  end
  # resource path
  local_var_path = '/contacts/folders/{folderId}/lists'.sub('{' + 'folderId' + '}', folder_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?

  # header parameters
  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 = {}

  # http body (model)
  post_body = nil
  auth_names = ['api-key', 'partner-key']
  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 => 'GetFolderLists')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#get_folder_lists\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_folder_with_http_info(folder_id, opts = {}) ⇒ Array<(GetFolder, Fixnum, Hash)>

Returns a folder&#39;s details

Parameters:

  • folder_id

    id of the folder

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

    the optional parameters

Returns:

  • (Array<(GetFolder, Fixnum, Hash)>)

    GetFolder data, response status code and response headers



994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
# File 'lib/brevo/api/contacts_api.rb', line 994

def get_folder_with_http_info(folder_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactsApi.get_folder ...'
  end
  # verify the required parameter 'folder_id' is set
  if @api_client.config.client_side_validation && folder_id.nil?
    fail ArgumentError, "Missing the required parameter 'folder_id' when calling ContactsApi.get_folder"
  end
  # resource path
  local_var_path = '/contacts/folders/{folderId}'.sub('{' + 'folderId' + '}', folder_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  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 = {}

  # http body (model)
  post_body = nil
  auth_names = ['api-key', 'partner-key']
  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 => 'GetFolder')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#get_folder\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_folders(opts = {}) ⇒ GetFolders

Get all folders

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Number of documents per page (default to 10)

  • :offset (Integer)

    Index of the first document of the page (default to 0)

  • :sort (String)

    Sort the results in the ascending/descending order of record creation. Default order is descending if &#x60;sort&#x60; is not passed (default to desc)

Returns:



1111
1112
1113
1114
# File 'lib/brevo/api/contacts_api.rb', line 1111

def get_folders(opts = {})
  data, _status_code, _headers = get_folders_with_http_info(opts)
  data
end

#get_folders_with_http_info(opts = {}) ⇒ Array<(GetFolders, Fixnum, Hash)>

Get all folders

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Number of documents per page

  • :offset (Integer)

    Index of the first document of the page

  • :sort (String)

    Sort the results in the ascending/descending order of record creation. Default order is descending if &#x60;sort&#x60; is not passed

Returns:

  • (Array<(GetFolders, Fixnum, Hash)>)

    GetFolders data, response status code and response headers



1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
# File 'lib/brevo/api/contacts_api.rb', line 1122

def get_folders_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactsApi.get_folders ...'
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 50
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ContactsApi.get_folders, must be smaller than or equal to 50.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 0
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ContactsApi.get_folders, must be greater than or equal to 0.'
  end

  if @api_client.config.client_side_validation && opts[:'sort'] && !['asc', 'desc'].include?(opts[:'sort'])
    fail ArgumentError, 'invalid value for "sort", must be one of asc, desc'
  end
  # resource path
  local_var_path = '/contacts/folders'

  # query parameters
  query_params = {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?

  # header parameters
  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 = {}

  # http body (model)
  post_body = nil
  auth_names = ['api-key', 'partner-key']
  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 => 'GetFolders')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#get_folders\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_list(list_id, opts = {}) ⇒ GetExtendedList

Get a list’s details

Parameters:

  • list_id

    Id of the list

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

    the optional parameters

Options Hash (opts):

  • :start_date (String)

    Mandatory if endDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id.Prefer to pass your timezone in date-time format for accurate result

  • :end_date (String)

    Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id.Prefer to pass your timezone in date-time format for accurate result

Returns:



1177
1178
1179
1180
# File 'lib/brevo/api/contacts_api.rb', line 1177

def get_list(list_id, opts = {})
  data, _status_code, _headers = get_list_with_http_info(list_id, opts)
  data
end

#get_list_with_http_info(list_id, opts = {}) ⇒ Array<(GetExtendedList, Fixnum, Hash)>

Get a list&#39;s details

Parameters:

  • list_id

    Id of the list

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

    the optional parameters

Options Hash (opts):

  • :start_date (String)

    Mandatory if endDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id.Prefer to pass your timezone in date-time format for accurate result

  • :end_date (String)

    Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id.Prefer to pass your timezone in date-time format for accurate result

Returns:

  • (Array<(GetExtendedList, Fixnum, Hash)>)

    GetExtendedList data, response status code and response headers



1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
# File 'lib/brevo/api/contacts_api.rb', line 1188

def get_list_with_http_info(list_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactsApi.get_list ...'
  end
  # verify the required parameter 'list_id' is set
  if @api_client.config.client_side_validation && list_id.nil?
    fail ArgumentError, "Missing the required parameter 'list_id' when calling ContactsApi.get_list"
  end
  # resource path
  local_var_path = '/contacts/lists/{listId}'.sub('{' + 'listId' + '}', list_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil?
  query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil?

  # header parameters
  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 = {}

  # http body (model)
  post_body = nil
  auth_names = ['api-key', 'partner-key']
  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 => 'GetExtendedList')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#get_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_lists(opts = {}) ⇒ GetLists

Get all the lists

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Number of documents per page (default to 10)

  • :offset (Integer)

    Index of the first document of the page (default to 0)

  • :sort (String)

    Sort the results in the ascending/descending order of record creation. Default order is descending if &#x60;sort&#x60; is not passed (default to desc)

Returns:



1235
1236
1237
1238
# File 'lib/brevo/api/contacts_api.rb', line 1235

def get_lists(opts = {})
  data, _status_code, _headers = get_lists_with_http_info(opts)
  data
end

#get_lists_with_http_info(opts = {}) ⇒ Array<(GetLists, Fixnum, Hash)>

Get all the lists

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Number of documents per page

  • :offset (Integer)

    Index of the first document of the page

  • :sort (String)

    Sort the results in the ascending/descending order of record creation. Default order is descending if &#x60;sort&#x60; is not passed

Returns:

  • (Array<(GetLists, Fixnum, Hash)>)

    GetLists data, response status code and response headers



1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
# File 'lib/brevo/api/contacts_api.rb', line 1246

def get_lists_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactsApi.get_lists ...'
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 50
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ContactsApi.get_lists, must be smaller than or equal to 50.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 0
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ContactsApi.get_lists, must be greater than or equal to 0.'
  end

  if @api_client.config.client_side_validation && opts[:'sort'] && !['asc', 'desc'].include?(opts[:'sort'])
    fail ArgumentError, 'invalid value for "sort", must be one of asc, desc'
  end
  # resource path
  local_var_path = '/contacts/lists'

  # query parameters
  query_params = {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?

  # header parameters
  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 = {}

  # http body (model)
  post_body = nil
  auth_names = ['api-key', 'partner-key']
  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 => 'GetLists')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#get_lists\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_segments(limit, offset, opts = {}) ⇒ GetSegments

Get all the Segments

Parameters:

  • limit

    Number of documents per page

  • offset

    Index of the first document of the page

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

    the optional parameters

Options Hash (opts):

  • :sort (String)

    Sort the results in the ascending/descending order of record creation. Default order is descending if &#x60;sort&#x60; is not passed (default to desc)

Returns:



1301
1302
1303
1304
# File 'lib/brevo/api/contacts_api.rb', line 1301

def get_segments(limit, offset, opts = {})
  data, _status_code, _headers = get_segments_with_http_info(limit, offset, opts)
  data
end

#get_segments_with_http_info(limit, offset, opts = {}) ⇒ Array<(GetSegments, Fixnum, Hash)>

Get all the Segments

Parameters:

  • limit

    Number of documents per page

  • offset

    Index of the first document of the page

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

    the optional parameters

Options Hash (opts):

  • :sort (String)

    Sort the results in the ascending/descending order of record creation. Default order is descending if &#x60;sort&#x60; is not passed

Returns:

  • (Array<(GetSegments, Fixnum, Hash)>)

    GetSegments data, response status code and response headers



1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
# File 'lib/brevo/api/contacts_api.rb', line 1312

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

  if @api_client.config.client_side_validation && limit < 0
    fail ArgumentError, 'invalid value for "limit" when calling ContactsApi.get_segments, must be greater than or equal to 0.'
  end

  # verify the required parameter 'offset' is set
  if @api_client.config.client_side_validation && offset.nil?
    fail ArgumentError, "Missing the required parameter 'offset' when calling ContactsApi.get_segments"
  end
  if @api_client.config.client_side_validation && opts[:'sort'] && !['asc', 'desc'].include?(opts[:'sort'])
    fail ArgumentError, 'invalid value for "sort", must be one of asc, desc'
  end
  # resource path
  local_var_path = '/contacts/segments'

  # query parameters
  query_params = {}
  query_params[:'limit'] = limit
  query_params[:'offset'] = offset
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?

  # header parameters
  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 = {}

  # http body (model)
  post_body = nil
  auth_names = ['api-key', 'partner-key']
  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 => 'GetSegments')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#get_segments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#import_contacts(request_contact_import, opts = {}) ⇒ CreatedProcessId

Import contacts It returns the background process ID which on completion calls the notify URL that you have set in the input. Note: - Any contact attribute that doesn’t exist in your account will be ignored at import end.

Parameters:

Returns:



1374
1375
1376
1377
# File 'lib/brevo/api/contacts_api.rb', line 1374

def import_contacts(request_contact_import, opts = {})
  data, _status_code, _headers = import_contacts_with_http_info(request_contact_import, opts)
  data
end

#import_contacts_with_http_info(request_contact_import, opts = {}) ⇒ Array<(CreatedProcessId, Fixnum, Hash)>

Import contacts It returns the background process ID which on completion calls the notify URL that you have set in the input. Note: - Any contact attribute that doesn&#39;t exist in your account will be ignored at import end.

Parameters:

Returns:

  • (Array<(CreatedProcessId, Fixnum, Hash)>)

    CreatedProcessId data, response status code and response headers



1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
# File 'lib/brevo/api/contacts_api.rb', line 1384

def import_contacts_with_http_info(request_contact_import, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactsApi.import_contacts ...'
  end
  # verify the required parameter 'request_contact_import' is set
  if @api_client.config.client_side_validation && request_contact_import.nil?
    fail ArgumentError, "Missing the required parameter 'request_contact_import' when calling ContactsApi.import_contacts"
  end
  # resource path
  local_var_path = '/contacts/import'

  # query parameters
  query_params = {}

  # header parameters
  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 = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(request_contact_import)
  auth_names = ['api-key', 'partner-key']
  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 => 'CreatedProcessId')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#import_contacts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#remove_contact_from_list(list_id, contact_emails, opts = {}) ⇒ PostContactInfo

Delete a contact from a list

Parameters:

  • list_id

    Id of the list

  • contact_emails

    Emails addresses OR IDs OR EXT_ID attributes of the contacts

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

    the optional parameters

Returns:



1428
1429
1430
1431
# File 'lib/brevo/api/contacts_api.rb', line 1428

def remove_contact_from_list(list_id, contact_emails, opts = {})
  data, _status_code, _headers = remove_contact_from_list_with_http_info(list_id, contact_emails, opts)
  data
end

#remove_contact_from_list_with_http_info(list_id, contact_emails, opts = {}) ⇒ Array<(PostContactInfo, Fixnum, Hash)>

Delete a contact from a list

Parameters:

  • list_id

    Id of the list

  • contact_emails

    Emails addresses OR IDs OR EXT_ID attributes of the contacts

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

    the optional parameters

Returns:

  • (Array<(PostContactInfo, Fixnum, Hash)>)

    PostContactInfo data, response status code and response headers



1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
# File 'lib/brevo/api/contacts_api.rb', line 1438

def remove_contact_from_list_with_http_info(list_id, contact_emails, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactsApi.remove_contact_from_list ...'
  end
  # verify the required parameter 'list_id' is set
  if @api_client.config.client_side_validation && list_id.nil?
    fail ArgumentError, "Missing the required parameter 'list_id' when calling ContactsApi.remove_contact_from_list"
  end
  # verify the required parameter 'contact_emails' is set
  if @api_client.config.client_side_validation && contact_emails.nil?
    fail ArgumentError, "Missing the required parameter 'contact_emails' when calling ContactsApi.remove_contact_from_list"
  end
  # resource path
  local_var_path = '/contacts/lists/{listId}/contacts/remove'.sub('{' + 'listId' + '}', list_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  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 = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(contact_emails)
  auth_names = ['api-key', 'partner-key']
  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 => 'PostContactInfo')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#remove_contact_from_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#request_contact_export(request_contact_export, opts = {}) ⇒ CreatedProcessId

Export contacts It returns the background process ID which on completion calls the notify URL that you have set in the input. File will be available in csv.

Parameters:

  • request_contact_export

    Values to request a contact export

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

    the optional parameters

Returns:



1486
1487
1488
1489
# File 'lib/brevo/api/contacts_api.rb', line 1486

def request_contact_export(request_contact_export, opts = {})
  data, _status_code, _headers = request_contact_export_with_http_info(request_contact_export, opts)
  data
end

#request_contact_export_with_http_info(request_contact_export, opts = {}) ⇒ Array<(CreatedProcessId, Fixnum, Hash)>

Export contacts It returns the background process ID which on completion calls the notify URL that you have set in the input. File will be available in csv.

Parameters:

  • request_contact_export

    Values to request a contact export

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

    the optional parameters

Returns:

  • (Array<(CreatedProcessId, Fixnum, Hash)>)

    CreatedProcessId data, response status code and response headers



1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
# File 'lib/brevo/api/contacts_api.rb', line 1496

def request_contact_export_with_http_info(request_contact_export, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactsApi.request_contact_export ...'
  end
  # verify the required parameter 'request_contact_export' is set
  if @api_client.config.client_side_validation && request_contact_export.nil?
    fail ArgumentError, "Missing the required parameter 'request_contact_export' when calling ContactsApi.request_contact_export"
  end
  # resource path
  local_var_path = '/contacts/export'

  # query parameters
  query_params = {}

  # header parameters
  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 = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(request_contact_export)
  auth_names = ['api-key', 'partner-key']
  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 => 'CreatedProcessId')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#request_contact_export\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#setUserAgent(user_agent) ⇒ Object

Set custom user_agent if explicitly passed in api default will still remain Swagger-Codegen/#VERSION/ruby



25
26
27
28
29
30
# File 'lib/brevo/api/contacts_api.rb', line 25

def setUserAgent(user_agent)
  @user_agent = user_agent
  if user_agent.is_a?(String) && user_agent.downcase.start_with?('brevo_')
    @api_client.default_headers['User-Agent'] = @user_agent
  end
end

#update_attribute(attribute_category, attribute_name, update_attribute, opts = {}) ⇒ nil

Update contact attribute

Parameters:

  • attribute_category

    Category of the attribute

  • attribute_name

    Name of the existing attribute

  • update_attribute

    Values to update an attribute

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

    the optional parameters

Returns:

  • (nil)


1541
1542
1543
1544
# File 'lib/brevo/api/contacts_api.rb', line 1541

def update_attribute(attribute_category, attribute_name, update_attribute, opts = {})
  update_attribute_with_http_info(attribute_category, attribute_name, update_attribute, opts)
  nil
end

#update_attribute_with_http_info(attribute_category, attribute_name, update_attribute, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Update contact attribute

Parameters:

  • attribute_category

    Category of the attribute

  • attribute_name

    Name of the existing attribute

  • update_attribute

    Values to update an attribute

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
# File 'lib/brevo/api/contacts_api.rb', line 1552

def update_attribute_with_http_info(attribute_category, attribute_name, update_attribute, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactsApi.update_attribute ...'
  end
  # verify the required parameter 'attribute_category' is set
  if @api_client.config.client_side_validation && attribute_category.nil?
    fail ArgumentError, "Missing the required parameter 'attribute_category' when calling ContactsApi.update_attribute"
  end
  # verify enum value
  if @api_client.config.client_side_validation && !['category', 'calculated', 'global', 'normal'].include?(attribute_category)
    fail ArgumentError, "invalid value for 'attribute_category', must be one of category, calculated, global, normal"
  end
  # verify the required parameter 'attribute_name' is set
  if @api_client.config.client_side_validation && attribute_name.nil?
    fail ArgumentError, "Missing the required parameter 'attribute_name' when calling ContactsApi.update_attribute"
  end
  # verify the required parameter 'update_attribute' is set
  if @api_client.config.client_side_validation && update_attribute.nil?
    fail ArgumentError, "Missing the required parameter 'update_attribute' when calling ContactsApi.update_attribute"
  end
  # resource path
  local_var_path = '/contacts/attributes/{attributeCategory}/{attributeName}'.sub('{' + 'attributeCategory' + '}', attribute_category.to_s).sub('{' + 'attributeName' + '}', attribute_name.to_s)

  # query parameters
  query_params = {}

  # header parameters
  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 = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(update_attribute)
  auth_names = ['api-key', 'partner-key']
  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)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#update_attribute\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_batch_contacts(update_batch_contacts, opts = {}) ⇒ nil

Update multiple contacts

Parameters:

  • update_batch_contacts

    Values to update multiple contacts

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

    the optional parameters

Returns:

  • (nil)


1606
1607
1608
1609
# File 'lib/brevo/api/contacts_api.rb', line 1606

def update_batch_contacts(update_batch_contacts, opts = {})
  update_batch_contacts_with_http_info(update_batch_contacts, opts)
  nil
end

#update_batch_contacts_with_http_info(update_batch_contacts, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Update multiple contacts

Parameters:

  • update_batch_contacts

    Values to update multiple contacts

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
# File 'lib/brevo/api/contacts_api.rb', line 1615

def update_batch_contacts_with_http_info(update_batch_contacts, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactsApi.update_batch_contacts ...'
  end
  # verify the required parameter 'update_batch_contacts' is set
  if @api_client.config.client_side_validation && update_batch_contacts.nil?
    fail ArgumentError, "Missing the required parameter 'update_batch_contacts' when calling ContactsApi.update_batch_contacts"
  end
  # resource path
  local_var_path = '/contacts/batch'

  # query parameters
  query_params = {}

  # header parameters
  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 = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(update_batch_contacts)
  auth_names = ['api-key', 'partner-key']
  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)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#update_batch_contacts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_contact(identifier, update_contact, opts = {}) ⇒ nil

Update a contact There are 2 ways to update a contact
Option 1- api.brevo.com/v3/contacts/identifier
Option 2- api.brevo.com/v3/contacts/identifier?identifierType={}

Option 1 only works if identifierType is email_id (for EMAIL) or contact_id (for ID of the contact),where you can directly pass the value of EMAIL and ID of the contact.
Option 2 works for all identifierType, use email_id for EMAIL attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE attribute

Parameters:

  • identifier

    Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) OR its SMS attribute value OR its WHATSAPP attribute value OR its LANDLINE attribute value

  • update_contact

    Values to update a contact

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

    the optional parameters

Options Hash (opts):

  • :identifier_type (String)

    email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE attribute

Returns:

  • (nil)


1660
1661
1662
1663
# File 'lib/brevo/api/contacts_api.rb', line 1660

def update_contact(identifier, update_contact, opts = {})
  update_contact_with_http_info(identifier, update_contact, opts)
  nil
end

#update_contact_with_http_info(identifier, update_contact, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Update a contact There are 2 ways to update a contact &lt;br&gt;&lt;br&gt; Option 1- api.brevo.com/v3/contacts/identifier &lt;br&gt;&lt;br&gt; Option 2- api.brevo.com/v3/contacts/identifier?identifierType&#x3D;{} &lt;br&gt; &lt;br&gt; Option 1 only works if identifierType is email_id (for EMAIL) or contact_id (for ID of the contact),where you can directly pass the value of EMAIL and ID of the contact. &lt;br&gt;&lt;br&gt; Option 2 works for all identifierType, use email_id for EMAIL attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE attribute

Parameters:

  • identifier

    Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) OR its SMS attribute value OR its WHATSAPP attribute value OR its LANDLINE attribute value

  • update_contact

    Values to update a contact

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

    the optional parameters

Options Hash (opts):

  • :identifier_type (String)

    email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE attribute

Returns:

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

    nil, response status code and response headers



1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
# File 'lib/brevo/api/contacts_api.rb', line 1672

def update_contact_with_http_info(identifier, update_contact, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactsApi.update_contact ...'
  end
  # verify the required parameter 'identifier' is set
  if @api_client.config.client_side_validation && identifier.nil?
    fail ArgumentError, "Missing the required parameter 'identifier' when calling ContactsApi.update_contact"
  end
  # verify the required parameter 'update_contact' is set
  if @api_client.config.client_side_validation && update_contact.nil?
    fail ArgumentError, "Missing the required parameter 'update_contact' when calling ContactsApi.update_contact"
  end
  if @api_client.config.client_side_validation && opts[:'identifier_type'] && !['email_id', 'contact_id', 'ext_id', 'phone_id', 'whatsapp_id', 'landline_number_id'].include?(opts[:'identifier_type'])
    fail ArgumentError, 'invalid value for "identifier_type", must be one of email_id, contact_id, ext_id, phone_id, whatsapp_id, landline_number_id'
  end
  # resource path
  local_var_path = '/contacts/{identifier}'.sub('{' + 'identifier' + '}', identifier.to_s)

  # query parameters
  query_params = {}
  query_params[:'identifierType'] = opts[:'identifier_type'] if !opts[:'identifier_type'].nil?

  # header parameters
  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 = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(update_contact)
  auth_names = ['api-key', 'partner-key']
  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)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#update_contact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_folder(folder_id, update_folder, opts = {}) ⇒ nil

Update a folder

Parameters:

  • folder_id

    Id of the folder

  • update_folder

    Name of the folder

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

    the optional parameters

Returns:

  • (nil)


1723
1724
1725
1726
# File 'lib/brevo/api/contacts_api.rb', line 1723

def update_folder(folder_id, update_folder, opts = {})
  update_folder_with_http_info(folder_id, update_folder, opts)
  nil
end

#update_folder_with_http_info(folder_id, update_folder, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Update a folder

Parameters:

  • folder_id

    Id of the folder

  • update_folder

    Name of the folder

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
# File 'lib/brevo/api/contacts_api.rb', line 1733

def update_folder_with_http_info(folder_id, update_folder, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactsApi.update_folder ...'
  end
  # verify the required parameter 'folder_id' is set
  if @api_client.config.client_side_validation && folder_id.nil?
    fail ArgumentError, "Missing the required parameter 'folder_id' when calling ContactsApi.update_folder"
  end
  # verify the required parameter 'update_folder' is set
  if @api_client.config.client_side_validation && update_folder.nil?
    fail ArgumentError, "Missing the required parameter 'update_folder' when calling ContactsApi.update_folder"
  end
  # resource path
  local_var_path = '/contacts/folders/{folderId}'.sub('{' + 'folderId' + '}', folder_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  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 = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(update_folder)
  auth_names = ['api-key', 'partner-key']
  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)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#update_folder\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_list(list_id, update_list, opts = {}) ⇒ nil

Update a list

Parameters:

  • list_id

    Id of the list

  • update_list

    Values to update a list

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

    the optional parameters

Returns:

  • (nil)


1780
1781
1782
1783
# File 'lib/brevo/api/contacts_api.rb', line 1780

def update_list(list_id, update_list, opts = {})
  update_list_with_http_info(list_id, update_list, opts)
  nil
end

#update_list_with_http_info(list_id, update_list, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Update a list

Parameters:

  • list_id

    Id of the list

  • update_list

    Values to update a list

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
# File 'lib/brevo/api/contacts_api.rb', line 1790

def update_list_with_http_info(list_id, update_list, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactsApi.update_list ...'
  end
  # verify the required parameter 'list_id' is set
  if @api_client.config.client_side_validation && list_id.nil?
    fail ArgumentError, "Missing the required parameter 'list_id' when calling ContactsApi.update_list"
  end
  # verify the required parameter 'update_list' is set
  if @api_client.config.client_side_validation && update_list.nil?
    fail ArgumentError, "Missing the required parameter 'update_list' when calling ContactsApi.update_list"
  end
  # resource path
  local_var_path = '/contacts/lists/{listId}'.sub('{' + 'listId' + '}', list_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  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 = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(update_list)
  auth_names = ['api-key', 'partner-key']
  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)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#update_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end