Class: KlaviyoBeta::FlowsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/klaviyo_sdk_beta/api/flows_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ FlowsApi

Returns a new instance of FlowsApi.



19
20
21
# File 'lib/klaviyo_sdk_beta/api/flows_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/klaviyo_sdk_beta/api/flows_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#get_flow(id, opts = {}) ⇒ Hash<String, Object>

Get Flow Get a flow by id
*Rate limits*:
Burst: `3/s`
Steady: `60/m`

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


30
31
32
33
# File 'lib/klaviyo_sdk_beta/api/flows_api.rb', line 30

def get_flow(id, opts = {})
  data, _status_code, _headers = get_flow_with_http_info(id, opts)
  data
end

#get_flow_action(id, opts = {}) ⇒ Hash<String, Object>

Get Flow Action Get a flow action by id
*Rate limits*:
Burst: `3/s`
Steady: `60/m`

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


117
118
119
120
# File 'lib/klaviyo_sdk_beta/api/flows_api.rb', line 117

def get_flow_action(id, opts = {})
  data, _status_code, _headers = get_flow_action_with_http_info(id, opts)
  data
end

#get_flow_action_flow(action_id, opts = {}) ⇒ Hash<String, Object>

Get Flow Action Flow Get the flow for a flow action
*Rate limits*:
Burst: `3/s`
Steady: `60/m`

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


207
208
209
210
# File 'lib/klaviyo_sdk_beta/api/flows_api.rb', line 207

def get_flow_action_flow(action_id, opts = {})
  data, _status_code, _headers = get_flow_action_flow_with_http_info(action_id, opts)
  data
end

#get_flow_action_flow_with_http_info(action_id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>

Get Flow Action Flow Get the flow for a flow action&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;3/s&#x60;&lt;br&gt;Steady: &#x60;60/m&#x60;

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
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
# File 'lib/klaviyo_sdk_beta/api/flows_api.rb', line 218

