klaviyo-api-sdk 10.0.0 → 11.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -0
  3. data/README.md +382 -136
  4. data/klaviyo-api-sdk.gemspec +1 -1
  5. data/lib/klaviyo-api-sdk/api/accounts_api.rb +2 -2
  6. data/lib/klaviyo-api-sdk/api/campaigns_api.rb +41 -23
  7. data/lib/klaviyo-api-sdk/api/catalogs_api.rb +82 -76
  8. data/lib/klaviyo-api-sdk/api/coupons_api.rb +111 -93
  9. data/lib/klaviyo-api-sdk/api/data_privacy_api.rb +1 -1
  10. data/lib/klaviyo-api-sdk/api/events_api.rb +128 -116
  11. data/lib/klaviyo-api-sdk/api/flows_api.rb +199 -169
  12. data/lib/klaviyo-api-sdk/api/forms_api.rb +19 -7
  13. data/lib/klaviyo-api-sdk/api/images_api.rb +5 -5
  14. data/lib/klaviyo-api-sdk/api/lists_api.rb +391 -337
  15. data/lib/klaviyo-api-sdk/api/metrics_api.rb +151 -115
  16. data/lib/klaviyo-api-sdk/api/profiles_api.rb +170 -119
  17. data/lib/klaviyo-api-sdk/api/reporting_api.rb +49 -7
  18. data/lib/klaviyo-api-sdk/api/reviews_api.rb +2 -2
  19. data/lib/klaviyo-api-sdk/api/segments_api.rb +170 -146
  20. data/lib/klaviyo-api-sdk/api/tags_api.rb +108 -42
  21. data/lib/klaviyo-api-sdk/api/templates_api.rb +12 -12
  22. data/lib/klaviyo-api-sdk/api/tracking_settings_api.rb +3 -3
  23. data/lib/klaviyo-api-sdk/api/webhooks_api.rb +7 -7
  24. data/lib/klaviyo-api-sdk/api_client.rb +1 -1
  25. data/lib/klaviyo-api-sdk/configuration.rb +18 -9
  26. data/lib/klaviyo-api-sdk/models/campaign_send_job_partial_update_query_resource_object_attributes.rb +34 -0
  27. data/lib/klaviyo-api-sdk/models/device_metadata.rb +2 -2
  28. data/lib/klaviyo-api-sdk/models/email_unsubscription_parameters.rb +224 -0
  29. data/lib/klaviyo-api-sdk/models/html_block_data.rb +4 -14
  30. data/lib/klaviyo-api-sdk/models/profile_subscription_delete_query_resource_object_attributes.rb +14 -5
  31. data/lib/klaviyo-api-sdk/models/sms_subscription_parameters.rb +13 -4
  32. data/lib/klaviyo-api-sdk/models/sms_unsubscription_parameters.rb +228 -0
  33. data/lib/klaviyo-api-sdk/models/template_create_query_resource_object_attributes.rb +1 -1
  34. data/lib/klaviyo-api-sdk/models/unsubscription_channels.rb +228 -0
  35. data/lib/klaviyo-api-sdk/models/unsubscription_parameters.rb +259 -0
  36. data/lib/klaviyo-api-sdk.rb +36 -19
  37. metadata +6 -2
@@ -73,7 +73,7 @@ module KlaviyoAPI
73
73
  return_type = opts[:debug_return_type]
74
74
 
75
75
  # auth_names
76
- auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
76
+ auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']
77
77
 
