=begin #Talon.One API #Use the Talon.One API to integrate with your application and to manage applications and campaigns: - Use the operations in the [Integration API section](#integration-api) are used to integrate with our platform - Use the operation in the [Management API section](#management-api) to manage applications and campaigns. ## Determining the base URL of the endpoints The API is available at the same hostname as your Campaign Manager deployment. For example, if you are reading this page at `https://mycompany.talon.one/docs/api/`, the URL for the [updateCustomerSession](https://docs.talon.one/integration-api/#operation/updateCustomerSessionV2) endpoint is `https://mycompany.talon.one/v2/customer_sessions/{Id}` The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech OpenAPI Generator version: 4.3.1 =end require 'cgi' module TalonOne class IntegrationApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Create audience # Create an audience. The audience can be created directly from scratch or can come from third party platforms. To create an audience from an existing audience in mParticle or Segment: 1. Set the `integration` property to `mparticle` or `segment` depending on a third-party platform. 1. Set `integrationId` to the ID of this audience in a third-party platform. To create an audience from an existing audience in another platform than mParticle: 1. Do not use the `integration` property. 1. Set `integrationId` to the ID of this audience in the 3rd-party platform. To create an audience from scratch: 1. Only set the `name` property. Once you create your first audience, audience-specific rule conditions are enabled in the Rule Builder. # @param body [NewAudience] # @param [Hash] opts the optional parameters # @return [Audience] def create_audience_v2(body, opts = {}) data, _status_code, _headers = create_audience_v2_with_http_info(body, opts) data end # Create audience # Create an audience. The audience can be created directly from scratch or can come from third party platforms. To create an audience from an existing audience in mParticle or Segment: 1. Set the `integration` property to `mparticle` or `segment` depending on a third-party platform. 1. Set `integrationId` to the ID of this audience in a third-party platform. To create an audience from an existing audience in another platform than mParticle: 1. Do not use the `integration` property. 1. Set `integrationId` to the ID of this audience in the 3rd-party platform. To create an audience from scratch: 1. Only set the `name` property. Once you create your first audience, audience-specific rule conditions are enabled in the Rule Builder. # @param body [NewAudience] # @param [Hash] opts the optional parameters # @return [Array<(Audience, Integer, Hash)>] Audience data, response status code and response headers def create_audience_v2_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IntegrationApi.create_audience_v2 ...' end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling IntegrationApi.create_audience_v2" end # resource path local_var_path = '/v2/audiences' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:return_type] || 'Audience' # auth_names auth_names = opts[:auth_names] || ['api_key_v1'] new_options = opts.merge( :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: IntegrationApi#create_audience_v2\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create coupon reservation # Create a coupon reservation for specified customer profiles on the specified coupon. Reserving a coupon allows you to associate a coupon code to a given customer(s). You can then list the reserved coupons of a given customer with the [List customer data endpoint](/integration-api/#operation/getCustomerInventory). If a coupon gets created for a specific user, it will automatically show up in their coupons. When a user redeems a coupon, a reservation is automatically created after the redemption and the used coupon will be returned in the [List customer data endpoint](/integration-api/#operation/getCustomerInventory). **Important:** - This endpoint creates a **soft** reservation. _Any_ customer can use a reserved coupon code and proceed to checkout. - To create a hard reservation, use the [Create coupons](/management-api/#operation/createCoupons) or [Create coupons for multiple recipients](/management-api/#operation/createCouponsForMultipleRecipients) endpoints setting the `recipientsIntegrationId` property. For example, you can use this endpoint and `List customer data` to create a \"coupon wallet\" by reserving coupon codes for a customer, and then displaying their \"coupon wallet\" when they visit your store. # @param coupon_value [String] The value of a coupon # @param body [CouponReservations] # @param [Hash] opts the optional parameters # @return [Coupon] def create_coupon_reservation(coupon_value, body, opts = {}) data, _status_code, _headers = create_coupon_reservation_with_http_info(coupon_value, body, opts) data end # Create coupon reservation # Create a coupon reservation for specified customer profiles on the specified coupon. Reserving a coupon allows you to associate a coupon code to a given customer(s). You can then list the reserved coupons of a given customer with the [List customer data endpoint](/integration-api/#operation/getCustomerInventory). If a coupon gets created for a specific user, it will automatically show up in their coupons. When a user redeems a coupon, a reservation is automatically created after the redemption and the used coupon will be returned in the [List customer data endpoint](/integration-api/#operation/getCustomerInventory). **Important:** - This endpoint creates a **soft** reservation. _Any_ customer can use a reserved coupon code and proceed to checkout. - To create a hard reservation, use the [Create coupons](/management-api/#operation/createCoupons) or [Create coupons for multiple recipients](/management-api/#operation/createCouponsForMultipleRecipients) endpoints setting the `recipientsIntegrationId` property. For example, you can use this endpoint and `List customer data` to create a \"coupon wallet\" by reserving coupon codes for a customer, and then displaying their \"coupon wallet\" when they visit your store. # @param coupon_value [String] The value of a coupon # @param body [CouponReservations] # @param [Hash] opts the optional parameters # @return [Array<(Coupon, Integer, Hash)>] Coupon data, response status code and response headers def create_coupon_reservation_with_http_info(coupon_value, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IntegrationApi.create_coupon_reservation ...' end # verify the required parameter 'coupon_value' is set if @api_client.config.client_side_validation && coupon_value.nil? fail ArgumentError, "Missing the required parameter 'coupon_value' when calling IntegrationApi.create_coupon_reservation" end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling IntegrationApi.create_coupon_reservation" end # resource path local_var_path = '/v1/coupon_reservations/{couponValue}'.sub('{' + 'couponValue' + '}', CGI.escape(coupon_value.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:return_type] || 'Coupon' # auth_names auth_names = opts[:auth_names] || ['api_key_v1'] new_options = opts.merge( :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: IntegrationApi#create_coupon_reservation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create referral code for an advocate # Creates a referral code for an advocate. The code will be valid for the referral campaign for which is created, indicated in the `campaignId` parameter, and will be associated with the profile specified in the `advocateProfileIntegrationId` parameter as the advocate's profile. # @param body [NewReferral] # @param [Hash] opts the optional parameters # @return [Referral] def create_referral(body, opts = {}) data, _status_code, _headers = create_referral_with_http_info(body, opts) data end # Create referral code for an advocate # Creates a referral code for an advocate. The code will be valid for the referral campaign for which is created, indicated in the `campaignId` parameter, and will be associated with the profile specified in the `advocateProfileIntegrationId` parameter as the advocate's profile. # @param body [NewReferral] # @param [Hash] opts the optional parameters # @return [Array<(Referral, Integer, Hash)>] Referral data, response status code and response headers def create_referral_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IntegrationApi.create_referral ...' end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling IntegrationApi.create_referral" end # resource path local_var_path = '/v1/referrals' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:return_type] || 'Referral' # auth_names auth_names = opts[:auth_names] || ['api_key_v1'] new_options = opts.merge( :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: IntegrationApi#create_referral\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create referral codes for multiple advocates # Creates unique referral codes for multiple advocates. The code will be valid for the referral campaign for which it is created, indicated in the `campaignId` parameter, and one referral code will be associated with one advocate using the profile specified in the `advocateProfileIntegrationId` parameter as the advocate's profile. # @param body [NewReferralsForMultipleAdvocates] # @param [Hash] opts the optional parameters # @option opts [String] :silent Possible values: `yes` or `no`. - `yes`: Increases the perfomance of the API call by returning a 204 response. - `no`: Returns a 200 response that contains essential data such as the updated customer profiles and session-related information. (default to 'yes') # @return [InlineResponse201] def create_referrals_for_multiple_advocates(body, opts = {}) data, _status_code, _headers = create_referrals_for_multiple_advocates_with_http_info(body, opts) data end # Create referral codes for multiple advocates # Creates unique referral codes for multiple advocates. The code will be valid for the referral campaign for which it is created, indicated in the `campaignId` parameter, and one referral code will be associated with one advocate using the profile specified in the `advocateProfileIntegrationId` parameter as the advocate's profile. # @param body [NewReferralsForMultipleAdvocates] # @param [Hash] opts the optional parameters # @option opts [String] :silent Possible values: `yes` or `no`. - `yes`: Increases the perfomance of the API call by returning a 204 response. - `no`: Returns a 200 response that contains essential data such as the updated customer profiles and session-related information. # @return [Array<(InlineResponse201, Integer, Hash)>] InlineResponse201 data, response status code and response headers def create_referrals_for_multiple_advocates_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IntegrationApi.create_referrals_for_multiple_advocates ...' end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling IntegrationApi.create_referrals_for_multiple_advocates" end # resource path local_var_path = '/v1/referrals_for_multiple_advocates' # query parameters query_params = opts[:query_params] || {} query_params[:'silent'] = opts[:'silent'] if !opts[:'silent'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:return_type] || 'InlineResponse201' # auth_names auth_names = opts[:auth_names] || ['api_key_v1'] new_options = opts.merge( :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: IntegrationApi#create_referrals_for_multiple_advocates\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete audience memberships # Remove all members from this audience. # @param audience_id [Integer] The ID of the audience. You get it via the `id` property when [creating an audience](#operation/createAudienceV2). # @param [Hash] opts the optional parameters # @return [nil] def delete_audience_memberships_v2(audience_id, opts = {}) delete_audience_memberships_v2_with_http_info(audience_id, opts) nil end # Delete audience memberships # Remove all members from this audience. # @param audience_id [Integer] The ID of the audience. You get it via the `id` property when [creating an audience](#operation/createAudienceV2). # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def delete_audience_memberships_v2_with_http_info(audience_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IntegrationApi.delete_audience_memberships_v2 ...' end # verify the required parameter 'audience_id' is set if @api_client.config.client_side_validation && audience_id.nil? fail ArgumentError, "Missing the required parameter 'audience_id' when calling IntegrationApi.delete_audience_memberships_v2" end # resource path local_var_path = '/v2/audiences/{audienceId}/memberships'.sub('{' + 'audienceId' + '}', CGI.escape(audience_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] # auth_names auth_names = opts[:auth_names] || ['manager_auth'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: IntegrationApi#delete_audience_memberships_v2\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete audience # Delete an audience created by a third-party integration. **Warning:** This endpoint also removes any associations recorded between a customer profile and this audience. # @param audience_id [Integer] The ID of the audience. You get it via the `id` property when [creating an audience](#operation/createAudienceV2). # @param [Hash] opts the optional parameters # @return [nil] def delete_audience_v2(audience_id, opts = {}) delete_audience_v2_with_http_info(audience_id, opts) nil end # Delete audience # Delete an audience created by a third-party integration. **Warning:** This endpoint also removes any associations recorded between a customer profile and this audience. # @param audience_id [Integer] The ID of the audience. You get it via the `id` property when [creating an audience](#operation/createAudienceV2). # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def delete_audience_v2_with_http_info(audience_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IntegrationApi.delete_audience_v2 ...' end # verify the required parameter 'audience_id' is set if @api_client.config.client_side_validation && audience_id.nil? fail ArgumentError, "Missing the required parameter 'audience_id' when calling IntegrationApi.delete_audience_v2" end # resource path local_var_path = '/v2/audiences/{audienceId}'.sub('{' + 'audienceId' + '}', CGI.escape(audience_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] # auth_names auth_names = opts[:auth_names] || ['manager_auth'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: IntegrationApi#delete_audience_v2\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete coupon reservations # Remove all passed customer profiles reservation from this coupon. # @param coupon_value [String] The value of a coupon # @param body [CouponReservations] # @param [Hash] opts the optional parameters # @return [nil] def delete_coupon_reservation(coupon_value, body, opts = {}) delete_coupon_reservation_with_http_info(coupon_value, body, opts) nil end # Delete coupon reservations # Remove all passed customer profiles reservation from this coupon. # @param coupon_value [String] The value of a coupon # @param body [CouponReservations] # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def delete_coupon_reservation_with_http_info(coupon_value, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IntegrationApi.delete_coupon_reservation ...' end # verify the required parameter 'coupon_value' is set if @api_client.config.client_side_validation && coupon_value.nil? fail ArgumentError, "Missing the required parameter 'coupon_value' when calling IntegrationApi.delete_coupon_reservation" end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling IntegrationApi.delete_coupon_reservation" end # resource path local_var_path = '/v1/coupon_reservations/{couponValue}'.sub('{' + 'couponValue' + '}', CGI.escape(coupon_value.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:return_type] # auth_names auth_names = opts[:auth_names] || ['api_key_v1'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: IntegrationApi#delete_coupon_reservation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete customer's personal data # Delete all attributes on the customer profile and on entities that reference this customer profile. **Important:** To preserve performance, we recommend avoiding deleting customer data during peak-traffic hours. # @param integration_id [String] The integration ID of the customer profile. You can get the `integrationId` of a profile using: - A customer session integration Id with the [Update customer session endpoint](https://docs.talon.one/integration-api/#operation/updateCustomerSessionV2). - The Management API with the [List application's customers endpoint](https://docs.talon.one/management-api/#operation/getApplicationCustomers). # @param [Hash] opts the optional parameters # @return [nil] def delete_customer_data(integration_id, opts = {}) delete_customer_data_with_http_info(integration_id, opts) nil end # Delete customer's personal data # Delete all attributes on the customer profile and on entities that reference this customer profile. **Important:** To preserve performance, we recommend avoiding deleting customer data during peak-traffic hours. # @param integration_id [String] The integration ID of the customer profile. You can get the `integrationId` of a profile using: - A customer session integration Id with the [Update customer session endpoint](https://docs.talon.one/integration-api/#operation/updateCustomerSessionV2). - The Management API with the [List application's customers endpoint](https://docs.talon.one/management-api/#operation/getApplicationCustomers). # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def delete_customer_data_with_http_info(integration_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IntegrationApi.delete_customer_data ...' end # verify the required parameter 'integration_id' is set if @api_client.config.client_side_validation && integration_id.nil? fail ArgumentError, "Missing the required parameter 'integration_id' when calling IntegrationApi.delete_customer_data" end # resource path local_var_path = '/v1/customer_data/{integrationId}'.sub('{' + 'integrationId' + '}', CGI.escape(integration_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] # auth_names auth_names = opts[:auth_names] || ['api_key_v1'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: IntegrationApi#delete_customer_data\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # List customer data # Return the customer inventory regarding entities referencing this customer profile's `integrationId`. Typical entities returned are: customer profile information, referral codes, loyalty points and reserved coupons. Reserved coupons also include redeemed coupons. You can also use this endpoint to get the projected loyalty balances in order to notify your customers about points that are about to expire, or to remind them how many points they have. # @param integration_id [String] The integration ID of the customer profile. You can get the `integrationId` of a profile using: - A customer session integration Id with the [Update customer session endpoint](https://docs.talon.one/integration-api/#operation/updateCustomerSessionV2). - The Management API with the [List application's customers endpoint](https://docs.talon.one/management-api/#operation/getApplicationCustomers). # @param [Hash] opts the optional parameters # @option opts [Boolean] :profile Set to `true` to include customer profile information in the response. # @option opts [Boolean] :referrals Set to `true` to include referral information in the response. # @option opts [Boolean] :coupons Set to `true` to include coupon information in the response. # @option opts [Boolean] :loyalty Set to `true` to include loyalty information in the response. # @option opts [Boolean] :giveaways Set to `true` to include giveaways information in the response. # @option opts [DateTime] :loyalty_projection_end_date Set an end date to query the projected loyalty balances. You can project results up to 31 days from today. # @return [CustomerInventory] def get_customer_inventory(integration_id, opts = {}) data, _status_code, _headers = get_customer_inventory_with_http_info(integration_id, opts) data end # List customer data # Return the customer inventory regarding entities referencing this customer profile's `integrationId`. Typical entities returned are: customer profile information, referral codes, loyalty points and reserved coupons. Reserved coupons also include redeemed coupons. You can also use this endpoint to get the projected loyalty balances in order to notify your customers about points that are about to expire, or to remind them how many points they have. # @param integration_id [String] The integration ID of the customer profile. You can get the `integrationId` of a profile using: - A customer session integration Id with the [Update customer session endpoint](https://docs.talon.one/integration-api/#operation/updateCustomerSessionV2). - The Management API with the [List application's customers endpoint](https://docs.talon.one/management-api/#operation/getApplicationCustomers). # @param [Hash] opts the optional parameters # @option opts [Boolean] :profile Set to `true` to include customer profile information in the response. # @option opts [Boolean] :referrals Set to `true` to include referral information in the response. # @option opts [Boolean] :coupons Set to `true` to include coupon information in the response. # @option opts [Boolean] :loyalty Set to `true` to include loyalty information in the response. # @option opts [Boolean] :giveaways Set to `true` to include giveaways information in the response. # @option opts [DateTime] :loyalty_projection_end_date Set an end date to query the projected loyalty balances. You can project results up to 31 days from today. # @return [Array<(CustomerInventory, Integer, Hash)>] CustomerInventory data, response status code and response headers def get_customer_inventory_with_http_info(integration_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IntegrationApi.get_customer_inventory ...' end # verify the required parameter 'integration_id' is set if @api_client.config.client_side_validation && integration_id.nil? fail ArgumentError, "Missing the required parameter 'integration_id' when calling IntegrationApi.get_customer_inventory" end # resource path local_var_path = '/v1/customer_profiles/{integrationId}/inventory'.sub('{' + 'integrationId' + '}', CGI.escape(integration_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'profile'] = opts[:'profile'] if !opts[:'profile'].nil? query_params[:'referrals'] = opts[:'referrals'] if !opts[:'referrals'].nil? query_params[:'coupons'] = opts[:'coupons'] if !opts[:'coupons'].nil? query_params[:'loyalty'] = opts[:'loyalty'] if !opts[:'loyalty'].nil? query_params[:'giveaways'] = opts[:'giveaways'] if !opts[:'giveaways'].nil? query_params[:'loyaltyProjectionEndDate'] = opts[:'loyalty_projection_end_date'] if !opts[:'loyalty_projection_end_date'].nil? # header parameters header_params = opts[:header_params] || {} # 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[:body] # return_type return_type = opts[:return_type] || 'CustomerInventory' # auth_names auth_names = opts[:auth_names] || ['api_key_v1'] new_options = opts.merge( :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: IntegrationApi#get_customer_inventory\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get customer session # Get customer session data. # @param customer_session_id [String] The `integration ID` of the customer session. You set this ID when you create a customer session. You can see existing customer session integration IDs in the Campaign Manager's **Sessions** menu, or via the [List Application session endpoint](https://docs.talon.one/management-api/#operation/getApplicationSessions). # @param [Hash] opts the optional parameters # @return [IntegrationCustomerSessionResponse] def get_customer_session(customer_session_id, opts = {}) data, _status_code, _headers = get_customer_session_with_http_info(customer_session_id, opts) data end # Get customer session # Get customer session data. # @param customer_session_id [String] The `integration ID` of the customer session. You set this ID when you create a customer session. You can see existing customer session integration IDs in the Campaign Manager's **Sessions** menu, or via the [List Application session endpoint](https://docs.talon.one/management-api/#operation/getApplicationSessions). # @param [Hash] opts the optional parameters # @return [Array<(IntegrationCustomerSessionResponse, Integer, Hash)>] IntegrationCustomerSessionResponse data, response status code and response headers def get_customer_session_with_http_info(customer_session_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IntegrationApi.get_customer_session ...' end # verify the required parameter 'customer_session_id' is set if @api_client.config.client_side_validation && customer_session_id.nil? fail ArgumentError, "Missing the required parameter 'customer_session_id' when calling IntegrationApi.get_customer_session" end # resource path local_var_path = '/v2/customer_sessions/{customerSessionId}'.sub('{' + 'customerSessionId' + '}', CGI.escape(customer_session_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'IntegrationCustomerSessionResponse' # auth_names auth_names = opts[:auth_names] || ['api_key_v1'] new_options = opts.merge( :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: IntegrationApi#get_customer_session\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # List customers that have this coupon reserved # Return all customers that have this coupon marked as reserved. Coupons are reserved in the following ways: - To create a soft reservation (any customer can use the coupon), use the [Create coupon reservation](#operation/createCouponReservation) endpoint. - To create a hard reservation (only the given customer can use the coupon), create a coupon in the Campaign Manager for a given `recipientIntegrationId` or use the [Create coupons](/management-api/#operation/createCoupons) or [Create coupons for multiple recipients](/management-api/#operation/createCouponsForMultipleRecipients) endpoints. # @param coupon_value [String] The value of a coupon # @param [Hash] opts the optional parameters # @return [InlineResponse200] def get_reserved_customers(coupon_value, opts = {}) data, _status_code, _headers = get_reserved_customers_with_http_info(coupon_value, opts) data end # List customers that have this coupon reserved # Return all customers that have this coupon marked as reserved. Coupons are reserved in the following ways: - To create a soft reservation (any customer can use the coupon), use the [Create coupon reservation](#operation/createCouponReservation) endpoint. - To create a hard reservation (only the given customer can use the coupon), create a coupon in the Campaign Manager for a given `recipientIntegrationId` or use the [Create coupons](/management-api/#operation/createCoupons) or [Create coupons for multiple recipients](/management-api/#operation/createCouponsForMultipleRecipients) endpoints. # @param coupon_value [String] The value of a coupon # @param [Hash] opts the optional parameters # @return [Array<(InlineResponse200, Integer, Hash)>] InlineResponse200 data, response status code and response headers def get_reserved_customers_with_http_info(coupon_value, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IntegrationApi.get_reserved_customers ...' end # verify the required parameter 'coupon_value' is set if @api_client.config.client_side_validation && coupon_value.nil? fail ArgumentError, "Missing the required parameter 'coupon_value' when calling IntegrationApi.get_reserved_customers" end # resource path local_var_path = '/v1/coupon_reservations/customerprofiles/{couponValue}'.sub('{' + 'couponValue' + '}', CGI.escape(coupon_value.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'InlineResponse200' # auth_names auth_names = opts[:auth_names] || ['api_key_v1'] new_options = opts.merge( :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: IntegrationApi#get_reserved_customers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Return cart items # Create a new return request for the specified cart items. This endpoint automatically changes the session state from `closed` to `partially returned`. Its behavior depends on whether [cart item flattening](https://docs.talon.one/docs/product/campaigns/campaign-evaluation/#flattened-cart-items) is enabled for the campaign. **Note:** This will roll back any effects associated with these cart items. For more information, see [our documentation on session states](https://docs.talon.one/docs/dev/concepts/entities#customer-session-states) and [this tutorial](https://docs.talon.one/docs/dev/tutorials/partially-returning-a-session). # @param customer_session_id [String] The `integration ID` of the customer session. You set this ID when you create a customer session. You can see existing customer session integration IDs in the Campaign Manager's **Sessions** menu, or via the [List Application session endpoint](https://docs.talon.one/management-api/#operation/getApplicationSessions). # @param body [ReturnIntegrationRequest] # @param [Hash] opts the optional parameters # @option opts [Boolean] :dry Indicates whether to persist the changes. Changes are ignored when `dry=true`. # @return [IntegrationStateV2] def return_cart_items(customer_session_id, body, opts = {}) data, _status_code, _headers = return_cart_items_with_http_info(customer_session_id, body, opts) data end # Return cart items # Create a new return request for the specified cart items. This endpoint automatically changes the session state from `closed` to `partially returned`. Its behavior depends on whether [cart item flattening](https://docs.talon.one/docs/product/campaigns/campaign-evaluation/#flattened-cart-items) is enabled for the campaign. **Note:** This will roll back any effects associated with these cart items. For more information, see [our documentation on session states](https://docs.talon.one/docs/dev/concepts/entities#customer-session-states) and [this tutorial](https://docs.talon.one/docs/dev/tutorials/partially-returning-a-session). # @param customer_session_id [String] The `integration ID` of the customer session. You set this ID when you create a customer session. You can see existing customer session integration IDs in the Campaign Manager's **Sessions** menu, or via the [List Application session endpoint](https://docs.talon.one/management-api/#operation/getApplicationSessions). # @param body [ReturnIntegrationRequest] # @param [Hash] opts the optional parameters # @option opts [Boolean] :dry Indicates whether to persist the changes. Changes are ignored when `dry=true`. # @return [Array<(IntegrationStateV2, Integer, Hash)>] IntegrationStateV2 data, response status code and response headers def return_cart_items_with_http_info(customer_session_id, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IntegrationApi.return_cart_items ...' end # verify the required parameter 'customer_session_id' is set if @api_client.config.client_side_validation && customer_session_id.nil? fail ArgumentError, "Missing the required parameter 'customer_session_id' when calling IntegrationApi.return_cart_items" end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling IntegrationApi.return_cart_items" end # resource path local_var_path = '/v2/customer_sessions/{customerSessionId}/returns'.sub('{' + 'customerSessionId' + '}', CGI.escape(customer_session_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'dry'] = opts[:'dry'] if !opts[:'dry'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:return_type] || 'IntegrationStateV2' # auth_names auth_names = opts[:auth_names] || ['api_key_v1'] new_options = opts.merge( :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: IntegrationApi#return_cart_items\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Track event # **Important:** This endpoint is **DEPRECATED**. Use [Track Event V2](https://docs.talon.one/integration-api/#tag/Events/operation/trackEventV2) instead. > Triggers a custom event in a customer session. You can then check this event in your rules. **Important:** Talon.One offers a set of [built-in events](/docs/dev/concepts/events), ensure you do not create a custom event when you can use a built-in event. > For example, use this endpoint to trigger an event when a user updates their payment information. > Before using this endpoint, create your event as a custom attribute of type `event`. See the [Developer docs](/docs/dev/concepts/events/#creating-a-custom-event). > An event is always part of a session. If either the profile or the session does not exist, a new empty profile/session is created. If the specified session already exists, it must belong to the same `profileId` or an error will be returned. # @param body [NewEvent] # @param [Hash] opts the optional parameters # @option opts [Boolean] :dry Indicates whether to persist the changes. Changes are ignored when `dry=true`. # @return [IntegrationState] def track_event(body, opts = {}) data, _status_code, _headers = track_event_with_http_info(body, opts) data end # Track event # **Important:** This endpoint is **DEPRECATED**. Use [Track Event V2](https://docs.talon.one/integration-api/#tag/Events/operation/trackEventV2) instead. > Triggers a custom event in a customer session. You can then check this event in your rules. **Important:** Talon.One offers a set of [built-in events](/docs/dev/concepts/events), ensure you do not create a custom event when you can use a built-in event. > For example, use this endpoint to trigger an event when a user updates their payment information. > Before using this endpoint, create your event as a custom attribute of type `event`. See the [Developer docs](/docs/dev/concepts/events/#creating-a-custom-event). > An event is always part of a session. If either the profile or the session does not exist, a new empty profile/session is created. If the specified session already exists, it must belong to the same `profileId` or an error will be returned. # @param body [NewEvent] # @param [Hash] opts the optional parameters # @option opts [Boolean] :dry Indicates whether to persist the changes. Changes are ignored when `dry=true`. # @return [Array<(IntegrationState, Integer, Hash)>] IntegrationState data, response status code and response headers def track_event_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IntegrationApi.track_event ...' end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling IntegrationApi.track_event" end # resource path local_var_path = '/v1/events' # query parameters query_params = opts[:query_params] || {} query_params[:'dry'] = opts[:'dry'] if !opts[:'dry'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:return_type] || 'IntegrationState' # auth_names auth_names = opts[:auth_names] || ['api_key_v1'] new_options = opts.merge( :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: IntegrationApi#track_event\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Track event V2 # Triggers a custom event. You can then check this event in your rules. **Important:** Talon.One offers a set of [built-in events](/docs/dev/concepts/events), ensure you do not create a custom event when you can use a built-in event. For example, use this endpoint to trigger an event when a user updates their payment information. Before using this endpoint, create your event as a custom attribute of type `event`. See the [Developer docs](/docs/dev/concepts/events/#creating-a-custom-event). **Important:** `profileId` is required. An event V2 is associated with a customer profile. # @param body [IntegrationEventV2Request] # @param [Hash] opts the optional parameters # @option opts [String] :silent Possible values: `yes` or `no`. - `yes`: Increases the perfomance of the API call by returning a 204 response. - `no`: Returns a 200 response that contains essential data such as the updated customer profiles and session-related information. (default to 'yes') # @option opts [Boolean] :dry Indicates whether to persist the changes. Changes are ignored when `dry=true`. # @return [IntegrationStateV2] def track_event_v2(body, opts = {}) data, _status_code, _headers = track_event_v2_with_http_info(body, opts) data end # Track event V2 # Triggers a custom event. You can then check this event in your rules. **Important:** Talon.One offers a set of [built-in events](/docs/dev/concepts/events), ensure you do not create a custom event when you can use a built-in event. For example, use this endpoint to trigger an event when a user updates their payment information. Before using this endpoint, create your event as a custom attribute of type `event`. See the [Developer docs](/docs/dev/concepts/events/#creating-a-custom-event). **Important:** `profileId` is required. An event V2 is associated with a customer profile. # @param body [IntegrationEventV2Request] # @param [Hash] opts the optional parameters # @option opts [String] :silent Possible values: `yes` or `no`. - `yes`: Increases the perfomance of the API call by returning a 204 response. - `no`: Returns a 200 response that contains essential data such as the updated customer profiles and session-related information. # @option opts [Boolean] :dry Indicates whether to persist the changes. Changes are ignored when `dry=true`. # @return [Array<(IntegrationStateV2, Integer, Hash)>] IntegrationStateV2 data, response status code and response headers def track_event_v2_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IntegrationApi.track_event_v2 ...' end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling IntegrationApi.track_event_v2" end # resource path local_var_path = '/v2/events' # query parameters query_params = opts[:query_params] || {} query_params[:'silent'] = opts[:'silent'] if !opts[:'silent'].nil? query_params[:'dry'] = opts[:'dry'] if !opts[:'dry'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:return_type] || 'IntegrationStateV2' # auth_names auth_names = opts[:auth_names] || ['api_key_v1'] new_options = opts.merge( :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: IntegrationApi#track_event_v2\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update profile attributes for all customers in audience # Update the specified profile attributes to the provided values for all customers in the specified audience. # @param audience_id [Integer] The ID of the audience. You get it via the `id` property when [creating an audience](#operation/createAudienceV2). # @param body [Object] # @param [Hash] opts the optional parameters # @return [nil] def update_audience_customers_attributes(audience_id, body, opts = {}) update_audience_customers_attributes_with_http_info(audience_id, body, opts) nil end # Update profile attributes for all customers in audience # Update the specified profile attributes to the provided values for all customers in the specified audience. # @param audience_id [Integer] The ID of the audience. You get it via the `id` property when [creating an audience](#operation/createAudienceV2). # @param body [Object] # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def update_audience_customers_attributes_with_http_info(audience_id, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IntegrationApi.update_audience_customers_attributes ...' end # verify the required parameter 'audience_id' is set if @api_client.config.client_side_validation && audience_id.nil? fail ArgumentError, "Missing the required parameter 'audience_id' when calling IntegrationApi.update_audience_customers_attributes" end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling IntegrationApi.update_audience_customers_attributes" end # resource path local_var_path = '/v2/audience_customers/{audienceId}/attributes'.sub('{' + 'audienceId' + '}', CGI.escape(audience_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:return_type] # auth_names auth_names = opts[:auth_names] || ['api_key_v1'] new_options = opts.merge( :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(:PUT, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: IntegrationApi#update_audience_customers_attributes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update audience # Update an Audience created by a third-party integration. # @param audience_id [Integer] The ID of the audience. You get it via the `id` property when [creating an audience](#operation/createAudienceV2). # @param body [UpdateAudience] # @param [Hash] opts the optional parameters # @return [Audience] def update_audience_v2(audience_id, body, opts = {}) data, _status_code, _headers = update_audience_v2_with_http_info(audience_id, body, opts) data end # Update audience # Update an Audience created by a third-party integration. # @param audience_id [Integer] The ID of the audience. You get it via the `id` property when [creating an audience](#operation/createAudienceV2). # @param body [UpdateAudience] # @param [Hash] opts the optional parameters # @return [Array<(Audience, Integer, Hash)>] Audience data, response status code and response headers def update_audience_v2_with_http_info(audience_id, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IntegrationApi.update_audience_v2 ...' end # verify the required parameter 'audience_id' is set if @api_client.config.client_side_validation && audience_id.nil? fail ArgumentError, "Missing the required parameter 'audience_id' when calling IntegrationApi.update_audience_v2" end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling IntegrationApi.update_audience_v2" end # resource path local_var_path = '/v2/audiences/{audienceId}'.sub('{' + 'audienceId' + '}', CGI.escape(audience_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:return_type] || 'Audience' # auth_names auth_names = opts[:auth_names] || ['api_key_v1'] new_options = opts.merge( :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(:PUT, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: IntegrationApi#update_audience_v2\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update multiple customer profiles' audiences # Update the specified customer profiles with the specified audiences. Use this endpoint when customers join or leave audiences. The limit of customer profiles per request is 1000. # @param body [CustomerProfileAudienceRequest] # @param [Hash] opts the optional parameters # @return [nil] def update_customer_profile_audiences(body, opts = {}) update_customer_profile_audiences_with_http_info(body, opts) nil end # Update multiple customer profiles' audiences # Update the specified customer profiles with the specified audiences. Use this endpoint when customers join or leave audiences. The limit of customer profiles per request is 1000. # @param body [CustomerProfileAudienceRequest] # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def update_customer_profile_audiences_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IntegrationApi.update_customer_profile_audiences ...' end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling IntegrationApi.update_customer_profile_audiences" end # resource path local_var_path = '/v2/customer_audiences' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:return_type] # auth_names auth_names = opts[:auth_names] || ['api_key_v1'] new_options = opts.merge( :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: IntegrationApi#update_customer_profile_audiences\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update customer profile # Update (or create) a [Customer Profile](/docs/dev/concepts/entities#customer-profile). **Performance tips** Updating a customer profile returns a response with the requested integration state. You can use the `responseContent` property to save yourself extra API calls. For example, you can get the customer profile details directly without extra requests. You can also set `runRuleEngine` to `false` to prevent unwanted rule executions. This allows you to improve response times. If `runRuleEngine` is set to `true`, the response includes: - The effects generated by the triggered campaigns. - The created coupons and referral objects. # @param integration_id [String] The integration identifier for this customer profile. Must be: - Unique within the deployment. - Stable for the customer. Do not use an ID that the customer can update themselves. For example, you can use a database ID. Once set, you cannot update this identifier. # @param body [CustomerProfileIntegrationRequestV2] # @param [Hash] opts the optional parameters # @option opts [Boolean] :run_rule_engine Indicates whether to run the rule engine. Setting this property to `false` improves response times. (default to false) # @option opts [Boolean] :dry Indicates whether to persist the changes. Changes are ignored when `dry=true`. Only used when `runRuleEngine` is set to `true`. # @return [IntegrationStateV2] def update_customer_profile_v2(integration_id, body, opts = {}) data, _status_code, _headers = update_customer_profile_v2_with_http_info(integration_id, body, opts) data end # Update customer profile # Update (or create) a [Customer Profile](/docs/dev/concepts/entities#customer-profile). **Performance tips** Updating a customer profile returns a response with the requested integration state. You can use the `responseContent` property to save yourself extra API calls. For example, you can get the customer profile details directly without extra requests. You can also set `runRuleEngine` to `false` to prevent unwanted rule executions. This allows you to improve response times. If `runRuleEngine` is set to `true`, the response includes: - The effects generated by the triggered campaigns. - The created coupons and referral objects. # @param integration_id [String] The integration identifier for this customer profile. Must be: - Unique within the deployment. - Stable for the customer. Do not use an ID that the customer can update themselves. For example, you can use a database ID. Once set, you cannot update this identifier. # @param body [CustomerProfileIntegrationRequestV2] # @param [Hash] opts the optional parameters # @option opts [Boolean] :run_rule_engine Indicates whether to run the rule engine. Setting this property to `false` improves response times. # @option opts [Boolean] :dry Indicates whether to persist the changes. Changes are ignored when `dry=true`. Only used when `runRuleEngine` is set to `true`. # @return [Array<(IntegrationStateV2, Integer, Hash)>] IntegrationStateV2 data, response status code and response headers def update_customer_profile_v2_with_http_info(integration_id, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IntegrationApi.update_customer_profile_v2 ...' end # verify the required parameter 'integration_id' is set if @api_client.config.client_side_validation && integration_id.nil? fail ArgumentError, "Missing the required parameter 'integration_id' when calling IntegrationApi.update_customer_profile_v2" end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling IntegrationApi.update_customer_profile_v2" end # resource path local_var_path = '/v2/customer_profiles/{integrationId}'.sub('{' + 'integrationId' + '}', CGI.escape(integration_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'runRuleEngine'] = opts[:'run_rule_engine'] if !opts[:'run_rule_engine'].nil? query_params[:'dry'] = opts[:'dry'] if !opts[:'dry'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:return_type] || 'IntegrationStateV2' # auth_names auth_names = opts[:auth_names] || ['api_key_v1'] new_options = opts.merge( :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(:PUT, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: IntegrationApi#update_customer_profile_v2\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update multiple customer profiles # Update (or create) up to 1000 [customer profiles](/docs/dev/concepts/entities#customer-profile) in 1 request. The `integrationId` must be any identifier that remains stable for the customer. Do not use an ID that the customer can update themselves. For example, you can use a database ID. A customer profile [can be linked to one or more sessions](/integration-api/#tag/Customer-sessions). # @param body [MultipleCustomerProfileIntegrationRequest] # @param [Hash] opts the optional parameters # @option opts [String] :silent Possible values: `yes` or `no`. - `yes`: Increases the perfomance of the API call by returning a 204 response. - `no`: Returns a 200 response that contains essential data such as the updated customer profiles and session-related information. (default to 'yes') # @return [MultipleCustomerProfileIntegrationResponseV2] def update_customer_profiles_v2(body, opts = {}) data, _status_code, _headers = update_customer_profiles_v2_with_http_info(body, opts) data end # Update multiple customer profiles # Update (or create) up to 1000 [customer profiles](/docs/dev/concepts/entities#customer-profile) in 1 request. The `integrationId` must be any identifier that remains stable for the customer. Do not use an ID that the customer can update themselves. For example, you can use a database ID. A customer profile [can be linked to one or more sessions](/integration-api/#tag/Customer-sessions). # @param body [MultipleCustomerProfileIntegrationRequest] # @param [Hash] opts the optional parameters # @option opts [String] :silent Possible values: `yes` or `no`. - `yes`: Increases the perfomance of the API call by returning a 204 response. - `no`: Returns a 200 response that contains essential data such as the updated customer profiles and session-related information. # @return [Array<(MultipleCustomerProfileIntegrationResponseV2, Integer, Hash)>] MultipleCustomerProfileIntegrationResponseV2 data, response status code and response headers def update_customer_profiles_v2_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IntegrationApi.update_customer_profiles_v2 ...' end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling IntegrationApi.update_customer_profiles_v2" end # resource path local_var_path = '/v2/customer_profiles' # query parameters query_params = opts[:query_params] || {} query_params[:'silent'] = opts[:'silent'] if !opts[:'silent'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:return_type] || 'MultipleCustomerProfileIntegrationResponseV2' # auth_names auth_names = opts[:auth_names] || ['api_key_v1'] new_options = opts.merge( :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(:PUT, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: IntegrationApi#update_customer_profiles_v2\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update customer session # Update or create a [customer session](/docs/dev/concepts/entities#customer-session). For example, use this endpoint to share the content of a customer's cart with Talon.One and to check which promotion rules apply. **Note:** The currency for the session and the cart items in the session is the same as the Application that owns this session. **Session management** The Talon.One platform supports multiple simultaneous sessions for the same profile. If you have multiple ways of accessing the same Application you can either: - Track multiple independent sessions or, - Use the same session across all of them. You should share sessions when application access points share other state, such as the user's cart. If two points of access to the application have independent states, for example a user can have different items in their cart across the two) they should use independent customer session ID's. See more information and tips about session management in the [documentation](/docs/dev/concepts/entities#customer-session). **Sessions and customer profiles** - To link a session to a customer profile, set the `profileId` parameter in the request body to a customer profile's `integrationId`. - While you can create an anonymous session with `profileId=\"\"`, we recommend you use a guest ID instead. **Note:** You do **not** have to create a customer profile first. If the specified profile does not exist, an empty profile is created automatically. **Performance tips** Updating a customer session returns a response with the requested integration state. You can use the `responseContent` property to save yourself extra API calls. For example, you can get the customer profile details directly without extra requests. For more information, see the [integration tutorial](https://docs.talon.one/docs/dev/tutorials/integrating-talon-one). # @param customer_session_id [String] The `integration ID` of the customer session. You set this ID when you create a customer session. You can see existing customer session integration IDs in the Campaign Manager's **Sessions** menu, or via the [List Application session endpoint](https://docs.talon.one/management-api/#operation/getApplicationSessions). # @param body [IntegrationRequest] # @param [Hash] opts the optional parameters # @option opts [Boolean] :dry Indicates whether to persist the changes. Changes are ignored when `dry=true`. # @return [IntegrationStateV2] def update_customer_session_v2(customer_session_id, body, opts = {}) data, _status_code, _headers = update_customer_session_v2_with_http_info(customer_session_id, body, opts) data end # Update customer session # Update or create a [customer session](/docs/dev/concepts/entities#customer-session). For example, use this endpoint to share the content of a customer's cart with Talon.One and to check which promotion rules apply. **Note:** The currency for the session and the cart items in the session is the same as the Application that owns this session. **Session management** The Talon.One platform supports multiple simultaneous sessions for the same profile. If you have multiple ways of accessing the same Application you can either: - Track multiple independent sessions or, - Use the same session across all of them. You should share sessions when application access points share other state, such as the user's cart. If two points of access to the application have independent states, for example a user can have different items in their cart across the two) they should use independent customer session ID's. See more information and tips about session management in the [documentation](/docs/dev/concepts/entities#customer-session). **Sessions and customer profiles** - To link a session to a customer profile, set the `profileId` parameter in the request body to a customer profile's `integrationId`. - While you can create an anonymous session with `profileId=\"\"`, we recommend you use a guest ID instead. **Note:** You do **not** have to create a customer profile first. If the specified profile does not exist, an empty profile is created automatically. **Performance tips** Updating a customer session returns a response with the requested integration state. You can use the `responseContent` property to save yourself extra API calls. For example, you can get the customer profile details directly without extra requests. For more information, see the [integration tutorial](https://docs.talon.one/docs/dev/tutorials/integrating-talon-one). # @param customer_session_id [String] The `integration ID` of the customer session. You set this ID when you create a customer session. You can see existing customer session integration IDs in the Campaign Manager's **Sessions** menu, or via the [List Application session endpoint](https://docs.talon.one/management-api/#operation/getApplicationSessions). # @param body [IntegrationRequest] # @param [Hash] opts the optional parameters # @option opts [Boolean] :dry Indicates whether to persist the changes. Changes are ignored when `dry=true`. # @return [Array<(IntegrationStateV2, Integer, Hash)>] IntegrationStateV2 data, response status code and response headers def update_customer_session_v2_with_http_info(customer_session_id, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IntegrationApi.update_customer_session_v2 ...' end # verify the required parameter 'customer_session_id' is set if @api_client.config.client_side_validation && customer_session_id.nil? fail ArgumentError, "Missing the required parameter 'customer_session_id' when calling IntegrationApi.update_customer_session_v2" end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling IntegrationApi.update_customer_session_v2" end # resource path local_var_path = '/v2/customer_sessions/{customerSessionId}'.sub('{' + 'customerSessionId' + '}', CGI.escape(customer_session_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'dry'] = opts[:'dry'] if !opts[:'dry'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:return_type] || 'IntegrationStateV2' # auth_names auth_names = opts[:auth_names] || ['api_key_v1'] new_options = opts.merge( :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(:PUT, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: IntegrationApi#update_customer_session_v2\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end