=begin #Klaviyo API #The Klaviyo REST API. Please visit https://developers.klaviyo.com for more details. The version of the OpenAPI document: 2024-07-15 Contact: developers@klaviyo.com Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'cgi' module KlaviyoAPI class ProfilesApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Create or Update Profile # Given a set of profile attributes and optionally an ID, create or update a profile. Returns 201 if a new profile was created, 200 if an existing profile was updated. Note that setting a field to `null` will clear out the field, whereas not including a field in your request will leave it unchanged.

*Rate limits*:
Burst: `75/s`
Steady: `700/m` **Scopes:** `profiles:write` # @param profile_upsert_query [ProfileUpsertQuery] # @param [Hash] opts the optional parameters # @return [Hash] def create_or_update_profile(profile_upsert_query, opts = {}) data, _status_code, _headers = create_or_update_profile_with_http_info(profile_upsert_query, opts) data end # alias of `create_or_update_profile` alias create_profile_import create_or_update_profile # Create or Update Profile # Given a set of profile attributes and optionally an ID, create or update a profile. Returns 201 if a new profile was created, 200 if an existing profile was updated. Note that setting a field to `null` will clear out the field, whereas not including a field in your request will leave it unchanged.<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `profiles:write` # @param profile_upsert_query [ProfileUpsertQuery] # @param [Hash] opts the optional parameters # @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers def create_or_update_profile_with_http_info(profile_upsert_query, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProfilesApi.create_or_update_profile ...' end # verify the required parameter 'profile_upsert_query' is set if @api_client.config.client_side_validation && profile_upsert_query.nil? fail ArgumentError, "Missing the required parameter 'profile_upsert_query' when calling ProfilesApi.create_or_update_profile" end # resource path local_var_path = '/api/profile-import/' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # klaviyo api revision header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2024-07-15" # 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(profile_upsert_query) # return_type return_type = opts[:debug_return_type] || 'Hash' # auth_names auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key'] new_options = opts.merge( :operation => :"ProfilesApi.create_or_update_profile", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ProfilesApi#create_or_update_profile\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # alias of `create_or_update_profile_with_http_info` alias create_profile_import_with_http_info create_or_update_profile_with_http_info # Create Profile # Create a new profile.

*Rate limits*:
Burst: `75/s`
Steady: `700/m` **Scopes:** `profiles:write` # @param profile_create_query [ProfileCreateQuery] # @param [Hash] opts the optional parameters # @return [Hash] def create_profile(profile_create_query, opts = {}) data, _status_code, _headers = create_profile_with_http_info(profile_create_query, opts) data end # Create Profile # Create a new profile.<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `profiles:write` # @param profile_create_query [ProfileCreateQuery] # @param [Hash] opts the optional parameters # @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers def create_profile_with_http_info(profile_create_query, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProfilesApi.create_profile ...' end # verify the required parameter 'profile_create_query' is set if @api_client.config.client_side_validation && profile_create_query.nil? fail ArgumentError, "Missing the required parameter 'profile_create_query' when calling ProfilesApi.create_profile" end # resource path local_var_path = '/api/profiles/' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # klaviyo api revision header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2024-07-15" # 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(profile_create_query) # return_type return_type = opts[:debug_return_type] || 'Hash' # auth_names auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key'] new_options = opts.merge( :operation => :"ProfilesApi.create_profile", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ProfilesApi#create_profile\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create or Update Push Token # Create or update a push token. This endpoint can be used to migrate push tokens from another platform to Klaviyo. Please use our mobile SDKs ([iOS](https://github.com/klaviyo/klaviyo-swift-sdk) and [Android](https://github.com/klaviyo/klaviyo-android-sdk)) to create push tokens from users' devices.

*Rate limits*:
Burst: `75/s`
Steady: `700/m` **Scopes:** `profiles:write` `push-tokens:write` # @param push_token_create_query [PushTokenCreateQuery] # @param [Hash] opts the optional parameters # @return [nil] def create_push_token(push_token_create_query, opts = {}) create_push_token_with_http_info(push_token_create_query, opts) nil end # Create or Update Push Token # Create or update a push token. This endpoint can be used to migrate push tokens from another platform to Klaviyo. Please use our mobile SDKs ([iOS](https://github.com/klaviyo/klaviyo-swift-sdk) and [Android](https://github.com/klaviyo/klaviyo-android-sdk)) to create push tokens from users' devices.<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `profiles:write` `push-tokens:write` # @param push_token_create_query [PushTokenCreateQuery] # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def create_push_token_with_http_info(push_token_create_query, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProfilesApi.create_push_token ...' end # verify the required parameter 'push_token_create_query' is set if @api_client.config.client_side_validation && push_token_create_query.nil? fail ArgumentError, "Missing the required parameter 'push_token_create_query' when calling ProfilesApi.create_push_token" end # resource path local_var_path = '/api/push-tokens/' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # klaviyo api revision header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2024-07-15" # 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(push_token_create_query) # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key'] new_options = opts.merge( :operation => :"ProfilesApi.create_push_token", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ProfilesApi#create_push_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get Bulk Profile Import Job # Get a bulk profile import job with the given job ID.

*Rate limits*:
Burst: `10/s`
Steady: `150/m` **Scopes:** `lists:read` `profiles:read` # @param job_id [String] ID of the job to retrieve. # @param [Hash] opts the optional parameters # @option opts [Array] :fields_list For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets # @option opts [Array] :fields_profile_bulk_import_job For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets # @option opts [Array] :include For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#relationships # @return [Hash] def get_bulk_profile_import_job(job_id, opts = {}) data, _status_code, _headers = get_bulk_profile_import_job_with_http_info(job_id, opts) data end # alias of `get_bulk_profile_import_job` alias get_profile_bulk_import_job get_bulk_profile_import_job # Get Bulk Profile Import Job # Get a bulk profile import job with the given job ID.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` **Scopes:** `lists:read` `profiles:read` # @param job_id [String] ID of the job to retrieve. # @param [Hash] opts the optional parameters # @option opts [Array] :fields_list For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets # @option opts [Array] :fields_profile_bulk_import_job For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets # @option opts [Array] :include For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#relationships # @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers def get_bulk_profile_import_job_with_http_info(job_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProfilesApi.get_bulk_profile_import_job ...' end # verify the required parameter 'job_id' is set if @api_client.config.client_side_validation && job_id.nil? fail ArgumentError, "Missing the required parameter 'job_id' when calling ProfilesApi.get_bulk_profile_import_job" end allowable_values = ["name", "created", "updated", "opt_in_process"] if @api_client.config.client_side_validation && opts[:'fields_list'] && !opts[:'fields_list'].all? { |item| allowable_values.include?(item) } fail ArgumentError, "invalid value for \"fields_list\", must include one of #{allowable_values}" end allowable_values = ["status", "created_at", "total_count", "completed_count", "failed_count", "completed_at", "expires_at", "started_at"] if @api_client.config.client_side_validation && opts[:'fields_profile_bulk_import_job'] && !opts[:'fields_profile_bulk_import_job'].all? { |item| allowable_values.include?(item) } fail ArgumentError, "invalid value for \"fields_profile_bulk_import_job\", must include one of #{allowable_values}" end allowable_values = ["lists"] 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/profile-bulk-import-jobs/{job_id}/'.sub('{' + 'job_id' + '}', CGI.escape(job_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'fields[list]'] = @api_client.build_collection_param(opts[:'fields_list'], :csv) if !opts[:'fields_list'].nil? query_params[:'fields[profile-bulk-import-job]'] = @api_client.build_collection_param(opts[:'fields_profile_bulk_import_job'], :csv) if !opts[:'fields_profile_bulk_import_job'].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['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2024-07-15" # 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' # auth_names auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key'] new_options = opts.merge( :operation => :"ProfilesApi.get_bulk_profile_import_job", :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: ProfilesApi#get_bulk_profile_import_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # alias of `get_bulk_profile_import_job_with_http_info` alias get_profile_bulk_import_job_with_http_info get_bulk_profile_import_job_with_http_info # Get Bulk Profile Import Job Errors # Get import errors for the bulk profile import job with the given ID.