def get_flow_action_flow_with_http_info(action_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FlowsApi.get_flow_action_flow ...'
  end
  # verify the required parameter 'action_id' is set
  if @api_client.config.client_side_validation && action_id.nil?
    fail ArgumentError, "Missing the required parameter 'action_id' when calling FlowsApi.get_flow_action_flow"
  end
  allowable_values = ["name", "status", "archived", "created", "updated", "trigger_type"]
  if @api_client.config.client_side_validation && opts[:'fields_flow'] && !opts[:'fields_flow'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_flow\", must include one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/flow-actions/{action_id}/flow/'.sub('{' + 'action_id' + '}', CGI.escape(action_id.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['API_REVISION'] || "2022-09-07.pre"
  # 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] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']

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

#get_flow_action_messages(action_id, opts = {}) ⇒ Hash<String, Object>

Get Flow Action Messages Gets a list of flow messages that belong to the given flow action. Sparse fieldsets can be utilized to request specific fields. The flow messages can be sorted by id, name, created, and updated in ascending and descending order. Each request will return a max of 50 flow messages, which can be paginated through offset pagination
*Rate limits*:
Burst: `3/s`
Steady: `60/m`

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


281
282
283
284
# File 'lib/klaviyo_sdk_beta/api/flows_api.rb', line 281

def get_flow_action_messages(action_id, opts = {})
  data, _status_code, _headers = get_flow_action_messages_with_http_info(action_id, opts)
  data
end

#get_flow_action_messages_with_http_info(action_id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>

Get Flow Action Messages Gets a list of flow messages that belong to the given flow action. Sparse fieldsets can be utilized to request specific fields. The flow messages can be sorted by id, name, created, and updated in ascending and descending order. Each request will return a max of 50 flow messages, which can be paginated through offset pagination&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;3/s&#x60;&lt;br&gt;Steady: &#x60;60/m&#x60;

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



294
295
296
297
298
299
300
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
348
349
350
351
352
353
# File 'lib/klaviyo_sdk_beta/api/flows_api.rb', line 294

def get_flow_action_messages_with_http_info(action_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FlowsApi.get_flow_action_messages ...'
  end
  # verify the required parameter 'action_id' is set
  if @api_client.config.client_side_validation && action_id.nil?
    fail ArgumentError, "Missing the required parameter 'action_id' when calling FlowsApi.get_flow_action_messages"
  end
  allowable_values = ["name", "channel", "content", "created", "updated"]
  if @api_client.config.client_side_validation && opts[:'fields_flow_message'] && !opts[:'fields_flow_message'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_flow_message\", must include one of #{allowable_values}"
  end
  allowable_values = ["created", "-created", "id", "-id", "name", "-name", "updated", "-updated"]
  if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
    fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/flow-actions/{action_id}/flow-messages/'.sub('{' + 'action_id' + '}', CGI.escape(action_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fields[flow-message]'] = @api_client.build_collection_param(opts[:'fields_flow_message'], :csv) if !opts[:'fields_flow_message'].nil?
  query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['API_REVISION'] || "2022-09-07.pre"
  # 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] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']

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

#get_flow_action_relationships(id, related_resource, opts = {}) ⇒ Hash<String, Object>

Get Flow Action Relationships Gets a list of relationships for flow messages that belong to the given flow action. The flow message relationships can be sorted by id in ascending and descending order. Each request will return a max of 50 flow message relationships, which can be paginated through offset pagination
*Rate limits*:
Burst: `3/s`
Steady: `60/m`

Parameters:

  • id (String)
  • related_resource (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


363
364
365
366
# File 'lib/klaviyo_sdk_beta/api/flows_api.rb', line 363

def get_flow_action_relationships(id, related_resource, opts = {})
  data, _status_code, _headers = get_flow_action_relationships_with_http_info(id, related_resource, opts)
  data
end

#get_flow_action_relationships_with_http_info(id, related_resource, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>

Get Flow Action Relationships Gets a list of relationships for flow messages that belong to the given flow action. The flow message relationships can be sorted by id in ascending and descending order. Each request will return a max of 50 flow message relationships, which can be paginated through offset pagination&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;3/s&#x60;&lt;br&gt;Steady: &#x60;60/m&#x60;

Parameters:

  • id (String)
  • related_resource (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



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
428
429
430
431
432
433
434
435
436
437
438
439
# File 'lib/klaviyo_sdk_beta/api/flows_api.rb', line 376

def get_flow_action_relationships_with_http_info(id, related_resource, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FlowsApi.get_flow_action_relationships ...'
  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 FlowsApi.get_flow_action_relationships"
  end
  # verify the required parameter 'related_resource' is set
  if @api_client.config.client_side_validation && related_resource.nil?
    fail ArgumentError, "Missing the required parameter 'related_resource' when calling FlowsApi.get_flow_action_relationships"
  end
  # verify enum value
  allowable_values = ["flow", "flow-messages"]
  if @api_client.config.client_side_validation && !allowable_values.include?(related_resource)
    fail ArgumentError, "invalid value for \"related_resource\", must be one of #{allowable_values}"
  end
  allowable_values = ["created", "-created", "id", "-id", "name", "-name", "updated", "-updated"]
  if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
    fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/flow-actions/{id}/relationships/{related_resource}/'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'related_resource' + '}', CGI.escape(related_resource.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['API_REVISION'] || "2022-09-07.pre"
  # 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] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']

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

#get_flow_action_with_http_info(id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>

Get Flow Action Get a flow action by id&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;3/s&#x60;&lt;br&gt;Steady: &#x60;60/m&#x60;

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



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
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
189
190
191
192
193
194
195
196
197
198
199
# File 'lib/klaviyo_sdk_beta/api/flows_api.rb', line 131

def get_flow_action_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FlowsApi.get_flow_action ...'
  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 FlowsApi.get_flow_action"
  end
  allowable_values = ["action_type", "status", "created", "updated", "settings", "tracking_options", "send_options", "send_options.use_smart_sending", "send_options.is_transactional", "render_options", "render_options.shorten_links", "render_options.add_org_prefix", "render_options.add_info_link", "render_options.add_opt_out_language"]
  if @api_client.config.client_side_validation && opts[:'fields_flow_action'] && !opts[:'fields_flow_action'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_flow_action\", must include one of #{allowable_values}"
  end
  allowable_values = ["name", "channel", "content", "created", "updated"]
  if @api_client.config.client_side_validation && opts[:'fields_flow_message'] && !opts[:'fields_flow_message'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_flow_message\", must include one of #{allowable_values}"
  end
  allowable_values = ["name", "status", "archived", "created", "updated", "trigger_type"]
  if @api_client.config.client_side_validation && opts[:'fields_flow'] && !opts[:'fields_flow'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_flow\", must include one of #{allowable_values}"
  end
  allowable_values = ["flow", "flow-messages"]
  if @api_client.config.client_side_validation && opts[:'include'] && !opts[:'include'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"include\", must include one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/flow-actions/{id}/'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fields[flow-action]'] = @api_client.build_collection_param(opts[:'fields_flow_action'], :csv) if !opts[:'fields_flow_action'].nil?
  query_params[:'fields[flow-message]'] = @api_client.build_collection_param(opts[:'fields_flow_message'], :csv) if !opts[:'fields_flow_message'].nil?
  query_params[:'fields[flow]'] = @api_client.build_collection_param(opts[:'fields_flow'], :csv) if !opts[:'fields_flow'].nil?
  query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :csv) if !opts[:'include'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['API_REVISION'] || "2022-09-07.pre"
  # 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] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']

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

#get_flow_flow_actions(flow_id, opts = {}) ⇒ Hash<String, Object>

Get Flow Flow Actions Gets a list of flow actions that belong to the given flow. Sparse fieldsets can be utilized to request specific fields. The flow actions can be sorted by id, action_type, status, created, and updated in ascending and descending order. Each request will return a max of 50 flow actions, which can be paginated through offset pagination
*Rate limits*:
Burst: `3/s`
Steady: `60/m`

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


449
450
451
452
# File 'lib/klaviyo_sdk_beta/api/flows_api.rb', line 449

def get_flow_flow_actions(flow_id, opts = {})
  data, _status_code, _headers = get_flow_flow_actions_with_http_info(flow_id, opts)
  data
end

#get_flow_flow_actions_with_http_info(flow_id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>

Get Flow Flow Actions Gets a list of flow actions that belong to the given flow. Sparse fieldsets can be utilized to request specific fields. The flow actions can be sorted by id, action_type, status, created, and updated in ascending and descending order. Each request will return a max of 50 flow actions, which can be paginated through offset pagination&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;3/s&#x60;&lt;br&gt;Steady: &#x60;60/m&#x60;

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



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
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
# File 'lib/klaviyo_sdk_beta/api/flows_api.rb', line 462

def get_flow_flow_actions_with_http_info(flow_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FlowsApi.get_flow_flow_actions ...'
  end
  # verify the required parameter 'flow_id' is set
  if @api_client.config.client_side_validation && flow_id.nil?
    fail ArgumentError, "Missing the required parameter 'flow_id' when calling FlowsApi.get_flow_flow_actions"
  end
  allowable_values = ["action_type", "status", "created", "updated", "settings", "tracking_options", "send_options", "send_options.use_smart_sending", "send_options.is_transactional", "render_options", "render_options.shorten_links", "render_options.add_org_prefix", "render_options.add_info_link", "render_options.add_opt_out_language"]
  if @api_client.config.client_side_validation && opts[:'fields_flow_action'] && !opts[:'fields_flow_action'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_flow_action\", must include one of #{allowable_values}"
  end
  allowable_values = ["created", "-created", "id", "-id", "status", "-status", "updated", "-updated"]
  if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
    fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/flows/{flow_id}/flow-actions/'.sub('{' + 'flow_id' + '}', CGI.escape(flow_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fields[flow-action]'] = @api_client.build_collection_param(opts[:'fields_flow_action'], :csv) if !opts[:'fields_flow_action'].nil?
  query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['API_REVISION'] || "2022-09-07.pre"
  # 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] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']

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

#get_flow_message(id, opts = {}) ⇒ Hash<String, Object>

Get Flow Message Get a flow message by id
*Rate limits*:
Burst: `3/s`
Steady: `60/m`

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


531
532
533
534
# File 'lib/klaviyo_sdk_beta/api/flows_api.rb', line 531

def get_flow_message(id, opts = {})
  data, _status_code, _headers = get_flow_message_with_http_info(id, opts)
  data
end

#get_flow_message_action(message_id, opts = {}) ⇒ Hash<String, Object>

Get Flow Message Action Get the flow action for a flow message
*Rate limits*:
Burst: `3/s`
Steady: `60/m`

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


615
616
617
618
# File 'lib/klaviyo_sdk_beta/api/flows_api.rb', line 615

def get_flow_message_action(message_id, opts = {})
  data, _status_code, _headers = get_flow_message_action_with_http_info(message_id, opts)
  data
end

#get_flow_message_action_with_http_info(message_id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>

Get Flow Message Action Get the flow action for a flow message&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;3/s&#x60;&lt;br&gt;Steady: &#x60;60/m&#x60;

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



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
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
# File 'lib/klaviyo_sdk_beta/api/flows_api.rb', line 626

def get_flow_message_action_with_http_info(message_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FlowsApi.get_flow_message_action ...'
  end
  # verify the required parameter 'message_id' is set
  if @api_client.config.client_side_validation && message_id.nil?
    fail ArgumentError, "Missing the required parameter 'message_id' when calling FlowsApi.get_flow_message_action"
  end
  allowable_values = ["action_type", "status", "created", "updated", "settings", "tracking_options", "send_options", "send_options.use_smart_sending", "send_options.is_transactional", "render_options", "render_options.shorten_links", "render_options.add_org_prefix", "render_options.add_info_link", "render_options.add_opt_out_language"]
  if @api_client.config.client_side_validation && opts[:'fields_flow_action'] && !opts[:'fields_flow_action'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_flow_action\", must include one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/flow-messages/{message_id}/flow-action/'.sub('{' + 'message_id' + '}', CGI.escape(message_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fields[flow-action]'] = @api_client.build_collection_param(opts[:'fields_flow_action'], :csv) if !opts[:'fields_flow_action'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['API_REVISION'] || "2022-09-07.pre"
  # 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] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']

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

#get_flow_message_relationships(id, related_resource, opts = {}) ⇒ Hash<String, Object>

Get Flow Message Relationships Get the relationship for a flow message's flow action
*Rate limits*:
Burst: `3/s`
Steady: `60/m`

Parameters:

  • id (String)
  • related_resource (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Hash<String, Object>)


687
688
689
690
# File 'lib/klaviyo_sdk_beta/api/flows_api.rb', line 687

def get_flow_message_relationships(id, related_resource, opts = {})
  data, _status_code, _headers = get_flow_message_relationships_with_http_info(id, related_resource, opts)
  data
end

#get_flow_message_relationships_with_http_info(id, related_resource, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>

Get Flow Message Relationships Get the relationship for a flow message&#39;s flow action&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;3/s&#x60;&lt;br&gt;Steady: &#x60;60/m&#x60;

Parameters:

  • id (String)
  • related_resource (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
# File 'lib/klaviyo_sdk_beta/api/flows_api.rb', line 698

def get_flow_message_relationships_with_http_info(id, related_resource, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FlowsApi.get_flow_message_relationships ...'
  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 FlowsApi.get_flow_message_relationships"
  end
  # verify the required parameter 'related_resource' is set
  if @api_client.config.client_side_validation && related_resource.nil?
    fail ArgumentError, "Missing the required parameter 'related_resource' when calling FlowsApi.get_flow_message_relationships"
  end
  # verify enum value
  allowable_values = ["flow-action"]
  if @api_client.config.client_side_validation && !allowable_values.include?(related_resource)
    fail ArgumentError, "invalid value for \"related_resource\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/flow-messages/{id}/relationships/{related_resource}/'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'related_resource' + '}', CGI.escape(related_resource.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['API_REVISION'] || "2022-09-07.pre"
  # 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] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']

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

#get_flow_message_with_http_info(id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>

Get Flow Message Get a flow message by id&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;3/s&#x60;&lt;br&gt;Steady: &#x60;60/m&#x60;

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



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
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
# File 'lib/klaviyo_sdk_beta/api/flows_api.rb', line 544

def get_flow_message_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FlowsApi.get_flow_message ...'
  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 FlowsApi.get_flow_message"
  end
  allowable_values = ["action_type", "status", "created", "updated", "settings", "tracking_options", "send_options", "send_options.use_smart_sending", "send_options.is_transactional", "render_options", "render_options.shorten_links", "render_options.add_org_prefix", "render_options.add_info_link", "render_options.add_opt_out_language"]
  if @api_client.config.client_side_validation && opts[:'fields_flow_action'] && !opts[:'fields_flow_action'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_flow_action\", must include one of #{allowable_values}"
  end
  allowable_values = ["name", "channel", "content", "created", "updated"]
  if @api_client.config.client_side_validation && opts[:'fields_flow_message'] && !opts[:'fields_flow_message'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_flow_message\", must include one of #{allowable_values}"
  end
  allowable_values = ["flow-action"]
  if @api_client.config.client_side_validation && opts[:'include'] && !opts[:'include'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"include\", must include one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/flow-messages/{id}/'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fields[flow-action]'] = @api_client.build_collection_param(opts[:'fields_flow_action'], :csv) if !opts[:'fields_flow_action'].nil?
  query_params[:'fields[flow-message]'] = @api_client.build_collection_param(opts[:'fields_flow_message'], :csv) if !opts[:'fields_flow_message'].nil?
  query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :csv) if !opts[:'include'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['API_REVISION'] || "2022-09-07.pre"
  # 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] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']

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

#get_flow_relationships(id, related_resource, opts = {}) ⇒ Hash<String, Object>

Get Flow Relationships Gets a list of relationships for flow actions that belong to the given flow. The flow action relationships can be sorted by id in ascending and descending order. Each request will return a max of 50 flow action relationships, which can be paginated through offset pagination
*Rate limits*:
Burst: `3/s`
Steady: `60/m`

Parameters:

  • id (String)
  • related_resource (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


765
766
767
768
# File 'lib/klaviyo_sdk_beta/api/flows_api.rb', line 765

def get_flow_relationships(id, related_resource, opts = {})
  data, _status_code, _headers = get_flow_relationships_with_http_info(id, related_resource, opts)
  data
end

#get_flow_relationships_with_http_info(id, related_resource, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>

Get Flow Relationships Gets a list of relationships for flow actions that belong to the given flow. The flow action relationships can be sorted by id in ascending and descending order. Each request will return a max of 50 flow action relationships, which can be paginated through offset pagination&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;3/s&#x60;&lt;br&gt;Steady: &#x60;60/m&#x60;

Parameters:

  • id (String)
  • related_resource (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
# File 'lib/klaviyo_sdk_beta/api/flows_api.rb', line 778

def get_flow_relationships_with_http_info(id, related_resource, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FlowsApi.get_flow_relationships ...'
  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 FlowsApi.get_flow_relationships"
  end
  # verify the required parameter 'related_resource' is set
  if @api_client.config.client_side_validation && related_resource.nil?
    fail ArgumentError, "Missing the required parameter 'related_resource' when calling FlowsApi.get_flow_relationships"
  end
  # verify enum value
  allowable_values = ["flow-actions"]
  if @api_client.config.client_side_validation && !allowable_values.include?(related_resource)
    fail ArgumentError, "invalid value for \"related_resource\", must be one of #{allowable_values}"
  end
  allowable_values = ["created", "-created", "id", "-id", "status", "-status", "updated", "-updated"]
  if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
    fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/flows/{id}/relationships/{related_resource}/'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'related_resource' + '}', CGI.escape(related_resource.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['API_REVISION'] || "2022-09-07.pre"
  # 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] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']

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

#get_flow_with_http_info(id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>

Get Flow Get a flow by id&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;3/s&#x60;&lt;br&gt;Steady: &#x60;60/m&#x60;

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



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
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/klaviyo_sdk_beta/api/flows_api.rb', line 43

def get_flow_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FlowsApi.get_flow ...'
  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 FlowsApi.get_flow"
  end
  allowable_values = ["action_type", "status", "created", "updated", "settings", "tracking_options", "send_options", "send_options.use_smart_sending", "send_options.is_transactional", "render_options", "render_options.shorten_links", "render_options.add_org_prefix", "render_options.add_info_link", "render_options.add_opt_out_language"]
  if @api_client.config.client_side_validation && opts[:'fields_flow_action'] && !opts[:'fields_flow_action'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_flow_action\", must include one of #{allowable_values}"
  end
  allowable_values = ["name", "status", "archived", "created", "updated", "trigger_type"]
  if @api_client.config.client_side_validation && opts[:'fields_flow'] && !opts[:'fields_flow'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_flow\", must include one of #{allowable_values}"
  end
  allowable_values = ["flow-actions"]
  if @api_client.config.client_side_validation && opts[:'include'] && !opts[:'include'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"include\", must include one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/flows/{id}/'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fields[flow-action]'] = @api_client.build_collection_param(opts[:'fields_flow_action'], :csv) if !opts[:'fields_flow_action'].nil?
  query_params[:'fields[flow]'] = @api_client.build_collection_param(opts[:'fields_flow'], :csv) if !opts[:'fields_flow'].nil?
  query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :csv) if !opts[:'include'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['API_REVISION'] || "2022-09-07.pre"
  # 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] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']

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

#get_flows(opts = {}) ⇒ Hash<String, Object>

Get Flows Gets a list of flows for the company. Sparsefieldsets can be utilized to request specific fields. The flows can be sorted by id, name, status, trigger_type, created, updated in ascending and descending order. Each request will return a max of 50 flows, which can be paginated through offset pagination
*Rate limits*:
Burst: `3/s`
Steady: `60/m`

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

  • (Hash<String, Object>)


852
853
854
855
# File 'lib/klaviyo_sdk_beta/api/flows_api.rb', line 852

def get_flows(opts = {})
  data, _status_code, _headers = get_flows_with_http_info(opts)
  data
end

#get_flows_with_http_info(opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>

Get Flows Gets a list of flows for the company. Sparsefieldsets can be utilized to request specific fields. The flows can be sorted by id, name, status, trigger_type, created, updated in ascending and descending order. Each request will return a max of 50 flows, which can be paginated through offset pagination&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;3/s&#x60;&lt;br&gt;Steady: &#x60;60/m&#x60;

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
# File 'lib/klaviyo_sdk_beta/api/flows_api.rb', line 866

def get_flows_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FlowsApi.get_flows ...'
  end
  allowable_values = ["action_type", "status", "created", "updated", "settings", "tracking_options", "send_options", "send_options.use_smart_sending", "send_options.is_transactional", "render_options", "render_options.shorten_links", "render_options.add_org_prefix", "render_options.add_info_link", "render_options.add_opt_out_language"]
  if @api_client.config.client_side_validation && opts[:'fields_flow_action'] && !opts[:'fields_flow_action'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_flow_action\", must include one of #{allowable_values}"
  end
  allowable_values = ["name", "status", "archived", "created", "updated", "trigger_type"]
  if @api_client.config.client_side_validation && opts[:'fields_flow'] && !opts[:'fields_flow'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"fields_flow\", must include one of #{allowable_values}"
  end
  allowable_values = ["flow-actions"]
  if @api_client.config.client_side_validation && opts[:'include'] && !opts[:'include'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"include\", must include one of #{allowable_values}"
  end
  allowable_values = ["created", "-created", "id", "-id", "name", "-name", "status", "-status", "trigger_type", "-trigger_type", "updated", "-updated"]
  if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
    fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/flows/'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fields[flow-action]'] = @api_client.build_collection_param(opts[:'fields_flow_action'], :csv) if !opts[:'fields_flow_action'].nil?
  query_params[:'fields[flow]'] = @api_client.build_collection_param(opts[:'fields_flow'], :csv) if !opts[:'fields_flow'].nil?
  query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
  query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :csv) if !opts[:'include'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['API_REVISION'] || "2022-09-07.pre"
  # 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] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']

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

#update_flow(id, flow_update_query, opts = {}) ⇒ Hash<String, Object>

Update Flow Update the status of a flow. As a side-effect, update the status of all actions belonging to that flow.
*Rate limits*:
Burst: `3/s`
Steady: `60/m`

Parameters:

  • id (String)
  • flow_update_query (FlowUpdateQuery)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Hash<String, Object>)


939
940
941
942
# File 'lib/klaviyo_sdk_beta/api/flows_api.rb', line 939

def update_flow(id, flow_update_query, opts = {})
  data, _status_code, _headers = update_flow_with_http_info(id, flow_update_query, opts)
  data
end

#update_flow_with_http_info(id, flow_update_query, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>

Update Flow Update the status of a flow. As a side-effect, update the status of all actions belonging to that flow.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;3/s&#x60;&lt;br&gt;Steady: &#x60;60/m&#x60;

Parameters:

  • id (String)
  • flow_update_query (FlowUpdateQuery)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
# File 'lib/klaviyo_sdk_beta/api/flows_api.rb', line 950

def update_flow_with_http_info(id, flow_update_query, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FlowsApi.update_flow ...'
  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 FlowsApi.update_flow"
  end
  # verify the required parameter 'flow_update_query' is set
  if @api_client.config.client_side_validation && flow_update_query.nil?
    fail ArgumentError, "Missing the required parameter 'flow_update_query' when calling FlowsApi.update_flow"
  end
  # resource path
  local_var_path = '/api/flows/{id}/'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['API_REVISION'] || "2022-09-07.pre"
  # 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(flow_update_query)

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']

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