=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 access the Campaign Manager at `https://yourbaseurl.talon.one/`, the URL for the [updateCustomerSessionV2](https://docs.talon.one/integration-api#operation/updateCustomerSessionV2) endpoint is `https://yourbaseurl.talon.one/v2/customer_sessions/{Id}`
The version of the OpenAPI document:
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. **Note:** Audiences can also be created from scratch via the Campaign Manager. See the [docs](https://docs.talon.one/docs/product/audiences/creating-audiences). To create an audience from an existing audience from a [technology partner](https://docs.talon.one/docs/dev/technology-partners/overview): 1. Set the `integration` property to `mparticle`, `segment` etc., 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: 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] body
# @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. **Note:** Audiences can also be created from scratch via the Campaign Manager. See the [docs](https://docs.talon.one/docs/product/audiences/creating-audiences). To create an audience from an existing audience from a [technology partner](https://docs.talon.one/docs/dev/technology-partners/overview): 1. Set the `integration` property to `mparticle`, `segment` etc., 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: 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] body
# @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. You can also create a reservation via the Campaign Manager using the [Create coupon code reservation effect](https://docs.talon.one/docs/product/rules/effects/using-effects#reserving-a-coupon-code). 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](https://docs.talon.one/integration-api#operation/getCustomerInventory) endpoint. If a coupon gets created for a specific user, it will automatically appear 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](https://docs.talon.one/integration-api#operation/getCustomerInventory) endpoint. 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.
Important
This endpoint creates a **soft** reservation. _Any_ customer can use a reserved coupon code and proceed to checkout. To create a hard reservation, you can: - use the [Create coupons](https://docs.talon.one/management-api#operation/createCoupons) endpoint or, - use the [Create coupons for multiple recipients](https://docs.talon.one/management-api#operation/createCouponsForMultipleRecipients) endpoint setting the `recipientsIntegrationId` property or, - create a coupon code with the **Reservation mandatory** option then use the [Create coupon code reservation effect](https://docs.talon.one/docs/product/rules/effects/using-effects#reserving-a-coupon-code).
To delete a reservation, use the [Delete reservation](https://docs.talon.one/integration-api#tag/Coupons/operation/deleteCouponReservation) endpoint.
# @param coupon_value [String] The code of the coupon.
# @param body [CouponReservations] body
# @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. You can also create a reservation via the Campaign Manager using the [Create coupon code reservation effect](https://docs.talon.one/docs/product/rules/effects/using-effects#reserving-a-coupon-code). 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](https://docs.talon.one/integration-api#operation/getCustomerInventory) endpoint. If a coupon gets created for a specific user, it will automatically appear 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](https://docs.talon.one/integration-api#operation/getCustomerInventory) endpoint. 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. <div class=\"redoc-section\"> <p class=\"title\">Important</p> This endpoint creates a **soft** reservation. _Any_ customer can use a reserved coupon code and proceed to checkout. To create a hard reservation, you can: - use the [Create coupons](https://docs.talon.one/management-api#operation/createCoupons) endpoint or, - use the [Create coupons for multiple recipients](https://docs.talon.one/management-api#operation/createCouponsForMultipleRecipients) endpoint setting the `recipientsIntegrationId` property or, - create a coupon code with the **Reservation mandatory** option then use the [Create coupon code reservation effect](https://docs.talon.one/docs/product/rules/effects/using-effects#reserving-a-coupon-code). </div> To delete a reservation, use the [Delete reservation](https://docs.talon.one/integration-api#tag/Coupons/operation/deleteCouponReservation) endpoint.
# @param coupon_value [String] The code of the coupon.
# @param body [CouponReservations] body
# @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] body
# @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] body
# @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] body
# @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 the updated customer profiles. (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] body
# @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 the updated customer profiles.
# @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] || ['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_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. **Note:** Audiences can also be deleted via the Campaign Manager. See the [docs](https://docs.talon.one/docs/product/audiences/managing-audiences#deleting-an-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. **Note:** Audiences can also be deleted via the Campaign Manager. See the [docs](https://docs.talon.one/docs/product/audiences/managing-audiences#deleting-an-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] || ['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_audience_v2\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Delete coupon reservations
# Remove all the coupon reservations from the provided customer profile integration IDs and the provided coupon code.
# @param coupon_value [String] The code of the coupon.
# @param body [CouponReservations] body
# @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 the coupon reservations from the provided customer profile integration IDs and the provided coupon code.
# @param coupon_value [String] The code of the coupon.
# @param body [CouponReservations] body
# @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](https://docs.talon.one/integration-api#operation/updateCustomerSessionV2) endpoint. - The Management API with the [List application's customers](https://docs.talon.one/management-api#operation/getApplicationCustomers) endpoint.
# @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](https://docs.talon.one/integration-api#operation/updateCustomerSessionV2) endpoint. - The Management API with the [List application's customers](https://docs.talon.one/management-api#operation/getApplicationCustomers) endpoint.
# @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, loyalty cards and reserved coupons. Reserved coupons also include redeemed coupons.
# @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](https://docs.talon.one/integration-api#operation/updateCustomerSessionV2) endpoint. - The Management API with the [List application's customers](https://docs.talon.one/management-api#operation/getApplicationCustomers) endpoint.
# @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.
# @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, loyalty cards and reserved coupons. Reserved coupons also include redeemed coupons.
# @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](https://docs.talon.one/integration-api#operation/updateCustomerSessionV2) endpoint. - The Management API with the [List application's customers](https://docs.talon.one/management-api#operation/getApplicationCustomers) endpoint.
# @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.
# @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?
# 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 the details of the given customer session. You can get the same data via other endpoints that also apply changes, which can help you save requests and increase performance. See: - [Update customer session](#tag/Customer-sessions/operation/updateCustomerSessionV2) - [Update customer profile](#tag/Customer-profiles/operation/updateCustomerProfileV2)
# @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](https://docs.talon.one/management-api#operation/getApplicationSessions) endpoint.
# @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 the details of the given customer session. You can get the same data via other endpoints that also apply changes, which can help you save requests and increase performance. See: - [Update customer session](#tag/Customer-sessions/operation/updateCustomerSessionV2) - [Update customer profile](#tag/Customer-profiles/operation/updateCustomerProfileV2)
# @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](https://docs.talon.one/management-api#operation/getApplicationSessions) endpoint.
# @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
# Get customer's loyalty points
# Retrieve loyalty ledger balances for the given Integration ID in the specified loyalty program. You can filter balances by date. If no filtering options are applied, you retrieve all loyalty balances on the current date for the given integration ID. Loyalty balances are calculated when Talon.One receives your request using the points stored in our database, so retrieving a large number of balances at once can impact performance. **Note:** For more information, see [our documentation on managing loyalty data](https://docs.talon.one/docs/product/loyalty-programs/managing-loyalty-data#obtaining-the-loyalty-balances-of-a-customer).
# @param loyalty_program_id [Integer] Identifier of the card-based loyalty program containing the loyalty card. You can get the ID with the [List loyalty programs](https://docs.talon.one/management-api#tag/Loyalty/operation/getLoyaltyPrograms) endpoint.
# @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 [Hash] opts the optional parameters
# @option opts [DateTime] :end_date Used to return balances only for entries older than this timestamp. The expired, active, and pending points are relative to this timestamp. **Note:** It must be an RFC3339 timestamp string.
# @return [LoyaltyBalances]
def get_loyalty_balances(loyalty_program_id, integration_id, opts = {})
data, _status_code, _headers = get_loyalty_balances_with_http_info(loyalty_program_id, integration_id, opts)
data
end
# Get customer's loyalty points
# Retrieve loyalty ledger balances for the given Integration ID in the specified loyalty program. You can filter balances by date. If no filtering options are applied, you retrieve all loyalty balances on the current date for the given integration ID. Loyalty balances are calculated when Talon.One receives your request using the points stored in our database, so retrieving a large number of balances at once can impact performance. **Note:** For more information, see [our documentation on managing loyalty data](https://docs.talon.one/docs/product/loyalty-programs/managing-loyalty-data#obtaining-the-loyalty-balances-of-a-customer).
# @param loyalty_program_id [Integer] Identifier of the card-based loyalty program containing the loyalty card. You can get the ID with the [List loyalty programs](https://docs.talon.one/management-api#tag/Loyalty/operation/getLoyaltyPrograms) endpoint.
# @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 [Hash] opts the optional parameters
# @option opts [DateTime] :end_date Used to return balances only for entries older than this timestamp. The expired, active, and pending points are relative to this timestamp. **Note:** It must be an RFC3339 timestamp string.
# @return [Array<(LoyaltyBalances, Integer, Hash)>] LoyaltyBalances data, response status code and response headers
def get_loyalty_balances_with_http_info(loyalty_program_id, integration_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: IntegrationApi.get_loyalty_balances ...'
end
# verify the required parameter 'loyalty_program_id' is set
if @api_client.config.client_side_validation && loyalty_program_id.nil?
fail ArgumentError, "Missing the required parameter 'loyalty_program_id' when calling IntegrationApi.get_loyalty_balances"
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_loyalty_balances"
end
# resource path
local_var_path = '/v1/loyalty_programs/{loyaltyProgramId}/profile/{integrationId}/balances'.sub('{' + 'loyaltyProgramId' + '}', CGI.escape(loyalty_program_id.to_s)).sub('{' + 'integrationId' + '}', CGI.escape(integration_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'endDate'] = opts[:'end_date'] if !opts[:'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] || 'LoyaltyBalances'
# 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_loyalty_balances\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get loyalty balances for a loyalty card
# Retrieve loyalty balances for the given loyalty card in the specified loyalty program with filtering options applied. If no filtering options are applied, all loyalty balances for the given loyalty card are returned.
# @param loyalty_program_id [Integer] Identifier of the card-based loyalty program containing the loyalty card. You can get the ID with the [List loyalty programs](https://docs.talon.one/management-api#tag/Loyalty/operation/getLoyaltyPrograms) endpoint.
# @param loyalty_card_identifier [String] Identifier of the loyalty card. You can get the identifier with the [List loyalty cards](https://docs.talon.one/management-api#tag/Loyalty-cards/operation/getLoyaltyCards) endpoint.
# @param [Hash] opts the optional parameters
# @option opts [DateTime] :end_date Used to return balances only for entries older than this timestamp. The expired, active, and pending points are relative to this timestamp. **Note:** It must be an RFC3339 timestamp string.
# @return [LoyaltyBalances]
def get_loyalty_card_balances(loyalty_program_id, loyalty_card_identifier, opts = {})
data, _status_code, _headers = get_loyalty_card_balances_with_http_info(loyalty_program_id, loyalty_card_identifier, opts)
data
end
# Get loyalty balances for a loyalty card
# Retrieve loyalty balances for the given loyalty card in the specified loyalty program with filtering options applied. If no filtering options are applied, all loyalty balances for the given loyalty card are returned.
# @param loyalty_program_id [Integer] Identifier of the card-based loyalty program containing the loyalty card. You can get the ID with the [List loyalty programs](https://docs.talon.one/management-api#tag/Loyalty/operation/getLoyaltyPrograms) endpoint.
# @param loyalty_card_identifier [String] Identifier of the loyalty card. You can get the identifier with the [List loyalty cards](https://docs.talon.one/management-api#tag/Loyalty-cards/operation/getLoyaltyCards) endpoint.
# @param [Hash] opts the optional parameters
# @option opts [DateTime] :end_date Used to return balances only for entries older than this timestamp. The expired, active, and pending points are relative to this timestamp. **Note:** It must be an RFC3339 timestamp string.
# @return [Array<(LoyaltyBalances, Integer, Hash)>] LoyaltyBalances data, response status code and response headers
def get_loyalty_card_balances_with_http_info(loyalty_program_id, loyalty_card_identifier, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: IntegrationApi.get_loyalty_card_balances ...'
end
# verify the required parameter 'loyalty_program_id' is set
if @api_client.config.client_side_validation && loyalty_program_id.nil?
fail ArgumentError, "Missing the required parameter 'loyalty_program_id' when calling IntegrationApi.get_loyalty_card_balances"
end
# verify the required parameter 'loyalty_card_identifier' is set
if @api_client.config.client_side_validation && loyalty_card_identifier.nil?
fail ArgumentError, "Missing the required parameter 'loyalty_card_identifier' when calling IntegrationApi.get_loyalty_card_balances"
end
if @api_client.config.client_side_validation && loyalty_card_identifier.to_s.length > 108
fail ArgumentError, 'invalid value for "loyalty_card_identifier" when calling IntegrationApi.get_loyalty_card_balances, the character length must be smaller than or equal to 108.'
end
# resource path
local_var_path = '/v1/loyalty_programs/{loyaltyProgramId}/cards/{loyaltyCardIdentifier}/balances'.sub('{' + 'loyaltyProgramId' + '}', CGI.escape(loyalty_program_id.to_s)).sub('{' + 'loyaltyCardIdentifier' + '}', CGI.escape(loyalty_card_identifier.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'endDate'] = opts[:'end_date'] if !opts[:'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] || 'LoyaltyBalances'
# 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_loyalty_card_balances\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get loyalty card transaction logs
# Retrieve loyalty transaction logs for the given loyalty card in the specified loyalty program with filtering options applied. If no filtering options are applied, the last 50 loyalty transactions for the given loyalty card are returned.
# @param loyalty_program_id [Integer] Identifier of the card-based loyalty program containing the loyalty card. You can get the ID with the [List loyalty programs](https://docs.talon.one/management-api#tag/Loyalty/operation/getLoyaltyPrograms) endpoint.
# @param loyalty_card_identifier [String] Identifier of the loyalty card. You can get the identifier with the [List loyalty cards](https://docs.talon.one/management-api#tag/Loyalty-cards/operation/getLoyaltyCards) endpoint.
# @param [Hash] opts the optional parameters
# @option opts [String] :subledger_id The ID of the subledger by which we filter the data.
# @option opts [DateTime] :start_date Date and time from which results are returned. Results are filtered by transaction creation date. **Note:** It must be an RFC3339 timestamp string.
# @option opts [DateTime] :end_date Date and time by which results are returned. Results are filtered by transaction creation date. **Note:** It must be an RFC3339 timestamp string.
# @option opts [Integer] :page_size The number of items in this response. (default to 1000)
# @option opts [Integer] :skip Skips the given number of items when paging through large result sets.
# @return [CardLedgerTransactionLogEntryIntegrationAPI]
def get_loyalty_card_transactions(loyalty_program_id, loyalty_card_identifier, opts = {})
data, _status_code, _headers = get_loyalty_card_transactions_with_http_info(loyalty_program_id, loyalty_card_identifier, opts)
data
end
# Get loyalty card transaction logs
# Retrieve loyalty transaction logs for the given loyalty card in the specified loyalty program with filtering options applied. If no filtering options are applied, the last 50 loyalty transactions for the given loyalty card are returned.
# @param loyalty_program_id [Integer] Identifier of the card-based loyalty program containing the loyalty card. You can get the ID with the [List loyalty programs](https://docs.talon.one/management-api#tag/Loyalty/operation/getLoyaltyPrograms) endpoint.
# @param loyalty_card_identifier [String] Identifier of the loyalty card. You can get the identifier with the [List loyalty cards](https://docs.talon.one/management-api#tag/Loyalty-cards/operation/getLoyaltyCards) endpoint.
# @param [Hash] opts the optional parameters
# @option opts [String] :subledger_id The ID of the subledger by which we filter the data.
# @option opts [DateTime] :start_date Date and time from which results are returned. Results are filtered by transaction creation date. **Note:** It must be an RFC3339 timestamp string.
# @option opts [DateTime] :end_date Date and time by which results are returned. Results are filtered by transaction creation date. **Note:** It must be an RFC3339 timestamp string.
# @option opts [Integer] :page_size The number of items in this response.
# @option opts [Integer] :skip Skips the given number of items when paging through large result sets.
# @return [Array<(CardLedgerTransactionLogEntryIntegrationAPI, Integer, Hash)>] CardLedgerTransactionLogEntryIntegrationAPI data, response status code and response headers
def get_loyalty_card_transactions_with_http_info(loyalty_program_id, loyalty_card_identifier, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: IntegrationApi.get_loyalty_card_transactions ...'
end
# verify the required parameter 'loyalty_program_id' is set
if @api_client.config.client_side_validation && loyalty_program_id.nil?
fail ArgumentError, "Missing the required parameter 'loyalty_program_id' when calling IntegrationApi.get_loyalty_card_transactions"
end
# verify the required parameter 'loyalty_card_identifier' is set
if @api_client.config.client_side_validation && loyalty_card_identifier.nil?
fail ArgumentError, "Missing the required parameter 'loyalty_card_identifier' when calling IntegrationApi.get_loyalty_card_transactions"
end
if @api_client.config.client_side_validation && loyalty_card_identifier.to_s.length > 108
fail ArgumentError, 'invalid value for "loyalty_card_identifier" when calling IntegrationApi.get_loyalty_card_transactions, the character length must be smaller than or equal to 108.'
end
if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000
fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling IntegrationApi.get_loyalty_card_transactions, must be smaller than or equal to 1000.'
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 IntegrationApi.get_loyalty_card_transactions, must be greater than or equal to 1.'
end
# resource path
local_var_path = '/v1/loyalty_programs/{loyaltyProgramId}/cards/{loyaltyCardIdentifier}/transactions'.sub('{' + 'loyaltyProgramId' + '}', CGI.escape(loyalty_program_id.to_s)).sub('{' + 'loyaltyCardIdentifier' + '}', CGI.escape(loyalty_card_identifier.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'subledgerId'] = opts[:'subledger_id'] if !opts[:'subledger_id'].nil?
query_params[:'startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil?
query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil?
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].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] || 'CardLedgerTransactionLogEntryIntegrationAPI'
# 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_loyalty_card_transactions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List customer's loyalty transactions
# Retrieve paginated results of loyalty transaction logs for the given Integration ID in the specified loyalty program. You can filter transactions by date. If no filters are applied, the last 50 loyalty transactions for the given integration ID are returned. **Note:** To retrieve all loyalty program transaction logs in a given loyalty program, use the [List loyalty program transactions](https://docs.talon.one/management-api#tag/Loyalty/operation/getLoyaltyProgramTransactions) endpoint.
# @param loyalty_program_id [Integer] Identifier of the card-based loyalty program containing the loyalty card. You can get the ID with the [List loyalty programs](https://docs.talon.one/management-api#tag/Loyalty/operation/getLoyaltyPrograms) endpoint.
# @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 [Hash] opts the optional parameters
# @option opts [String] :subledger_id The ID of the subledger by which we filter the data.
# @option opts [DateTime] :start_date Date and time from which results are returned. Results are filtered by transaction creation date. **Note:** It must be an RFC3339 timestamp string.
# @option opts [DateTime] :end_date Date and time by which results are returned. Results are filtered by transaction creation date. **Note:** It must be an RFC3339 timestamp string.
# @option opts [Integer] :page_size The number of items in this response. (default to 50)
# @option opts [Integer] :skip Skips the given number of items when paging through large result sets.
# @return [InlineResponse2001]
def get_loyalty_program_profile_transactions(loyalty_program_id, integration_id, opts = {})
data, _status_code, _headers = get_loyalty_program_profile_transactions_with_http_info(loyalty_program_id, integration_id, opts)
data
end
# List customer's loyalty transactions
# Retrieve paginated results of loyalty transaction logs for the given Integration ID in the specified loyalty program. You can filter transactions by date. If no filters are applied, the last 50 loyalty transactions for the given integration ID are returned. **Note:** To retrieve all loyalty program transaction logs in a given loyalty program, use the [List loyalty program transactions](https://docs.talon.one/management-api#tag/Loyalty/operation/getLoyaltyProgramTransactions) endpoint.
# @param loyalty_program_id [Integer] Identifier of the card-based loyalty program containing the loyalty card. You can get the ID with the [List loyalty programs](https://docs.talon.one/management-api#tag/Loyalty/operation/getLoyaltyPrograms) endpoint.
# @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 [Hash] opts the optional parameters
# @option opts [String] :subledger_id The ID of the subledger by which we filter the data.
# @option opts [DateTime] :start_date Date and time from which results are returned. Results are filtered by transaction creation date. **Note:** It must be an RFC3339 timestamp string.
# @option opts [DateTime] :end_date Date and time by which results are returned. Results are filtered by transaction creation date. **Note:** It must be an RFC3339 timestamp string.
# @option opts [Integer] :page_size The number of items in this response.
# @option opts [Integer] :skip Skips the given number of items when paging through large result sets.
# @return [Array<(InlineResponse2001, Integer, Hash)>] InlineResponse2001 data, response status code and response headers
def get_loyalty_program_profile_transactions_with_http_info(loyalty_program_id, integration_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: IntegrationApi.get_loyalty_program_profile_transactions ...'
end
# verify the required parameter 'loyalty_program_id' is set
if @api_client.config.client_side_validation && loyalty_program_id.nil?
fail ArgumentError, "Missing the required parameter 'loyalty_program_id' when calling IntegrationApi.get_loyalty_program_profile_transactions"
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_loyalty_program_profile_transactions"
end
if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 50
fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling IntegrationApi.get_loyalty_program_profile_transactions, must be smaller than or equal to 50.'
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 IntegrationApi.get_loyalty_program_profile_transactions, must be greater than or equal to 1.'
end
# resource path
local_var_path = '/v1/loyalty_programs/{loyaltyProgramId}/profile/{integrationId}/transactions'.sub('{' + 'loyaltyProgramId' + '}', CGI.escape(loyalty_program_id.to_s)).sub('{' + 'integrationId' + '}', CGI.escape(integration_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'subledgerId'] = opts[:'subledger_id'] if !opts[:'subledger_id'].nil?
query_params[:'startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil?
query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil?
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].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] || 'InlineResponse2001'
# 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_loyalty_program_profile_transactions\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](https://docs.talon.one/management-api#operation/createCoupons) or [Create coupons for multiple recipients](https://docs.talon.one/management-api#operation/createCouponsForMultipleRecipients) endpoints.
# @param coupon_value [String] The code of the 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](https://docs.talon.one/management-api#operation/createCoupons) or [Create coupons for multiple recipients](https://docs.talon.one/management-api#operation/createCouponsForMultipleRecipients) endpoints.
# @param coupon_value [String] The code of the 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
# Link customer profile to loyalty card
# [Loyalty cards](https://docs.talon.one/docs/product/loyalty-programs/loyalty-cards/loyalty-card-overview) allow customers to collect and spend loyalty points within a [card-based loyalty program](https://docs.talon.one/docs/product/loyalty-programs/overview#loyalty-program-types). They are useful to gamify loyalty programs and can be used with or without customer profiles linked to them. Link a customer profile to a given loyalty card for the card to be set as **Registered**. This affects how it can be used. See the [docs](https://docs.talon.one/docs/product/loyalty-programs/loyalty-cards/managing-loyalty-cards#linking-customer-profiles-to-a-loyalty-card). **Note:** You can link as many customer profiles to a given loyalty card as the [**card user limit**](https://docs.talon.one/docs/product/loyalty-programs/creating-loyalty-programs#creating-card-based-loyalty-programs) allows.
# @param loyalty_program_id [Integer] Identifier of the card-based loyalty program containing the loyalty card. You can get the ID with the [List loyalty programs](https://docs.talon.one/management-api#tag/Loyalty/operation/getLoyaltyPrograms) endpoint.
# @param loyalty_card_identifier [String] Identifier of the loyalty card. You can get the identifier with the [List loyalty cards](https://docs.talon.one/management-api#tag/Loyalty-cards/operation/getLoyaltyCards) endpoint.
# @param body [LoyaltyCardRegistration] body
# @param [Hash] opts the optional parameters
# @return [LoyaltyCard]
def link_loyalty_card_to_profile(loyalty_program_id, loyalty_card_identifier, body, opts = {})
data, _status_code, _headers = link_loyalty_card_to_profile_with_http_info(loyalty_program_id, loyalty_card_identifier, body, opts)
data
end
# Link customer profile to loyalty card
# [Loyalty cards](https://docs.talon.one/docs/product/loyalty-programs/loyalty-cards/loyalty-card-overview) allow customers to collect and spend loyalty points within a [card-based loyalty program](https://docs.talon.one/docs/product/loyalty-programs/overview#loyalty-program-types). They are useful to gamify loyalty programs and can be used with or without customer profiles linked to them. Link a customer profile to a given loyalty card for the card to be set as **Registered**. This affects how it can be used. See the [docs](https://docs.talon.one/docs/product/loyalty-programs/loyalty-cards/managing-loyalty-cards#linking-customer-profiles-to-a-loyalty-card). **Note:** You can link as many customer profiles to a given loyalty card as the [**card user limit**](https://docs.talon.one/docs/product/loyalty-programs/creating-loyalty-programs#creating-card-based-loyalty-programs) allows.
# @param loyalty_program_id [Integer] Identifier of the card-based loyalty program containing the loyalty card. You can get the ID with the [List loyalty programs](https://docs.talon.one/management-api#tag/Loyalty/operation/getLoyaltyPrograms) endpoint.
# @param loyalty_card_identifier [String] Identifier of the loyalty card. You can get the identifier with the [List loyalty cards](https://docs.talon.one/management-api#tag/Loyalty-cards/operation/getLoyaltyCards) endpoint.
# @param body [LoyaltyCardRegistration] body
# @param [Hash] opts the optional parameters
# @return [Array<(LoyaltyCard, Integer, Hash)>] LoyaltyCard data, response status code and response headers
def link_loyalty_card_to_profile_with_http_info(loyalty_program_id, loyalty_card_identifier, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: IntegrationApi.link_loyalty_card_to_profile ...'
end
# verify the required parameter 'loyalty_program_id' is set
if @api_client.config.client_side_validation && loyalty_program_id.nil?
fail ArgumentError, "Missing the required parameter 'loyalty_program_id' when calling IntegrationApi.link_loyalty_card_to_profile"
end
# verify the required parameter 'loyalty_card_identifier' is set
if @api_client.config.client_side_validation && loyalty_card_identifier.nil?
fail ArgumentError, "Missing the required parameter 'loyalty_card_identifier' when calling IntegrationApi.link_loyalty_card_to_profile"
end
if @api_client.config.client_side_validation && loyalty_card_identifier.to_s.length > 108
fail ArgumentError, 'invalid value for "loyalty_card_identifier" when calling IntegrationApi.link_loyalty_card_to_profile, the character length must be smaller than or equal to 108.'
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.link_loyalty_card_to_profile"
end
# resource path
local_var_path = '/v2/loyalty_programs/{loyaltyProgramId}/cards/{loyaltyCardIdentifier}/link_profile'.sub('{' + 'loyaltyProgramId' + '}', CGI.escape(loyalty_program_id.to_s)).sub('{' + 'loyaltyCardIdentifier' + '}', CGI.escape(loyalty_card_identifier.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] || 'LoyaltyCard'
# 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#link_loyalty_card_to_profile\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Reopen customer session
# Reopen a closed [customer session](https://docs.talon.one/docs/dev/concepts/entities#customer-session). For example, if a session has been completed but still needs to be edited, you can reopen it with this endpoint. A reopen session is treated like a standard open session. When reopening a session: - The `talon_session_reopened` event is triggered. You can see it in the **Events** view in the Campaign Manager. - The session state is updated to `open`. - Modified budgets and triggered effects when the session was closed are rolled back except for the list below. Effects and budgets unimpacted by a session reopening
The following effects and budgets are left the way they were once the session was originally closed:
- Add free item effect
- Any not pending pending loyalty points.
- Award giveaway
- Coupon and referral creation
- Coupon reservation
- Custom effect
- Update attribute value
- Update cart item attribute value
To see an example of roll back, see the Cancelling a session with campaign budgets tutorial.
**Note:** If your order workflow requires you to create a new session instead of reopening a session, use the [Update customer session](https://docs.talon.one/integration-api#tag/Customer-sessions/operation/updateCustomerSessionV2) endpoint to cancel a closed session and create a new 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](https://docs.talon.one/management-api#operation/getApplicationSessions) endpoint.
# @param [Hash] opts the optional parameters
# @return [IntegrationStateV2]
def reopen_customer_session(customer_session_id, opts = {})
data, _status_code, _headers = reopen_customer_session_with_http_info(customer_session_id, opts)
data
end
# Reopen customer session
# Reopen a closed [customer session](https://docs.talon.one/docs/dev/concepts/entities#customer-session). For example, if a session has been completed but still needs to be edited, you can reopen it with this endpoint. A reopen session is treated like a standard open session. When reopening a session: - The `talon_session_reopened` event is triggered. You can see it in the **Events** view in the Campaign Manager. - The session state is updated to `open`. - Modified budgets and triggered effects when the session was closed are rolled back except for the list below. <details> <summary><strong>Effects and budgets unimpacted by a session reopening</strong></summary> <div> <p>The following effects and budgets are left the way they were once the session was originally closed:</p> <ul> <li>Add free item effect</li> <li>Any <strong>not pending</strong> pending loyalty points.</li> <li>Award giveaway</li> <li>Coupon and referral creation</li> <li>Coupon reservation</li> <li>Custom effect</li> <li>Update attribute value</li> <li>Update cart item attribute value</li> </ul> </div> <p>To see an example of roll back, see the <a href=\"https://docs.talon.one/docs/dev/tutorials/rolling-back-effects\">Cancelling a session with campaign budgets tutorial</a>.</p> </details> **Note:** If your order workflow requires you to create a new session instead of reopening a session, use the [Update customer session](https://docs.talon.one/integration-api#tag/Customer-sessions/operation/updateCustomerSessionV2) endpoint to cancel a closed session and create a new 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](https://docs.talon.one/management-api#operation/getApplicationSessions) endpoint.
# @param [Hash] opts the optional parameters
# @return [Array<(IntegrationStateV2, Integer, Hash)>] IntegrationStateV2 data, response status code and response headers
def reopen_customer_session_with_http_info(customer_session_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: IntegrationApi.reopen_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.reopen_customer_session"
end
# resource path
local_var_path = '/v2/customer_sessions/{customerSessionId}/reopen'.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] || '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#reopen_customer_session\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#flattening) is enabled for the Application. **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](https://docs.talon.one/management-api#operation/getApplicationSessions) endpoint.
# @param body [ReturnIntegrationRequest] body
# @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#flattening) is enabled for the Application. **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](https://docs.talon.one/management-api#operation/getApplicationSessions) endpoint.
# @param body [ReturnIntegrationRequest] body
# @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
# Sync cart item catalog
# Perform one or more of the following sync actions on this cart item catalog, up to 1000 actions: - Add an item to the catalog. - Edit the attributes of an item in the catalog. - Edit the attributes of more than one item in the catalog. - Remove an item from the catalog. - Remove more than one item from the catalog. **Note:** For more information, see [our documentation on managing cart item catalogs](https://docs.talon.one/docs/product/account/dev-tools/managing-cart-item-catalogs). ### Filtering cart items Use [cart item attributes](https://docs.talon.one/docs/product/account/dev-tools/managing-cart-item-catalogs#displaying-the-details-and-content-of-a-catalog) to filter items and select the ones you want to edit or delete when editing or deleting more than one item at a time. The `filters` array contains an object with the following properties: - `attr`: A [cart item attribute](https://docs.talon.one/docs/product/account/dev-tools/managing-attributes) connected to the catalog. It is applied to all items in the catalog. - `op`: The filtering operator indicating the relationship between the value of each cart item in the catalog and the value of the `value` property for the attribute selected in `attr`. The value of `op` can be one of the following: - `EQ`: Equal to `value` - `LT`: Less than `value` - `LE`: Less than or equal to `value` - `GT`: Greater than `value` - `GE`: Greater than or equal to `value` - `IN`: One of the comma-separated values that `value` is set to. **Note:** `GE`, `LE`, `GT`, `LT` are for numeric values only. - `value`: The value of the attribute selected in `attr`. ### Payload examples Synchronization actions are sent as `PUT` requests. See the structure for each action: Adding an item to the catalog
```json { \"actions\": [ { \"payload\": { \"attributes\": { \"color\": \"Navy blue\", \"type\": \"shoe\" }, \"replaceIfExists\": true, \"sku\": \"SKU1241028\", \"price\": 100 }, \"type\": \"ADD\" } ] } ```
Editing the attributes of an item in the catalog
```json { \"actions\": [ { \"payload\": { \"attributes\": { \"age\": 11, \"origin\": \"germany\" }, \"createIfNotExists\": false, \"sku\": \"SKU1241028\" }, \"type\": \"PATCH\" } ] } ```
Editing the attributes of several items at once
```json { \"actions\": [ { \"payload\": { \"attributes\": { \"color\": \"red\" }, \"filters\": [ { \"attr\": \"color\", \"op\": \"EQ\", \"value\": \"blue\" } ] }, \"type\": \"PATCH_MANY\" } ] } ```
Removing an item from the catalog
```json { \"actions\": [ { \"payload\": { \"sku\": \"SKU1241028\" }, \"type\": \"REMOVE\" } ] } ```
Removing several items from the catalog at once
```json { \"actions\": [ { \"payload\": { \"filters\": [ { \"attr\": \"color\", \"op\": \"EQ\", \"value\": \"blue\" } ] }, \"type\": \"REMOVE_MANY\" } ] } ```
Removing shoes of sizes above 45 from the catalog
Let's imagine that we have a shoe store and we have decided to stop selling shoes larger than size 45. We can remove from the catalog all the shoes of sizes above 45 with a single action:
```json { \"actions\": [ { \"payload\": { \"filters\": [ { \"attr\": \"size\", \"op\": \"GT\", \"value\": \"45\" } ] }, \"type\": \"REMOVE_MANY\" } ] } ```
# @param catalog_id [Integer] The ID of the catalog. You can find the ID in the Campaign Manager in **Account** > **Tools** > **Cart item catalogs**.
# @param body [CatalogSyncRequest] body
# @param [Hash] opts the optional parameters
# @return [Catalog]
def sync_catalog(catalog_id, body, opts = {})
data, _status_code, _headers = sync_catalog_with_http_info(catalog_id, body, opts)
data
end
# Sync cart item catalog
# Perform one or more of the following sync actions on this cart item catalog, up to 1000 actions: - Add an item to the catalog. - Edit the attributes of an item in the catalog. - Edit the attributes of more than one item in the catalog. - Remove an item from the catalog. - Remove more than one item from the catalog. **Note:** For more information, see [our documentation on managing cart item catalogs](https://docs.talon.one/docs/product/account/dev-tools/managing-cart-item-catalogs). ### Filtering cart items Use [cart item attributes](https://docs.talon.one/docs/product/account/dev-tools/managing-cart-item-catalogs#displaying-the-details-and-content-of-a-catalog) to filter items and select the ones you want to edit or delete when editing or deleting more than one item at a time. The `filters` array contains an object with the following properties: - `attr`: A [cart item attribute](https://docs.talon.one/docs/product/account/dev-tools/managing-attributes) connected to the catalog. It is applied to all items in the catalog. - `op`: The filtering operator indicating the relationship between the value of each cart item in the catalog and the value of the `value` property for the attribute selected in `attr`. The value of `op` can be one of the following: - `EQ`: Equal to `value` - `LT`: Less than `value` - `LE`: Less than or equal to `value` - `GT`: Greater than `value` - `GE`: Greater than or equal to `value` - `IN`: One of the comma-separated values that `value` is set to. **Note:** `GE`, `LE`, `GT`, `LT` are for numeric values only. - `value`: The value of the attribute selected in `attr`. ### Payload examples Synchronization actions are sent as `PUT` requests. See the structure for each action: <details> <summary><strong>Adding an item to the catalog</strong></summary> <div> ```json { \"actions\": [ { \"payload\": { \"attributes\": { \"color\": \"Navy blue\", \"type\": \"shoe\" }, \"replaceIfExists\": true, \"sku\": \"SKU1241028\", \"price\": 100 }, \"type\": \"ADD\" } ] } ``` </div> </details> <details> <summary><strong>Editing the attributes of an item in the catalog</strong></summary> <div> ```json { \"actions\": [ { \"payload\": { \"attributes\": { \"age\": 11, \"origin\": \"germany\" }, \"createIfNotExists\": false, \"sku\": \"SKU1241028\" }, \"type\": \"PATCH\" } ] } ``` </div> </details> <details> <summary><strong>Editing the attributes of several items at once</strong></summary> <div> ```json { \"actions\": [ { \"payload\": { \"attributes\": { \"color\": \"red\" }, \"filters\": [ { \"attr\": \"color\", \"op\": \"EQ\", \"value\": \"blue\" } ] }, \"type\": \"PATCH_MANY\" } ] } ``` </div> </details> <details> <summary><strong>Removing an item from the catalog</strong></summary> <div> ```json { \"actions\": [ { \"payload\": { \"sku\": \"SKU1241028\" }, \"type\": \"REMOVE\" } ] } ``` </div> </details> <details> <summary><strong>Removing several items from the catalog at once</strong></summary> <div> ```json { \"actions\": [ { \"payload\": { \"filters\": [ { \"attr\": \"color\", \"op\": \"EQ\", \"value\": \"blue\" } ] }, \"type\": \"REMOVE_MANY\" } ] } ``` </div> </details> <details> <summary><strong>Removing shoes of sizes above 45 from the catalog</strong></summary> <div> <p> Let's imagine that we have a shoe store and we have decided to stop selling shoes larger than size 45. We can remove from the catalog all the shoes of sizes above 45 with a single action:</p> ```json { \"actions\": [ { \"payload\": { \"filters\": [ { \"attr\": \"size\", \"op\": \"GT\", \"value\": \"45\" } ] }, \"type\": \"REMOVE_MANY\" } ] } ``` </div> </details>
# @param catalog_id [Integer] The ID of the catalog. You can find the ID in the Campaign Manager in **Account** > **Tools** > **Cart item catalogs**.
# @param body [CatalogSyncRequest] body
# @param [Hash] opts the optional parameters
# @return [Array<(Catalog, Integer, Hash)>] Catalog data, response status code and response headers
def sync_catalog_with_http_info(catalog_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: IntegrationApi.sync_catalog ...'
end
# verify the required parameter 'catalog_id' is set
if @api_client.config.client_side_validation && catalog_id.nil?
fail ArgumentError, "Missing the required parameter 'catalog_id' when calling IntegrationApi.sync_catalog"
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.sync_catalog"
end
# resource path
local_var_path = '/v1/catalogs/{catalogId}/sync'.sub('{' + 'catalogId' + '}', CGI.escape(catalog_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] || 'Catalog'
# 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#sync_catalog\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Track event
# Triggers a custom event in a customer session. You can then check this event in your rules. Before using this endpoint, create your event as a custom attribute of type `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] body
# @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
# <div class=\"redoc-section\"> <p class=\"title\">Deprecation warning</p> <p>This endpoint is DEPRECATED and will be sunset on March 31st 2023. Use <a href=\"https://docs.talon.one/integration-api#tag/Events/operation/trackEventV2\">Track Event V2</a> instead.</p> <p>See <a href=\"https://docs.talon.one/docs/dev/tutorials/migrating-to-v2\">Migrating to V2</a>.</p> </div> Triggers a custom event in a customer session. You can then check this event in your rules. Before using this endpoint, create your event as a custom attribute of type `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] body
# @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 build a condition around this event in your rules. Talon.One offers a set of [built-in events](https://docs.talon.one/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 customer shares a link to a product. See the [tutorial](https://docs.talon.one/docs/product/tutorials/referrals/incentivizing-product-link-sharing). **Important:** - `profileId` is required. An event V2 is associated with a customer profile. - Before using this endpoint, create your event as a custom attribute of type `event`. See the [Developer docs](https://docs.talon.one/docs/dev/concepts/events#creating-a-custom-event). When you successfully sent an event to Talon.One, you can list received events in the **Events** view in the Campaign Manager.
# @param body [IntegrationEventV2Request] body
# @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 the updated customer profiles. (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 build a condition around this event in your rules. Talon.One offers a set of [built-in events](https://docs.talon.one/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 customer shares a link to a product. See the [tutorial](https://docs.talon.one/docs/product/tutorials/referrals/incentivizing-product-link-sharing). **Important:** - `profileId` is required. An event V2 is associated with a customer profile. - Before using this endpoint, create your event as a custom attribute of type `event`. See the [Developer docs](https://docs.talon.one/docs/dev/concepts/events#creating-a-custom-event). When you successfully sent an event to Talon.One, you can list received events in the **Events** view in the Campaign Manager.
# @param body [IntegrationEventV2Request] body
# @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 the updated customer profiles.
# @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] body
# @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] body
# @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 name
# Update the name of the given audience created by a third-party integration. Sending a request to this endpoint does **not** trigger the rule engine. To update the audience's members, use the [Update customer profile](#tag/Customer-profiles/operation/updateCustomerProfileV2) endpoint.
# @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] body
# @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 name
# Update the name of the given audience created by a third-party integration. Sending a request to this endpoint does **not** trigger the rule engine. To update the audience's members, use the [Update customer profile](#tag/Customer-profiles/operation/updateCustomerProfileV2) endpoint.
# @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] body
# @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] body
# @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] body
# @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](https://docs.talon.one/docs/dev/concepts/entities#customer-profile). This endpoint triggers the Rule Builder. You can use this endpoint to: - Set attributes on the given customer profile. Ensure you create the attributes in the Campaign Manager, first. - Modify the audience the customer profile is a member of. 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.
# @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] body
# @param [Hash] opts the optional parameters
# @option opts [Boolean] :run_rule_engine Indicates whether to run the Rule Engine. If `true`, the response includes: - The effects generated by the triggered campaigns are returned in the `effects` property. - The created coupons and referral objects. If `false`: - The rules are not executed and the `effects` property is always empty. - The response time improves. - You cannot use `responseContent` in the body. (default to false)
# @option opts [Boolean] :dry (Only works when `runRuleEngine=true`) Indicates whether to persist the changes. Changes are ignored when `dry=true`. When set to `true`, you can use the `evaluableCampaignIds` body property to select specific campaigns to run.
# @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](https://docs.talon.one/docs/dev/concepts/entities#customer-profile). This endpoint triggers the Rule Builder. You can use this endpoint to: - Set attributes on the given customer profile. Ensure you create the attributes in the Campaign Manager, first. - Modify the audience the customer profile is a member of. <div class=\"redoc-section\"> <p class=\"title\">Performance tips</p> 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. </div>
# @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] body
# @param [Hash] opts the optional parameters
# @option opts [Boolean] :run_rule_engine Indicates whether to run the Rule Engine. If `true`, the response includes: - The effects generated by the triggered campaigns are returned in the `effects` property. - The created coupons and referral objects. If `false`: - The rules are not executed and the `effects` property is always empty. - The response time improves. - You cannot use `responseContent` in the body.
# @option opts [Boolean] :dry (Only works when `runRuleEngine=true`) Indicates whether to persist the changes. Changes are ignored when `dry=true`. When set to `true`, you can use the `evaluableCampaignIds` body property to select specific campaigns to run.
# @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](https://docs.talon.one/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](https://docs.talon.one/integration-api#tag/Customer-sessions).
# @param body [MultipleCustomerProfileIntegrationRequest] body
# @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 the updated customer profiles. (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](https://docs.talon.one/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](https://docs.talon.one/integration-api#tag/Customer-sessions).
# @param body [MultipleCustomerProfileIntegrationRequest] body
# @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 the updated customer profiles.
# @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](https://docs.talon.one/docs/dev/concepts/entities#customer-session). The endpoint responds with the potential promotion rule [effects](https://docs.talon.one/docs/dev/integration-api/api-effects) that match the current cart. For example, use this endpoint to share the contents of a customer's cart with Talon.One. **Note:** The currency for the session and the cart items in the session is the currency set for the Application that owns this session. ### Session management To use this endpoint, start by learning about [customer sessions](https://docs.talon.one/docs/dev/concepts/entities#customer-session) and their states and refer to the `state` parameter documentation the request body schema docs below. ### 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. - A profile can be linked to simultaneous sessions in different Applications. Either: - Use unique session integration IDs or, - Use the same session integration ID across all of the Applications. **Note:** If the specified profile does not exist, an empty profile is **created automatically**. You can update it with [Update customer profile](https://docs.talon.one/integration-api#tag/Customer-profiles/operation/updateCustomerProfileV2). Performance tips
Updating a customer session returns a response with the new integration state. 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 introductory video in [Getting started](https://docs.talon.one/docs/dev/getting-started/overview). - 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](https://docs.talon.one/management-api#operation/getApplicationSessions) endpoint.
# @param body [IntegrationRequest] body
# @param [Hash] opts the optional parameters
# @option opts [Boolean] :dry Indicates whether to persist the changes. Changes are ignored when `dry=true`. When set to `true`, you can use the `evaluableCampaignIds` body property to select specific campaigns to run.
# @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](https://docs.talon.one/docs/dev/concepts/entities#customer-session). The endpoint responds with the potential promotion rule [effects](https://docs.talon.one/docs/dev/integration-api/api-effects) that match the current cart. For example, use this endpoint to share the contents of a customer's cart with Talon.One. **Note:** The currency for the session and the cart items in the session is the currency set for the Application that owns this session. ### Session management To use this endpoint, start by learning about [customer sessions](https://docs.talon.one/docs/dev/concepts/entities#customer-session) and their states and refer to the `state` parameter documentation the request body schema docs below. ### 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. - A profile can be linked to simultaneous sessions in different Applications. Either: - Use unique session integration IDs or, - Use the same session integration ID across all of the Applications. **Note:** If the specified profile does not exist, an empty profile is **created automatically**. You can update it with [Update customer profile](https://docs.talon.one/integration-api#tag/Customer-profiles/operation/updateCustomerProfileV2). <div class=\"redoc-section\"> <p class=\"title\">Performance tips</p> Updating a customer session returns a response with the new integration state. Use the `responseContent` property to save yourself extra API calls. For example, you can get the customer profile details directly without extra requests. </div> For more information, see: - The introductory video in [Getting started](https://docs.talon.one/docs/dev/getting-started/overview). - 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](https://docs.talon.one/management-api#operation/getApplicationSessions) endpoint.
# @param body [IntegrationRequest] body
# @param [Hash] opts the optional parameters
# @option opts [Boolean] :dry Indicates whether to persist the changes. Changes are ignored when `dry=true`. When set to `true`, you can use the `evaluableCampaignIds` body property to select specific campaigns to run.
# @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