*Rate limits*:
Burst: `10/s`
Steady: `150/m` **Scopes:** `profiles:read` # @param id [String] # @param [Hash] opts the optional parameters # @option opts [Array] :fields_import_error For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets # @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#pagination # @option opts [Integer] :page_size Default: 20. Min: 1. Max: 100. (default to 20) # @return [Hash] def get_bulk_profile_import_job_import_errors(id, opts = {}) data, _status_code, _headers = get_bulk_profile_import_job_import_errors_with_http_info(id, opts) data end # alias of `get_bulk_profile_import_job_import_errors` alias get_profile_bulk_import_job_import_errors get_bulk_profile_import_job_import_errors # Get Bulk Profile Import Job Errors # Get import errors for the bulk profile import job with the given ID.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` **Scopes:** `profiles:read` # @param id [String] # @param [Hash] opts the optional parameters # @option opts [Array] :fields_import_error For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets # @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#pagination # @option opts [Integer] :page_size Default: 20. Min: 1. Max: 100. (default to 20) # @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers def get_bulk_profile_import_job_import_errors_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProfilesApi.get_bulk_profile_import_job_import_errors ...' 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 ProfilesApi.get_bulk_profile_import_job_import_errors" end allowable_values = ["code", "title", "detail", "source", "source.pointer", "original_payload"] if @api_client.config.client_side_validation && opts[:'fields_import_error'] && !opts[:'fields_import_error'].all? { |item| allowable_values.include?(item) } fail ArgumentError, "invalid value for \"fields_import_error\", must include one of #{allowable_values}" end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ProfilesApi.get_bulk_profile_import_job_import_errors, must be smaller than or equal to 100.' end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ProfilesApi.get_bulk_profile_import_job_import_errors, must be greater than or equal to 1.' end # resource path local_var_path = '/api/profile-bulk-import-jobs/{id}/import-errors/'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'fields[import-error]'] = @api_client.build_collection_param(opts[:'fields_import_error'], :csv) if !opts[:'fields_import_error'].nil? query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil? query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil? # header parameters header_params = opts[:header_params] || {} # klaviyo api revision header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2024-07-15" # 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' # auth_names auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key'] new_options = opts.merge( :operation => :"ProfilesApi.get_bulk_profile_import_job_import_errors", :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: ProfilesApi#get_bulk_profile_import_job_import_errors\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # alias of `get_bulk_profile_import_job_import_errors_with_http_info` alias get_profile_bulk_import_job_import_errors_with_http_info get_bulk_profile_import_job_import_errors_with_http_info # Get Bulk Profile Import Job Lists # Get list for the bulk profile import job with the given ID.

*Rate limits*:
Burst: `10/s`
Steady: `150/m` **Scopes:** `lists:read` # @param id [String] # @param [Hash] opts the optional parameters # @option opts [Array] :fields_list For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets # @return [Hash] def get_bulk_profile_import_job_lists(id, opts = {}) data, _status_code, _headers = get_bulk_profile_import_job_lists_with_http_info(id, opts) data end # alias of `get_bulk_profile_import_job_lists` alias get_profile_bulk_import_job_lists get_bulk_profile_import_job_lists # Get Bulk Profile Import Job Lists # Get list for the bulk profile import job with the given ID.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` **Scopes:** `lists:read` # @param id [String] # @param [Hash] opts the optional parameters # @option opts [Array] :fields_list For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets # @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers def get_bulk_profile_import_job_lists_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProfilesApi.get_bulk_profile_import_job_lists ...' 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 ProfilesApi.get_bulk_profile_import_job_lists" end allowable_values = ["name", "created", "updated", "opt_in_process"] if @api_client.config.client_side_validation && opts[:'fields_list'] && !opts[:'fields_list'].all? { |item| allowable_values.include?(item) } fail ArgumentError, "invalid value for \"fields_list\", must include one of #{allowable_values}" end # resource path local_var_path = '/api/profile-bulk-import-jobs/{id}/lists/'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'fields[list]'] = @api_client.build_collection_param(opts[:'fields_list'], :csv) if !opts[:'fields_list'].nil? # header parameters header_params = opts[:header_params] || {} # klaviyo api revision header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2024-07-15" # 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' # auth_names auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key'] new_options = opts.merge( :operation => :"ProfilesApi.get_bulk_profile_import_job_lists", :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: ProfilesApi#get_bulk_profile_import_job_lists\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # alias of `get_bulk_profile_import_job_lists_with_http_info` alias get_profile_bulk_import_job_lists_with_http_info get_bulk_profile_import_job_lists_with_http_info # Get Bulk Profile Import Job Profiles # Get profiles for the bulk profile import job with the given ID.

