=begin #Klaviyo API #The Klaviyo REST API. Please visit https://developers.klaviyo.com for more details. The version of the OpenAPI document: 2024-10-15 Contact: developers@klaviyo.com Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end # Common files require 'klaviyo-api-sdk/api_client' require 'klaviyo-api-sdk/api_error' require 'klaviyo-api-sdk/version' require 'klaviyo-api-sdk/configuration' # Models require 'klaviyo-api-sdk/models/api_method_filter' require 'klaviyo-api-sdk/models/alltime_date_filter' require 'klaviyo-api-sdk/models/anniversary_date_filter' require 'klaviyo-api-sdk/models/any_enum' require 'klaviyo-api-sdk/models/api_enum' require 'klaviyo-api-sdk/models/audiences_sub_object' require 'klaviyo-api-sdk/models/back_in_stock_enum' require 'klaviyo-api-sdk/models/back_in_stock_method_filter' require 'klaviyo-api-sdk/models/back_in_stock_subscription_enum' require 'klaviyo-api-sdk/models/base_event_create_query_resource_object' require 'klaviyo-api-sdk/models/base_event_create_query_resource_object_attributes' require 'klaviyo-api-sdk/models/block_display_options' require 'klaviyo-api-sdk/models/block_enum' require 'klaviyo-api-sdk/models/boolean_enum' require 'klaviyo-api-sdk/models/boolean_filter' require 'klaviyo-api-sdk/models/bounce_date_enum' require 'klaviyo-api-sdk/models/bounce_date_filter' require 'klaviyo-api-sdk/models/bounce_date_filter_filter' require 'klaviyo-api-sdk/models/bulk_remove_enum' require 'klaviyo-api-sdk/models/bulk_remove_method_filter' require 'klaviyo-api-sdk/models/calendar_date_filter' require 'klaviyo-api-sdk/models/campaign_clone_query' require 'klaviyo-api-sdk/models/campaign_clone_query_resource_object' require 'klaviyo-api-sdk/models/campaign_clone_query_resource_object_attributes' require 'klaviyo-api-sdk/models/campaign_create_query' require 'klaviyo-api-sdk/models/campaign_create_query_resource_object' require 'klaviyo-api-sdk/models/campaign_create_query_resource_object_attributes' require 'klaviyo-api-sdk/models/campaign_create_query_resource_object_attributes_campaign_messages' require 'klaviyo-api-sdk/models/campaign_create_query_resource_object_attributes_send_options' require 'klaviyo-api-sdk/models/campaign_create_query_resource_object_attributes_tracking_options' require 'klaviyo-api-sdk/models/campaign_enum' require 'klaviyo-api-sdk/models/campaign_message_assign_template_query' require 'klaviyo-api-sdk/models/campaign_message_assign_template_query_resource_object' require 'klaviyo-api-sdk/models/campaign_message_assign_template_query_resource_object_relationships' require 'klaviyo-api-sdk/models/campaign_message_assign_template_query_resource_object_relationships_template' require 'klaviyo-api-sdk/models/campaign_message_assign_template_query_resource_object_relationships_template_data' require 'klaviyo-api-sdk/models/campaign_message_create_query_resource_object' require 'klaviyo-api-sdk/models/campaign_message_create_query_resource_object_attributes' require 'klaviyo-api-sdk/models/campaign_message_create_query_resource_object_attributes_content' require 'klaviyo-api-sdk/models/campaign_message_enum' require 'klaviyo-api-sdk/models/campaign_message_partial_update_query' require 'klaviyo-api-sdk/models/campaign_message_partial_update_query_resource_object' require 'klaviyo-api-sdk/models/campaign_message_partial_update_query_resource_object_attributes' require 'klaviyo-api-sdk/models/campaign_partial_update_query' require 'klaviyo-api-sdk/models/campaign_partial_update_query_resource_object' require 'klaviyo-api-sdk/models/campaign_partial_update_query_resource_object_attributes' require 'klaviyo-api-sdk/models/campaign_recipient_estimation_job_create_query' require 'klaviyo-api-sdk/models/campaign_recipient_estimation_job_create_query_resource_object' require 'klaviyo-api-sdk/models/campaign_recipient_estimation_job_enum' require 'klaviyo-api-sdk/models/campaign_send_job_create_query' require 'klaviyo-api-sdk/models/campaign_send_job_create_query_resource_object' require 'klaviyo-api-sdk/models/campaign_send_job_enum' require 'klaviyo-api-sdk/models/campaign_send_job_partial_update_query' require 'klaviyo-api-sdk/models/campaign_send_job_partial_update_query_resource_object' require 'klaviyo-api-sdk/models/campaign_send_job_partial_update_query_resource_object_attributes' require 'klaviyo-api-sdk/models/campaign_tracking_setting_dynamic_param' require 'klaviyo-api-sdk/models/campaign_tracking_setting_static_param' require 'klaviyo-api-sdk/models/campaign_values_report_enum' require 'klaviyo-api-sdk/models/campaign_values_request_dto' require 'klaviyo-api-sdk/models/campaign_values_request_dto_resource_object' require 'klaviyo-api-sdk/models/campaign_values_request_dto_resource_object_attributes' require 'klaviyo-api-sdk/models/campaign_values_request_dto_resource_object_attributes_timeframe' require 'klaviyo-api-sdk/models/carrier_deactivation_enum' require 'klaviyo-api-sdk/models/carrier_deactivation_method_filter' require 'klaviyo-api-sdk/models/catalog_category_bulk_create_job_enum' require 'klaviyo-api-sdk/models/catalog_category_bulk_delete_job_enum' require 'klaviyo-api-sdk/models/catalog_category_bulk_update_job_enum' require 'klaviyo-api-sdk/models/catalog_category_create_job_create_query' require 'klaviyo-api-sdk/models/catalog_category_create_job_create_query_resource_object' require 'klaviyo-api-sdk/models/catalog_category_create_job_create_query_resource_object_attributes' require 'klaviyo-api-sdk/models/catalog_category_create_job_create_query_resource_object_attributes_categories' require 'klaviyo-api-sdk/models/catalog_category_create_query' require 'klaviyo-api-sdk/models/catalog_category_create_query_resource_object' require 'klaviyo-api-sdk/models/catalog_category_create_query_resource_object_attributes' require 'klaviyo-api-sdk/models/catalog_category_create_query_resource_object_relationships' require 'klaviyo-api-sdk/models/catalog_category_create_query_resource_object_relationships_items' require 'klaviyo-api-sdk/models/catalog_category_create_query_resource_object_relationships_items_data_inner' require 'klaviyo-api-sdk/models/catalog_category_delete_job_create_query' require 'klaviyo-api-sdk/models/catalog_category_delete_job_create_query_resource_object' require 'klaviyo-api-sdk/models/catalog_category_delete_job_create_query_resource_object_attributes' require 'klaviyo-api-sdk/models/catalog_category_delete_job_create_query_resource_object_attributes_categories' require 'klaviyo-api-sdk/models/catalog_category_delete_query_resource_object' require 'klaviyo-api-sdk/models/catalog_category_enum' require 'klaviyo-api-sdk/models/catalog_category_item_op' require 'klaviyo-api-sdk/models/catalog_category_update_job_create_query' require 'klaviyo-api-sdk/models/catalog_category_update_job_create_query_resource_object' require 'klaviyo-api-sdk/models/catalog_category_update_job_create_query_resource_object_attributes' require 'klaviyo-api-sdk/models/catalog_category_update_job_create_query_resource_object_attributes_categories' require 'klaviyo-api-sdk/models/catalog_category_update_query' require 'klaviyo-api-sdk/models/catalog_category_update_query_resource_object' require 'klaviyo-api-sdk/models/catalog_category_update_query_resource_object_attributes' require 'klaviyo-api-sdk/models/catalog_item_bulk_create_job_enum' require 'klaviyo-api-sdk/models/catalog_item_bulk_delete_job_enum' require 'klaviyo-api-sdk/models/catalog_item_bulk_update_job_enum' require 'klaviyo-api-sdk/models/catalog_item_category_op' require 'klaviyo-api-sdk/models/catalog_item_create_job_create_query' require 'klaviyo-api-sdk/models/catalog_item_create_job_create_query_resource_object' require 'klaviyo-api-sdk/models/catalog_item_create_job_create_query_resource_object_attributes' require 'klaviyo-api-sdk/models/catalog_item_create_job_create_query_resource_object_attributes_items' require 'klaviyo-api-sdk/models/catalog_item_create_query' require 'klaviyo-api-sdk/models/catalog_item_create_query_resource_object' require 'klaviyo-api-sdk/models/catalog_item_create_query_resource_object_attributes' require 'klaviyo-api-sdk/models/catalog_item_create_query_resource_object_relationships' require 'klaviyo-api-sdk/models/catalog_item_create_query_resource_object_relationships_categories' require 'klaviyo-api-sdk/models/catalog_item_create_query_resource_object_relationships_categories_data_inner' require 'klaviyo-api-sdk/models/catalog_item_delete_job_create_query' require 'klaviyo-api-sdk/models/catalog_item_delete_job_create_query_resource_object' require 'klaviyo-api-sdk/models/catalog_item_delete_job_create_query_resource_object_attributes' require 'klaviyo-api-sdk/models/catalog_item_delete_job_create_query_resource_object_attributes_items' require 'klaviyo-api-sdk/models/catalog_item_delete_query_resource_object' require 'klaviyo-api-sdk/models/catalog_item_enum' require 'klaviyo-api-sdk/models/catalog_item_update_job_create_query' require 'klaviyo-api-sdk/models/catalog_item_update_job_create_query_resource_object' require 'klaviyo-api-sdk/models/catalog_item_update_job_create_query_resource_object_attributes' require 'klaviyo-api-sdk/models/catalog_item_update_job_create_query_resource_object_attributes_items' require 'klaviyo-api-sdk/models/catalog_item_update_query' require 'klaviyo-api-sdk/models/catalog_item_update_query_resource_object' require 'klaviyo-api-sdk/models/catalog_item_update_query_resource_object_attributes' require 'klaviyo-api-sdk/models/catalog_variant_bulk_create_job_enum' require 'klaviyo-api-sdk/models/catalog_variant_bulk_delete_job_enum' require 'klaviyo-api-sdk/models/catalog_variant_bulk_update_job_enum' require 'klaviyo-api-sdk/models/catalog_variant_create_job_create_query' require 'klaviyo-api-sdk/models/catalog_variant_create_job_create_query_resource_object' require 'klaviyo-api-sdk/models/catalog_variant_create_job_create_query_resource_object_attributes' require 'klaviyo-api-sdk/models/catalog_variant_create_job_create_query_resource_object_attributes_variants' require 'klaviyo-api-sdk/models/catalog_variant_create_query' require 'klaviyo-api-sdk/models/catalog_variant_create_query_resource_object' require 'klaviyo-api-sdk/models/catalog_variant_create_query_resource_object_attributes' require 'klaviyo-api-sdk/models/catalog_variant_create_query_resource_object_relationships' require 'klaviyo-api-sdk/models/catalog_variant_create_query_resource_object_relationships_item' require 'klaviyo-api-sdk/models/catalog_variant_create_query_resource_object_relationships_item_data' require 'klaviyo-api-sdk/models/catalog_variant_delete_job_create_query' require 'klaviyo-api-sdk/models/catalog_variant_delete_job_create_query_resource_object' require 'klaviyo-api-sdk/models/catalog_variant_delete_job_create_query_resource_object_attributes' require 'klaviyo-api-sdk/models/catalog_variant_delete_job_create_query_resource_object_attributes_variants' require 'klaviyo-api-sdk/models/catalog_variant_delete_query_resource_object' require 'klaviyo-api-sdk/models/catalog_variant_enum' require 'klaviyo-api-sdk/models/catalog_variant_update_job_create_query' require 'klaviyo-api-sdk/models/catalog_variant_update_job_create_query_resource_object' require 'klaviyo-api-sdk/models/catalog_variant_update_job_create_query_resource_object_attributes' require 'klaviyo-api-sdk/models/catalog_variant_update_job_create_query_resource_object_attributes_variants' require 'klaviyo-api-sdk/models/catalog_variant_update_query' require 'klaviyo-api-sdk/models/catalog_variant_update_query_resource_object' require 'klaviyo-api-sdk/models/catalog_variant_update_query_resource_object_attributes' require 'klaviyo-api-sdk/models/checkout_enum' require 'klaviyo-api-sdk/models/checkout_method_filter' require 'klaviyo-api-sdk/models/condition_group' require 'klaviyo-api-sdk/models/condition_group_conditions_inner' require 'klaviyo-api-sdk/models/constant_contact_enum' require 'klaviyo-api-sdk/models/constant_contact_integration_filter' require 'klaviyo-api-sdk/models/constant_contact_integration_method_filter' require 'klaviyo-api-sdk/models/content_repeat' require 'klaviyo-api-sdk/models/coupon_code_bulk_create_job_enum' require 'klaviyo-api-sdk/models/coupon_code_create_job_create_query' require 'klaviyo-api-sdk/models/coupon_code_create_job_create_query_resource_object' require 'klaviyo-api-sdk/models/coupon_code_create_job_create_query_resource_object_attributes' require 'klaviyo-api-sdk/models/coupon_code_create_job_create_query_resource_object_attributes_coupon_codes' require 'klaviyo-api-sdk/models/coupon_code_create_query' require 'klaviyo-api-sdk/models/coupon_code_create_query_resource_object' require 'klaviyo-api-sdk/models/coupon_code_create_query_resource_object_attributes' require 'klaviyo-api-sdk/models/coupon_code_create_query_resource_object_relationships' require 'klaviyo-api-sdk/models/coupon_code_create_query_resource_object_relationships_coupon' require 'klaviyo-api-sdk/models/coupon_code_create_query_resource_object_relationships_coupon_data' require 'klaviyo-api-sdk/models/coupon_code_enum' require 'klaviyo-api-sdk/models/coupon_code_update_query' require 'klaviyo-api-sdk/models/coupon_code_update_query_resource_object' require 'klaviyo-api-sdk/models/coupon_code_update_query_resource_object_attributes' require 'klaviyo-api-sdk/models/coupon_create_query' require 'klaviyo-api-sdk/models/coupon_create_query_resource_object' require 'klaviyo-api-sdk/models/coupon_create_query_resource_object_attributes' require 'klaviyo-api-sdk/models/coupon_enum' require 'klaviyo-api-sdk/models/coupon_update_query' require 'klaviyo-api-sdk/models/coupon_update_query_resource_object' require 'klaviyo-api-sdk/models/coupon_update_query_resource_object_attributes' require 'klaviyo-api-sdk/models/custom_source_enum' require 'klaviyo-api-sdk/models/custom_source_filter' require 'klaviyo-api-sdk/models/custom_timeframe' require 'klaviyo-api-sdk/models/custom_tracking_param_dto' require 'klaviyo-api-sdk/models/data_privacy_create_deletion_job_query' require 'klaviyo-api-sdk/models/data_privacy_create_deletion_job_query_resource_object' require 'klaviyo-api-sdk/models/data_privacy_create_deletion_job_query_resource_object_attributes' require 'klaviyo-api-sdk/models/data_privacy_create_deletion_job_query_resource_object_attributes_profile' require 'klaviyo-api-sdk/models/data_privacy_deletion_job_enum' require 'klaviyo-api-sdk/models/data_privacy_profile_query_resource_object' require 'klaviyo-api-sdk/models/data_privacy_profile_query_resource_object_attributes' require 'klaviyo-api-sdk/models/date_enum' require 'klaviyo-api-sdk/models/device_metadata' require 'klaviyo-api-sdk/models/double_optin_filter' require 'klaviyo-api-sdk/models/dynamic_enum' require 'klaviyo-api-sdk/models/dynamic_tracking_param' require 'klaviyo-api-sdk/models/email_content_sub_object' require 'klaviyo-api-sdk/models/email_enum' require 'klaviyo-api-sdk/models/email_send_options_sub_object' require 'klaviyo-api-sdk/models/email_subscription_parameters' require 'klaviyo-api-sdk/models/email_tracking_options_sub_object' require 'klaviyo-api-sdk/models/email_tracking_options_sub_object_custom_tracking_params_inner' require 'klaviyo-api-sdk/models/equals_enum' require 'klaviyo-api-sdk/models/equals_string_filter' require 'klaviyo-api-sdk/models/event_bulk_create_enum' require 'klaviyo-api-sdk/models/event_bulk_create_job_enum' require 'klaviyo-api-sdk/models/event_create_query_v2' require 'klaviyo-api-sdk/models/event_create_query_v2_resource_object' require 'klaviyo-api-sdk/models/event_create_query_v2_resource_object_attributes' require 'klaviyo-api-sdk/models/event_create_query_v2_resource_object_attributes_metric' require 'klaviyo-api-sdk/models/event_create_query_v2_resource_object_attributes_profile' require 'klaviyo-api-sdk/models/event_enum' require 'klaviyo-api-sdk/models/event_profile_create_query_resource_object' require 'klaviyo-api-sdk/models/event_profile_create_query_resource_object_attributes' require 'klaviyo-api-sdk/models/events_bulk_create_job' require 'klaviyo-api-sdk/models/events_bulk_create_job_resource_object' require 'klaviyo-api-sdk/models/events_bulk_create_job_resource_object_attributes' require 'klaviyo-api-sdk/models/events_bulk_create_job_resource_object_attributes_events_bulk_create' require 'klaviyo-api-sdk/models/events_bulk_create_query_resource_object' require 'klaviyo-api-sdk/models/events_bulk_create_query_resource_object_attributes' require 'klaviyo-api-sdk/models/events_bulk_create_query_resource_object_attributes_events' require 'klaviyo-api-sdk/models/events_bulk_create_query_resource_object_attributes_profile' require 'klaviyo-api-sdk/models/existence_enum' require 'klaviyo-api-sdk/models/existence_operator_filter' require 'klaviyo-api-sdk/models/failed_age_gate_enum' require 'klaviyo-api-sdk/models/failed_age_gate_method_filter' require 'klaviyo-api-sdk/models/flow_enum' require 'klaviyo-api-sdk/models/flow_series_report_enum' require 'klaviyo-api-sdk/models/flow_series_request_dto' require 'klaviyo-api-sdk/models/flow_series_request_dto_resource_object' require 'klaviyo-api-sdk/models/flow_series_request_dto_resource_object_attributes' require 'klaviyo-api-sdk/models/flow_tracking_setting_dynamic_param' require 'klaviyo-api-sdk/models/flow_tracking_setting_static_param' require 'klaviyo-api-sdk/models/flow_update_query' require 'klaviyo-api-sdk/models/flow_update_query_resource_object' require 'klaviyo-api-sdk/models/flow_update_query_resource_object_attributes' require 'klaviyo-api-sdk/models/flow_values_report_enum' require 'klaviyo-api-sdk/models/flow_values_request_dto' require 'klaviyo-api-sdk/models/flow_values_request_dto_resource_object' require 'klaviyo-api-sdk/models/flow_values_request_dto_resource_object_attributes' require 'klaviyo-api-sdk/models/form_enum' require 'klaviyo-api-sdk/models/form_method_filter' require 'klaviyo-api-sdk/models/form_series_report_enum' require 'klaviyo-api-sdk/models/form_series_request_dto' require 'klaviyo-api-sdk/models/form_series_request_dto_resource_object' require 'klaviyo-api-sdk/models/form_series_request_dto_resource_object_attributes' require 'klaviyo-api-sdk/models/form_values_report_enum' require 'klaviyo-api-sdk/models/form_values_request_dto' require 'klaviyo-api-sdk/models/form_values_request_dto_resource_object' require 'klaviyo-api-sdk/models/form_values_request_dto_resource_object_attributes' require 'klaviyo-api-sdk/models/get_accounts4_xx_response' require 'klaviyo-api-sdk/models/get_accounts4_xx_response_errors_inner' require 'klaviyo-api-sdk/models/get_accounts4_xx_response_errors_inner_source' require 'klaviyo-api-sdk/models/greater_than_enum' require 'klaviyo-api-sdk/models/html_block' require 'klaviyo-api-sdk/models/html_block_data' require 'klaviyo-api-sdk/models/has_email_marketing' require 'klaviyo-api-sdk/models/has_email_marketing_consent' require 'klaviyo-api-sdk/models/has_email_marketing_consent_consent_status' require 'klaviyo-api-sdk/models/has_email_marketing_never_subscribed' require 'klaviyo-api-sdk/models/has_email_marketing_subscribed' require 'klaviyo-api-sdk/models/has_email_marketing_subscribed_filters_inner' require 'klaviyo-api-sdk/models/has_push_marketing' require 'klaviyo-api-sdk/models/has_push_marketing_consent' require 'klaviyo-api-sdk/models/has_sms_marketing_consent' require 'klaviyo-api-sdk/models/has_sms_marketing_subscribed' require 'klaviyo-api-sdk/models/has_sms_marketing_subscribed_filters_inner' require 'klaviyo-api-sdk/models/html_enum' require 'klaviyo-api-sdk/models/image_create_query' require 'klaviyo-api-sdk/models/image_create_query_resource_object' require 'klaviyo-api-sdk/models/image_create_query_resource_object_attributes' require 'klaviyo-api-sdk/models/image_enum' require 'klaviyo-api-sdk/models/image_partial_update_query' require 'klaviyo-api-sdk/models/image_partial_update_query_resource_object' require 'klaviyo-api-sdk/models/image_partial_update_query_resource_object_attributes' require 'klaviyo-api-sdk/models/in_enum' require 'klaviyo-api-sdk/models/in_string_array_filter' require 'klaviyo-api-sdk/models/inbound_message_enum' require 'klaviyo-api-sdk/models/inbound_message_method_filter' require 'klaviyo-api-sdk/models/integration_enum' require 'klaviyo-api-sdk/models/invalid_email_date_enum' require 'klaviyo-api-sdk/models/invalid_email_date_filter' require 'klaviyo-api-sdk/models/is_double_opt_in_enum' require 'klaviyo-api-sdk/models/is_set_enum' require 'klaviyo-api-sdk/models/is_set_existence_filter' require 'klaviyo-api-sdk/models/less_than_enum' require 'klaviyo-api-sdk/models/list_contains_operator_filter' require 'klaviyo-api-sdk/models/list_contains_operator_filter_value' require 'klaviyo-api-sdk/models/list_create_query' require 'klaviyo-api-sdk/models/list_create_query_resource_object' require 'klaviyo-api-sdk/models/list_create_query_resource_object_attributes' require 'klaviyo-api-sdk/models/list_enum' require 'klaviyo-api-sdk/models/list_length_filter' require 'klaviyo-api-sdk/models/list_members_add_query' require 'klaviyo-api-sdk/models/list_members_add_query_data_inner' require 'klaviyo-api-sdk/models/list_members_delete_query' require 'klaviyo-api-sdk/models/list_partial_update_query' require 'klaviyo-api-sdk/models/list_partial_update_query_resource_object' require 'klaviyo-api-sdk/models/list_set_filter' require 'klaviyo-api-sdk/models/list_substring_filter' require 'klaviyo-api-sdk/models/mailbox_provider_enum' require 'klaviyo-api-sdk/models/mailbox_provider_method_filter' require 'klaviyo-api-sdk/models/manual_add_enum' require 'klaviyo-api-sdk/models/manual_add_method_filter' require 'klaviyo-api-sdk/models/manual_import_enum' require 'klaviyo-api-sdk/models/manual_import_method_filter' require 'klaviyo-api-sdk/models/manual_remove_enum' require 'klaviyo-api-sdk/models/manual_remove_method_filter' require 'klaviyo-api-sdk/models/manual_suppression_date_enum' require 'klaviyo-api-sdk/models/manual_suppression_date_filter' require 'klaviyo-api-sdk/models/message_blocked_enum' require 'klaviyo-api-sdk/models/message_blocked_method_filter' require 'klaviyo-api-sdk/models/method_enum' require 'klaviyo-api-sdk/models/metric_aggregate_enum' require 'klaviyo-api-sdk/models/metric_aggregate_query' require 'klaviyo-api-sdk/models/metric_aggregate_query_resource_object' require 'klaviyo-api-sdk/models/metric_aggregate_query_resource_object_attributes' require 'klaviyo-api-sdk/models/metric_create_query_resource_object' require 'klaviyo-api-sdk/models/metric_create_query_resource_object_attributes' require 'klaviyo-api-sdk/models/metric_enum' require 'klaviyo-api-sdk/models/never_subscribed_enum' require 'klaviyo-api-sdk/models/no_email_marketing' require 'klaviyo-api-sdk/models/no_email_marketing_consent' require 'klaviyo-api-sdk/models/no_email_marketing_consent_consent_status' require 'klaviyo-api-sdk/models/no_email_marketing_filters_inner' require 'klaviyo-api-sdk/models/no_email_marketing_never_subscribed' require 'klaviyo-api-sdk/models/no_email_marketing_subscribed' require 'klaviyo-api-sdk/models/no_email_marketing_unsubscribed' require 'klaviyo-api-sdk/models/no_email_marketing_unsubscribed_filters' require 'klaviyo-api-sdk/models/no_email_marketing_unsubscribed_filters_one_of_inner' require 'klaviyo-api-sdk/models/no_push_marketing' require 'klaviyo-api-sdk/models/no_push_marketing_consent' require 'klaviyo-api-sdk/models/no_sms_marketing' require 'klaviyo-api-sdk/models/no_sms_marketing_consent' require 'klaviyo-api-sdk/models/no_sms_marketing_consent_consent_status' require 'klaviyo-api-sdk/models/no_sms_marketing_never_subscribed' require 'klaviyo-api-sdk/models/no_sms_marketing_unsubscribed' require 'klaviyo-api-sdk/models/no_sms_marketing_unsubscribed_filters_inner' require 'klaviyo-api-sdk/models/not_equals_enum' require 'klaviyo-api-sdk/models/numeric_enum' require 'klaviyo-api-sdk/models/numeric_operator_filter' require 'klaviyo-api-sdk/models/numeric_operator_filter_value' require 'klaviyo-api-sdk/models/onsite_profile_create_query_resource_object' require 'klaviyo-api-sdk/models/onsite_profile_create_query_resource_object_attributes' require 'klaviyo-api-sdk/models/onsite_profile_meta' require 'klaviyo-api-sdk/models/preference_page_enum' require 'klaviyo-api-sdk/models/preference_page_filter' require 'klaviyo-api-sdk/models/preference_page_method_filter' require 'klaviyo-api-sdk/models/profile_bulk_import_job_enum' require 'klaviyo-api-sdk/models/profile_create_query' require 'klaviyo-api-sdk/models/profile_create_query_resource_object' require 'klaviyo-api-sdk/models/profile_create_query_resource_object_attributes' require 'klaviyo-api-sdk/models/profile_enum' require 'klaviyo-api-sdk/models/profile_group_membership_enum' require 'klaviyo-api-sdk/models/profile_has_group_membership_condition' require 'klaviyo-api-sdk/models/profile_has_group_membership_condition_timeframe_filter' require 'klaviyo-api-sdk/models/profile_identifier_dto_resource_object' require 'klaviyo-api-sdk/models/profile_identifier_dto_resource_object_attributes' require 'klaviyo-api-sdk/models/profile_import_job_create_query' require 'klaviyo-api-sdk/models/profile_import_job_create_query_resource_object' require 'klaviyo-api-sdk/models/profile_import_job_create_query_resource_object_attributes' require 'klaviyo-api-sdk/models/profile_import_job_create_query_resource_object_attributes_profiles' require 'klaviyo-api-sdk/models/profile_import_job_create_query_resource_object_relationships' require 'klaviyo-api-sdk/models/profile_import_job_create_query_resource_object_relationships_lists' require 'klaviyo-api-sdk/models/profile_import_job_create_query_resource_object_relationships_lists_data_inner' require 'klaviyo-api-sdk/models/profile_location' require 'klaviyo-api-sdk/models/profile_location_latitude' require 'klaviyo-api-sdk/models/profile_location_longitude' require 'klaviyo-api-sdk/models/profile_marketing_consent_condition' require 'klaviyo-api-sdk/models/profile_marketing_consent_condition_consent' require 'klaviyo-api-sdk/models/profile_marketing_consent_enum' require 'klaviyo-api-sdk/models/profile_merge_enum' require 'klaviyo-api-sdk/models/profile_merge_query' require 'klaviyo-api-sdk/models/profile_merge_query_resource_object' require 'klaviyo-api-sdk/models/profile_merge_query_resource_object_relationships' require 'klaviyo-api-sdk/models/profile_merge_query_resource_object_relationships_profiles' require 'klaviyo-api-sdk/models/profile_merge_query_resource_object_relationships_profiles_data_inner' require 'klaviyo-api-sdk/models/profile_meta' require 'klaviyo-api-sdk/models/profile_meta_patch_properties' require 'klaviyo-api-sdk/models/profile_meta_patch_properties_unset' require 'klaviyo-api-sdk/models/profile_metric_condition' require 'klaviyo-api-sdk/models/profile_metric_condition_timeframe_filter' require 'klaviyo-api-sdk/models/profile_metric_enum' require 'klaviyo-api-sdk/models/profile_metric_property_filter' require 'klaviyo-api-sdk/models/profile_metric_property_filter_filter' require 'klaviyo-api-sdk/models/profile_no_group_membership_condition' require 'klaviyo-api-sdk/models/profile_partial_update_query' require 'klaviyo-api-sdk/models/profile_partial_update_query_resource_object' require 'klaviyo-api-sdk/models/profile_partial_update_query_resource_object_attributes' require 'klaviyo-api-sdk/models/profile_postal_code_distance_condition' require 'klaviyo-api-sdk/models/profile_postal_code_distance_enum' require 'klaviyo-api-sdk/models/profile_predictive_analytics_enum' require 'klaviyo-api-sdk/models/profile_predictive_analytics_numeric_condition' require 'klaviyo-api-sdk/models/profile_predictive_analytics_string_condition' require 'klaviyo-api-sdk/models/profile_predictive_analytics_string_filter' require 'klaviyo-api-sdk/models/profile_predictive_analytics_string_filter_operator' require 'klaviyo-api-sdk/models/profile_property_condition' require 'klaviyo-api-sdk/models/profile_property_condition_filter' require 'klaviyo-api-sdk/models/profile_property_enum' require 'klaviyo-api-sdk/models/profile_region_condition' require 'klaviyo-api-sdk/models/profile_region_enum' require 'klaviyo-api-sdk/models/profile_subscription_bulk_create_job_enum' require 'klaviyo-api-sdk/models/profile_subscription_bulk_delete_job_enum' require 'klaviyo-api-sdk/models/profile_subscription_create_query_resource_object' require 'klaviyo-api-sdk/models/profile_subscription_create_query_resource_object_attributes' require 'klaviyo-api-sdk/models/profile_subscription_delete_query_resource_object' require 'klaviyo-api-sdk/models/profile_subscription_delete_query_resource_object_attributes' require 'klaviyo-api-sdk/models/profile_suppression_bulk_create_job_enum' require 'klaviyo-api-sdk/models/profile_suppression_bulk_delete_job_enum' require 'klaviyo-api-sdk/models/profile_suppression_create_query_resource_object' require 'klaviyo-api-sdk/models/profile_suppression_create_query_resource_object_attributes' require 'klaviyo-api-sdk/models/profile_suppression_delete_query_resource_object' require 'klaviyo-api-sdk/models/profile_suppression_delete_query_resource_object_attributes' require 'klaviyo-api-sdk/models/profile_upsert_query' require 'klaviyo-api-sdk/models/profile_upsert_query_resource_object' require 'klaviyo-api-sdk/models/profile_upsert_query_resource_object_attributes' require 'klaviyo-api-sdk/models/provided_landline_enum' require 'klaviyo-api-sdk/models/provided_landline_method_filter' require 'klaviyo-api-sdk/models/provided_no_age_enum' require 'klaviyo-api-sdk/models/provided_no_age_method_filter' require 'klaviyo-api-sdk/models/push_enum' require 'klaviyo-api-sdk/models/push_profile_upsert_query_resource_object' require 'klaviyo-api-sdk/models/push_profile_upsert_query_resource_object_attributes' require 'klaviyo-api-sdk/models/push_token_create_query' require 'klaviyo-api-sdk/models/push_token_create_query_resource_object' require 'klaviyo-api-sdk/models/push_token_create_query_resource_object_attributes' require 'klaviyo-api-sdk/models/push_token_create_query_resource_object_attributes_profile' require 'klaviyo-api-sdk/models/push_token_enum' require 'klaviyo-api-sdk/models/relative_anniversary_date_filter' require 'klaviyo-api-sdk/models/relative_date_operator_base_filter' require 'klaviyo-api-sdk/models/relative_date_range_filter' require 'klaviyo-api-sdk/models/render_options_sub_object' require 'klaviyo-api-sdk/models/sms_content_sub_object_create' require 'klaviyo-api-sdk/models/sms_send_options_sub_object' require 'klaviyo-api-sdk/models/sms_subscription_parameters' require 'klaviyo-api-sdk/models/sms_tracking_options_sub_object' require 'klaviyo-api-sdk/models/sto_schedule_options' require 'klaviyo-api-sdk/models/segment_create_query' require 'klaviyo-api-sdk/models/segment_create_query_resource_object' require 'klaviyo-api-sdk/models/segment_create_query_resource_object_attributes' require 'klaviyo-api-sdk/models/segment_definition' require 'klaviyo-api-sdk/models/segment_enum' require 'klaviyo-api-sdk/models/segment_partial_update_query' require 'klaviyo-api-sdk/models/segment_partial_update_query_resource_object' require 'klaviyo-api-sdk/models/segment_partial_update_query_resource_object_attributes' require 'klaviyo-api-sdk/models/segment_series_report_enum' require 'klaviyo-api-sdk/models/segment_series_request_dto' require 'klaviyo-api-sdk/models/segment_series_request_dto_resource_object' require 'klaviyo-api-sdk/models/segment_series_request_dto_resource_object_attributes' require 'klaviyo-api-sdk/models/segment_values_report_enum' require 'klaviyo-api-sdk/models/segment_values_request_dto' require 'klaviyo-api-sdk/models/segment_values_request_dto_resource_object' require 'klaviyo-api-sdk/models/segment_values_request_dto_resource_object_attributes' require 'klaviyo-api-sdk/models/segment_values_request_dto_resource_object_attributes_timeframe' require 'klaviyo-api-sdk/models/send_strategy_sub_object' require 'klaviyo-api-sdk/models/server_bis_subscription_create_query' require 'klaviyo-api-sdk/models/server_bis_subscription_create_query_resource_object' require 'klaviyo-api-sdk/models/server_bis_subscription_create_query_resource_object_attributes' require 'klaviyo-api-sdk/models/server_bis_subscription_create_query_resource_object_attributes_profile' require 'klaviyo-api-sdk/models/server_bis_subscription_create_query_resource_object_relationships' require 'klaviyo-api-sdk/models/server_bis_subscription_create_query_resource_object_relationships_variant' require 'klaviyo-api-sdk/models/server_bis_subscription_create_query_resource_object_relationships_variant_data' require 'klaviyo-api-sdk/models/sftp_enum' require 'klaviyo-api-sdk/models/sftp_method_filter' require 'klaviyo-api-sdk/models/shopify_enum' require 'klaviyo-api-sdk/models/shopify_integration_filter' require 'klaviyo-api-sdk/models/shopify_integration_method_filter' require 'klaviyo-api-sdk/models/sms_enum' require 'klaviyo-api-sdk/models/spam_complaint_enum' require 'klaviyo-api-sdk/models/spam_complaint_method_filter' require 'klaviyo-api-sdk/models/static_date_filter' require 'klaviyo-api-sdk/models/static_date_range_filter' require 'klaviyo-api-sdk/models/static_enum' require 'klaviyo-api-sdk/models/static_schedule_options' require 'klaviyo-api-sdk/models/static_tracking_param' require 'klaviyo-api-sdk/models/status_date_enum' require 'klaviyo-api-sdk/models/status_date_filter' require 'klaviyo-api-sdk/models/status_date_filter_filter' require 'klaviyo-api-sdk/models/string_array_operator_filter' require 'klaviyo-api-sdk/models/string_enum' require 'klaviyo-api-sdk/models/string_operator_filter' require 'klaviyo-api-sdk/models/string_phone_operator_array_filter' require 'klaviyo-api-sdk/models/subscribed_enum' require 'klaviyo-api-sdk/models/subscription_channels' require 'klaviyo-api-sdk/models/subscription_create_job_create_query' require 'klaviyo-api-sdk/models/subscription_create_job_create_query_resource_object' require 'klaviyo-api-sdk/models/subscription_create_job_create_query_resource_object_attributes' require 'klaviyo-api-sdk/models/subscription_create_job_create_query_resource_object_attributes_profiles' require 'klaviyo-api-sdk/models/subscription_create_job_create_query_resource_object_relationships' require 'klaviyo-api-sdk/models/subscription_create_job_create_query_resource_object_relationships_list' require 'klaviyo-api-sdk/models/subscription_create_job_create_query_resource_object_relationships_list_data' require 'klaviyo-api-sdk/models/subscription_delete_job_create_query' require 'klaviyo-api-sdk/models/subscription_delete_job_create_query_resource_object' require 'klaviyo-api-sdk/models/subscription_delete_job_create_query_resource_object_attributes' require 'klaviyo-api-sdk/models/subscription_delete_job_create_query_resource_object_attributes_profiles' require 'klaviyo-api-sdk/models/subscription_delete_job_create_query_resource_object_relationships' require 'klaviyo-api-sdk/models/subscription_delete_job_create_query_resource_object_relationships_list' require 'klaviyo-api-sdk/models/subscription_delete_job_create_query_resource_object_relationships_list_data' require 'klaviyo-api-sdk/models/subscription_parameters' require 'klaviyo-api-sdk/models/suppression_create_job_create_query' require 'klaviyo-api-sdk/models/suppression_create_job_create_query_resource_object' require 'klaviyo-api-sdk/models/suppression_create_job_create_query_resource_object_attributes' require 'klaviyo-api-sdk/models/suppression_create_job_create_query_resource_object_attributes_profiles' require 'klaviyo-api-sdk/models/suppression_create_job_create_query_resource_object_relationships' require 'klaviyo-api-sdk/models/suppression_create_job_create_query_resource_object_relationships_list' require 'klaviyo-api-sdk/models/suppression_create_job_create_query_resource_object_relationships_list_data' require 'klaviyo-api-sdk/models/suppression_create_job_create_query_resource_object_relationships_segment' require 'klaviyo-api-sdk/models/suppression_create_job_create_query_resource_object_relationships_segment_data' require 'klaviyo-api-sdk/models/suppression_delete_job_create_query' require 'klaviyo-api-sdk/models/suppression_delete_job_create_query_resource_object' require 'klaviyo-api-sdk/models/suppression_delete_job_create_query_resource_object_attributes' require 'klaviyo-api-sdk/models/suppression_delete_job_create_query_resource_object_attributes_profiles' require 'klaviyo-api-sdk/models/suppression_delete_job_create_query_resource_object_relationships' require 'klaviyo-api-sdk/models/suppression_delete_job_create_query_resource_object_relationships_list' require 'klaviyo-api-sdk/models/suppression_delete_job_create_query_resource_object_relationships_list_data' require 'klaviyo-api-sdk/models/suppression_delete_job_create_query_resource_object_relationships_segment' require 'klaviyo-api-sdk/models/suppression_delete_job_create_query_resource_object_relationships_segment_data' require 'klaviyo-api-sdk/models/tag_campaign_op' require 'klaviyo-api-sdk/models/tag_campaign_op_data_inner' require 'klaviyo-api-sdk/models/tag_create_query' require 'klaviyo-api-sdk/models/tag_create_query_resource_object' require 'klaviyo-api-sdk/models/tag_create_query_resource_object_attributes' require 'klaviyo-api-sdk/models/tag_create_query_resource_object_relationships' require 'klaviyo-api-sdk/models/tag_create_query_resource_object_relationships_tag_group' require 'klaviyo-api-sdk/models/tag_create_query_resource_object_relationships_tag_group_data' require 'klaviyo-api-sdk/models/tag_enum' require 'klaviyo-api-sdk/models/tag_flow_op' require 'klaviyo-api-sdk/models/tag_flow_op_data_inner' require 'klaviyo-api-sdk/models/tag_group_create_query' require 'klaviyo-api-sdk/models/tag_group_create_query_resource_object' require 'klaviyo-api-sdk/models/tag_group_create_query_resource_object_attributes' require 'klaviyo-api-sdk/models/tag_group_enum' require 'klaviyo-api-sdk/models/tag_group_update_query' require 'klaviyo-api-sdk/models/tag_group_update_query_resource_object' require 'klaviyo-api-sdk/models/tag_group_update_query_resource_object_attributes' require 'klaviyo-api-sdk/models/tag_list_op' require 'klaviyo-api-sdk/models/tag_list_op_data_inner' require 'klaviyo-api-sdk/models/tag_segment_op' require 'klaviyo-api-sdk/models/tag_segment_op_data_inner' require 'klaviyo-api-sdk/models/tag_update_query' require 'klaviyo-api-sdk/models/tag_update_query_resource_object' require 'klaviyo-api-sdk/models/template_clone_query' require 'klaviyo-api-sdk/models/template_clone_query_resource_object' require 'klaviyo-api-sdk/models/template_clone_query_resource_object_attributes' require 'klaviyo-api-sdk/models/template_create_query' require 'klaviyo-api-sdk/models/template_create_query_resource_object' require 'klaviyo-api-sdk/models/template_create_query_resource_object_attributes' require 'klaviyo-api-sdk/models/template_enum' require 'klaviyo-api-sdk/models/template_render_query' require 'klaviyo-api-sdk/models/template_render_query_resource_object' require 'klaviyo-api-sdk/models/template_render_query_resource_object_attributes' require 'klaviyo-api-sdk/models/template_universal_content_enum' require 'klaviyo-api-sdk/models/template_update_query' require 'klaviyo-api-sdk/models/template_update_query_resource_object' require 'klaviyo-api-sdk/models/template_update_query_resource_object_attributes' require 'klaviyo-api-sdk/models/text_block' require 'klaviyo-api-sdk/models/text_block_data' require 'klaviyo-api-sdk/models/text_block_styles' require 'klaviyo-api-sdk/models/text_enum' require 'klaviyo-api-sdk/models/throttled_schedule_options' require 'klaviyo-api-sdk/models/timeframe' require 'klaviyo-api-sdk/models/tracking_param_dto' require 'klaviyo-api-sdk/models/tracking_param_dto_campaign' require 'klaviyo-api-sdk/models/tracking_param_dto_flow' require 'klaviyo-api-sdk/models/tracking_setting_enum' require 'klaviyo-api-sdk/models/tracking_setting_partial_update_query' require 'klaviyo-api-sdk/models/tracking_setting_partial_update_query_resource_object' require 'klaviyo-api-sdk/models/tracking_setting_partial_update_query_resource_object_attributes' require 'klaviyo-api-sdk/models/union_positive_numeric_filter' require 'klaviyo-api-sdk/models/union_positive_numeric_filter_operator' require 'klaviyo-api-sdk/models/universal_content_create_query' require 'klaviyo-api-sdk/models/universal_content_create_query_resource_object' require 'klaviyo-api-sdk/models/universal_content_create_query_resource_object_attributes' require 'klaviyo-api-sdk/models/universal_content_create_query_resource_object_attributes_definition' require 'klaviyo-api-sdk/models/universal_content_partial_update_query' require 'klaviyo-api-sdk/models/universal_content_partial_update_query_resource_object' require 'klaviyo-api-sdk/models/universal_content_partial_update_query_resource_object_attributes' require 'klaviyo-api-sdk/models/universal_content_partial_update_query_resource_object_attributes_definition' require 'klaviyo-api-sdk/models/unsubscribed_enum' require 'klaviyo-api-sdk/models/webhook_create_query' require 'klaviyo-api-sdk/models/webhook_create_query_resource_object' require 'klaviyo-api-sdk/models/webhook_create_query_resource_object_attributes' require 'klaviyo-api-sdk/models/webhook_create_query_resource_object_relationships' require 'klaviyo-api-sdk/models/webhook_create_query_resource_object_relationships_webhook_topics' require 'klaviyo-api-sdk/models/webhook_create_query_resource_object_relationships_webhook_topics_data_inner' require 'klaviyo-api-sdk/models/webhook_enum' require 'klaviyo-api-sdk/models/webhook_partial_update_query' require 'klaviyo-api-sdk/models/webhook_partial_update_query_resource_object' require 'klaviyo-api-sdk/models/webhook_partial_update_query_resource_object_attributes' require 'klaviyo-api-sdk/models/webhook_topic_enum' # APIs require 'klaviyo-api-sdk/api/accounts_api' require 'klaviyo-api-sdk/api/campaigns_api' require 'klaviyo-api-sdk/api/catalogs_api' require 'klaviyo-api-sdk/api/coupons_api' require 'klaviyo-api-sdk/api/data_privacy_api' require 'klaviyo-api-sdk/api/events_api' require 'klaviyo-api-sdk/api/flows_api' require 'klaviyo-api-sdk/api/forms_api' require 'klaviyo-api-sdk/api/images_api' require 'klaviyo-api-sdk/api/lists_api' require 'klaviyo-api-sdk/api/metrics_api' require 'klaviyo-api-sdk/api/profiles_api' require 'klaviyo-api-sdk/api/reporting_api' require 'klaviyo-api-sdk/api/reviews_api' require 'klaviyo-api-sdk/api/segments_api' require 'klaviyo-api-sdk/api/tags_api' require 'klaviyo-api-sdk/api/templates_api' require 'klaviyo-api-sdk/api/tracking_settings_api' require 'klaviyo-api-sdk/api/webhooks_api' # retry logic require 'retriable' module KlaviyoAPI @is_initialized = false class << self # Customize default settings for the SDK using block. # KlaviyoAPI.configure do |config| # config.username = "xxx" # config.password = "xxx" # end # If no block given, return the default Configuration object. # add retriable config # todo: check how slow this is Configuration.default.class.module_eval { attr_accessor :max_retries, :max_delay } def configure if block_given? yield(Configuration.default) else Configuration.default end # create wrapper classes if !@is_initialized # run this only once self.constants.each do |c| if c[-3..-1] == "Api" attributes = [:attr1] wrapper_class = KlaviyoAPI.const_set(c[0..-4], Struct.new(*attributes)) original_class = KlaviyoAPI.const_get(c) # recreate methods original_class.public_instance_methods(false).each do |m| wrapper_class.class_eval { define_singleton_method m do |*arg| max_retries = Configuration.default.max_retries || 3 max_delay = Configuration.default.max_delay || 60 KlaviyoAPI.with_retry(max_retries, max_delay) do KlaviyoAPI.const_get(c).new.send(m, *arg) end end } end end end @is_initialized = true end end def with_retry(tries, max_elapsed_time) start_time = Time.now elapsed_time = -> { Time.now - start_time } last_request_retry_after = nil last_request_timestamp = nil index = 0 attempt = 0 last_exception = nil while true begin retry_after_value_elapsed = last_request_retry_after == nil || Time.now - last_request_timestamp > Integer(last_request_retry_after) if retry_after_value_elapsed attempt += 1 return yield end rescue KlaviyoAPI::ApiError => exception last_exception = exception last_request_retry_after = exception.response_headers[:'Retry-After'] last_request_timestamp = Time.now raise unless [429, 503, 504, 524].include? exception.code end interval = Retriable::ExponentialBackoff.new(tries: index + 1).intervals[index] raise last_exception if attempt >= tries || (elapsed_time.call + interval) > max_elapsed_time sleep interval index += 1 end end end end