Class: Zernio::BroadcastsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/zernio-sdk/api/broadcasts_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ BroadcastsApi

Returns a new instance of BroadcastsApi.



19
20
21
# File 'lib/zernio-sdk/api/broadcasts_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/zernio-sdk/api/broadcasts_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#add_broadcast_recipients(broadcast_id, add_broadcast_recipients_request, opts = {}) ⇒ AddBroadcastRecipients200Response

Add recipients to a broadcast Add recipients by contact IDs, raw phone numbers, or from the broadcast's segment filters.

Parameters:

  • broadcast_id (String)
  • add_broadcast_recipients_request (AddBroadcastRecipientsRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



28
29
30
31
# File 'lib/zernio-sdk/api/broadcasts_api.rb', line 28

def add_broadcast_recipients(broadcast_id, add_broadcast_recipients_request, opts = {})
  data, _status_code, _headers = add_broadcast_recipients_with_http_info(broadcast_id, add_broadcast_recipients_request, opts)
  data
end

#add_broadcast_recipients_with_http_info(broadcast_id, add_broadcast_recipients_request, opts = {}) ⇒ Array<(AddBroadcastRecipients200Response, Integer, Hash)>

Add recipients to a broadcast Add recipients by contact IDs, raw phone numbers, or from the broadcast's segment filters.

Parameters:

  • broadcast_id (String)
  • add_broadcast_recipients_request (AddBroadcastRecipientsRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/zernio-sdk/api/broadcasts_api.rb', line 39

def add_broadcast_recipients_with_http_info(broadcast_id, add_broadcast_recipients_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BroadcastsApi.add_broadcast_recipients ...'
  end
  # verify the required parameter 'broadcast_id' is set
  if @api_client.config.client_side_validation && broadcast_id.nil?
    fail ArgumentError, "Missing the required parameter 'broadcast_id' when calling BroadcastsApi.add_broadcast_recipients"
  end
  # verify the required parameter 'add_broadcast_recipients_request' is set
  if @api_client.config.client_side_validation && add_broadcast_recipients_request.nil?
    fail ArgumentError, "Missing the required parameter 'add_broadcast_recipients_request' when calling BroadcastsApi.add_broadcast_recipients"
  end
  # resource path
  local_var_path = '/v1/broadcasts/{broadcastId}/recipients'.sub('{' + 'broadcastId' + '}', CGI.escape(broadcast_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']) unless header_params['Accept']
  # 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(add_broadcast_recipients_request)

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

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

  new_options = opts.merge(
    :operation => :"BroadcastsApi.add_broadcast_recipients",
    :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: BroadcastsApi#add_broadcast_recipients\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#cancel_broadcast(broadcast_id, opts = {}) ⇒ CancelBroadcast200Response

Cancel broadcast Cancel a scheduled or in-progress broadcast. Already-sent messages are not affected.

Parameters:

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

    the optional parameters

Returns:



101
102
103
104
# File 'lib/zernio-sdk/api/broadcasts_api.rb', line 101

def cancel_broadcast(broadcast_id, opts = {})
  data, _status_code, _headers = cancel_broadcast_with_http_info(broadcast_id, opts)
  data
end

#cancel_broadcast_with_http_info(broadcast_id, opts = {}) ⇒ Array<(CancelBroadcast200Response, Integer, Hash)>

Cancel broadcast Cancel a scheduled or in-progress broadcast. Already-sent messages are not affected.

Parameters:

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

    the optional parameters

Returns:

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

    CancelBroadcast200Response data, response status code and response headers



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
157
# File 'lib/zernio-sdk/api/broadcasts_api.rb', line 111

def cancel_broadcast_with_http_info(broadcast_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BroadcastsApi.cancel_broadcast ...'
  end
  # verify the required parameter 'broadcast_id' is set
  if @api_client.config.client_side_validation && broadcast_id.nil?
    fail ArgumentError, "Missing the required parameter 'broadcast_id' when calling BroadcastsApi.cancel_broadcast"
  end
  # resource path
  local_var_path = '/v1/broadcasts/{broadcastId}/cancel'.sub('{' + 'broadcastId' + '}', CGI.escape(broadcast_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']) unless header_params['Accept']

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

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

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

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

  new_options = opts.merge(
    :operation => :"BroadcastsApi.cancel_broadcast",
    :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: BroadcastsApi#cancel_broadcast\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_broadcast(create_broadcast_request, opts = {}) ⇒ CreateBroadcast200Response

Create broadcast draft Create a broadcast in draft status. Add recipients and then send or schedule it.

Parameters:

Returns:



164
165
166
167
# File 'lib/zernio-sdk/api/broadcasts_api.rb', line 164

def create_broadcast(create_broadcast_request, opts = {})
  data, _status_code, _headers = create_broadcast_with_http_info(create_broadcast_request, opts)
  data
end

#create_broadcast_with_http_info(create_broadcast_request, opts = {}) ⇒ Array<(CreateBroadcast200Response, Integer, Hash)>

Create broadcast draft Create a broadcast in draft status. Add recipients and then send or schedule it.

Parameters:

Returns:

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

    CreateBroadcast200Response data, response status code and response headers



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
219
220
221
222
223
224
225
# File 'lib/zernio-sdk/api/broadcasts_api.rb', line 174

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

  # 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']) unless header_params['Accept']
  # 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(create_broadcast_request)

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

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

  new_options = opts.merge(
    :operation => :"BroadcastsApi.create_broadcast",
    :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: BroadcastsApi#create_broadcast\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_broadcast(broadcast_id, opts = {}) ⇒ nil

Delete broadcast Permanently delete a broadcast. Only drafts can be deleted.

Parameters:

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

    the optional parameters

Returns:

  • (nil)


232
233
234
235
# File 'lib/zernio-sdk/api/broadcasts_api.rb', line 232

def delete_broadcast(broadcast_id, opts = {})
  delete_broadcast_with_http_info(broadcast_id, opts)
  nil
end

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

Delete broadcast Permanently delete a broadcast. Only drafts can be deleted.

Parameters:

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
285
286
287
288
# File 'lib/zernio-sdk/api/broadcasts_api.rb', line 242

def delete_broadcast_with_http_info(broadcast_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BroadcastsApi.delete_broadcast ...'
  end
  # verify the required parameter 'broadcast_id' is set
  if @api_client.config.client_side_validation && broadcast_id.nil?
    fail ArgumentError, "Missing the required parameter 'broadcast_id' when calling BroadcastsApi.delete_broadcast"
  end
  # resource path
  local_var_path = '/v1/broadcasts/{broadcastId}'.sub('{' + 'broadcastId' + '}', CGI.escape(broadcast_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']) unless header_params['Accept']

  # 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] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"BroadcastsApi.delete_broadcast",
    :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: BroadcastsApi#delete_broadcast\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_broadcast(broadcast_id, opts = {}) ⇒ GetBroadcast200Response

Get broadcast details Returns a broadcast with its full configuration and delivery stats.

Parameters:

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

    the optional parameters

Returns:



295
296
297
298
# File 'lib/zernio-sdk/api/broadcasts_api.rb', line 295

def get_broadcast(broadcast_id, opts = {})
  data, _status_code, _headers = get_broadcast_with_http_info(broadcast_id, opts)
  data
end

#get_broadcast_with_http_info(broadcast_id, opts = {}) ⇒ Array<(GetBroadcast200Response, Integer, Hash)>

Get broadcast details Returns a broadcast with its full configuration and delivery stats.

Parameters:

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

    the optional parameters

Returns:

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

    GetBroadcast200Response data, response status code and response headers



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
348
349
350
351
# File 'lib/zernio-sdk/api/broadcasts_api.rb', line 305

def get_broadcast_with_http_info(broadcast_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BroadcastsApi.get_broadcast ...'
  end
  # verify the required parameter 'broadcast_id' is set
  if @api_client.config.client_side_validation && broadcast_id.nil?
    fail ArgumentError, "Missing the required parameter 'broadcast_id' when calling BroadcastsApi.get_broadcast"
  end
  # resource path
  local_var_path = '/v1/broadcasts/{broadcastId}'.sub('{' + 'broadcastId' + '}', CGI.escape(broadcast_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']) unless header_params['Accept']

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

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

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

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

  new_options = opts.merge(
    :operation => :"BroadcastsApi.get_broadcast",
    :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: BroadcastsApi#get_broadcast\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_broadcast_recipients(broadcast_id, opts = {}) ⇒ ListBroadcastRecipients200Response

List broadcast recipients Returns recipients for a broadcast with individual delivery status. Filter by status.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :status (String)
  • :limit (Integer) — default: default to 50
  • :skip (Integer) — default: default to 0

Returns:



361
362
363
364
# File 'lib/zernio-sdk/api/broadcasts_api.rb', line 361

def list_broadcast_recipients(broadcast_id, opts = {})
  data, _status_code, _headers = list_broadcast_recipients_with_http_info(broadcast_id, opts)
  data
end

#list_broadcast_recipients_with_http_info(broadcast_id, opts = {}) ⇒ Array<(ListBroadcastRecipients200Response, Integer, Hash)>

List broadcast recipients Returns recipients for a broadcast with individual delivery status. Filter by status.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :status (String)
  • :limit (Integer) — default: default to 50
  • :skip (Integer) — default: default to 0

Returns:



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
420
421
422
423
424
425
426
427
# File 'lib/zernio-sdk/api/broadcasts_api.rb', line 374

def list_broadcast_recipients_with_http_info(broadcast_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BroadcastsApi.list_broadcast_recipients ...'
  end
  # verify the required parameter 'broadcast_id' is set
  if @api_client.config.client_side_validation && broadcast_id.nil?
    fail ArgumentError, "Missing the required parameter 'broadcast_id' when calling BroadcastsApi.list_broadcast_recipients"
  end
  allowable_values = ["pending", "sent", "delivered", "read", "failed"]
  if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
    fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v1/broadcasts/{broadcastId}/recipients'.sub('{' + 'broadcastId' + '}', CGI.escape(broadcast_id.to_s))

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

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

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

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

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

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

  new_options = opts.merge(
    :operation => :"BroadcastsApi.list_broadcast_recipients",
    :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: BroadcastsApi#list_broadcast_recipients\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_broadcasts(opts = {}) ⇒ ListBroadcasts200Response

List broadcasts Returns broadcasts with delivery stats. Filter by status, platform, or profile.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :profile_id (String)

    Filter by profile. Omit to list across all profiles

  • :status (String)
  • :platform (String)
  • :limit (Integer) — default: default to 50
  • :skip (Integer) — default: default to 0

Returns:



438
439
440
441
# File 'lib/zernio-sdk/api/broadcasts_api.rb', line 438

def list_broadcasts(opts = {})
  data, _status_code, _headers = list_broadcasts_with_http_info(opts)
  data
end

#list_broadcasts_with_http_info(opts = {}) ⇒ Array<(ListBroadcasts200Response, Integer, Hash)>

List broadcasts Returns broadcasts with delivery stats. Filter by status, platform, or profile.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :profile_id (String)

    Filter by profile. Omit to list across all profiles

  • :status (String)
  • :platform (String)
  • :limit (Integer) — default: default to 50
  • :skip (Integer) — default: default to 0

Returns:

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

    ListBroadcasts200Response data, response status code and response headers



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
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
# File 'lib/zernio-sdk/api/broadcasts_api.rb', line 452

def list_broadcasts_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BroadcastsApi.list_broadcasts ...'
  end
  allowable_values = ["draft", "scheduled", "sending", "completed", "failed", "cancelled"]
  if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
    fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v1/broadcasts'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'profileId'] = opts[:'profile_id'] if !opts[:'profile_id'].nil?
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  query_params[:'platform'] = opts[:'platform'] if !opts[:'platform'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?

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

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

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

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

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

  new_options = opts.merge(
    :operation => :"BroadcastsApi.list_broadcasts",
    :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: BroadcastsApi#list_broadcasts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#schedule_broadcast(broadcast_id, schedule_broadcast_request, opts = {}) ⇒ ScheduleBroadcast200Response

Schedule broadcast for later Schedule a draft broadcast to be sent at a future date and time.

Parameters:

  • broadcast_id (String)
  • schedule_broadcast_request (ScheduleBroadcastRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



511
512
513
514
# File 'lib/zernio-sdk/api/broadcasts_api.rb', line 511

def schedule_broadcast(broadcast_id, schedule_broadcast_request, opts = {})
  data, _status_code, _headers = schedule_broadcast_with_http_info(broadcast_id, schedule_broadcast_request, opts)
  data
end

#schedule_broadcast_with_http_info(broadcast_id, schedule_broadcast_request, opts = {}) ⇒ Array<(ScheduleBroadcast200Response, Integer, Hash)>

Schedule broadcast for later Schedule a draft broadcast to be sent at a future date and time.

Parameters:

  • broadcast_id (String)
  • schedule_broadcast_request (ScheduleBroadcastRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



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
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
# File 'lib/zernio-sdk/api/broadcasts_api.rb', line 522

def schedule_broadcast_with_http_info(broadcast_id, schedule_broadcast_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BroadcastsApi.schedule_broadcast ...'
  end
  # verify the required parameter 'broadcast_id' is set
  if @api_client.config.client_side_validation && broadcast_id.nil?
    fail ArgumentError, "Missing the required parameter 'broadcast_id' when calling BroadcastsApi.schedule_broadcast"
  end
  # verify the required parameter 'schedule_broadcast_request' is set
  if @api_client.config.client_side_validation && schedule_broadcast_request.nil?
    fail ArgumentError, "Missing the required parameter 'schedule_broadcast_request' when calling BroadcastsApi.schedule_broadcast"
  end
  # resource path
  local_var_path = '/v1/broadcasts/{broadcastId}/schedule'.sub('{' + 'broadcastId' + '}', CGI.escape(broadcast_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']) unless header_params['Accept']
  # 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(schedule_broadcast_request)

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

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

  new_options = opts.merge(
    :operation => :"BroadcastsApi.schedule_broadcast",
    :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: BroadcastsApi#schedule_broadcast\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#send_broadcast(broadcast_id, opts = {}) ⇒ SendBroadcast200Response

Send broadcast now Immediately start sending a draft broadcast to its recipients.

Parameters:

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

    the optional parameters

Returns:



584
585
586
587
# File 'lib/zernio-sdk/api/broadcasts_api.rb', line 584

def send_broadcast(broadcast_id, opts = {})
  data, _status_code, _headers = send_broadcast_with_http_info(broadcast_id, opts)
  data
end

#send_broadcast_with_http_info(broadcast_id, opts = {}) ⇒ Array<(SendBroadcast200Response, Integer, Hash)>

Send broadcast now Immediately start sending a draft broadcast to its recipients.

Parameters:

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

    the optional parameters

Returns:

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

    SendBroadcast200Response data, response status code and response headers



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
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
# File 'lib/zernio-sdk/api/broadcasts_api.rb', line 594

def send_broadcast_with_http_info(broadcast_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BroadcastsApi.send_broadcast ...'
  end
  # verify the required parameter 'broadcast_id' is set
  if @api_client.config.client_side_validation && broadcast_id.nil?
    fail ArgumentError, "Missing the required parameter 'broadcast_id' when calling BroadcastsApi.send_broadcast"
  end
  # resource path
  local_var_path = '/v1/broadcasts/{broadcastId}/send'.sub('{' + 'broadcastId' + '}', CGI.escape(broadcast_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']) unless header_params['Accept']

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

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

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

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

  new_options = opts.merge(
    :operation => :"BroadcastsApi.send_broadcast",
    :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: BroadcastsApi#send_broadcast\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_broadcast(broadcast_id, opts = {}) ⇒ UpdateBroadcast200Response

Update broadcast Update a broadcast's name, message, template, or segment filters. Only draft broadcasts can be updated.

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:



648
649
650
651
# File 'lib/zernio-sdk/api/broadcasts_api.rb', line 648

def update_broadcast(broadcast_id, opts = {})
  data, _status_code, _headers = update_broadcast_with_http_info(broadcast_id, opts)
  data
end

#update_broadcast_with_http_info(broadcast_id, opts = {}) ⇒ Array<(UpdateBroadcast200Response, Integer, Hash)>

Update broadcast Update a broadcast's name, message, template, or segment filters. Only draft broadcasts can be updated.

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

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

    UpdateBroadcast200Response data, response status code and response headers



659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
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
# File 'lib/zernio-sdk/api/broadcasts_api.rb', line 659

def update_broadcast_with_http_info(broadcast_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BroadcastsApi.update_broadcast ...'
  end
  # verify the required parameter 'broadcast_id' is set
  if @api_client.config.client_side_validation && broadcast_id.nil?
    fail ArgumentError, "Missing the required parameter 'broadcast_id' when calling BroadcastsApi.update_broadcast"
  end
  # resource path
  local_var_path = '/v1/broadcasts/{broadcastId}'.sub('{' + 'broadcastId' + '}', CGI.escape(broadcast_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']) unless header_params['Accept']
  # 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(opts[:'update_broadcast_request'])

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

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

  new_options = opts.merge(
    :operation => :"BroadcastsApi.update_broadcast",
    :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(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BroadcastsApi#update_broadcast\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end