Class: SibApiV3Sdk::EmailCampaignsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/sib-api-v3-sdk/api/email_campaigns_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ EmailCampaignsApi

Returns a new instance of EmailCampaignsApi.



19
20
21
# File 'lib/sib-api-v3-sdk/api/email_campaigns_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/sib-api-v3-sdk/api/email_campaigns_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_email_campaign(email_campaigns, opts = {}) ⇒ CreateModel

Create an email campaign

Parameters:

  • email_campaigns

    Values to create a campaign

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

    the optional parameters

Returns:



36
37
38
39
# File 'lib/sib-api-v3-sdk/api/email_campaigns_api.rb', line 36

def create_email_campaign(email_campaigns, opts = {})
  data, _status_code, _headers = create_email_campaign_with_http_info(email_campaigns, opts)
  data
end

#create_email_campaign_with_http_info(email_campaigns, opts = {}) ⇒ Array<(CreateModel, Fixnum, Hash)>

Create an email campaign

Parameters:

  • email_campaigns

    Values to create a campaign

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

    the optional parameters

Returns:

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

    CreateModel data, response status code and response headers



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/sib-api-v3-sdk/api/email_campaigns_api.rb', line 45

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

  # 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(email_campaigns)
  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: EmailCampaignsApi#create_email_campaign\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_email_campaign(campaign_id, opts = {}) ⇒ nil

Delete an email campaign

Parameters:

  • campaign_id

    id of the campaign

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

    the optional parameters

Returns:

  • (nil)


88
89
90
91
# File 'lib/sib-api-v3-sdk/api/email_campaigns_api.rb', line 88

def delete_email_campaign(campaign_id, opts = {})
  delete_email_campaign_with_http_info(campaign_id, opts)
  nil
end

#delete_email_campaign_with_http_info(campaign_id, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Delete an email campaign

Parameters:

  • campaign_id

    id of the campaign

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



97
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
# File 'lib/sib-api-v3-sdk/api/email_campaigns_api.rb', line 97