78
78
  new_options = opts.merge(
79
79
  :operation => :"EventsApi.bulk_create_events",
@@ -146,7 +146,7 @@ module KlaviyoAPI
146
146
  return_type = opts[:debug_return_type]
147
147
 
148
148
  # auth_names
149
- auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
149
+ auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']
150
150
 
151
151
  new_options = opts.merge(
152
152
  :operation => :"EventsApi.create_event",
@@ -239,7 +239,7 @@ module KlaviyoAPI
239
239
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'
240
240
 
241
241
  # auth_names
242
- auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
242
+ auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']
243
243
 
244
244
  new_options = opts.merge(
245
245
  :operation => :"EventsApi.get_event",
@@ -258,41 +258,69 @@ module KlaviyoAPI
258
258
  return data, status_code, headers
259
259
  end
260
260
 
261
- # Get Event Metric
262
- # Get the metric for an event with the given event ID.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `events:read` `metrics:read`
263
- # @param id [String] ID of the event
261
+ # Get Events
262
+ # Get all events in an account Requests can be sorted by the following fields: `datetime`, `timestamp` Returns a maximum of 200 events per page.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `events:read`
264
263
  # @param [Hash] opts the optional parameters
264
+ # @option opts [Array<String>] :fields_event For more information please visit https://developers.klaviyo.com/en/v2024-10-15/reference/api-overview#sparse-fieldsets
265
265
  # @option opts [Array<String>] :fields_metric For more information please visit https://developers.klaviyo.com/en/v2024-10-15/reference/api-overview#sparse-fieldsets
266
+ # @option opts [Array<String>] :fields_profile For more information please visit https://developers.klaviyo.com/en/v2024-10-15/reference/api-overview#sparse-fieldsets
267
+ # @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2024-10-15/reference/api-overview#filtering&lt;br&gt;Allowed field(s)/operator(s):&lt;br&gt;&#x60;metric_id&#x60;: &#x60;equals&#x60;&lt;br&gt;&#x60;profile_id&#x60;: &#x60;equals&#x60;&lt;br&gt;&#x60;profile&#x60;: &#x60;has&#x60;&lt;br&gt;&#x60;datetime&#x60;: &#x60;greater-or-equal&#x60;, &#x60;greater-than&#x60;, &#x60;less-or-equal&#x60;, &#x60;less-than&#x60;&lt;br&gt;&#x60;timestamp&#x60;: &#x60;greater-or-equal&#x60;, &#x60;greater-than&#x60;, &#x60;less-or-equal&#x60;, &#x60;less-than&#x60;
268
+ # @option opts [Array<String>] :include For more information please visit https://developers.klaviyo.com/en/v2024-10-15/reference/api-overview#relationships
269
+ # @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2024-10-15/reference/api-overview#pagination
270
+ # @option opts [String] :sort For more information please visit https://developers.klaviyo.com/en/v2024-10-15/reference/api-overview#sorting
266
271
  # @return [Hash<String, Object>]
267
- def get_event_metric(id, opts = {})
268
- data, _status_code, _headers = get_event_metric_with_http_info(id, opts)
272
+ def get_events(opts = {})
273
+ data, _status_code, _headers = get_events_with_http_info(opts)
269
274
  data
270
275
  end
271
276
 
272
- # Get Event Metric
273
- # Get the metric for an event with the given event ID.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;350/s&#x60;&lt;br&gt;Steady: &#x60;3500/m&#x60; **Scopes:** &#x60;events:read&#x60; &#x60;metrics:read&#x60;
274
- # @param id [String] ID of the event
277
+ # Get Events
278
+ # Get all events in an account Requests can be sorted by the following fields: &#x60;datetime&#x60;, &#x60;timestamp&#x60; Returns a maximum of 200 events per page.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;350/s&#x60;&lt;br&gt;Steady: &#x60;3500/m&#x60; **Scopes:** &#x60;events:read&#x60;
275
279
  # @param [Hash] opts the optional parameters
280
+ # @option opts [Array<String>] :fields_event For more information please visit https://developers.klaviyo.com/en/v2024-10-15/reference/api-overview#sparse-fieldsets
276
281
  # @option opts [Array<String>] :fields_metric For more information please visit https://developers.klaviyo.com/en/v2024-10-15/reference/api-overview#sparse-fieldsets
282
+ # @option opts [Array<String>] :fields_profile For more information please visit https://developers.klaviyo.com/en/v2024-10-15/reference/api-overview#sparse-fieldsets
283
+ # @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2024-10-15/reference/api-overview#filtering&lt;br&gt;Allowed field(s)/operator(s):&lt;br&gt;&#x60;metric_id&#x60;: &#x60;equals&#x60;&lt;br&gt;&#x60;profile_id&#x60;: &#x60;equals&#x60;&lt;br&gt;&#x60;profile&#x60;: &#x60;has&#x60;&lt;br&gt;&#x60;datetime&#x60;: &#x60;greater-or-equal&#x60;, &#x60;greater-than&#x60;, &#x60;less-or-equal&#x60;, &#x60;less-than&#x60;&lt;br&gt;&#x60;timestamp&#x60;: &#x60;greater-or-equal&#x60;, &#x60;greater-than&#x60;, &#x60;less-or-equal&#x60;, &#x60;less-than&#x60;
284
+ # @option opts [Array<String>] :include For more information please visit https://developers.klaviyo.com/en/v2024-10-15/reference/api-overview#relationships
285
+ # @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2024-10-15/reference/api-overview#pagination
286
+ # @option opts [String] :sort For more information please visit https://developers.klaviyo.com/en/v2024-10-15/reference/api-overview#sorting
277
287
  # @return [Array<(Hash<String, Object>, Integer, Hash)>] Hash<String, Object> data, response status code and response headers
278
- def get_event_metric_with_http_info(id, opts = {})
288
+ def get_events_with_http_info(opts = {})
279
289
  if @api_client.config.debugging
280
- @api_client.config.logger.debug 'Calling API: EventsApi.get_event_metric ...'
290
+ @api_client.config.logger.debug 'Calling API: EventsApi.get_events ...'
281
291
  end
282
- # verify the required parameter 'id' is set
283
- if @api_client.config.client_side_validation && id.nil?
284
- fail ArgumentError, "Missing the required parameter 'id' when calling EventsApi.get_event_metric"
292
+ allowable_values = ["timestamp", "event_properties", "datetime", "uuid"]
293
+ if @api_client.config.client_side_validation && opts[:'fields_event'] && !opts[:'fields_event'].all? { |item| allowable_values.include?(item) }
294
+ fail ArgumentError, "invalid value for \"fields_event\", must include one of #{allowable_values}"
285
295
  end
286
296
  allowable_values = ["name", "created", "updated", "integration"]
287
297
  if @api_client.config.client_side_validation && opts[:'fields_metric'] && !opts[:'fields_metric'].all? { |item| allowable_values.include?(item) }
288
298
  fail ArgumentError, "invalid value for \"fields_metric\", must include one of #{allowable_values}"
289
299
  end
300
+ allowable_values = ["email", "phone_number", "external_id", "first_name", "last_name", "organization", "locale", "title", "image", "created", "updated", "last_event_date", "location", "location.address1", "location.address2", "location.city", "location.country", "location.latitude", "location.longitude", "location.region", "location.zip", "location.timezone", "location.ip", "properties"]
301
+ if @api_client.config.client_side_validation && opts[:'fields_profile'] && !opts[:'fields_profile'].all? { |item| allowable_values.include?(item) }
302
+ fail ArgumentError, "invalid value for \"fields_profile\", must include one of #{allowable_values}"
303
+ end
304
+ allowable_values = ["attributions", "metric", "profile"]
305
+ if @api_client.config.client_side_validation && opts[:'include'] && !opts[:'include'].all? { |item| allowable_values.include?(item) }
306
+ fail ArgumentError, "invalid value for \"include\", must include one of #{allowable_values}"
307
+ end
308
+ allowable_values = ["datetime", "-datetime", "timestamp", "-timestamp"]
309
+ if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
310
+ fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
311
+ end
290
312
  # resource path
291
- local_var_path = '/api/events/{id}/metric'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
313
+ local_var_path = '/api/events'
292
314
 
293
315
  # query parameters
294
316
  query_params = opts[:query_params] || {}
317
+ query_params[:'fields[event]'] = @api_client.build_collection_param(opts[:'fields_event'], :csv) if !opts[:'fields_event'].nil?
295
318
  query_params[:'fields[metric]'] = @api_client.build_collection_param(opts[:'fields_metric'], :csv) if !opts[:'fields_metric'].nil?
319
+ query_params[:'fields[profile]'] = @api_client.build_collection_param(opts[:'fields_profile'], :csv) if !opts[:'fields_profile'].nil?
320
+ query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
321
+ query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :csv) if !opts[:'include'].nil?
322
+ query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil?
323
+ query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
296
324
 
297
325
  # header parameters
298
326
  header_params = opts[:header_params] || {}
@@ -311,10 +339,10 @@ module KlaviyoAPI
311
339
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'
312
340
 
313
341
  # auth_names
314
- auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
342
+ auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']
315
343
 
316
344
  new_options = opts.merge(
317
- :operation => :"EventsApi.get_event_metric",
345
+ :operation => :"EventsApi.get_events",
318
346
  :header_params => header_params,
319
347
  :query_params => query_params,
320
348
  :form_params => form_params,
@@ -325,53 +353,49 @@ module KlaviyoAPI
325
353
 
326
354
  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
327
355
  if @api_client.config.debugging
328
- @api_client.config.logger.debug "API called: EventsApi#get_event_metric\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
356
+ @api_client.config.logger.debug "API called: EventsApi#get_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
329
357
  end
330
358
  return data, status_code, headers
331
359
  end
332
360
 
333
- # Get Event Profile
334
- # Get the profile associated with an event with the given event ID.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `events:read` `profiles:read`
361
+ # Get Metric for Event
362
+ # Get the metric for an event with the given event ID.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `events:read` `metrics:read`
335
363
  # @param id [String] ID of the event
336
364
  # @param [Hash] opts the optional parameters
337
- # @option opts [Array<String>] :additional_fields_profile Request additional fields not included by default in the response. Supported values: &#39;subscriptions&#39;, &#39;predictive_analytics&#39;
338
- # @option opts [Array<String>] :fields_profile For more information please visit https://developers.klaviyo.com/en/v2024-10-15/reference/api-overview#sparse-fieldsets
365
+ # @option opts [Array<String>] :fields_metric For more information please visit https://developers.klaviyo.com/en/v2024-10-15/reference/api-overview#sparse-fieldsets
339
366
  # @return [Hash<String, Object>]
340
- def get_event_profile(id, opts = {})
341
- data, _status_code, _headers = get_event_profile_with_http_info(id, opts)
367
+ def get_metric_for_event(id, opts = {})
368
+ data, _status_code, _headers = get_metric_for_event_with_http_info(id, opts)
342
369
  data
343
370
  end
344
371
 
345
- # Get Event Profile
346
- # Get the profile associated with an event with the given event ID.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;350/s&#x60;&lt;br&gt;Steady: &#x60;3500/m&#x60; **Scopes:** &#x60;events:read&#x60; &#x60;profiles:read&#x60;
372
+ # alias of `get_metric_for_event`
373
+ alias get_event_metric get_metric_for_event
374
+
375
+ # Get Metric for Event
376
+ # Get the metric for an event with the given event ID.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;350/s&#x60;&lt;br&gt;Steady: &#x60;3500/m&#x60; **Scopes:** &#x60;events:read&#x60; &#x60;metrics:read&#x60;
347
377
  # @param id [String] ID of the event
348
378
  # @param [Hash] opts the optional parameters
349
- # @option opts [Array<String>] :additional_fields_profile Request additional fields not included by default in the response. Supported values: &#39;subscriptions&#39;, &#39;predictive_analytics&#39;
350
- # @option opts [Array<String>] :fields_profile For more information please visit https://developers.klaviyo.com/en/v2024-10-15/reference/api-overview#sparse-fieldsets
379
+ # @option opts [Array<String>] :fields_metric For more information please visit https://developers.klaviyo.com/en/v2024-10-15/reference/api-overview#sparse-fieldsets
351
380
  # @return [Array<(Hash<String, Object>, Integer, Hash)>] Hash<String, Object> data, response status code and response headers
352
- def get_event_profile_with_http_info(id, opts = {})
381
+ def get_metric_for_event_with_http_info(id, opts = {})
353
382
  if @api_client.config.debugging
354
- @api_client.config.logger.debug 'Calling API: EventsApi.get_event_profile ...'
383
+ @api_client.config.logger.debug 'Calling API: EventsApi.get_metric_for_event ...'
355
384
  end
356
385
  # verify the required parameter 'id' is set
357
386
  if @api_client.config.client_side_validation && id.nil?
358
- fail ArgumentError, "Missing the required parameter 'id' when calling EventsApi.get_event_profile"
387
+ fail ArgumentError, "Missing the required parameter 'id' when calling EventsApi.get_metric_for_event"
359
388
  end
360
- allowable_values = ["subscriptions", "predictive_analytics"]
361
- if @api_client.config.client_side_validation && opts[:'additional_fields_profile'] && !opts[:'additional_fields_profile'].all? { |item| allowable_values.include?(item) }
362
- fail ArgumentError, "invalid value for \"additional_fields_profile\", must include one of #{allowable_values}"
363
- end
364
- allowable_values = ["email", "phone_number", "external_id", "first_name", "last_name", "organization", "locale", "title", "image", "created", "updated", "last_event_date", "location", "location.address1", "location.address2", "location.city", "location.country", "location.latitude", "location.longitude", "location.region", "location.zip", "location.timezone", "location.ip", "properties", "subscriptions", "subscriptions.email", "subscriptions.email.marketing", "subscriptions.email.marketing.can_receive_email_marketing", "subscriptions.email.marketing.consent", "subscriptions.email.marketing.consent_timestamp", "subscriptions.email.marketing.last_updated", "subscriptions.email.marketing.method", "subscriptions.email.marketing.method_detail", "subscriptions.email.marketing.custom_method_detail", "subscriptions.email.marketing.double_optin", "subscriptions.email.marketing.suppression", "subscriptions.email.marketing.list_suppressions", "subscriptions.sms", "subscriptions.sms.marketing", "subscriptions.sms.marketing.can_receive_sms_marketing", "subscriptions.sms.marketing.consent", "subscriptions.sms.marketing.consent_timestamp", "subscriptions.sms.marketing.method", "subscriptions.sms.marketing.method_detail", "subscriptions.sms.marketing.last_updated", "subscriptions.sms.transactional", "subscriptions.sms.transactional.can_receive_sms_transactional", "subscriptions.sms.transactional.consent", "subscriptions.sms.transactional.consent_timestamp", "subscriptions.sms.transactional.method", "subscriptions.sms.transactional.method_detail", "subscriptions.sms.transactional.last_updated", "subscriptions.mobile_push", "subscriptions.mobile_push.marketing", "subscriptions.mobile_push.marketing.can_receive_push_marketing", "subscriptions.mobile_push.marketing.consent", "subscriptions.mobile_push.marketing.consent_timestamp", "predictive_analytics", "predictive_analytics.historic_clv", "predictive_analytics.predicted_clv", "predictive_analytics.total_clv", "predictive_analytics.historic_number_of_orders", "predictive_analytics.predicted_number_of_orders", "predictive_analytics.average_days_between_orders", "predictive_analytics.average_order_value", "predictive_analytics.churn_probability", "predictive_analytics.expected_date_of_next_order"]
365
- if @api_client.config.client_side_validation && opts[:'fields_profile'] && !opts[:'fields_profile'].all? { |item| allowable_values.include?(item) }
366
- fail ArgumentError, "invalid value for \"fields_profile\", must include one of #{allowable_values}"
389
+ allowable_values = ["name", "created", "updated", "integration"]
390
+ if @api_client.config.client_side_validation && opts[:'fields_metric'] && !opts[:'fields_metric'].all? { |item| allowable_values.include?(item) }
391
+ fail ArgumentError, "invalid value for \"fields_metric\", must include one of #{allowable_values}"
367
392
  end
368
393
  # resource path
369
- local_var_path = '/api/events/{id}/profile'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
394
+ local_var_path = '/api/events/{id}/metric'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
370
395
 
371
396
  # query parameters
372
397
  query_params = opts[:query_params] || {}
373
- query_params[:'additional-fields[profile]'] = @api_client.build_collection_param(opts[:'additional_fields_profile'], :csv) if !opts[:'additional_fields_profile'].nil?
374
- query_params[:'fields[profile]'] = @api_client.build_collection_param(opts[:'fields_profile'], :csv) if !opts[:'fields_profile'].nil?
398
+ query_params[:'fields[metric]'] = @api_client.build_collection_param(opts[:'fields_metric'], :csv) if !opts[:'fields_metric'].nil?
375
399
 
376
400
  # header parameters
377
401
  header_params = opts[:header_params] || {}
@@ -390,10 +414,10 @@ module KlaviyoAPI
390
414
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'
391
415
 
392
416
  # auth_names
393
- auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
417
+ auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']
394
418
 
395
419
  new_options = opts.merge(
396
- :operation => :"EventsApi.get_event_profile",
420
+ :operation => :"EventsApi.get_metric_for_event",
397
421
  :header_params => header_params,
398
422
  :query_params => query_params,
399
423
  :form_params => form_params,
@@ -404,74 +428,45 @@ module KlaviyoAPI
404
428
 
405
429
  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
406
430
  if @api_client.config.debugging
407
- @api_client.config.logger.debug "API called: EventsApi#get_event_profile\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
431
+ @api_client.config.logger.debug "API called: EventsApi#get_metric_for_event\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
408
432
  end
409
433
  return data, status_code, headers
410
434
  end
411
435
 
412
- # Get Events
413
- # Get all events in an account Requests can be sorted by the following fields: `datetime`, `timestamp` Returns a maximum of 200 events per page.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `events:read`
436
+ # alias of `get_metric_for_event_with_http_info`
437
+ alias get_event_metric_with_http_info get_metric_for_event_with_http_info
438
+
439
+ # Get Metric ID for Event
440
+ # Get a list of related Metrics for an Event<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `events:read` `metrics:read`
441
+ # @param id [String] ID of the event
414
442
  # @param [Hash] opts the optional parameters
415
- # @option opts [Array<String>] :fields_event For more information please visit https://developers.klaviyo.com/en/v2024-10-15/reference/api-overview#sparse-fieldsets
416
- # @option opts [Array<String>] :fields_metric For more information please visit https://developers.klaviyo.com/en/v2024-10-15/reference/api-overview#sparse-fieldsets
417
- # @option opts [Array<String>] :fields_profile For more information please visit https://developers.klaviyo.com/en/v2024-10-15/reference/api-overview#sparse-fieldsets
418
- # @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2024-10-15/reference/api-overview#filtering&lt;br&gt;Allowed field(s)/operator(s):&lt;br&gt;&#x60;metric_id&#x60;: &#x60;equals&#x60;&lt;br&gt;&#x60;profile_id&#x60;: &#x60;equals&#x60;&lt;br&gt;&#x60;profile&#x60;: &#x60;has&#x60;&lt;br&gt;&#x60;datetime&#x60;: &#x60;greater-or-equal&#x60;, &#x60;greater-than&#x60;, &#x60;less-or-equal&#x60;, &#x60;less-than&#x60;&lt;br&gt;&#x60;timestamp&#x60;: &#x60;greater-or-equal&#x60;, &#x60;greater-than&#x60;, &#x60;less-or-equal&#x60;, &#x60;less-than&#x60;
419
- # @option opts [Array<String>] :include For more information please visit https://developers.klaviyo.com/en/v2024-10-15/reference/api-overview#relationships
420
- # @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2024-10-15/reference/api-overview#pagination
421
- # @option opts [String] :sort For more information please visit https://developers.klaviyo.com/en/v2024-10-15/reference/api-overview#sorting
422
443
  # @return [Hash<String, Object>]
423
- def get_events(opts = {})
424
- data, _status_code, _headers = get_events_with_http_info(opts)
444
+ def get_metric_id_for_event(id, opts = {})
445
+ data, _status_code, _headers = get_metric_id_for_event_with_http_info(id, opts)
425
446
  data
426
447
  end
427
448
 
428
- # Get Events
429
- # Get all events in an account Requests can be sorted by the following fields: &#x60;datetime&#x60;, &#x60;timestamp&#x60; Returns a maximum of 200 events per page.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;350/s&#x60;&lt;br&gt;Steady: &#x60;3500/m&#x60; **Scopes:** &#x60;events:read&#x60;
449
+ # alias of `get_metric_id_for_event`
450
+ alias get_event_relationships_metric get_metric_id_for_event
451
+
452
+ # Get Metric ID for Event
453
+ # Get a list of related Metrics for an Event&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;350/s&#x60;&lt;br&gt;Steady: &#x60;3500/m&#x60; **Scopes:** &#x60;events:read&#x60; &#x60;metrics:read&#x60;
454
+ # @param id [String] ID of the event
430
455
  # @param [Hash] opts the optional parameters
431
- # @option opts [Array<String>] :fields_event For more information please visit https://developers.klaviyo.com/en/v2024-10-15/reference/api-overview#sparse-fieldsets
432
- # @option opts [Array<String>] :fields_metric For more information please visit https://developers.klaviyo.com/en/v2024-10-15/reference/api-overview#sparse-fieldsets
433
- # @option opts [Array<String>] :fields_profile For more information please visit https://developers.klaviyo.com/en/v2024-10-15/reference/api-overview#sparse-fieldsets
434
- # @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2024-10-15/reference/api-overview#filtering&lt;br&gt;Allowed field(s)/operator(s):&lt;br&gt;&#x60;metric_id&#x60;: &#x60;equals&#x60;&lt;br&gt;&#x60;profile_id&#x60;: &#x60;equals&#x60;&lt;br&gt;&#x60;profile&#x60;: &#x60;has&#x60;&lt;br&gt;&#x60;datetime&#x60;: &#x60;greater-or-equal&#x60;, &#x60;greater-than&#x60;, &#x60;less-or-equal&#x60;, &#x60;less-than&#x60;&lt;br&gt;&#x60;timestamp&#x60;: &#x60;greater-or-equal&#x60;, &#x60;greater-than&#x60;, &#x60;less-or-equal&#x60;, &#x60;less-than&#x60;
435
- # @option opts [Array<String>] :include For more information please visit https://developers.klaviyo.com/en/v2024-10-15/reference/api-overview#relationships
436
- # @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2024-10-15/reference/api-overview#pagination
437
- # @option opts [String] :sort For more information please visit https://developers.klaviyo.com/en/v2024-10-15/reference/api-overview#sorting
438
456
  # @return [Array<(Hash<String, Object>, Integer, Hash)>] Hash<String, Object> data, response status code and response headers
439
- def get_events_with_http_info(opts = {})
457
+ def get_metric_id_for_event_with_http_info(id, opts = {})
440
458
  if @api_client.config.debugging
441
- @api_client.config.logger.debug 'Calling API: EventsApi.get_events ...'
442
- end
443
- allowable_values = ["timestamp", "event_properties", "datetime", "uuid"]
444
- if @api_client.config.client_side_validation && opts[:'fields_event'] && !opts[:'fields_event'].all? { |item| allowable_values.include?(item) }
445
- fail ArgumentError, "invalid value for \"fields_event\", must include one of #{allowable_values}"
446
- end
447
- allowable_values = ["name", "created", "updated", "integration"]
448
- if @api_client.config.client_side_validation && opts[:'fields_metric'] && !opts[:'fields_metric'].all? { |item| allowable_values.include?(item) }
449
- fail ArgumentError, "invalid value for \"fields_metric\", must include one of #{allowable_values}"
450
- end
451
- allowable_values = ["email", "phone_number", "external_id", "first_name", "last_name", "organization", "locale", "title", "image", "created", "updated", "last_event_date", "location", "location.address1", "location.address2", "location.city", "location.country", "location.latitude", "location.longitude", "location.region", "location.zip", "location.timezone", "location.ip", "properties"]
452
- if @api_client.config.client_side_validation && opts[:'fields_profile'] && !opts[:'fields_profile'].all? { |item| allowable_values.include?(item) }
453
- fail ArgumentError, "invalid value for \"fields_profile\", must include one of #{allowable_values}"
454
- end
455
- allowable_values = ["attributions", "metric", "profile"]
456
- if @api_client.config.client_side_validation && opts[:'include'] && !opts[:'include'].all? { |item| allowable_values.include?(item) }
457
- fail ArgumentError, "invalid value for \"include\", must include one of #{allowable_values}"
459
+ @api_client.config.logger.debug 'Calling API: EventsApi.get_metric_id_for_event ...'
458
460
  end
459
- allowable_values = ["datetime", "-datetime", "timestamp", "-timestamp"]
460
- if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
461
- fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
461
+ # verify the required parameter 'id' is set
462
+ if @api_client.config.client_side_validation && id.nil?
463
+ fail ArgumentError, "Missing the required parameter 'id' when calling EventsApi.get_metric_id_for_event"
462
464
  end
463
465
  # resource path
464
- local_var_path = '/api/events'
466
+ local_var_path = '/api/events/{id}/relationships/metric'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
465
467
 
466
468
  # query parameters
467
469
  query_params = opts[:query_params] || {}
468
- query_params[:'fields[event]'] = @api_client.build_collection_param(opts[:'fields_event'], :csv) if !opts[:'fields_event'].nil?
469
- query_params[:'fields[metric]'] = @api_client.build_collection_param(opts[:'fields_metric'], :csv) if !opts[:'fields_metric'].nil?
470
- query_params[:'fields[profile]'] = @api_client.build_collection_param(opts[:'fields_profile'], :csv) if !opts[:'fields_profile'].nil?
471
- query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
472
- query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :csv) if !opts[:'include'].nil?
473
- query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil?
474
- query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
475
470
 
476
471
  # header parameters
477
472
  header_params = opts[:header_params] || {}
@@ -490,10 +485,10 @@ module KlaviyoAPI
490
485
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'
491
486
 
492
487
  # auth_names
493
- auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
488
+ auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']
494
489
 
495
490
  new_options = opts.merge(
496
- :operation => :"EventsApi.get_events",
491
+ :operation => :"EventsApi.get_metric_id_for_event",
497
492
  :header_params => header_params,
498
493
  :query_params => query_params,
499
494
  :form_params => form_params,
@@ -504,42 +499,59 @@ module KlaviyoAPI
504
499
 
505
500
  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
506
501
  if @api_client.config.debugging
507
- @api_client.config.logger.debug "API called: EventsApi#get_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
502
+ @api_client.config.logger.debug "API called: EventsApi#get_metric_id_for_event\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
508
503
  end
509
504
  return data, status_code, headers
510
505
  end
511
506
 
512
- # Get Metric ID for Event
513
- # Get a list of related Metrics for an Event<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `events:read` `metrics:read`
507
+ # alias of `get_metric_id_for_event_with_http_info`
508
+ alias get_event_relationships_metric_with_http_info get_metric_id_for_event_with_http_info
509
+
510
+ # Get Profile for Event
511
+ # Get the profile associated with an event with the given event ID.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `events:read` `profiles:read`
514
512
  # @param id [String] ID of the event
515
513
  # @param [Hash] opts the optional parameters
514
+ # @option opts [Array<String>] :additional_fields_profile Request additional fields not included by default in the response. Supported values: &#39;subscriptions&#39;, &#39;predictive_analytics&#39;
515
+ # @option opts [Array<String>] :fields_profile For more information please visit https://developers.klaviyo.com/en/v2024-10-15/reference/api-overview#sparse-fieldsets
516
516
  # @return [Hash<String, Object>]
517
- def get_metric_id_for_event(id, opts = {})
518
- data, _status_code, _headers = get_metric_id_for_event_with_http_info(id, opts)
517
+ def get_profile_for_event(id, opts = {})
518
+ data, _status_code, _headers = get_profile_for_event_with_http_info(id, opts)
519
519
  data
520
520
  end
521
521
 
522
- # alias of `get_metric_id_for_event`
523
- alias get_event_relationships_metric get_metric_id_for_event
522
+ # alias of `get_profile_for_event`
523
+ alias get_event_profile get_profile_for_event
524
524
 
525
- # Get Metric ID for Event
526
- # Get a list of related Metrics for an Event&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;350/s&#x60;&lt;br&gt;Steady: &#x60;3500/m&#x60; **Scopes:** &#x60;events:read&#x60; &#x60;metrics:read&#x60;
525
+ # Get Profile for Event
526
+ # Get the profile associated with an event with the given event ID.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;350/s&#x60;&lt;br&gt;Steady: &#x60;3500/m&#x60; **Scopes:** &#x60;events:read&#x60; &#x60;profiles:read&#x60;
527
527
  # @param id [String] ID of the event
528
528
  # @param [Hash] opts the optional parameters
529
+ # @option opts [Array<String>] :additional_fields_profile Request additional fields not included by default in the response. Supported values: &#39;subscriptions&#39;, &#39;predictive_analytics&#39;
530
+ # @option opts [Array<String>] :fields_profile For more information please visit https://developers.klaviyo.com/en/v2024-10-15/reference/api-overview#sparse-fieldsets
529
531
  # @return [Array<(Hash<String, Object>, Integer, Hash)>] Hash<String, Object> data, response status code and response headers
530
- def get_metric_id_for_event_with_http_info(id, opts = {})
532
+ def get_profile_for_event_with_http_info(id, opts = {})
531
533
  if @api_client.config.debugging
532
- @api_client.config.logger.debug 'Calling API: EventsApi.get_metric_id_for_event ...'
534
+ @api_client.config.logger.debug 'Calling API: EventsApi.get_profile_for_event ...'
533
535
  end
534
536
  # verify the required parameter 'id' is set
535
537
  if @api_client.config.client_side_validation && id.nil?
536
- fail ArgumentError, "Missing the required parameter 'id' when calling EventsApi.get_metric_id_for_event"
538
+ fail ArgumentError, "Missing the required parameter 'id' when calling EventsApi.get_profile_for_event"
539
+ end
540
+ allowable_values = ["subscriptions", "predictive_analytics"]
541
+ if @api_client.config.client_side_validation && opts[:'additional_fields_profile'] && !opts[:'additional_fields_profile'].all? { |item| allowable_values.include?(item) }
542
+ fail ArgumentError, "invalid value for \"additional_fields_profile\", must include one of #{allowable_values}"
543
+ end
544
+ allowable_values = ["email", "phone_number", "external_id", "first_name", "last_name", "organization", "locale", "title", "image", "created", "updated", "last_event_date", "location", "location.address1", "location.address2", "location.city", "location.country", "location.latitude", "location.longitude", "location.region", "location.zip", "location.timezone", "location.ip", "properties", "subscriptions", "subscriptions.email", "subscriptions.email.marketing", "subscriptions.email.marketing.can_receive_email_marketing", "subscriptions.email.marketing.consent", "subscriptions.email.marketing.consent_timestamp", "subscriptions.email.marketing.last_updated", "subscriptions.email.marketing.method", "subscriptions.email.marketing.method_detail", "subscriptions.email.marketing.custom_method_detail", "subscriptions.email.marketing.double_optin", "subscriptions.email.marketing.suppression", "subscriptions.email.marketing.list_suppressions", "subscriptions.sms", "subscriptions.sms.marketing", "subscriptions.sms.marketing.can_receive_sms_marketing", "subscriptions.sms.marketing.consent", "subscriptions.sms.marketing.consent_timestamp", "subscriptions.sms.marketing.method", "subscriptions.sms.marketing.method_detail", "subscriptions.sms.marketing.last_updated", "subscriptions.sms.transactional", "subscriptions.sms.transactional.can_receive_sms_transactional", "subscriptions.sms.transactional.consent", "subscriptions.sms.transactional.consent_timestamp", "subscriptions.sms.transactional.method", "subscriptions.sms.transactional.method_detail", "subscriptions.sms.transactional.last_updated", "subscriptions.mobile_push", "subscriptions.mobile_push.marketing", "subscriptions.mobile_push.marketing.can_receive_push_marketing", "subscriptions.mobile_push.marketing.consent", "subscriptions.mobile_push.marketing.consent_timestamp", "predictive_analytics", "predictive_analytics.historic_clv", "predictive_analytics.predicted_clv", "predictive_analytics.total_clv", "predictive_analytics.historic_number_of_orders", "predictive_analytics.predicted_number_of_orders", "predictive_analytics.average_days_between_orders", "predictive_analytics.average_order_value", "predictive_analytics.churn_probability", "predictive_analytics.expected_date_of_next_order"]
545
+ if @api_client.config.client_side_validation && opts[:'fields_profile'] && !opts[:'fields_profile'].all? { |item| allowable_values.include?(item) }
546
+ fail ArgumentError, "invalid value for \"fields_profile\", must include one of #{allowable_values}"
537
547
  end
538
548
  # resource path
539
- local_var_path = '/api/events/{id}/relationships/metric'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
549
+ local_var_path = '/api/events/{id}/profile'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
540
550
 
541
551
  # query parameters
542
552
  query_params = opts[:query_params] || {}
553
+ query_params[:'additional-fields[profile]'] = @api_client.build_collection_param(opts[:'additional_fields_profile'], :csv) if !opts[:'additional_fields_profile'].nil?
554
+ query_params[:'fields[profile]'] = @api_client.build_collection_param(opts[:'fields_profile'], :csv) if !opts[:'fields_profile'].nil?
543
555
 
544
556
  # header parameters
545
557
  header_params = opts[:header_params] || {}
@@ -558,10 +570,10 @@ module KlaviyoAPI
558
570
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'
559
571
 
560
572
  # auth_names
561
- auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
573
+ auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']
562
574
 
563
575
  new_options = opts.merge(
564
- :operation => :"EventsApi.get_metric_id_for_event",
576
+ :operation => :"EventsApi.get_profile_for_event",
565
577
  :header_params => header_params,
566
578
  :query_params => query_params,
567
579
  :form_params => form_params,
@@ -572,13 +584,13 @@ module KlaviyoAPI
572
584
 
573
585
  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
574
586
  if @api_client.config.debugging
575
- @api_client.config.logger.debug "API called: EventsApi#get_metric_id_for_event\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
587
+ @api_client.config.logger.debug "API called: EventsApi#get_profile_for_event\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
576
588
  end
577
589
  return data, status_code, headers
578
590
  end
579
591
 
580
- # alias of `get_metric_id_for_event_with_http_info`
581
- alias get_event_relationships_metric_with_http_info get_metric_id_for_event_with_http_info
592
+ # alias of `get_profile_for_event_with_http_info`
593
+ alias get_event_profile_with_http_info get_profile_for_event_with_http_info
582
594
 
583
595
  # Get Profile ID for Event
584
596
  # Get profile [relationships](https://developers.klaviyo.com/en/reference/api_overview#relationships) for an event with the given event ID.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `events:read` `profiles:read`
@@ -629,7 +641,7 @@ module KlaviyoAPI
629
641
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'
630
642
 
631
643
  # auth_names
632
- auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
644
+ auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth']
633
645
 
634
646
  new_options = opts.merge(
635
647
  :operation => :"EventsApi.get_profile_id_for_event",