Class: ElasticEmail::ContactsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/ElasticEmail/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/ElasticEmail/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/ElasticEmail/api/contacts_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#contacts_by_email_delete(email, opts = {}) ⇒ nil

Delete Contact Deletes the provided contact. Required Access Level: ModifyContacts

Parameters:

  • email (String)

    Proper email address.

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

    the optional parameters

Returns:

  • (nil)


27
28
29
30
# File 'lib/ElasticEmail/api/contacts_api.rb', line 27

def contacts_by_email_delete(email, opts = {})
  contacts_by_email_delete_with_http_info(email, opts)
  nil
end

#contacts_by_email_delete_with_http_info(email, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete Contact Deletes the provided contact. Required Access Level: ModifyContacts

Parameters:

  • email (String)

    Proper email address.

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/ElasticEmail/api/contacts_api.rb', line 37

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

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

  # header parameters
  header_params = opts[:header_params] || {}

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

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

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['apikey']

  new_options = opts.merge(
    :operation => :"ContactsApi.contacts_by_email_delete",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#contacts_by_email_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#contacts_by_email_get(email, opts = {}) ⇒ Contact

Load Contact Load detailed contact information for specified email. Required Access Level: ViewContacts

Parameters:

  • email (String)

    Proper email address.

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

    the optional parameters

Returns:



88
89
90
91
# File 'lib/ElasticEmail/api/contacts_api.rb', line 88

def contacts_by_email_get(email, opts = {})
  data, _status_code, _headers = contacts_by_email_get_with_http_info(email, opts)
  data
end

#contacts_by_email_get_with_http_info(email, opts = {}) ⇒ Array<(Contact, Integer, Hash)>

Load Contact Load detailed contact information for specified email. Required Access Level: ViewContacts

Parameters:

  • email (String)

    Proper email address.

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

    the optional parameters

Returns:

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

    Contact data, response status code and response headers



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/ElasticEmail/api/contacts_api.rb', line 98

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

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

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

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'Contact'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['apikey']

  new_options = opts.merge(
    :operation => :"ContactsApi.contacts_by_email_get",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#contacts_by_email_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#contacts_by_email_put(email, contact_update_payload, opts = {}) ⇒ Contact

Update Contact Update selected contact. Omitted contact's fields will not be changed. Required Access Level: ModifyContacts

Parameters:

  • email (String)

    Proper email address.

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

    the optional parameters

Returns:



152
153
154
155
# File 'lib/ElasticEmail/api/contacts_api.rb', line 152

def contacts_by_email_put(email, contact_update_payload, opts = {})
  data, _status_code, _headers = contacts_by_email_put_with_http_info(email, contact_update_payload, opts)
  data
end

#contacts_by_email_put_with_http_info(email, contact_update_payload, opts = {}) ⇒ Array<(Contact, Integer, Hash)>

Update Contact Update selected contact. Omitted contact&#39;s fields will not be changed. Required Access Level: ModifyContacts

Parameters:

  • email (String)

    Proper email address.

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

    the optional parameters

Returns:

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

    Contact data, response status code and response headers



163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# File 'lib/ElasticEmail/api/contacts_api.rb', line 163

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

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'Contact'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['apikey']

  new_options = opts.merge(
    :operation => :"ContactsApi.contacts_by_email_put",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#contacts_by_email_put\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#contacts_delete_post(emails_payload, opts = {}) ⇒ nil

Delete Contacts Bulk Deletes provided contacts in bulk. Required Access Level: ModifyContacts

Parameters:

  • emails_payload (EmailsPayload)

    Provide either rule or a list of emails, not both.

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

    the optional parameters

Returns:

  • (nil)


225
226
227
228
# File 'lib/ElasticEmail/api/contacts_api.rb', line 225

def contacts_delete_post(emails_payload, opts = {})
  contacts_delete_post_with_http_info(emails_payload, opts)
  nil
end

#contacts_delete_post_with_http_info(emails_payload, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete Contacts Bulk Deletes provided contacts in bulk. Required Access Level: ModifyContacts

Parameters:

  • emails_payload (EmailsPayload)

    Provide either rule or a list of emails, not both.

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
# File 'lib/ElasticEmail/api/contacts_api.rb', line 235

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

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

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

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

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['apikey']

  new_options = opts.merge(
    :operation => :"ContactsApi.contacts_delete_post",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#contacts_delete_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#contacts_export_by_id_status_get(id, opts = {}) ⇒ ExportStatus

Check Export Status Check the current status of the export. Required Access Level: Export

Parameters:

  • id (String)

    ID of the exported file

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

    the optional parameters

Returns:



291
292
293
294
# File 'lib/ElasticEmail/api/contacts_api.rb', line 291

def contacts_export_by_id_status_get(id, opts = {})
  data, _status_code, _headers = contacts_export_by_id_status_get_with_http_info(id, opts)
  data
end

#contacts_export_by_id_status_get_with_http_info(id, opts = {}) ⇒ Array<(ExportStatus, Integer, Hash)>

Check Export Status Check the current status of the export. Required Access Level: Export

Parameters:

  • id (String)

    ID of the exported file

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

    the optional parameters

Returns:

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

    ExportStatus data, response status code and response headers



301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
# File 'lib/ElasticEmail/api/contacts_api.rb', line 301

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

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

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

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'ExportStatus'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['apikey']

  new_options = opts.merge(
    :operation => :"ContactsApi.contacts_export_by_id_status_get",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#contacts_export_by_id_status_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#contacts_export_post(opts = {}) ⇒ ExportLink

Export Contacts Request an Export of specified Contacts. Required Access Level: Export

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :file_format (ExportFileFormats)

    Format of the exported file (default to 'Csv')

  • :rule (String)

    Query used for filtering.

  • :emails (Array<String>)

    Comma delimited list of contact emails

  • :compression_format (CompressionFormat)

    FileResponse compression format. None or Zip. (default to 'None')

  • :file_name (String)

    Name of your file including extension.

Returns:



358
359
360
361
# File 'lib/ElasticEmail/api/contacts_api.rb', line 358

def contacts_export_post(opts = {})
  data, _status_code, _headers = contacts_export_post_with_http_info(opts)
  data
end

#contacts_export_post_with_http_info(opts = {}) ⇒ Array<(ExportLink, Integer, Hash)>

Export Contacts Request an Export of specified Contacts. Required Access Level: Export

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :file_format (ExportFileFormats)

    Format of the exported file (default to 'Csv')

  • :rule (String)

    Query used for filtering.

  • :emails (Array<String>)

    Comma delimited list of contact emails

  • :compression_format (CompressionFormat)

    FileResponse compression format. None or Zip. (default to 'None')

  • :file_name (String)

    Name of your file including extension.

Returns:

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

    ExportLink data, response status code and response headers



372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
# File 'lib/ElasticEmail/api/contacts_api.rb', line 372

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

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fileFormat'] = opts[:'file_format'] if !opts[:'file_format'].nil?
  query_params[:'rule'] = opts[:'rule'] if !opts[:'rule'].nil?
  query_params[:'emails'] = @api_client.build_collection_param(opts[:'emails'], :multi) if !opts[:'emails'].nil?
  query_params[:'compressionFormat'] = opts[:'compression_format'] if !opts[:'compression_format'].nil?
  query_params[:'fileName'] = opts[:'file_name'] if !opts[:'file_name'].nil?

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

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'ExportLink'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['apikey']

  new_options = opts.merge(
    :operation => :"ContactsApi.contacts_export_post",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#contacts_export_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#contacts_get(opts = {}) ⇒ Array<Contact>

Load Contacts Returns a list of contacts. Required Access Level: ViewContacts

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Maximum number of returned items.

  • :offset (Integer)

    How many items should be returned ahead.

Returns:



427
428
429
430
# File 'lib/ElasticEmail/api/contacts_api.rb', line 427

def contacts_get(opts = {})
  data, _status_code, _headers = contacts_get_with_http_info(opts)
  data
end

#contacts_get_with_http_info(opts = {}) ⇒ Array<(Array<Contact>, Integer, Hash)>

Load Contacts Returns a list of contacts. Required Access Level: ViewContacts

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Maximum number of returned items.

  • :offset (Integer)

    How many items should be returned ahead.

Returns:

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

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



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

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

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

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

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'Array<Contact>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['apikey']

  new_options = opts.merge(
    :operation => :"ContactsApi.contacts_get",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#contacts_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#contacts_import_post(opts = {}) ⇒ nil

Upload Contacts Upload contacts from a file. Required Access Level: ModifyContacts

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :list_name (String)

    Name of an existing list to add these contacts to

  • :encoding_name (String)

    In what encoding the file is uploaded

  • :file_url (String)

    Optional url of csv to import

  • :file (File)

Returns:

  • (nil)


492
493
494
495
# File 'lib/ElasticEmail/api/contacts_api.rb', line 492

def contacts_import_post(opts = {})
  contacts_import_post_with_http_info(opts)
  nil
end

#contacts_import_post_with_http_info(opts = {}) ⇒ Array<(nil, Integer, Hash)>

Upload Contacts Upload contacts from a file. Required Access Level: ModifyContacts

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :list_name (String)

    Name of an existing list to add these contacts to

  • :encoding_name (String)

    In what encoding the file is uploaded

  • :file_url (String)

    Optional url of csv to import

  • :file (File)

Returns:

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

    nil, response status code and response headers



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
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
# File 'lib/ElasticEmail/api/contacts_api.rb', line 505

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

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'listName'] = opts[:'list_name'] if !opts[:'list_name'].nil?
  query_params[:'encodingName'] = opts[:'encoding_name'] if !opts[:'encoding_name'].nil?
  query_params[:'fileUrl'] = opts[:'file_url'] if !opts[:'file_url'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['multipart/form-data'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}
  form_params['file'] = opts[:'file'] if !opts[:'file'].nil?

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

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['apikey']

  new_options = opts.merge(
    :operation => :"ContactsApi.contacts_import_post",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#contacts_import_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#contacts_post(contact_payload, opts = {}) ⇒ Array<Contact>

Add Contact Add new Contacts to your Lists. Up to 1000 can be added (for more please refer to the import request). Required Access Level: ModifyContacts

Parameters:

  • contact_payload (Array<ContactPayload>)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :listnames (Array<String>)

    Names of lists to which the uploaded contacts should be added to

Returns:



562
563
564
565
# File 'lib/ElasticEmail/api/contacts_api.rb', line 562

def contacts_post(contact_payload, opts = {})
  data, _status_code, _headers = contacts_post_with_http_info(contact_payload, opts)
  data
end

#contacts_post_with_http_info(contact_payload, opts = {}) ⇒ Array<(Array<Contact>, Integer, Hash)>

Add Contact Add new Contacts to your Lists. Up to 1000 can be added (for more please refer to the import request). Required Access Level: ModifyContacts

Parameters:

  • contact_payload (Array<ContactPayload>)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :listnames (Array<String>)

    Names of lists to which the uploaded contacts should be added to

Returns:

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

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



573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
# File 'lib/ElasticEmail/api/contacts_api.rb', line 573

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

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'Array<Contact>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['apikey']

  new_options = opts.merge(
    :operation => :"ContactsApi.contacts_post",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactsApi#contacts_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end