*Rate limits*:
Burst: `10/s`
Steady: `150/m` **Scopes:** `profiles:read` # @param id [String] # @param [Hash] opts the optional parameters # @option opts [Array] :additional_fields_profile Request additional fields not included by default in the response. Supported values: 'subscriptions', 'predictive_analytics' # @option opts [Array] :fields_profile For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets # @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#pagination # @option opts [Integer] :page_size Default: 20. Min: 1. Max: 100. (default to 20) # @return [Hash] def get_bulk_profile_import_job_profiles(id, opts = {}) data, _status_code, _headers = get_bulk_profile_import_job_profiles_with_http_info(id, opts) data end # alias of `get_bulk_profile_import_job_profiles` alias get_profile_bulk_import_job_profiles get_bulk_profile_import_job_profiles # Get Bulk Profile Import Job Profiles # Get profiles for the bulk profile import job with the given ID.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` **Scopes:** `profiles:read` # @param id [String] # @param [Hash] opts the optional parameters # @option opts [Array] :additional_fields_profile Request additional fields not included by default in the response. Supported values: 'subscriptions', 'predictive_analytics' # @option opts [Array] :fields_profile For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets # @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#pagination # @option opts [Integer] :page_size Default: 20. Min: 1. Max: 100. (default to 20) # @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers def get_bulk_profile_import_job_profiles_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProfilesApi.get_bulk_profile_import_job_profiles ...' 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 ProfilesApi.get_bulk_profile_import_job_profiles" end allowable_values = ["subscriptions", "predictive_analytics"] if @api_client.config.client_side_validation && opts[:'additional_fields_profile'] && !opts[:'additional_fields_profile'].all? { |item| allowable_values.include?(item) } fail ArgumentError, "invalid value for \"additional_fields_profile\", must include one of #{allowable_values}" end 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.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"] if @api_client.config.client_side_validation && opts[:'fields_profile'] && !opts[:'fields_profile'].all? { |item| allowable_values.include?(item) } fail ArgumentError, "invalid value for \"fields_profile\", must include one of #{allowable_values}" end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ProfilesApi.get_bulk_profile_import_job_profiles, must be smaller than or equal to 100.' end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ProfilesApi.get_bulk_profile_import_job_profiles, must be greater than or equal to 1.' end # resource path local_var_path = '/api/profile-bulk-import-jobs/{id}/profiles/'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'additional-fields[profile]'] = @api_client.build_collection_param(opts[:'additional_fields_profile'], :csv) if !opts[:'additional_fields_profile'].nil? query_params[:'fields[profile]'] = @api_client.build_collection_param(opts[:'fields_profile'], :csv) if !opts[:'fields_profile'].nil? query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil? query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil? # header parameters header_params = opts[:header_params] || {} # klaviyo api revision header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2024-07-15" # 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' # auth_names auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key'] new_options = opts.merge( :operation => :"ProfilesApi.get_bulk_profile_import_job_profiles", :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: ProfilesApi#get_bulk_profile_import_job_profiles\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # alias of `get_bulk_profile_import_job_profiles_with_http_info` alias get_profile_bulk_import_job_profiles_with_http_info get_bulk_profile_import_job_profiles_with_http_info # Get Bulk Profile Import Job Relationships Lists # Get list relationship for the bulk profile import job with the given ID.

*Rate limits*:
Burst: `10/s`
Steady: `150/m` **Scopes:** `lists:read` # @param id [String] # @param [Hash] opts the optional parameters # @return [Hash] def get_bulk_profile_import_job_relationships_lists(id, opts = {}) data, _status_code, _headers = get_bulk_profile_import_job_relationships_lists_with_http_info(id, opts) data end # alias of `get_bulk_profile_import_job_relationships_lists` alias get_profile_bulk_import_job_relationships_lists get_bulk_profile_import_job_relationships_lists # Get Bulk Profile Import Job Relationships Lists # Get list relationship for the bulk profile import job with the given ID.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` **Scopes:** `lists:read` # @param id [String] # @param [Hash] opts the optional parameters # @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers def get_bulk_profile_import_job_relationships_lists_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProfilesApi.get_bulk_profile_import_job_relationships_lists ...' 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 ProfilesApi.get_bulk_profile_import_job_relationships_lists" end # resource path local_var_path = '/api/profile-bulk-import-jobs/{id}/relationships/lists/'.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['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2024-07-15" # 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' # auth_names auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key'] new_options = opts.merge( :operation => :"ProfilesApi.get_bulk_profile_import_job_relationships_lists", :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: ProfilesApi#get_bulk_profile_import_job_relationships_lists\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # alias of `get_bulk_profile_import_job_relationships_lists_with_http_info` alias get_profile_bulk_import_job_relationships_lists_with_http_info get_bulk_profile_import_job_relationships_lists_with_http_info # Get Bulk Profile Import Job Relationships Profiles # Get profile relationships for the bulk profile import job with the given ID.

*Rate limits*:
Burst: `10/s`
Steady: `150/m` **Scopes:** `profiles:read` # @param id [String] # @param [Hash] opts the optional parameters # @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#pagination # @option opts [Integer] :page_size Default: 20. Min: 1. Max: 100. (default to 20) # @return [Hash] def get_bulk_profile_import_job_relationships_profiles(id, opts = {}) data, _status_code, _headers = get_bulk_profile_import_job_relationships_profiles_with_http_info(id, opts) data end # alias of `get_bulk_profile_import_job_relationships_profiles` alias get_profile_bulk_import_job_relationships_profiles get_bulk_profile_import_job_relationships_profiles # Get Bulk Profile Import Job Relationships Profiles # Get profile relationships for the bulk profile import job with the given ID.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` **Scopes:** `profiles:read` # @param id [String] # @param [Hash] opts the optional parameters # @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#pagination # @option opts [Integer] :page_size Default: 20. Min: 1. Max: 100. (default to 20) # @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers def get_bulk_profile_import_job_relationships_profiles_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProfilesApi.get_bulk_profile_import_job_relationships_profiles ...' 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 ProfilesApi.get_bulk_profile_import_job_relationships_profiles" end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ProfilesApi.get_bulk_profile_import_job_relationships_profiles, must be smaller than or equal to 100.' end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ProfilesApi.get_bulk_profile_import_job_relationships_profiles, must be greater than or equal to 1.' end # resource path local_var_path = '/api/profile-bulk-import-jobs/{id}/relationships/profiles/'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil? query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil? # header parameters header_params = opts[:header_params] || {} # klaviyo api revision header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2024-07-15" # 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' # auth_names auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key'] new_options = opts.merge( :operation => :"ProfilesApi.get_bulk_profile_import_job_relationships_profiles", :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: ProfilesApi#get_bulk_profile_import_job_relationships_profiles\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # alias of `get_bulk_profile_import_job_relationships_profiles_with_http_info` alias get_profile_bulk_import_job_relationships_profiles_with_http_info get_bulk_profile_import_job_relationships_profiles_with_http_info # Get Bulk Profile Import Jobs # Get all bulk profile import jobs. Returns a maximum of 100 jobs per request.