def delete_email_campaign_with_http_info(campaign_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailCampaignsApi.delete_email_campaign ...'
  end
  # verify the required parameter 'campaign_id' is set
  if @api_client.config.client_side_validation && campaign_id.nil?
    fail ArgumentError, "Missing the required parameter 'campaign_id' when calling EmailCampaignsApi.delete_email_campaign"
  end
  # resource path
  local_var_path = '/emailCampaigns/{campaignId}'.sub('{' + 'campaignId' + '}', campaign_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: EmailCampaignsApi#delete_email_campaign\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#email_export_recipients(campaign_id, opts = {}) ⇒ CreatedProcessId

Export the recipients of an email campaign

Parameters:

  • campaign_id

    Id of the campaign

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

    the optional parameters

Options Hash (opts):

Returns:



140
141
142
143
# File 'lib/sib-api-v3-sdk/api/email_campaigns_api.rb', line 140

def email_export_recipients(campaign_id, opts = {})
  data, _status_code, _headers = email_export_recipients_with_http_info(campaign_id, opts)
  data
end

#email_export_recipients_with_http_info(campaign_id, opts = {}) ⇒ Array<(CreatedProcessId, Fixnum, Hash)>

Export the recipients of an email campaign

Parameters:

  • campaign_id

    Id of the campaign

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

    the optional parameters

Options Hash (opts):

Returns:

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

    CreatedProcessId data, response status code and response headers



150
151
152
153
154
155
156
157
158
159
160
161
162
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
# File 'lib/sib-api-v3-sdk/api/email_campaigns_api.rb', line 150

def email_export_recipients_with_http_info(campaign_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailCampaignsApi.email_export_recipients ...'
  end
  # verify the required parameter 'campaign_id' is set
  if @api_client.config.client_side_validation && campaign_id.nil?
    fail ArgumentError, "Missing the required parameter 'campaign_id' when calling EmailCampaignsApi.email_export_recipients"
  end
  # resource path
  local_var_path = '/emailCampaigns/{campaignId}/exportRecipients'.sub('{' + 'campaignId' + '}', campaign_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(opts[:'recipient_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: EmailCampaignsApi#email_export_recipients\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_ab_test_campaign_result(campaign_id, opts = {}) ⇒ AbTestCampaignResult

Get an A/B test email campaign results Obtain winning version of an A/B test email campaign

Parameters:

  • campaign_id

    Id of the A/B test campaign

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

    the optional parameters

Returns:



194
195
196
197
# File 'lib/sib-api-v3-sdk/api/email_campaigns_api.rb', line 194

def get_ab_test_campaign_result(campaign_id, opts = {})
  data, _status_code, _headers = get_ab_test_campaign_result_with_http_info(campaign_id, opts)
  data
end

#get_ab_test_campaign_result_with_http_info(campaign_id, opts = {}) ⇒ Array<(AbTestCampaignResult, Fixnum, Hash)>

Get an A/B test email campaign results Obtain winning version of an A/B test email campaign

Parameters:

  • campaign_id

    Id of the A/B test campaign

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

    the optional parameters

Returns:

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

    AbTestCampaignResult data, response status code and response headers



204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# File 'lib/sib-api-v3-sdk/api/email_campaigns_api.rb', line 204

def get_ab_test_campaign_result_with_http_info(campaign_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailCampaignsApi.get_ab_test_campaign_result ...'
  end
  # verify the required parameter 'campaign_id' is set
  if @api_client.config.client_side_validation && campaign_id.nil?
    fail ArgumentError, "Missing the required parameter 'campaign_id' when calling EmailCampaignsApi.get_ab_test_campaign_result"
  end
  # resource path
  local_var_path = '/emailCampaigns/{campaignId}/abTestCampaignResult'.sub('{' + 'campaignId' + '}', campaign_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 => 'AbTestCampaignResult')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: EmailCampaignsApi#get_ab_test_campaign_result\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_email_campaign(campaign_id, opts = {}) ⇒ GetEmailCampaign

Get an email campaign report

Parameters:

  • campaign_id

    Id of the campaign

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

    the optional parameters

Returns:



247
248
249
250
# File 'lib/sib-api-v3-sdk/api/email_campaigns_api.rb', line 247

def get_email_campaign(campaign_id, opts = {})
  data, _status_code, _headers = get_email_campaign_with_http_info(campaign_id, opts)
  data
end

#get_email_campaign_with_http_info(campaign_id, opts = {}) ⇒ Array<(GetEmailCampaign, Fixnum, Hash)>

Get an email campaign report

Parameters:

  • campaign_id

    Id of the campaign

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

    the optional parameters

Returns:

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

    GetEmailCampaign data, response status code and response headers



256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
# File 'lib/sib-api-v3-sdk/api/email_campaigns_api.rb', line 256

def get_email_campaign_with_http_info(campaign_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailCampaignsApi.get_email_campaign ...'
  end
  # verify the required parameter 'campaign_id' is set
  if @api_client.config.client_side_validation && campaign_id.nil?
    fail ArgumentError, "Missing the required parameter 'campaign_id' when calling EmailCampaignsApi.get_email_campaign"
  end
  # resource path
  local_var_path = '/emailCampaigns/{campaignId}'.sub('{' + 'campaignId' + '}', campaign_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 => 'GetEmailCampaign')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: EmailCampaignsApi#get_email_campaign\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_email_campaigns(opts = {}) ⇒ GetEmailCampaigns

Return all your created email campaigns

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :type (String)

    Filter on the type of the campaigns

  • :status (String)

    Filter on the status of the campaign

  • :start_date (String)

    Mandatory if endDate is used. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either &#39;status&#39; not passed and if passed is set to &#39;sent&#39; )

  • :end_date (String)

    Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either &#39;status&#39; not passed and if passed is set to &#39;sent&#39; )

  • :limit (Integer)

    Number of documents per page (default to 50)

  • :offset (Integer)

    Index of the first document in 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:



305
306
307
308
# File 'lib/sib-api-v3-sdk/api/email_campaigns_api.rb', line 305

def get_email_campaigns(opts = {})
  data, _status_code, _headers = get_email_campaigns_with_http_info(opts)
  data
end

#get_email_campaigns_with_http_info(opts = {}) ⇒ Array<(GetEmailCampaigns, Fixnum, Hash)>

Return all your created email campaigns

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :type (String)

    Filter on the type of the campaigns

  • :status (String)

    Filter on the status of the campaign

  • :start_date (String)

    Mandatory if endDate is used. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either &#39;status&#39; not passed and if passed is set to &#39;sent&#39; )

  • :end_date (String)

    Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either &#39;status&#39; not passed and if passed is set to &#39;sent&#39; )

  • :limit (Integer)

    Number of documents per page

  • :offset (Integer)

    Index of the first document in 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<(GetEmailCampaigns, Fixnum, Hash)>)

    GetEmailCampaigns data, response status code and response headers



320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
# File 'lib/sib-api-v3-sdk/api/email_campaigns_api.rb', line 320

def get_email_campaigns_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailCampaignsApi.get_email_campaigns ...'
  end
  if @api_client.config.client_side_validation && opts[:'type'] && !['classic', 'trigger'].include?(opts[:'type'])
    fail ArgumentError, 'invalid value for "type", must be one of classic, trigger'
  end
  if @api_client.config.client_side_validation && opts[:'status'] && !['suspended', 'archive', 'sent', 'queued', 'draft', 'inProcess'].include?(opts[:'status'])
    fail ArgumentError, 'invalid value for "status", must be one of suspended, archive, sent, queued, draft, inProcess'
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling EmailCampaignsApi.get_email_campaigns, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 0
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling EmailCampaignsApi.get_email_campaigns, 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 = '/emailCampaigns'

  # query parameters
  query_params = {}
  query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  query_params[:'startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil?
  query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].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 => 'GetEmailCampaigns')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: EmailCampaignsApi#get_email_campaigns\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_shared_template_url(campaign_id, opts = {}) ⇒ GetSharedTemplateUrl

Get a shared template url Get a unique URL to share & import an email template from one Sendinblue account to another.

Parameters:

  • campaign_id

    Id of the campaign or template

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

    the optional parameters

Returns:



384
385
386
387
# File 'lib/sib-api-v3-sdk/api/email_campaigns_api.rb', line 384

def get_shared_template_url(campaign_id, opts = {})
  data, _status_code, _headers = get_shared_template_url_with_http_info(campaign_id, opts)
  data
end

#get_shared_template_url_with_http_info(campaign_id, opts = {}) ⇒ Array<(GetSharedTemplateUrl, Fixnum, Hash)>

Get a shared template url Get a unique URL to share &amp; import an email template from one Sendinblue account to another.

Parameters:

  • campaign_id

    Id of the campaign or template

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

    the optional parameters

Returns:

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

    GetSharedTemplateUrl data, response status code and response headers



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
427
428
429
430
431
432
# File 'lib/sib-api-v3-sdk/api/email_campaigns_api.rb', line 394

def get_shared_template_url_with_http_info(campaign_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailCampaignsApi.get_shared_template_url ...'
  end
  # verify the required parameter 'campaign_id' is set
  if @api_client.config.client_side_validation && campaign_id.nil?
    fail ArgumentError, "Missing the required parameter 'campaign_id' when calling EmailCampaignsApi.get_shared_template_url"
  end
  # resource path
  local_var_path = '/emailCampaigns/{campaignId}/sharedUrl'.sub('{' + 'campaignId' + '}', campaign_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 => 'GetSharedTemplateUrl')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: EmailCampaignsApi#get_shared_template_url\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#send_email_campaign_now(campaign_id, opts = {}) ⇒ nil

Send an email campaign immediately, based on campaignId

Parameters:

  • campaign_id

    Id of the campaign

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

    the optional parameters

Returns:

  • (nil)


437
438
439
440
# File 'lib/sib-api-v3-sdk/api/email_campaigns_api.rb', line 437

def send_email_campaign_now(campaign_id, opts = {})
  send_email_campaign_now_with_http_info(campaign_id, opts)
  nil
end

#send_email_campaign_now_with_http_info(campaign_id, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Send an email campaign immediately, based on campaignId

Parameters:

  • campaign_id

    Id of the campaign

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
# File 'lib/sib-api-v3-sdk/api/email_campaigns_api.rb', line 446

def send_email_campaign_now_with_http_info(campaign_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailCampaignsApi.send_email_campaign_now ...'
  end
  # verify the required parameter 'campaign_id' is set
  if @api_client.config.client_side_validation && campaign_id.nil?
    fail ArgumentError, "Missing the required parameter 'campaign_id' when calling EmailCampaignsApi.send_email_campaign_now"
  end
  # resource path
  local_var_path = '/emailCampaigns/{campaignId}/sendNow'.sub('{' + 'campaignId' + '}', campaign_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(: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: EmailCampaignsApi#send_email_campaign_now\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#send_report(campaign_id, send_report, opts = {}) ⇒ nil

Send the report of a campaign A PDF will be sent to the specified email addresses

Parameters:

  • campaign_id

    Id of the campaign

  • send_report

    Values for send a report

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

    the optional parameters

Returns:

  • (nil)


490
491
492
493
# File 'lib/sib-api-v3-sdk/api/email_campaigns_api.rb', line 490

def send_report(campaign_id, send_report, opts = {})
  send_report_with_http_info(campaign_id, send_report, opts)
  nil
end

#send_report_with_http_info(campaign_id, send_report, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Send the report of a campaign A PDF will be sent to the specified email addresses

Parameters:

  • campaign_id

    Id of the campaign

  • send_report

    Values for send a report

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
537
538
539
540
541
542
# File 'lib/sib-api-v3-sdk/api/email_campaigns_api.rb', line 501

def send_report_with_http_info(campaign_id, send_report, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailCampaignsApi.send_report ...'
  end
  # verify the required parameter 'campaign_id' is set
  if @api_client.config.client_side_validation && campaign_id.nil?
    fail ArgumentError, "Missing the required parameter 'campaign_id' when calling EmailCampaignsApi.send_report"
  end
  # verify the required parameter 'send_report' is set
  if @api_client.config.client_side_validation && send_report.nil?
    fail ArgumentError, "Missing the required parameter 'send_report' when calling EmailCampaignsApi.send_report"
  end
  # resource path
  local_var_path = '/emailCampaigns/{campaignId}/sendReport'.sub('{' + 'campaignId' + '}', campaign_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(send_report)
  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: EmailCampaignsApi#send_report\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#send_test_email(campaign_id, email_to, opts = {}) ⇒ nil

Send an email campaign to your test list

Parameters:

  • campaign_id

    Id of the campaign

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

    the optional parameters

Returns:

  • (nil)


548
549
550
551
# File 'lib/sib-api-v3-sdk/api/email_campaigns_api.rb', line 548

def send_test_email(campaign_id, email_to, opts = {})
  send_test_email_with_http_info(campaign_id, email_to, opts)
  nil
end

#send_test_email_with_http_info(campaign_id, email_to, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Send an email campaign to your test list

Parameters:

  • campaign_id

    Id of the campaign

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
588
589
590
591
592
593
594
595
596
597
598
599
# File 'lib/sib-api-v3-sdk/api/email_campaigns_api.rb', line 558

def send_test_email_with_http_info(campaign_id, email_to, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailCampaignsApi.send_test_email ...'
  end
  # verify the required parameter 'campaign_id' is set
  if @api_client.config.client_side_validation && campaign_id.nil?
    fail ArgumentError, "Missing the required parameter 'campaign_id' when calling EmailCampaignsApi.send_test_email"
  end
  # verify the required parameter 'email_to' is set
  if @api_client.config.client_side_validation && email_to.nil?
    fail ArgumentError, "Missing the required parameter 'email_to' when calling EmailCampaignsApi.send_test_email"
  end
  # resource path
  local_var_path = '/emailCampaigns/{campaignId}/sendTest'.sub('{' + 'campaignId' + '}', campaign_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(email_to)
  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: EmailCampaignsApi#send_test_email\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/sib-api-v3-sdk/api/email_campaigns_api.rb', line 25

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

#update_campaign_status(campaign_id, status, opts = {}) ⇒ nil

Update an email campaign status

Parameters:

  • campaign_id

    Id of the campaign

  • status

    Status of the campaign

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

    the optional parameters

Returns:

  • (nil)


605
606
607
608
# File 'lib/sib-api-v3-sdk/api/email_campaigns_api.rb', line 605

def update_campaign_status(campaign_id, status, opts = {})
  update_campaign_status_with_http_info(campaign_id, status, opts)
  nil
end

#update_campaign_status_with_http_info(campaign_id, status, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Update an email campaign status

Parameters:

  • campaign_id

    Id of the campaign

  • status

    Status of the campaign

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
655
656
# File 'lib/sib-api-v3-sdk/api/email_campaigns_api.rb', line 615

def update_campaign_status_with_http_info(campaign_id, status, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailCampaignsApi.update_campaign_status ...'
  end
  # verify the required parameter 'campaign_id' is set
  if @api_client.config.client_side_validation && campaign_id.nil?
    fail ArgumentError, "Missing the required parameter 'campaign_id' when calling EmailCampaignsApi.update_campaign_status"
  end
  # verify the required parameter 'status' is set
  if @api_client.config.client_side_validation && status.nil?
    fail ArgumentError, "Missing the required parameter 'status' when calling EmailCampaignsApi.update_campaign_status"
  end
  # resource path
  local_var_path = '/emailCampaigns/{campaignId}/status'.sub('{' + 'campaignId' + '}', campaign_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(status)
  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: EmailCampaignsApi#update_campaign_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_email_campaign(campaign_id, email_campaign, opts = {}) ⇒ nil

Update an email campaign

Parameters:

  • campaign_id

    Id of the campaign

  • email_campaign

    Values to update a campaign

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

    the optional parameters

Returns:

  • (nil)


662
663
664
665
# File 'lib/sib-api-v3-sdk/api/email_campaigns_api.rb', line 662

def update_email_campaign(campaign_id, email_campaign, opts = {})
  update_email_campaign_with_http_info(campaign_id, email_campaign, opts)
  nil
end

#update_email_campaign_with_http_info(campaign_id, email_campaign, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Update an email campaign

Parameters:

  • campaign_id

    Id of the campaign

  • email_campaign

    Values to update a campaign

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
701
702
703
704
705
706
707
708
709
710
711
712
713
# File 'lib/sib-api-v3-sdk/api/email_campaigns_api.rb', line 672

def update_email_campaign_with_http_info(campaign_id, email_campaign, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailCampaignsApi.update_email_campaign ...'
  end
  # verify the required parameter 'campaign_id' is set
  if @api_client.config.client_side_validation && campaign_id.nil?
    fail ArgumentError, "Missing the required parameter 'campaign_id' when calling EmailCampaignsApi.update_email_campaign"
  end
  # verify the required parameter 'email_campaign' is set
  if @api_client.config.client_side_validation && email_campaign.nil?
    fail ArgumentError, "Missing the required parameter 'email_campaign' when calling EmailCampaignsApi.update_email_campaign"
  end
  # resource path
  local_var_path = '/emailCampaigns/{campaignId}'.sub('{' + 'campaignId' + '}', campaign_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(email_campaign)
  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: EmailCampaignsApi#update_email_campaign\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

Upload an image to your account’s image gallery

Parameters:

  • upload_image

    Parameters to upload an image

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

    the optional parameters

Returns:



718
719
720
721
# File 'lib/sib-api-v3-sdk/api/email_campaigns_api.rb', line 718

def upload_image_to_gallery(upload_image, opts = {})
  data, _status_code, _headers = upload_image_to_gallery_with_http_info(upload_image, opts)
  data
end

Upload an image to your account&#39;s image gallery

Parameters:

  • upload_image

    Parameters to upload an image

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

    the optional parameters

Returns:

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

    UploadImageModel data, response status code and response headers



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
# File 'lib/sib-api-v3-sdk/api/email_campaigns_api.rb', line 727

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

  # 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(upload_image)
  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 => 'UploadImageModel')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: EmailCampaignsApi#upload_image_to_gallery\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end