*Rate limits*:
Burst: `10/s`
Steady: `150/m` **Scopes:** `lists:read` `profiles:read` # @param [Hash] opts the optional parameters # @option opts [Array] :fields_profile_bulk_import_job For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets # @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`status`: `any`, `equals` # @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#pagination # @option opts [Integer] :page_size Default: 20. Min: 1. Max: 100. (default to 20) # @option opts [String] :sort For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sorting # @return [Hash] def get_bulk_profile_import_jobs(opts = {}) data, _status_code, _headers = get_bulk_profile_import_jobs_with_http_info(opts) data end # alias of `get_bulk_profile_import_jobs` alias get_profile_bulk_import_jobs get_bulk_profile_import_jobs # Get Bulk Profile Import Jobs # Get all bulk profile import jobs. Returns a maximum of 100 jobs per request.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` **Scopes:** `lists:read` `profiles:read` # @param [Hash] opts the optional parameters # @option opts [Array] :fields_profile_bulk_import_job For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets # @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`status`: `any`, `equals` # @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#pagination # @option opts [Integer] :page_size Default: 20. Min: 1. Max: 100. (default to 20) # @option opts [String] :sort For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sorting # @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers def get_bulk_profile_import_jobs_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProfilesApi.get_bulk_profile_import_jobs ...' end allowable_values = ["status", "created_at", "total_count", "completed_count", "failed_count", "completed_at", "expires_at", "started_at"] if @api_client.config.client_side_validation && opts[:'fields_profile_bulk_import_job'] && !opts[:'fields_profile_bulk_import_job'].all? { |item| allowable_values.include?(item) } fail ArgumentError, "invalid value for \"fields_profile_bulk_import_job\", must include one of #{allowable_values}" end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ProfilesApi.get_bulk_profile_import_jobs, must be smaller than or equal to 100.' end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ProfilesApi.get_bulk_profile_import_jobs, must be greater than or equal to 1.' end allowable_values = ["created_at", "-created_at"] 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/profile-bulk-import-jobs/' # query parameters query_params = opts[:query_params] || {} query_params[:'fields[profile-bulk-import-job]'] = @api_client.build_collection_param(opts[:'fields_profile_bulk_import_job'], :csv) if !opts[:'fields_profile_bulk_import_job'].nil? query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil? query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil? query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil? query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? # header parameters header_params = opts[:header_params] || {} # klaviyo api revision header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2024-07-15" # 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' # auth_names auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key'] new_options = opts.merge( :operation => :"ProfilesApi.get_bulk_profile_import_jobs", :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: ProfilesApi#get_bulk_profile_import_jobs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # alias of `get_bulk_profile_import_jobs_with_http_info` alias get_profile_bulk_import_jobs_with_http_info get_bulk_profile_import_jobs_with_http_info # Get Profile # Get the profile with the given profile ID.

*Rate limits*:
Burst: `75/s`
Steady: `700/m` **Scopes:** `profiles:read` # @param id [String] # @param [Hash] opts the optional parameters # @option opts [Array] :additional_fields_profile Request additional fields not included by default in the response. Supported values: 'subscriptions', 'predictive_analytics' # @option opts [Array] :fields_list For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets # @option opts [Array] :fields_profile For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets # @option opts [Array] :fields_segment For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets # @option opts [Array] :include For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#relationships # @return [Hash] def get_profile(id, opts = {}) data, _status_code, _headers = get_profile_with_http_info(id, opts) data end # Get Profile # Get the profile with the given profile ID.<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `profiles:read` # @param id [String] # @param [Hash] opts the optional parameters # @option opts [Array] :additional_fields_profile Request additional fields not included by default in the response. Supported values: 'subscriptions', 'predictive_analytics' # @option opts [Array] :fields_list For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets # @option opts [Array] :fields_profile For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets # @option opts [Array] :fields_segment For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets # @option opts [Array] :include For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#relationships # @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers def get_profile_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProfilesApi.get_profile ...' 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 ProfilesApi.get_profile" end allowable_values = ["subscriptions", "predictive_analytics"] if @api_client.config.client_side_validation && opts[:'additional_fields_profile'] && !opts[:'additional_fields_profile'].all? { |item| allowable_values.include?(item) } fail ArgumentError, "invalid value for \"additional_fields_profile\", must include one of #{allowable_values}" end allowable_values = ["name", "created", "updated", "opt_in_process"] if @api_client.config.client_side_validation && opts[:'fields_list'] && !opts[:'fields_list'].all? { |item| allowable_values.include?(item) } fail ArgumentError, "invalid value for \"fields_list\", must include one of #{allowable_values}" end 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.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"] if @api_client.config.client_side_validation && opts[:'fields_profile'] && !opts[:'fields_profile'].all? { |item| allowable_values.include?(item) } fail ArgumentError, "invalid value for \"fields_profile\", must include one of #{allowable_values}" end allowable_values = ["name", "definition", "definition.condition_groups", "created", "updated", "is_active", "is_processing", "is_starred"] if @api_client.config.client_side_validation && opts[:'fields_segment'] && !opts[:'fields_segment'].all? { |item| allowable_values.include?(item) } fail ArgumentError, "invalid value for \"fields_segment\", must include one of #{allowable_values}" end allowable_values = ["lists", "segments"] 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/profiles/{id}/'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'additional-fields[profile]'] = @api_client.build_collection_param(opts[:'additional_fields_profile'], :csv) if !opts[:'additional_fields_profile'].nil? query_params[:'fields[list]'] = @api_client.build_collection_param(opts[:'fields_list'], :csv) if !opts[:'fields_list'].nil? query_params[:'fields[profile]'] = @api_client.build_collection_param(opts[:'fields_profile'], :csv) if !opts[:'fields_profile'].nil? query_params[:'fields[segment]'] = @api_client.build_collection_param(opts[:'fields_segment'], :csv) if !opts[:'fields_segment'].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['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2024-07-15" # 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' # auth_names auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key'] new_options = opts.merge( :operation => :"ProfilesApi.get_profile", :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: ProfilesApi#get_profile\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get Profile Lists # Get list memberships for a profile with the given profile ID.

*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `lists:read` `profiles:read` # @param id [String] # @param [Hash] opts the optional parameters # @option opts [Array] :fields_list For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets # @return [Hash] def get_profile_lists(id, opts = {}) data, _status_code, _headers = get_profile_lists_with_http_info(id, opts) data end # Get Profile Lists # Get list memberships for a profile with the given profile ID.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `lists:read` `profiles:read` # @param id [String] # @param [Hash] opts the optional parameters # @option opts [Array] :fields_list For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets # @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers def get_profile_lists_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProfilesApi.get_profile_lists ...' 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 ProfilesApi.get_profile_lists" end allowable_values = ["name", "created", "updated", "opt_in_process"] if @api_client.config.client_side_validation && opts[:'fields_list'] && !opts[:'fields_list'].all? { |item| allowable_values.include?(item) } fail ArgumentError, "invalid value for \"fields_list\", must include one of #{allowable_values}" end # resource path local_var_path = '/api/profiles/{id}/lists/'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'fields[list]'] = @api_client.build_collection_param(opts[:'fields_list'], :csv) if !opts[:'fields_list'].nil? # header parameters header_params = opts[:header_params] || {} # klaviyo api revision header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2024-07-15" # 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' # auth_names auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key'] new_options = opts.merge( :operation => :"ProfilesApi.get_profile_lists", :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: ProfilesApi#get_profile_lists\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get Profile Relationships Lists # Get list memberships for a profile with the given profile ID.

*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `lists:read` `profiles:read` # @param id [String] # @param [Hash] opts the optional parameters # @return [Hash] def get_profile_relationships_lists(id, opts = {}) data, _status_code, _headers = get_profile_relationships_lists_with_http_info(id, opts) data end # Get Profile Relationships Lists # Get list memberships for a profile with the given profile ID.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `lists:read` `profiles:read` # @param id [String] # @param [Hash] opts the optional parameters # @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers def get_profile_relationships_lists_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProfilesApi.get_profile_relationships_lists ...' 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 ProfilesApi.get_profile_relationships_lists" end # resource path local_var_path = '/api/profiles/{id}/relationships/lists/'.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['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2024-07-15" # 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' # auth_names auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key'] new_options = opts.merge( :operation => :"ProfilesApi.get_profile_relationships_lists", :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: ProfilesApi#get_profile_relationships_lists\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get Profile Relationships Segments # Get segment membership relationships for a profile with the given profile ID.

*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `profiles:read` `segments:read` # @param id [String] # @param [Hash] opts the optional parameters # @return [Hash] def get_profile_relationships_segments(id, opts = {}) data, _status_code, _headers = get_profile_relationships_segments_with_http_info(id, opts) data end # Get Profile Relationships Segments # Get segment membership relationships for a profile with the given profile ID.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `profiles:read` `segments:read` # @param id [String] # @param [Hash] opts the optional parameters # @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers def get_profile_relationships_segments_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProfilesApi.get_profile_relationships_segments ...' 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 ProfilesApi.get_profile_relationships_segments" end # resource path local_var_path = '/api/profiles/{id}/relationships/segments/'.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['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2024-07-15" # 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' # auth_names auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key'] new_options = opts.merge( :operation => :"ProfilesApi.get_profile_relationships_segments", :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: ProfilesApi#get_profile_relationships_segments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get Profile Segments # Get segment memberships for a profile with the given profile ID.

*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `profiles:read` `segments:read` # @param id [String] # @param [Hash] opts the optional parameters # @option opts [Array] :fields_segment For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets # @return [Hash] def get_profile_segments(id, opts = {}) data, _status_code, _headers = get_profile_segments_with_http_info(id, opts) data end # Get Profile Segments # Get segment memberships for a profile with the given profile ID.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `profiles:read` `segments:read` # @param id [String] # @param [Hash] opts the optional parameters # @option opts [Array] :fields_segment For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets # @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers def get_profile_segments_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProfilesApi.get_profile_segments ...' 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 ProfilesApi.get_profile_segments" end allowable_values = ["name", "definition", "definition.condition_groups", "created", "updated", "is_active", "is_processing", "is_starred"] if @api_client.config.client_side_validation && opts[:'fields_segment'] && !opts[:'fields_segment'].all? { |item| allowable_values.include?(item) } fail ArgumentError, "invalid value for \"fields_segment\", must include one of #{allowable_values}" end # resource path local_var_path = '/api/profiles/{id}/segments/'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'fields[segment]'] = @api_client.build_collection_param(opts[:'fields_segment'], :csv) if !opts[:'fields_segment'].nil? # header parameters header_params = opts[:header_params] || {} # klaviyo api revision header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2024-07-15" # 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' # auth_names auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key'] new_options = opts.merge( :operation => :"ProfilesApi.get_profile_segments", :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: ProfilesApi#get_profile_segments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get Profiles # Get all profiles in an account. Profiles can be sorted by the following fields in ascending and descending order: `id`, `created`, `updated`, `email`, `subscriptions.email.marketing.suppression.timestamp`, `subscriptions.email.marketing.list_suppressions.timestamp`

*Rate limits*:
Burst: `75/s`
Steady: `700/m`

Rate limits when using the `additional-fields[profile]=predictive_analytics` parameter in your API request:
Burst: `10/s`
Steady: `150/m`

To learn more about how the `additional-fields` parameter impacts rate limits, check out our [Rate limits, status codes, and errors](https://developers.klaviyo.com/en/v2024-07-15/docs/rate_limits_and_error_handling) guide. **Scopes:** `profiles:read` # @param [Hash] opts the optional parameters # @option opts [Array] :additional_fields_profile Request additional fields not included by default in the response. Supported values: 'subscriptions', 'predictive_analytics' # @option opts [Array] :fields_profile For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets # @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`id`: `any`, `equals`<br>`email`: `any`, `equals`<br>`phone_number`: `any`, `equals`<br>`external_id`: `any`, `equals`<br>`_kx`: `equals`<br>`created`: `greater-than`, `less-than`<br>`updated`: `greater-than`, `less-than`<br>`subscriptions.email.marketing.suppression.timestamp` : `greater-than`, `greater-or-equal`, `less-than`, `less-or-equal`<br>`subscriptions.email.marketing.suppression.reason` : `equals`<br>`subscriptions.email.marketing.list_suppressions.list_id` : `equals`<br>`subscriptions.email.marketing.list_suppressions.reason` : `equals`<br>`subscriptions.email.marketing.list_suppressions.timestamp` : `greater-than`, `greater-or-equal`, `less-than`, `less-or-equal` # @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#pagination # @option opts [Integer] :page_size Default: 20. Min: 1. Max: 100. (default to 20) # @option opts [String] :sort For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sorting # @return [Hash] def get_profiles(opts = {}) data, _status_code, _headers = get_profiles_with_http_info(opts) data end # Get Profiles # Get all profiles in an account. Profiles can be sorted by the following fields in ascending and descending order: `id`, `created`, `updated`, `email`, `subscriptions.email.marketing.suppression.timestamp`, `subscriptions.email.marketing.list_suppressions.timestamp`<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m`<br><br>Rate limits when using the `additional-fields[profile]=predictive_analytics` parameter in your API request:<br>Burst: `10/s`<br>Steady: `150/m`<br><br>To learn more about how the `additional-fields` parameter impacts rate limits, check out our [Rate limits, status codes, and errors](https://developers.klaviyo.com/en/v2024-07-15/docs/rate_limits_and_error_handling) guide. **Scopes:** `profiles:read` # @param [Hash] opts the optional parameters # @option opts [Array] :additional_fields_profile Request additional fields not included by default in the response. Supported values: 'subscriptions', 'predictive_analytics' # @option opts [Array] :fields_profile For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sparse-fieldsets # @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`id`: `any`, `equals`<br>`email`: `any`, `equals`<br>`phone_number`: `any`, `equals`<br>`external_id`: `any`, `equals`<br>`_kx`: `equals`<br>`created`: `greater-than`, `less-than`<br>`updated`: `greater-than`, `less-than`<br>`subscriptions.email.marketing.suppression.timestamp` : `greater-than`, `greater-or-equal`, `less-than`, `less-or-equal`<br>`subscriptions.email.marketing.suppression.reason` : `equals`<br>`subscriptions.email.marketing.list_suppressions.list_id` : `equals`<br>`subscriptions.email.marketing.list_suppressions.reason` : `equals`<br>`subscriptions.email.marketing.list_suppressions.timestamp` : `greater-than`, `greater-or-equal`, `less-than`, `less-or-equal` # @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#pagination # @option opts [Integer] :page_size Default: 20. Min: 1. Max: 100. (default to 20) # @option opts [String] :sort For more information please visit https://developers.klaviyo.com/en/v2024-07-15/reference/api-overview#sorting # @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers def get_profiles_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProfilesApi.get_profiles ...' end allowable_values = ["subscriptions", "predictive_analytics"] if @api_client.config.client_side_validation && opts[:'additional_fields_profile'] && !opts[:'additional_fields_profile'].all? { |item| allowable_values.include?(item) } fail ArgumentError, "invalid value for \"additional_fields_profile\", must include one of #{allowable_values}" end 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.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"] if @api_client.config.client_side_validation && opts[:'fields_profile'] && !opts[:'fields_profile'].all? { |item| allowable_values.include?(item) } fail ArgumentError, "invalid value for \"fields_profile\", must include one of #{allowable_values}" end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ProfilesApi.get_profiles, must be smaller than or equal to 100.' end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ProfilesApi.get_profiles, must be greater than or equal to 1.' end allowable_values = ["created", "-created", "email", "-email", "id", "-id", "updated", "-updated", "subscriptions.email.marketing.list_suppressions.timestamp", "-subscriptions.email.marketing.list_suppressions.timestamp", "subscriptions.email.marketing.suppression.timestamp", "-subscriptions.email.marketing.suppression.timestamp"] 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/profiles/' # query parameters query_params = opts[:query_params] || {} query_params[:'additional-fields[profile]'] = @api_client.build_collection_param(opts[:'additional_fields_profile'], :csv) if !opts[:'additional_fields_profile'].nil? query_params[:'fields[profile]'] = @api_client.build_collection_param(opts[:'fields_profile'], :csv) if !opts[:'fields_profile'].nil? query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil? query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil? query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil? query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? # header parameters header_params = opts[:header_params] || {} # klaviyo api revision header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2024-07-15" # 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' # auth_names auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key'] new_options = opts.merge( :operation => :"ProfilesApi.get_profiles", :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: ProfilesApi#get_profiles\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Merge Profiles # Merge a given related profile into a profile with the given profile ID. The profile provided under `relationships` (the \"source\" profile) will be merged into the profile provided by the ID in the base data object (the \"destination\" profile). This endpoint queues an asynchronous task which will merge data from the source profile into the destination profile, deleting the source profile in the process. This endpoint accepts only one source profile. To learn more about how profile data is preserved or overwritten during a merge, please [visit our Help Center](https://help.klaviyo.com/hc/en-us/articles/115005073847#merge-2-profiles3).

*Rate limits*:
Burst: `10/s`
Steady: `150/m` **Scopes:** `profiles:write` # @param profile_merge_query [ProfileMergeQuery] # @param [Hash] opts the optional parameters # @return [Hash] def merge_profiles(profile_merge_query, opts = {}) data, _status_code, _headers = merge_profiles_with_http_info(profile_merge_query, opts) data end # alias of `merge_profiles` alias create_profile_merge merge_profiles # Merge Profiles # Merge a given related profile into a profile with the given profile ID. The profile provided under `relationships` (the \"source\" profile) will be merged into the profile provided by the ID in the base data object (the \"destination\" profile). This endpoint queues an asynchronous task which will merge data from the source profile into the destination profile, deleting the source profile in the process. This endpoint accepts only one source profile. To learn more about how profile data is preserved or overwritten during a merge, please [visit our Help Center](https://help.klaviyo.com/hc/en-us/articles/115005073847#merge-2-profiles3).<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` **Scopes:** `profiles:write` # @param profile_merge_query [ProfileMergeQuery] # @param [Hash] opts the optional parameters # @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers def merge_profiles_with_http_info(profile_merge_query, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProfilesApi.merge_profiles ...' end # verify the required parameter 'profile_merge_query' is set if @api_client.config.client_side_validation && profile_merge_query.nil? fail ArgumentError, "Missing the required parameter 'profile_merge_query' when calling ProfilesApi.merge_profiles" end # resource path local_var_path = '/api/profile-merge/' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # klaviyo api revision header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2024-07-15" # 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(profile_merge_query) # return_type return_type = opts[:debug_return_type] || 'Hash' # auth_names auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key'] new_options = opts.merge( :operation => :"ProfilesApi.merge_profiles", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ProfilesApi#merge_profiles\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # alias of `merge_profiles_with_http_info` alias create_profile_merge_with_http_info merge_profiles_with_http_info # Spawn Bulk Profile Import Job # Create a bulk profile import job to create or update a batch of profiles. Accepts up to 10,000 profiles per request. The maximum allowed payload size is 5MB. To learn more, see our [Bulk Profile Import API guide](https://developers.klaviyo.com/en/docs/use_klaviyos_bulk_profile_import_api).

*Rate limits*:
Burst: `10/s`
Steady: `150/m` **Scopes:** `lists:write` `profiles:write` # @param profile_import_job_create_query [ProfileImportJobCreateQuery] # @param [Hash] opts the optional parameters # @return [Hash] def spawn_bulk_profile_import_job(profile_import_job_create_query, opts = {}) data, _status_code, _headers = spawn_bulk_profile_import_job_with_http_info(profile_import_job_create_query, opts) data end # alias of `spawn_bulk_profile_import_job` alias create_profile_bulk_import_job spawn_bulk_profile_import_job # Spawn Bulk Profile Import Job # Create a bulk profile import job to create or update a batch of profiles. Accepts up to 10,000 profiles per request. The maximum allowed payload size is 5MB. To learn more, see our [Bulk Profile Import API guide](https://developers.klaviyo.com/en/docs/use_klaviyos_bulk_profile_import_api).<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` **Scopes:** `lists:write` `profiles:write` # @param profile_import_job_create_query [ProfileImportJobCreateQuery] # @param [Hash] opts the optional parameters # @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers def spawn_bulk_profile_import_job_with_http_info(profile_import_job_create_query, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProfilesApi.spawn_bulk_profile_import_job ...' end # verify the required parameter 'profile_import_job_create_query' is set if @api_client.config.client_side_validation && profile_import_job_create_query.nil? fail ArgumentError, "Missing the required parameter 'profile_import_job_create_query' when calling ProfilesApi.spawn_bulk_profile_import_job" end # resource path local_var_path = '/api/profile-bulk-import-jobs/' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # klaviyo api revision header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2024-07-15" # 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(profile_import_job_create_query) # return_type return_type = opts[:debug_return_type] || 'Hash' # auth_names auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key'] new_options = opts.merge( :operation => :"ProfilesApi.spawn_bulk_profile_import_job", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ProfilesApi#spawn_bulk_profile_import_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # alias of `spawn_bulk_profile_import_job_with_http_info` alias create_profile_bulk_import_job_with_http_info spawn_bulk_profile_import_job_with_http_info # Subscribe Profiles # Subscribe one or more profiles to email marketing, SMS marketing, or both. If the provided list has double opt-in enabled, profiles will receive a message requiring their confirmation before subscribing. Otherwise, profiles will be immediately subscribed without receiving a confirmation message. Learn more about [consent in this guide](https://developers.klaviyo.com/en/docs/collect_email_and_sms_consent_via_api). If a list is not provided, the opt-in process used will be determined by the [account-level default opt-in setting](https://www.klaviyo.com/settings/account/api-keys). To add someone to a list without changing their subscription status, use [Add Profile to List](https://developers.klaviyo.com/en/reference/create_list_relationships). This API will remove any `UNSUBSCRIBE`, `SPAM_REPORT` or `USER_SUPPRESSED` suppressions from the provided profiles. Learn more about [suppressed profiles](https://help.klaviyo.com/hc/en-us/articles/115005246108-Understanding-suppressed-email-profiles#what-is-a-suppressed-profile-1). Maximum number of profiles can be submitted for subscription: 1000 This endpoint now supports a `historical_import` flag. If this flag is set `true`, profiles being subscribed will bypass double opt-in emails and be subscribed immediately. They will also bypass any associated \"Added to list\" flows. This is useful for importing historical data where you have already collected consent. If `historical_import` is set to true, the `consented_at` field is required and must be in the past.

*Rate limits*:
Burst: `75/s`
Steady: `700/m` **Scopes:** `lists:write` `profiles:write` `subscriptions:write` # @param subscription_create_job_create_query [SubscriptionCreateJobCreateQuery] Subscribes one or more profiles to marketing. Currently, supports email and SMS only. All profiles will be added to the provided list. Either email or phone number is required. Both may be specified to subscribe to both channels. If a profile cannot be found matching the given identifier(s), a new profile will be created and then subscribed. # @param [Hash] opts the optional parameters # @return [nil] def subscribe_profiles(subscription_create_job_create_query, opts = {}) subscribe_profiles_with_http_info(subscription_create_job_create_query, opts) nil end # alias of `subscribe_profiles` alias create_profile_subscription_bulk_create_job subscribe_profiles # Subscribe Profiles # Subscribe one or more profiles to email marketing, SMS marketing, or both. If the provided list has double opt-in enabled, profiles will receive a message requiring their confirmation before subscribing. Otherwise, profiles will be immediately subscribed without receiving a confirmation message. Learn more about [consent in this guide](https://developers.klaviyo.com/en/docs/collect_email_and_sms_consent_via_api). If a list is not provided, the opt-in process used will be determined by the [account-level default opt-in setting](https://www.klaviyo.com/settings/account/api-keys). To add someone to a list without changing their subscription status, use [Add Profile to List](https://developers.klaviyo.com/en/reference/create_list_relationships). This API will remove any `UNSUBSCRIBE`, `SPAM_REPORT` or `USER_SUPPRESSED` suppressions from the provided profiles. Learn more about [suppressed profiles](https://help.klaviyo.com/hc/en-us/articles/115005246108-Understanding-suppressed-email-profiles#what-is-a-suppressed-profile-1). Maximum number of profiles can be submitted for subscription: 1000 This endpoint now supports a `historical_import` flag. If this flag is set `true`, profiles being subscribed will bypass double opt-in emails and be subscribed immediately. They will also bypass any associated \"Added to list\" flows. This is useful for importing historical data where you have already collected consent. If `historical_import` is set to true, the `consented_at` field is required and must be in the past.<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `lists:write` `profiles:write` `subscriptions:write` # @param subscription_create_job_create_query [SubscriptionCreateJobCreateQuery] Subscribes one or more profiles to marketing. Currently, supports email and SMS only. All profiles will be added to the provided list. Either email or phone number is required. Both may be specified to subscribe to both channels. If a profile cannot be found matching the given identifier(s), a new profile will be created and then subscribed. # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def subscribe_profiles_with_http_info(subscription_create_job_create_query, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProfilesApi.subscribe_profiles ...' end # verify the required parameter 'subscription_create_job_create_query' is set if @api_client.config.client_side_validation && subscription_create_job_create_query.nil? fail ArgumentError, "Missing the required parameter 'subscription_create_job_create_query' when calling ProfilesApi.subscribe_profiles" end # resource path local_var_path = '/api/profile-subscription-bulk-create-jobs/' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # klaviyo api revision header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2024-07-15" # 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(subscription_create_job_create_query) # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key'] new_options = opts.merge( :operation => :"ProfilesApi.subscribe_profiles", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ProfilesApi#subscribe_profiles\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # alias of `subscribe_profiles_with_http_info` alias create_profile_subscription_bulk_create_job_with_http_info subscribe_profiles_with_http_info # Suppress Profiles # Manually suppress profiles using their email address, or by specifying a segment or list ID to suppress all current members. Suppressed profiles cannot receive email marketing, independent of their consent status. To learn more, see our [email suppressions guide](https://help.klaviyo.com/hc/en-us/articles/115005246108-Understanding-suppressed-email-profiles#what-is-a-suppressed-profile-1) and our [collecting consent guide](https://developers.klaviyo.com/en/docs/collect_email_and_sms_consent_via_api). Email addresses per request limit: 100

*Rate limits*:
Burst: `75/s`
Steady: `700/m` **Scopes:** `profiles:write` `subscriptions:write` # @param suppression_create_job_create_query [SuppressionCreateJobCreateQuery] Suppresses one or more profiles from receiving marketing. Currently, supports email only. If a profile is not found with the given email, one will be created and immediately suppressed. # @param [Hash] opts the optional parameters # @return [nil] def suppress_profiles(suppression_create_job_create_query, opts = {}) suppress_profiles_with_http_info(suppression_create_job_create_query, opts) nil end # alias of `suppress_profiles` alias create_profile_suppression_bulk_create_job suppress_profiles # Suppress Profiles # Manually suppress profiles using their email address, or by specifying a segment or list ID to suppress all current members. Suppressed profiles cannot receive email marketing, independent of their consent status. To learn more, see our [email suppressions guide](https://help.klaviyo.com/hc/en-us/articles/115005246108-Understanding-suppressed-email-profiles#what-is-a-suppressed-profile-1) and our [collecting consent guide](https://developers.klaviyo.com/en/docs/collect_email_and_sms_consent_via_api). Email addresses per request limit: 100<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `profiles:write` `subscriptions:write` # @param suppression_create_job_create_query [SuppressionCreateJobCreateQuery] Suppresses one or more profiles from receiving marketing. Currently, supports email only. If a profile is not found with the given email, one will be created and immediately suppressed. # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def suppress_profiles_with_http_info(suppression_create_job_create_query, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProfilesApi.suppress_profiles ...' end # verify the required parameter 'suppression_create_job_create_query' is set if @api_client.config.client_side_validation && suppression_create_job_create_query.nil? fail ArgumentError, "Missing the required parameter 'suppression_create_job_create_query' when calling ProfilesApi.suppress_profiles" end # resource path local_var_path = '/api/profile-suppression-bulk-create-jobs/' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # klaviyo api revision header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2024-07-15" # 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(suppression_create_job_create_query) # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key'] new_options = opts.merge( :operation => :"ProfilesApi.suppress_profiles", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ProfilesApi#suppress_profiles\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # alias of `suppress_profiles_with_http_info` alias create_profile_suppression_bulk_create_job_with_http_info suppress_profiles_with_http_info # Unsubscribe Profiles # Unsubscribe one or more profiles to email marketing, SMS marketing, or both. Learn more about [consent in this guide](https://developers.klaviyo.com/en/docs/collect_email_and_sms_consent_via_api). To remove someone from a list without changing their subscription status, use [Remove Profile from List](https://developers.klaviyo.com/en/reference/delete_list_relationships). Maximum number of profile can be submitted for unsubscription: 100

*Rate limits*:
Burst: `75/s`
Steady: `700/m` **Scopes:** `lists:write` `profiles:write` `subscriptions:write` # @param subscription_delete_job_create_query [SubscriptionDeleteJobCreateQuery] Unsubscribes one or more profiles from marketing. Currently, supports email and SMS only. All profiles will be removed from the provided list. Either email or phone number is required. If a profile cannot be found matching the given identifier(s), a new profile will be created and then unsubscribed. # @param [Hash] opts the optional parameters # @return [nil] def unsubscribe_profiles(subscription_delete_job_create_query, opts = {}) unsubscribe_profiles_with_http_info(subscription_delete_job_create_query, opts) nil end # alias of `unsubscribe_profiles` alias create_profile_subscription_bulk_delete_job unsubscribe_profiles # Unsubscribe Profiles # Unsubscribe one or more profiles to email marketing, SMS marketing, or both. Learn more about [consent in this guide](https://developers.klaviyo.com/en/docs/collect_email_and_sms_consent_via_api). To remove someone from a list without changing their subscription status, use [Remove Profile from List](https://developers.klaviyo.com/en/reference/delete_list_relationships). Maximum number of profile can be submitted for unsubscription: 100<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `lists:write` `profiles:write` `subscriptions:write` # @param subscription_delete_job_create_query [SubscriptionDeleteJobCreateQuery] Unsubscribes one or more profiles from marketing. Currently, supports email and SMS only. All profiles will be removed from the provided list. Either email or phone number is required. If a profile cannot be found matching the given identifier(s), a new profile will be created and then unsubscribed. # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def unsubscribe_profiles_with_http_info(subscription_delete_job_create_query, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProfilesApi.unsubscribe_profiles ...' end # verify the required parameter 'subscription_delete_job_create_query' is set if @api_client.config.client_side_validation && subscription_delete_job_create_query.nil? fail ArgumentError, "Missing the required parameter 'subscription_delete_job_create_query' when calling ProfilesApi.unsubscribe_profiles" end # resource path local_var_path = '/api/profile-subscription-bulk-delete-jobs/' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # klaviyo api revision header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2024-07-15" # 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(subscription_delete_job_create_query) # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key'] new_options = opts.merge( :operation => :"ProfilesApi.unsubscribe_profiles", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ProfilesApi#unsubscribe_profiles\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # alias of `unsubscribe_profiles_with_http_info` alias create_profile_subscription_bulk_delete_job_with_http_info unsubscribe_profiles_with_http_info # Unsuppress Profiles # Manually unsuppress profiles using their email address, or by specifying a segment or list ID to unsuppress all current members. This only removes suppressions with reason `USER_SUPPRESSED`, leaving unsubscribed profiles and profiles suppressed with reason `INVALID_EMAIL` or `HARD_BOUNCE` unchanged. To learn more, see our [email suppressions guide](https://help.klaviyo.com/hc/en-us/articles/115005246108-Understanding-suppressed-email-profiles#what-is-a-suppressed-profile-1) and our [collecting consent guide](https://developers.klaviyo.com/en/docs/collect_email_and_sms_consent_via_api). Email addresses per request limit: 100

*Rate limits*:
Burst: `75/s`
Steady: `700/m` **Scopes:** `subscriptions:write` # @param suppression_delete_job_create_query [SuppressionDeleteJobCreateQuery] Unsuppresses one or more profiles from receiving marketing. Currently, supports email only. If a profile is not found with the given email, no action will be taken. # @param [Hash] opts the optional parameters # @return [nil] def unsuppress_profiles(suppression_delete_job_create_query, opts = {}) unsuppress_profiles_with_http_info(suppression_delete_job_create_query, opts) nil end # alias of `unsuppress_profiles` alias create_profile_suppression_bulk_delete_job unsuppress_profiles # Unsuppress Profiles # Manually unsuppress profiles using their email address, or by specifying a segment or list ID to unsuppress all current members. This only removes suppressions with reason `USER_SUPPRESSED`, leaving unsubscribed profiles and profiles suppressed with reason `INVALID_EMAIL` or `HARD_BOUNCE` unchanged. To learn more, see our [email suppressions guide](https://help.klaviyo.com/hc/en-us/articles/115005246108-Understanding-suppressed-email-profiles#what-is-a-suppressed-profile-1) and our [collecting consent guide](https://developers.klaviyo.com/en/docs/collect_email_and_sms_consent_via_api). Email addresses per request limit: 100<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `subscriptions:write` # @param suppression_delete_job_create_query [SuppressionDeleteJobCreateQuery] Unsuppresses one or more profiles from receiving marketing. Currently, supports email only. If a profile is not found with the given email, no action will be taken. # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def unsuppress_profiles_with_http_info(suppression_delete_job_create_query, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProfilesApi.unsuppress_profiles ...' end # verify the required parameter 'suppression_delete_job_create_query' is set if @api_client.config.client_side_validation && suppression_delete_job_create_query.nil? fail ArgumentError, "Missing the required parameter 'suppression_delete_job_create_query' when calling ProfilesApi.unsuppress_profiles" end # resource path local_var_path = '/api/profile-suppression-bulk-delete-jobs/' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # klaviyo api revision header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2024-07-15" # 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(suppression_delete_job_create_query) # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key'] new_options = opts.merge( :operation => :"ProfilesApi.unsuppress_profiles", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ProfilesApi#unsuppress_profiles\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # alias of `unsuppress_profiles_with_http_info` alias create_profile_suppression_bulk_delete_job_with_http_info unsuppress_profiles_with_http_info # Update Profile # Update the profile with the given profile ID. Note that setting a field to `null` will clear out the field, whereas not including a field in your request will leave it unchanged.

*Rate limits*:
Burst: `75/s`
Steady: `700/m` **Scopes:** `profiles:write` # @param id [String] Primary key that uniquely identifies this profile. Generated by Klaviyo. # @param profile_partial_update_query [ProfilePartialUpdateQuery] # @param [Hash] opts the optional parameters # @return [Hash] def update_profile(id, profile_partial_update_query, opts = {}) data, _status_code, _headers = update_profile_with_http_info(id, profile_partial_update_query, opts) data end # Update Profile # Update the profile with the given profile ID. Note that setting a field to `null` will clear out the field, whereas not including a field in your request will leave it unchanged.<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `profiles:write` # @param id [String] Primary key that uniquely identifies this profile. Generated by Klaviyo. # @param profile_partial_update_query [ProfilePartialUpdateQuery] # @param [Hash] opts the optional parameters # @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers def update_profile_with_http_info(id, profile_partial_update_query, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProfilesApi.update_profile ...' 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 ProfilesApi.update_profile" end # verify the required parameter 'profile_partial_update_query' is set if @api_client.config.client_side_validation && profile_partial_update_query.nil? fail ArgumentError, "Missing the required parameter 'profile_partial_update_query' when calling ProfilesApi.update_profile" end # resource path local_var_path = '/api/profiles/{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['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2024-07-15" # 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(profile_partial_update_query) # return_type return_type = opts[:debug_return_type] || 'Hash' # auth_names auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key'] new_options = opts.merge( :operation => :"ProfilesApi.update_profile", :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: ProfilesApi#update_profile\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end