=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 ManagementApi
attr_accessor :api_client
def initialize(api_client = ApiClient.default)
@api_client = api_client
end
# Enable user by email address
# Enable a [disabled user](https://docs.talon.one/docs/product/account/account-settings/managing-users#disabling-a-user) by their email address.
# @param body [DeactivateUserRequest] body
# @param [Hash] opts the optional parameters
# @return [nil]
def activate_user_by_email(body, opts = {})
activate_user_by_email_with_http_info(body, opts)
nil
end
# Enable user by email address
# Enable a [disabled user](https://docs.talon.one/docs/product/account/account-settings/managing-users#disabling-a-user) by their email address.
# @param body [DeactivateUserRequest] body
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def activate_user_by_email_with_http_info(body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.activate_user_by_email ...'
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 ManagementApi.activate_user_by_email"
end
# resource path
local_var_path = '/v1/users/activate'
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# 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] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#activate_user_by_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Add points to card
# Add points to the given loyalty card in the specified card-based loyalty program.
# @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_id [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 [AddLoyaltyPoints] body
# @param [Hash] opts the optional parameters
# @return [nil]
def add_loyalty_card_points(loyalty_program_id, loyalty_card_id, body, opts = {})
add_loyalty_card_points_with_http_info(loyalty_program_id, loyalty_card_id, body, opts)
nil
end
# Add points to card
# Add points to the given loyalty card in the specified card-based loyalty program.
# @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_id [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 [AddLoyaltyPoints] body
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def add_loyalty_card_points_with_http_info(loyalty_program_id, loyalty_card_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.add_loyalty_card_points ...'
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 ManagementApi.add_loyalty_card_points"
end
# verify the required parameter 'loyalty_card_id' is set
if @api_client.config.client_side_validation && loyalty_card_id.nil?
fail ArgumentError, "Missing the required parameter 'loyalty_card_id' when calling ManagementApi.add_loyalty_card_points"
end
if @api_client.config.client_side_validation && loyalty_card_id.to_s.length > 108
fail ArgumentError, 'invalid value for "loyalty_card_id" when calling ManagementApi.add_loyalty_card_points, 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 ManagementApi.add_loyalty_card_points"
end
# resource path
local_var_path = '/v1/loyalty_programs/{loyaltyProgramId}/cards/{loyaltyCardId}/add_points'.sub('{' + 'loyaltyProgramId' + '}', CGI.escape(loyalty_program_id.to_s)).sub('{' + 'loyaltyCardId' + '}', CGI.escape(loyalty_card_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] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#add_loyalty_card_points\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Add points to customer profile
# Add points in the specified loyalty program for the given customer. To get the `integrationId` of the profile from a `sessionId`, use the [Update customer session](https://docs.talon.one/integration-api#operation/updateCustomerSessionV2) endpoint.
# @param loyalty_program_id [String] The identifier for the loyalty program.
# @param integration_id [String] The identifier of the profile.
# @param body [AddLoyaltyPoints] body
# @param [Hash] opts the optional parameters
# @return [nil]
def add_loyalty_points(loyalty_program_id, integration_id, body, opts = {})
add_loyalty_points_with_http_info(loyalty_program_id, integration_id, body, opts)
nil
end
# Add points to customer profile
# Add points in the specified loyalty program for the given customer. To get the `integrationId` of the profile from a `sessionId`, use the [Update customer session](https://docs.talon.one/integration-api#operation/updateCustomerSessionV2) endpoint.
# @param loyalty_program_id [String] The identifier for the loyalty program.
# @param integration_id [String] The identifier of the profile.
# @param body [AddLoyaltyPoints] body
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def add_loyalty_points_with_http_info(loyalty_program_id, integration_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.add_loyalty_points ...'
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 ManagementApi.add_loyalty_points"
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 ManagementApi.add_loyalty_points"
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 ManagementApi.add_loyalty_points"
end
# resource path
local_var_path = '/v1/loyalty_programs/{loyaltyProgramId}/profile/{integrationId}/add_points'.sub('{' + 'loyaltyProgramId' + '}', CGI.escape(loyalty_program_id.to_s)).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'])
# 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] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#add_loyalty_points\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Copy the campaign into the specified Application
# Copy the campaign into all specified Applications.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param body [CampaignCopy] body
# @param [Hash] opts the optional parameters
# @return [InlineResponse2006]
def copy_campaign_to_applications(application_id, campaign_id, body, opts = {})
data, _status_code, _headers = copy_campaign_to_applications_with_http_info(application_id, campaign_id, body, opts)
data
end
# Copy the campaign into the specified Application
# Copy the campaign into all specified Applications.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param body [CampaignCopy] body
# @param [Hash] opts the optional parameters
# @return [Array<(InlineResponse2006, Integer, Hash)>] InlineResponse2006 data, response status code and response headers
def copy_campaign_to_applications_with_http_info(application_id, campaign_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.copy_campaign_to_applications ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.copy_campaign_to_applications"
end
# verify the required parameter 'campaign_id' is set
if @api_client.config.client_side_validation && campaign_id.nil?
fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ManagementApi.copy_campaign_to_applications"
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 ManagementApi.copy_campaign_to_applications"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/campaigns/{campaignId}/copy'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'campaignId' + '}', CGI.escape(campaign_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] || 'InlineResponse2006'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#copy_campaign_to_applications\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Create account-level collection
# Create an account-level collection.
# @param body [NewCollection] body
# @param [Hash] opts the optional parameters
# @return [Collection]
def create_account_collection(body, opts = {})
data, _status_code, _headers = create_account_collection_with_http_info(body, opts)
data
end
# Create account-level collection
# Create an account-level collection.
# @param body [NewCollection] body
# @param [Hash] opts the optional parameters
# @return [Array<(Collection, Integer, Hash)>] Collection data, response status code and response headers
def create_account_collection_with_http_info(body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.create_account_collection ...'
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 ManagementApi.create_account_collection"
end
# resource path
local_var_path = '/v1/collections'
# 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] || 'Collection'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#create_account_collection\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Create achievement
# Create a new achievement in a specific campaign.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param body [CreateAchievement] body
# @param [Hash] opts the optional parameters
# @return [Achievement]
def create_achievement(application_id, campaign_id, body, opts = {})
data, _status_code, _headers = create_achievement_with_http_info(application_id, campaign_id, body, opts)
data
end
# Create achievement
# Create a new achievement in a specific campaign.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param body [CreateAchievement] body
# @param [Hash] opts the optional parameters
# @return [Array<(Achievement, Integer, Hash)>] Achievement data, response status code and response headers
def create_achievement_with_http_info(application_id, campaign_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.create_achievement ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.create_achievement"
end
# verify the required parameter 'campaign_id' is set
if @api_client.config.client_side_validation && campaign_id.nil?
fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ManagementApi.create_achievement"
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 ManagementApi.create_achievement"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/campaigns/{campaignId}/achievements'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'campaignId' + '}', CGI.escape(campaign_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] || 'Achievement'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#create_achievement\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Create additional cost
# Create an [additional cost](https://docs.talon.one/docs/product/account/dev-tools/managing-additional-costs). These additional costs are shared across all applications in your account, and are never required.
# @param body [NewAdditionalCost] body
# @param [Hash] opts the optional parameters
# @return [AccountAdditionalCost]
def create_additional_cost(body, opts = {})
data, _status_code, _headers = create_additional_cost_with_http_info(body, opts)
data
end
# Create additional cost
# Create an [additional cost](https://docs.talon.one/docs/product/account/dev-tools/managing-additional-costs). These additional costs are shared across all applications in your account, and are never required.
# @param body [NewAdditionalCost] body
# @param [Hash] opts the optional parameters
# @return [Array<(AccountAdditionalCost, Integer, Hash)>] AccountAdditionalCost data, response status code and response headers
def create_additional_cost_with_http_info(body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.create_additional_cost ...'
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 ManagementApi.create_additional_cost"
end
# resource path
local_var_path = '/v1/additional_costs'
# 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] || 'AccountAdditionalCost'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#create_additional_cost\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Create custom attribute
# Create a _custom attribute_ in this account. [Custom attributes](https://docs.talon.one/docs/dev/concepts/attributes) allow you to add data to Talon.One domain entities like campaigns, coupons, customers and so on. These attributes can then be given values when creating/updating these entities, and these values can be used in your campaign rules. For example, you could define a `zipCode` field for customer sessions, and add a rule to your campaign that only allows certain ZIP codes. These attributes are shared across all Applications in your account and are never required.
# @param body [NewAttribute] body
# @param [Hash] opts the optional parameters
# @return [Attribute]
def create_attribute(body, opts = {})
data, _status_code, _headers = create_attribute_with_http_info(body, opts)
data
end
# Create custom attribute
# Create a _custom attribute_ in this account. [Custom attributes](https://docs.talon.one/docs/dev/concepts/attributes) allow you to add data to Talon.One domain entities like campaigns, coupons, customers and so on. These attributes can then be given values when creating/updating these entities, and these values can be used in your campaign rules. For example, you could define a `zipCode` field for customer sessions, and add a rule to your campaign that only allows certain ZIP codes. These attributes are shared across all Applications in your account and are never required.
# @param body [NewAttribute] body
# @param [Hash] opts the optional parameters
# @return [Array<(Attribute, Integer, Hash)>] Attribute data, response status code and response headers
def create_attribute_with_http_info(body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.create_attribute ...'
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 ManagementApi.create_attribute"
end
# resource path
local_var_path = '/v1/attributes'
# 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] || 'Attribute'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#create_attribute\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Create loyalty cards
# Create a batch of loyalty cards in a specified [card-based loyalty program](https://docs.talon.one/docs/product/loyalty-programs/overview#loyalty-program-types). Customers can use loyalty cards to collect and spend loyalty points. **Important:** - The specified card-based loyalty program must have a defined card code format that is used to generate the loyalty card codes. - Trying to create more than 20,000 loyalty cards in a single request returns an error message with a `400` status code.
# @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 body [LoyaltyCardBatch] body
# @param [Hash] opts the optional parameters
# @return [LoyaltyCardBatchResponse]
def create_batch_loyalty_cards(loyalty_program_id, body, opts = {})
data, _status_code, _headers = create_batch_loyalty_cards_with_http_info(loyalty_program_id, body, opts)
data
end
# Create loyalty cards
# Create a batch of loyalty cards in a specified [card-based loyalty program](https://docs.talon.one/docs/product/loyalty-programs/overview#loyalty-program-types). Customers can use loyalty cards to collect and spend loyalty points. **Important:** - The specified card-based loyalty program must have a defined card code format that is used to generate the loyalty card codes. - Trying to create more than 20,000 loyalty cards in a single request returns an error message with a `400` status code.
# @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 body [LoyaltyCardBatch] body
# @param [Hash] opts the optional parameters
# @return [Array<(LoyaltyCardBatchResponse, Integer, Hash)>] LoyaltyCardBatchResponse data, response status code and response headers
def create_batch_loyalty_cards_with_http_info(loyalty_program_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.create_batch_loyalty_cards ...'
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 ManagementApi.create_batch_loyalty_cards"
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 ManagementApi.create_batch_loyalty_cards"
end
# resource path
local_var_path = '/v1/loyalty_programs/{loyaltyProgramId}/cards/batch'.sub('{' + 'loyaltyProgramId' + '}', CGI.escape(loyalty_program_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] || 'LoyaltyCardBatchResponse'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#create_batch_loyalty_cards\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Create campaign from campaign template
# Use the campaign template referenced in the request body to create a new campaign in one of the connected Applications. If the template was created from a campaign with rules referencing [campaign collections](https://docs.talon.one/docs/product/campaigns/managing-collections), the corresponding collections for the new campaign are created automatically.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param body [CreateTemplateCampaign] body
# @param [Hash] opts the optional parameters
# @return [CreateTemplateCampaignResponse]
def create_campaign_from_template(application_id, body, opts = {})
data, _status_code, _headers = create_campaign_from_template_with_http_info(application_id, body, opts)
data
end
# Create campaign from campaign template
# Use the campaign template referenced in the request body to create a new campaign in one of the connected Applications. If the template was created from a campaign with rules referencing [campaign collections](https://docs.talon.one/docs/product/campaigns/managing-collections), the corresponding collections for the new campaign are created automatically.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param body [CreateTemplateCampaign] body
# @param [Hash] opts the optional parameters
# @return [Array<(CreateTemplateCampaignResponse, Integer, Hash)>] CreateTemplateCampaignResponse data, response status code and response headers
def create_campaign_from_template_with_http_info(application_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.create_campaign_from_template ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.create_campaign_from_template"
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 ManagementApi.create_campaign_from_template"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/create_campaign_from_template'.sub('{' + 'applicationId' + '}', CGI.escape(application_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] || 'CreateTemplateCampaignResponse'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#create_campaign_from_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Create campaign-level collection
# Create a campaign-level collection in a given campaign.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param body [NewCampaignCollection] body
# @param [Hash] opts the optional parameters
# @return [Collection]
def create_collection(application_id, campaign_id, body, opts = {})
data, _status_code, _headers = create_collection_with_http_info(application_id, campaign_id, body, opts)
data
end
# Create campaign-level collection
# Create a campaign-level collection in a given campaign.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param body [NewCampaignCollection] body
# @param [Hash] opts the optional parameters
# @return [Array<(Collection, Integer, Hash)>] Collection data, response status code and response headers
def create_collection_with_http_info(application_id, campaign_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.create_collection ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.create_collection"
end
# verify the required parameter 'campaign_id' is set
if @api_client.config.client_side_validation && campaign_id.nil?
fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ManagementApi.create_collection"
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 ManagementApi.create_collection"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/campaigns/{campaignId}/collections'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'campaignId' + '}', CGI.escape(campaign_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] || 'Collection'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#create_collection\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Create coupons
# Create coupons according to some pattern. Up to 20.000 coupons can be created without a unique prefix. When a unique prefix is provided, up to 200.000 coupons can be created.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param body [NewCoupons] 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 [InlineResponse2008]
def create_coupons(application_id, campaign_id, body, opts = {})
data, _status_code, _headers = create_coupons_with_http_info(application_id, campaign_id, body, opts)
data
end
# Create coupons
# Create coupons according to some pattern. Up to 20.000 coupons can be created without a unique prefix. When a unique prefix is provided, up to 200.000 coupons can be created.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param body [NewCoupons] 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<(InlineResponse2008, Integer, Hash)>] InlineResponse2008 data, response status code and response headers
def create_coupons_with_http_info(application_id, campaign_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.create_coupons ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.create_coupons"
end
# verify the required parameter 'campaign_id' is set
if @api_client.config.client_side_validation && campaign_id.nil?
fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ManagementApi.create_coupons"
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 ManagementApi.create_coupons"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/campaigns/{campaignId}/coupons'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s))
# 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] || 'InlineResponse2008'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#create_coupons\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Create coupons asynchronously
# Create up to 5,000,000 coupons asynchronously. You should typically use this enpdoint when you create at least 20,001 coupons. You receive an email when the creation is complete. If you want to create less than 20,001 coupons, you can use the [Create coupons](https://docs.talon.one/management-api#tag/Coupons/operation/createCoupons) endpoint.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param body [NewCouponCreationJob] body
# @param [Hash] opts the optional parameters
# @return [AsyncCouponCreationResponse]
def create_coupons_async(application_id, campaign_id, body, opts = {})
data, _status_code, _headers = create_coupons_async_with_http_info(application_id, campaign_id, body, opts)
data
end
# Create coupons asynchronously
# Create up to 5,000,000 coupons asynchronously. You should typically use this enpdoint when you create at least 20,001 coupons. You receive an email when the creation is complete. If you want to create less than 20,001 coupons, you can use the [Create coupons](https://docs.talon.one/management-api#tag/Coupons/operation/createCoupons) endpoint.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param body [NewCouponCreationJob] body
# @param [Hash] opts the optional parameters
# @return [Array<(AsyncCouponCreationResponse, Integer, Hash)>] AsyncCouponCreationResponse data, response status code and response headers
def create_coupons_async_with_http_info(application_id, campaign_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.create_coupons_async ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.create_coupons_async"
end
# verify the required parameter 'campaign_id' is set
if @api_client.config.client_side_validation && campaign_id.nil?
fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ManagementApi.create_coupons_async"
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 ManagementApi.create_coupons_async"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/campaigns/{campaignId}/coupons_async'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'campaignId' + '}', CGI.escape(campaign_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] || 'AsyncCouponCreationResponse'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#create_coupons_async\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Creates a coupon deletion job
# This endpoint handles creating a job to delete coupons asynchronously.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param body [NewCouponDeletionJob] body
# @param [Hash] opts the optional parameters
# @return [AsyncCouponDeletionJobResponse]
def create_coupons_deletion_job(application_id, campaign_id, body, opts = {})
data, _status_code, _headers = create_coupons_deletion_job_with_http_info(application_id, campaign_id, body, opts)
data
end
# Creates a coupon deletion job
# This endpoint handles creating a job to delete coupons asynchronously.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param body [NewCouponDeletionJob] body
# @param [Hash] opts the optional parameters
# @return [Array<(AsyncCouponDeletionJobResponse, Integer, Hash)>] AsyncCouponDeletionJobResponse data, response status code and response headers
def create_coupons_deletion_job_with_http_info(application_id, campaign_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.create_coupons_deletion_job ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.create_coupons_deletion_job"
end
# verify the required parameter 'campaign_id' is set
if @api_client.config.client_side_validation && campaign_id.nil?
fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ManagementApi.create_coupons_deletion_job"
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 ManagementApi.create_coupons_deletion_job"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/campaigns/{campaignId}/coupons_deletion_jobs'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'campaignId' + '}', CGI.escape(campaign_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] || 'AsyncCouponDeletionJobResponse'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#create_coupons_deletion_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Create coupons for multiple recipients
# Create coupons according to some pattern for up to 1000 recipients.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param body [NewCouponsForMultipleRecipients] 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 [InlineResponse2008]
def create_coupons_for_multiple_recipients(application_id, campaign_id, body, opts = {})
data, _status_code, _headers = create_coupons_for_multiple_recipients_with_http_info(application_id, campaign_id, body, opts)
data
end
# Create coupons for multiple recipients
# Create coupons according to some pattern for up to 1000 recipients.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param body [NewCouponsForMultipleRecipients] 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<(InlineResponse2008, Integer, Hash)>] InlineResponse2008 data, response status code and response headers
def create_coupons_for_multiple_recipients_with_http_info(application_id, campaign_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.create_coupons_for_multiple_recipients ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.create_coupons_for_multiple_recipients"
end
# verify the required parameter 'campaign_id' is set
if @api_client.config.client_side_validation && campaign_id.nil?
fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ManagementApi.create_coupons_for_multiple_recipients"
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 ManagementApi.create_coupons_for_multiple_recipients"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/campaigns/{campaignId}/coupons_with_recipients'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s))
# 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] || 'InlineResponse2008'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#create_coupons_for_multiple_recipients\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Resend invitation email
# Resend an email invitation to an existing user. **Note:** The invitation token is valid for 24 hours after the email has been sent.
# @param body [NewInviteEmail] body
# @param [Hash] opts the optional parameters
# @return [NewInviteEmail]
def create_invite_email(body, opts = {})
data, _status_code, _headers = create_invite_email_with_http_info(body, opts)
data
end
# Resend invitation email
# Resend an email invitation to an existing user. **Note:** The invitation token is valid for 24 hours after the email has been sent.
# @param body [NewInviteEmail] body
# @param [Hash] opts the optional parameters
# @return [Array<(NewInviteEmail, Integer, Hash)>] NewInviteEmail data, response status code and response headers
def create_invite_email_with_http_info(body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.create_invite_email ...'
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 ManagementApi.create_invite_email"
end
# resource path
local_var_path = '/v1/invite_emails'
# 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] || 'NewInviteEmail'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#create_invite_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Invite user
# Create a new user in the account and send an invitation to their email address. **Note**: The invitation token is valid for 24 hours after the email has been sent. You can resend an invitation to a user with the [Resend invitation email](https://docs.talon.one/management-api#tag/Accounts-and-users/operation/createInviteEmail) endpoint.
# @param body [NewInvitation] body
# @param [Hash] opts the optional parameters
# @return [User]
def create_invite_v2(body, opts = {})
data, _status_code, _headers = create_invite_v2_with_http_info(body, opts)
data
end
# Invite user
# Create a new user in the account and send an invitation to their email address. **Note**: The invitation token is valid for 24 hours after the email has been sent. You can resend an invitation to a user with the [Resend invitation email](https://docs.talon.one/management-api#tag/Accounts-and-users/operation/createInviteEmail) endpoint.
# @param body [NewInvitation] body
# @param [Hash] opts the optional parameters
# @return [Array<(User, Integer, Hash)>] User data, response status code and response headers
def create_invite_v2_with_http_info(body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.create_invite_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 ManagementApi.create_invite_v2"
end
# resource path
local_var_path = '/v2/invites'
# 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] || 'User'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#create_invite_v2\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Request a password reset
# Send an email with a password recovery link to the email address of an existing account. **Note:** The password recovery link expires 30 minutes after this endpoint is triggered.
# @param body [NewPasswordEmail] body
# @param [Hash] opts the optional parameters
# @return [NewPasswordEmail]
def create_password_recovery_email(body, opts = {})
data, _status_code, _headers = create_password_recovery_email_with_http_info(body, opts)
data
end
# Request a password reset
# Send an email with a password recovery link to the email address of an existing account. **Note:** The password recovery link expires 30 minutes after this endpoint is triggered.
# @param body [NewPasswordEmail] body
# @param [Hash] opts the optional parameters
# @return [Array<(NewPasswordEmail, Integer, Hash)>] NewPasswordEmail data, response status code and response headers
def create_password_recovery_email_with_http_info(body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.create_password_recovery_email ...'
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 ManagementApi.create_password_recovery_email"
end
# resource path
local_var_path = '/v1/password_recovery_emails'
# 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] || 'NewPasswordEmail'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#create_password_recovery_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Create session
# Create a session to use the Management API endpoints. Use the value of the `token` property provided in the response as bearer token in other API calls. A token is valid for 3 months. In accordance with best pratices, use your generated token for all your API requests. Do **not** regenerate a token for each request. This endpoint has a rate limit of 3 to 6 requests per second per account, depending on your setup.
Granular API key
Instead of using a session, you can also use the
Management API key feature in the Campaign Manager to decide which endpoints can be used with a given key.
# @param body [LoginParams] body
# @param [Hash] opts the optional parameters
# @return [Session]
def create_session(body, opts = {})
data, _status_code, _headers = create_session_with_http_info(body, opts)
data
end
# Create session
# Create a session to use the Management API endpoints. Use the value of the `token` property provided in the response as bearer token in other API calls. A token is valid for 3 months. In accordance with best pratices, use your generated token for all your API requests. Do **not** regenerate a token for each request. This endpoint has a rate limit of 3 to 6 requests per second per account, depending on your setup. <div class=\"redoc-section\"> <p class=\"title\">Granular API key</p> Instead of using a session, you can also use the <a href=\"https://docs.talon.one/docs/product/account/dev-tools/managing-mapi-keys\">Management API key feature</a> in the Campaign Manager to decide which endpoints can be used with a given key. </div>
# @param body [LoginParams] body
# @param [Hash] opts the optional parameters
# @return [Array<(Session, Integer, Hash)>] Session data, response status code and response headers
def create_session_with_http_info(body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.create_session ...'
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 ManagementApi.create_session"
end
# resource path
local_var_path = '/v1/sessions'
# 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] || 'Session'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#create_session\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Create store
# Create a new store in a specific Application.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param body [NewStore] body
# @param [Hash] opts the optional parameters
# @return [Store]
def create_store(application_id, body, opts = {})
data, _status_code, _headers = create_store_with_http_info(application_id, body, opts)
data
end
# Create store
# Create a new store in a specific Application.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param body [NewStore] body
# @param [Hash] opts the optional parameters
# @return [Array<(Store, Integer, Hash)>] Store data, response status code and response headers
def create_store_with_http_info(application_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.create_store ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.create_store"
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 ManagementApi.create_store"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/stores'.sub('{' + 'applicationId' + '}', CGI.escape(application_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] || 'Store'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#create_store\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Disable user by email address
# [Disable a specific user](https://docs.talon.one/docs/product/account/account-settings/managing-users#disabling-a-user) by their email address.
# @param body [DeactivateUserRequest] body
# @param [Hash] opts the optional parameters
# @return [nil]
def deactivate_user_by_email(body, opts = {})
deactivate_user_by_email_with_http_info(body, opts)
nil
end
# Disable user by email address
# [Disable a specific user](https://docs.talon.one/docs/product/account/account-settings/managing-users#disabling-a-user) by their email address.
# @param body [DeactivateUserRequest] body
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def deactivate_user_by_email_with_http_info(body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.deactivate_user_by_email ...'
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 ManagementApi.deactivate_user_by_email"
end
# resource path
local_var_path = '/v1/users/deactivate'
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# 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] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#deactivate_user_by_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Deduct points from card
# Deduct points from the given loyalty card in the specified card-based loyalty program.
# @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_id [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 [DeductLoyaltyPoints] body
# @param [Hash] opts the optional parameters
# @return [nil]
def deduct_loyalty_card_points(loyalty_program_id, loyalty_card_id, body, opts = {})
deduct_loyalty_card_points_with_http_info(loyalty_program_id, loyalty_card_id, body, opts)
nil
end
# Deduct points from card
# Deduct points from the given loyalty card in the specified card-based loyalty program.
# @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_id [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 [DeductLoyaltyPoints] body
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def deduct_loyalty_card_points_with_http_info(loyalty_program_id, loyalty_card_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.deduct_loyalty_card_points ...'
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 ManagementApi.deduct_loyalty_card_points"
end
# verify the required parameter 'loyalty_card_id' is set
if @api_client.config.client_side_validation && loyalty_card_id.nil?
fail ArgumentError, "Missing the required parameter 'loyalty_card_id' when calling ManagementApi.deduct_loyalty_card_points"
end
if @api_client.config.client_side_validation && loyalty_card_id.to_s.length > 108
fail ArgumentError, 'invalid value for "loyalty_card_id" when calling ManagementApi.deduct_loyalty_card_points, 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 ManagementApi.deduct_loyalty_card_points"
end
# resource path
local_var_path = '/v1/loyalty_programs/{loyaltyProgramId}/cards/{loyaltyCardId}/deduct_points'.sub('{' + 'loyaltyProgramId' + '}', CGI.escape(loyalty_program_id.to_s)).sub('{' + 'loyaltyCardId' + '}', CGI.escape(loyalty_card_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] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#deduct_loyalty_card_points\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Delete account-level collection
# Delete a given account-level collection.
# @param collection_id [Integer] The ID of the collection. You can get it with the [List collections in account](#operation/listAccountCollections) endpoint.
# @param [Hash] opts the optional parameters
# @return [nil]
def delete_account_collection(collection_id, opts = {})
delete_account_collection_with_http_info(collection_id, opts)
nil
end
# Delete account-level collection
# Delete a given account-level collection.
# @param collection_id [Integer] The ID of the collection. You can get it with the [List collections in account](#operation/listAccountCollections) endpoint.
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def delete_account_collection_with_http_info(collection_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.delete_account_collection ...'
end
# verify the required parameter 'collection_id' is set
if @api_client.config.client_side_validation && collection_id.nil?
fail ArgumentError, "Missing the required parameter 'collection_id' when calling ManagementApi.delete_account_collection"
end
# resource path
local_var_path = '/v1/collections/{collectionId}'.sub('{' + 'collectionId' + '}', CGI.escape(collection_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] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#delete_account_collection\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Delete achievement
# Delete the specified achievement.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param achievement_id [Integer] The ID of the achievement. You can get this ID with the [List achievement](https://docs.talon.one/management-api#tag/Achievements/operation/listAchievements) endpoint.
# @param [Hash] opts the optional parameters
# @return [nil]
def delete_achievement(application_id, campaign_id, achievement_id, opts = {})
delete_achievement_with_http_info(application_id, campaign_id, achievement_id, opts)
nil
end
# Delete achievement
# Delete the specified achievement.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param achievement_id [Integer] The ID of the achievement. You can get this ID with the [List achievement](https://docs.talon.one/management-api#tag/Achievements/operation/listAchievements) endpoint.
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def delete_achievement_with_http_info(application_id, campaign_id, achievement_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.delete_achievement ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.delete_achievement"
end
# verify the required parameter 'campaign_id' is set
if @api_client.config.client_side_validation && campaign_id.nil?
fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ManagementApi.delete_achievement"
end
# verify the required parameter 'achievement_id' is set
if @api_client.config.client_side_validation && achievement_id.nil?
fail ArgumentError, "Missing the required parameter 'achievement_id' when calling ManagementApi.delete_achievement"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/campaigns/{campaignId}/achievements/{achievementId}'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'achievementId' + '}', CGI.escape(achievement_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] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#delete_achievement\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Delete campaign
# Delete the given campaign.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @return [nil]
def delete_campaign(application_id, campaign_id, opts = {})
delete_campaign_with_http_info(application_id, campaign_id, opts)
nil
end
# Delete campaign
# Delete the given campaign.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def delete_campaign_with_http_info(application_id, campaign_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.delete_campaign ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.delete_campaign"
end
# verify the required parameter 'campaign_id' is set
if @api_client.config.client_side_validation && campaign_id.nil?
fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ManagementApi.delete_campaign"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/campaigns/{campaignId}'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# 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] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#delete_campaign\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Delete campaign-level collection
# Delete a given campaign-level collection.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param collection_id [Integer] The ID of the collection. You can get it with the [List collections in Application](#operation/listCollectionsInApplication) endpoint.
# @param [Hash] opts the optional parameters
# @return [nil]
def delete_collection(application_id, campaign_id, collection_id, opts = {})
delete_collection_with_http_info(application_id, campaign_id, collection_id, opts)
nil
end
# Delete campaign-level collection
# Delete a given campaign-level collection.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param collection_id [Integer] The ID of the collection. You can get it with the [List collections in Application](#operation/listCollectionsInApplication) endpoint.
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def delete_collection_with_http_info(application_id, campaign_id, collection_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.delete_collection ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.delete_collection"
end
# verify the required parameter 'campaign_id' is set
if @api_client.config.client_side_validation && campaign_id.nil?
fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ManagementApi.delete_collection"
end
# verify the required parameter 'collection_id' is set
if @api_client.config.client_side_validation && collection_id.nil?
fail ArgumentError, "Missing the required parameter 'collection_id' when calling ManagementApi.delete_collection"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/campaigns/{campaignId}/collections/{collectionId}'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'collectionId' + '}', CGI.escape(collection_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] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#delete_collection\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Delete coupon
# Delete the specified coupon.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param coupon_id [String] The internal ID of the coupon code. You can find this value in the `id` property from the [List coupons](https://docs.talon.one/management-api#tag/Coupons/operation/getCouponsWithoutTotalCount) endpoint response.
# @param [Hash] opts the optional parameters
# @return [nil]
def delete_coupon(application_id, campaign_id, coupon_id, opts = {})
delete_coupon_with_http_info(application_id, campaign_id, coupon_id, opts)
nil
end
# Delete coupon
# Delete the specified coupon.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param coupon_id [String] The internal ID of the coupon code. You can find this value in the `id` property from the [List coupons](https://docs.talon.one/management-api#tag/Coupons/operation/getCouponsWithoutTotalCount) endpoint response.
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def delete_coupon_with_http_info(application_id, campaign_id, coupon_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.delete_coupon ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.delete_coupon"
end
# verify the required parameter 'campaign_id' is set
if @api_client.config.client_side_validation && campaign_id.nil?
fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ManagementApi.delete_coupon"
end
# verify the required parameter 'coupon_id' is set
if @api_client.config.client_side_validation && coupon_id.nil?
fail ArgumentError, "Missing the required parameter 'coupon_id' when calling ManagementApi.delete_coupon"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/campaigns/{campaignId}/coupons/{couponId}'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'couponId' + '}', CGI.escape(coupon_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# 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] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#delete_coupon\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Delete coupons
# Deletes all the coupons matching the specified criteria.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [String] :value Filter results performing case-insensitive matching against the coupon code. Both the code and the query are folded to remove all non-alpha-numeric characters.
# @option opts [DateTime] :created_before Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :created_after Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :starts_after Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon start date timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :starts_before Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon start date timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :expires_after Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon expiration date timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :expires_before Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon expiration date timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [String] :valid - `expired`: Matches coupons in which the expiration date is set and in the past. - `validNow`: Matches coupons in which start date is null or in the past and expiration date is null or in the future. - `validFuture`: Matches coupons in which start date is set and in the future.
# @option opts [String] :batch_id Filter results by batches of coupons
# @option opts [String] :usable - `true`: only coupons where `usageCounter < usageLimit` will be returned. - `false`: only coupons where `usageCounter >= usageLimit` will be returned.
# @option opts [Integer] :referral_id Filter the results by matching them with the ID of a referral. This filter shows the coupons created by redeeming a referral code.
# @option opts [String] :recipient_integration_id Filter results by match with a profile ID specified in the coupon's `RecipientIntegrationId` field.
# @option opts [Boolean] :exact_match Filter results to an exact case-insensitive matching against the coupon code (default to false)
# @return [nil]
def delete_coupons(application_id, campaign_id, opts = {})
delete_coupons_with_http_info(application_id, campaign_id, opts)
nil
end
# Delete coupons
# Deletes all the coupons matching the specified criteria.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [String] :value Filter results performing case-insensitive matching against the coupon code. Both the code and the query are folded to remove all non-alpha-numeric characters.
# @option opts [DateTime] :created_before Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :created_after Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :starts_after Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon start date timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :starts_before Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon start date timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :expires_after Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon expiration date timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :expires_before Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon expiration date timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [String] :valid - `expired`: Matches coupons in which the expiration date is set and in the past. - `validNow`: Matches coupons in which start date is null or in the past and expiration date is null or in the future. - `validFuture`: Matches coupons in which start date is set and in the future.
# @option opts [String] :batch_id Filter results by batches of coupons
# @option opts [String] :usable - `true`: only coupons where `usageCounter < usageLimit` will be returned. - `false`: only coupons where `usageCounter >= usageLimit` will be returned.
# @option opts [Integer] :referral_id Filter the results by matching them with the ID of a referral. This filter shows the coupons created by redeeming a referral code.
# @option opts [String] :recipient_integration_id Filter results by match with a profile ID specified in the coupon's `RecipientIntegrationId` field.
# @option opts [Boolean] :exact_match Filter results to an exact case-insensitive matching against the coupon code
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def delete_coupons_with_http_info(application_id, campaign_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.delete_coupons ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.delete_coupons"
end
# verify the required parameter 'campaign_id' is set
if @api_client.config.client_side_validation && campaign_id.nil?
fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ManagementApi.delete_coupons"
end
allowable_values = ["expired", "validNow", "validFuture"]
if @api_client.config.client_side_validation && opts[:'valid'] && !allowable_values.include?(opts[:'valid'])
fail ArgumentError, "invalid value for \"valid\", must be one of #{allowable_values}"
end
allowable_values = ["true", "false"]
if @api_client.config.client_side_validation && opts[:'usable'] && !allowable_values.include?(opts[:'usable'])
fail ArgumentError, "invalid value for \"usable\", must be one of #{allowable_values}"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/campaigns/{campaignId}/coupons'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'value'] = opts[:'value'] if !opts[:'value'].nil?
query_params[:'createdBefore'] = opts[:'created_before'] if !opts[:'created_before'].nil?
query_params[:'createdAfter'] = opts[:'created_after'] if !opts[:'created_after'].nil?
query_params[:'startsAfter'] = opts[:'starts_after'] if !opts[:'starts_after'].nil?
query_params[:'startsBefore'] = opts[:'starts_before'] if !opts[:'starts_before'].nil?
query_params[:'expiresAfter'] = opts[:'expires_after'] if !opts[:'expires_after'].nil?
query_params[:'expiresBefore'] = opts[:'expires_before'] if !opts[:'expires_before'].nil?
query_params[:'valid'] = opts[:'valid'] if !opts[:'valid'].nil?
query_params[:'batchId'] = opts[:'batch_id'] if !opts[:'batch_id'].nil?
query_params[:'usable'] = opts[:'usable'] if !opts[:'usable'].nil?
query_params[:'referralId'] = opts[:'referral_id'] if !opts[:'referral_id'].nil?
query_params[:'recipientIntegrationId'] = opts[:'recipient_integration_id'] if !opts[:'recipient_integration_id'].nil?
query_params[:'exactMatch'] = opts[:'exact_match'] if !opts[:'exact_match'].nil?
# header parameters
header_params = opts[:header_params] || {}
# 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] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#delete_coupons\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Delete loyalty card
# Delete the given loyalty card.
# @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_id [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
# @return [nil]
def delete_loyalty_card(loyalty_program_id, loyalty_card_id, opts = {})
delete_loyalty_card_with_http_info(loyalty_program_id, loyalty_card_id, opts)
nil
end
# Delete loyalty card
# Delete the given loyalty card.
# @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_id [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
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def delete_loyalty_card_with_http_info(loyalty_program_id, loyalty_card_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.delete_loyalty_card ...'
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 ManagementApi.delete_loyalty_card"
end
# verify the required parameter 'loyalty_card_id' is set
if @api_client.config.client_side_validation && loyalty_card_id.nil?
fail ArgumentError, "Missing the required parameter 'loyalty_card_id' when calling ManagementApi.delete_loyalty_card"
end
if @api_client.config.client_side_validation && loyalty_card_id.to_s.length > 108
fail ArgumentError, 'invalid value for "loyalty_card_id" when calling ManagementApi.delete_loyalty_card, the character length must be smaller than or equal to 108.'
end
# resource path
local_var_path = '/v1/loyalty_programs/{loyaltyProgramId}/cards/{loyaltyCardId}'.sub('{' + 'loyaltyProgramId' + '}', CGI.escape(loyalty_program_id.to_s)).sub('{' + 'loyaltyCardId' + '}', CGI.escape(loyalty_card_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] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#delete_loyalty_card\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Delete referral
# Delete the specified referral.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param referral_id [String] The ID of the referral code.
# @param [Hash] opts the optional parameters
# @return [nil]
def delete_referral(application_id, campaign_id, referral_id, opts = {})
delete_referral_with_http_info(application_id, campaign_id, referral_id, opts)
nil
end
# Delete referral
# Delete the specified referral.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param referral_id [String] The ID of the referral code.
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def delete_referral_with_http_info(application_id, campaign_id, referral_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.delete_referral ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.delete_referral"
end
# verify the required parameter 'campaign_id' is set
if @api_client.config.client_side_validation && campaign_id.nil?
fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ManagementApi.delete_referral"
end
# verify the required parameter 'referral_id' is set
if @api_client.config.client_side_validation && referral_id.nil?
fail ArgumentError, "Missing the required parameter 'referral_id' when calling ManagementApi.delete_referral"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/campaigns/{campaignId}/referrals/{referralId}'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'referralId' + '}', CGI.escape(referral_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# 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] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#delete_referral\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Delete store
# Delete the specified store.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param store_id [String] The ID of the store. You can get this ID with the [List stores](#tag/Stores/operation/listStores) endpoint.
# @param [Hash] opts the optional parameters
# @return [nil]
def delete_store(application_id, store_id, opts = {})
delete_store_with_http_info(application_id, store_id, opts)
nil
end
# Delete store
# Delete the specified store.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param store_id [String] The ID of the store. You can get this ID with the [List stores](#tag/Stores/operation/listStores) endpoint.
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def delete_store_with_http_info(application_id, store_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.delete_store ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.delete_store"
end
# verify the required parameter 'store_id' is set
if @api_client.config.client_side_validation && store_id.nil?
fail ArgumentError, "Missing the required parameter 'store_id' when calling ManagementApi.delete_store"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/stores/{storeId}'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'storeId' + '}', CGI.escape(store_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] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#delete_store\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Delete user
# Delete a specific user.
# @param user_id [Integer] The ID of the user.
# @param [Hash] opts the optional parameters
# @return [nil]
def delete_user(user_id, opts = {})
delete_user_with_http_info(user_id, opts)
nil
end
# Delete user
# Delete a specific user.
# @param user_id [Integer] The ID of the user.
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def delete_user_with_http_info(user_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.delete_user ...'
end
# verify the required parameter 'user_id' is set
if @api_client.config.client_side_validation && user_id.nil?
fail ArgumentError, "Missing the required parameter 'user_id' when calling ManagementApi.delete_user"
end
# resource path
local_var_path = '/v1/users/{userId}'.sub('{' + 'userId' + '}', CGI.escape(user_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# 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] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#delete_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Delete user by email address
# [Delete a specific user](https://docs.talon.one/docs/product/account/account-settings/managing-users#deleting-a-user) by their email address.
# @param body [DeactivateUserRequest] body
# @param [Hash] opts the optional parameters
# @return [nil]
def delete_user_by_email(body, opts = {})
delete_user_by_email_with_http_info(body, opts)
nil
end
# Delete user by email address
# [Delete a specific user](https://docs.talon.one/docs/product/account/account-settings/managing-users#deleting-a-user) by their email address.
# @param body [DeactivateUserRequest] body
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def delete_user_by_email_with_http_info(body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.delete_user_by_email ...'
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 ManagementApi.delete_user_by_email"
end
# resource path
local_var_path = '/v1/users/delete'
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# 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] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#delete_user_by_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Destroy session
# Destroys the session.
# @param [Hash] opts the optional parameters
# @return [nil]
def destroy_session(opts = {})
destroy_session_with_http_info(opts)
nil
end
# Destroy session
# Destroys the session.
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def destroy_session_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.destroy_session ...'
end
# resource path
local_var_path = '/v1/sessions'
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# 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] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#destroy_session\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Disconnect stores
# Disconnect the stores linked to a specific campaign.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @return [nil]
def disconnect_campaign_stores(application_id, campaign_id, opts = {})
disconnect_campaign_stores_with_http_info(application_id, campaign_id, opts)
nil
end
# Disconnect stores
# Disconnect the stores linked to a specific campaign.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def disconnect_campaign_stores_with_http_info(application_id, campaign_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.disconnect_campaign_stores ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.disconnect_campaign_stores"
end
# verify the required parameter 'campaign_id' is set
if @api_client.config.client_side_validation && campaign_id.nil?
fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ManagementApi.disconnect_campaign_stores"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/campaigns/{campaignId}/stores'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'campaignId' + '}', CGI.escape(campaign_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] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#disconnect_campaign_stores\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Export account-level collection's items
# Download a CSV file containing items from a given account-level collection. **Tip:** If the exported CSV file is too large to view, you can [split it into multiple files](https://www.makeuseof.com/tag/how-to-split-a-huge-csv-excel-workbook-into-seperate-files/).
# @param collection_id [Integer] The ID of the collection. You can get it with the [List collections in account](#operation/listAccountCollections) endpoint.
# @param [Hash] opts the optional parameters
# @return [String]
def export_account_collection_items(collection_id, opts = {})
data, _status_code, _headers = export_account_collection_items_with_http_info(collection_id, opts)
data
end
# Export account-level collection's items
# Download a CSV file containing items from a given account-level collection. **Tip:** If the exported CSV file is too large to view, you can [split it into multiple files](https://www.makeuseof.com/tag/how-to-split-a-huge-csv-excel-workbook-into-seperate-files/).
# @param collection_id [Integer] The ID of the collection. You can get it with the [List collections in account](#operation/listAccountCollections) endpoint.
# @param [Hash] opts the optional parameters
# @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
def export_account_collection_items_with_http_info(collection_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.export_account_collection_items ...'
end
# verify the required parameter 'collection_id' is set
if @api_client.config.client_side_validation && collection_id.nil?
fail ArgumentError, "Missing the required parameter 'collection_id' when calling ManagementApi.export_account_collection_items"
end
# resource path
local_var_path = '/v1/collections/{collectionId}/export'.sub('{' + 'collectionId' + '}', CGI.escape(collection_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/csv'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:body]
# return_type
return_type = opts[:return_type] || 'String'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#export_account_collection_items\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Export achievement customer data
# Download a CSV file containing a list of all the customers who have participated in and are currently participating in the given achievement. The CSV file contains the following columns: - `profileIntegrationID`: The integration ID of the customer profile participating in the achievement. - `title`: The display name of the achievement in the Campaign Manager. - `target`: The required number of actions or the transactional milestone to complete the achievement. - `progress`: The current progress of the customer in the achievement. - `status`: The status of the achievement. Can be one of: ['inprogress', 'completed', 'expired']. - `startDate`: The date on which the customer profile started the achievement in RFC3339. - `endDate`: The date on which the achievement ends and resets for the customer profile in RFC3339. - `completionDate`: The date on which the customer profile completed the achievement in RFC3339.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param achievement_id [Integer] The ID of the achievement. You can get this ID with the [List achievement](https://docs.talon.one/management-api#tag/Achievements/operation/listAchievements) endpoint.
# @param [Hash] opts the optional parameters
# @return [String]
def export_achievements(application_id, campaign_id, achievement_id, opts = {})
data, _status_code, _headers = export_achievements_with_http_info(application_id, campaign_id, achievement_id, opts)
data
end
# Export achievement customer data
# Download a CSV file containing a list of all the customers who have participated in and are currently participating in the given achievement. The CSV file contains the following columns: - `profileIntegrationID`: The integration ID of the customer profile participating in the achievement. - `title`: The display name of the achievement in the Campaign Manager. - `target`: The required number of actions or the transactional milestone to complete the achievement. - `progress`: The current progress of the customer in the achievement. - `status`: The status of the achievement. Can be one of: ['inprogress', 'completed', 'expired']. - `startDate`: The date on which the customer profile started the achievement in RFC3339. - `endDate`: The date on which the achievement ends and resets for the customer profile in RFC3339. - `completionDate`: The date on which the customer profile completed the achievement in RFC3339.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param achievement_id [Integer] The ID of the achievement. You can get this ID with the [List achievement](https://docs.talon.one/management-api#tag/Achievements/operation/listAchievements) endpoint.
# @param [Hash] opts the optional parameters
# @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
def export_achievements_with_http_info(application_id, campaign_id, achievement_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.export_achievements ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.export_achievements"
end
# verify the required parameter 'campaign_id' is set
if @api_client.config.client_side_validation && campaign_id.nil?
fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ManagementApi.export_achievements"
end
# verify the required parameter 'achievement_id' is set
if @api_client.config.client_side_validation && achievement_id.nil?
fail ArgumentError, "Missing the required parameter 'achievement_id' when calling ManagementApi.export_achievements"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/campaigns/{campaignId}/achievements/{achievementId}/export'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'achievementId' + '}', CGI.escape(achievement_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/csv'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:body]
# return_type
return_type = opts[:return_type] || 'String'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#export_achievements\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Export audience members
# Download a CSV file containing the integration IDs of the members of an audience. **Tip:** If the exported CSV file is too large to view, you can [split it into multiple files](https://www.makeuseof.com/tag/how-to-split-a-huge-csv-excel-workbook-into-seperate-files/). The file contains the following column: - `profileintegrationid`: The integration ID of the customer profile.
# @param audience_id [Integer] The ID of the audience.
# @param [Hash] opts the optional parameters
# @return [String]
def export_audiences_memberships(audience_id, opts = {})
data, _status_code, _headers = export_audiences_memberships_with_http_info(audience_id, opts)
data
end
# Export audience members
# Download a CSV file containing the integration IDs of the members of an audience. **Tip:** If the exported CSV file is too large to view, you can [split it into multiple files](https://www.makeuseof.com/tag/how-to-split-a-huge-csv-excel-workbook-into-seperate-files/). The file contains the following column: - `profileintegrationid`: The integration ID of the customer profile.
# @param audience_id [Integer] The ID of the audience.
# @param [Hash] opts the optional parameters
# @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
def export_audiences_memberships_with_http_info(audience_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.export_audiences_memberships ...'
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 ManagementApi.export_audiences_memberships"
end
# resource path
local_var_path = '/v1/audiences/{audienceId}/memberships/export'.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/csv'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:body]
# return_type
return_type = opts[:return_type] || 'String'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#export_audiences_memberships\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Export stores
# Download a CSV file containing the stores linked to a specific campaign. **Tip:** If the exported CSV file is too large to view, you can [split it into multiple files](https://www.makeuseof.com/tag/how-to-split-a-huge-csv-excel-workbook-into-seperate-files/). The CSV file contains the following column: - `store_integration_id`: The identifier of the store.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @return [String]
def export_campaign_stores(application_id, campaign_id, opts = {})
data, _status_code, _headers = export_campaign_stores_with_http_info(application_id, campaign_id, opts)
data
end
# Export stores
# Download a CSV file containing the stores linked to a specific campaign. **Tip:** If the exported CSV file is too large to view, you can [split it into multiple files](https://www.makeuseof.com/tag/how-to-split-a-huge-csv-excel-workbook-into-seperate-files/). The CSV file contains the following column: - `store_integration_id`: The identifier of the store.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
def export_campaign_stores_with_http_info(application_id, campaign_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.export_campaign_stores ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.export_campaign_stores"
end
# verify the required parameter 'campaign_id' is set
if @api_client.config.client_side_validation && campaign_id.nil?
fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ManagementApi.export_campaign_stores"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/campaigns/{campaignId}/stores/export'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'campaignId' + '}', CGI.escape(campaign_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/csv'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:body]
# return_type
return_type = opts[:return_type] || 'String'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#export_campaign_stores\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Export campaign-level collection's items
# Download a CSV file containing items from a given campaign-level collection. **Tip:** If the exported CSV file is too large to view, you can [split it into multiple files](https://www.makeuseof.com/tag/how-to-split-a-huge-csv-excel-workbook-into-seperate-files/).
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param collection_id [Integer] The ID of the collection. You can get it with the [List collections in Application](#operation/listCollectionsInApplication) endpoint.
# @param [Hash] opts the optional parameters
# @return [String]
def export_collection_items(application_id, campaign_id, collection_id, opts = {})
data, _status_code, _headers = export_collection_items_with_http_info(application_id, campaign_id, collection_id, opts)
data
end
# Export campaign-level collection's items
# Download a CSV file containing items from a given campaign-level collection. **Tip:** If the exported CSV file is too large to view, you can [split it into multiple files](https://www.makeuseof.com/tag/how-to-split-a-huge-csv-excel-workbook-into-seperate-files/).
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param collection_id [Integer] The ID of the collection. You can get it with the [List collections in Application](#operation/listCollectionsInApplication) endpoint.
# @param [Hash] opts the optional parameters
# @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
def export_collection_items_with_http_info(application_id, campaign_id, collection_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.export_collection_items ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.export_collection_items"
end
# verify the required parameter 'campaign_id' is set
if @api_client.config.client_side_validation && campaign_id.nil?
fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ManagementApi.export_collection_items"
end
# verify the required parameter 'collection_id' is set
if @api_client.config.client_side_validation && collection_id.nil?
fail ArgumentError, "Missing the required parameter 'collection_id' when calling ManagementApi.export_collection_items"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/campaigns/{campaignId}/collections/{collectionId}/export'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'collectionId' + '}', CGI.escape(collection_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/csv'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:body]
# return_type
return_type = opts[:return_type] || 'String'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#export_collection_items\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Export coupons
# Download a CSV file containing the coupons that match the given properties. **Tip:** If the exported CSV file is too large to view, you can [split it into multiple files](https://www.makeuseof.com/tag/how-to-split-a-huge-csv-excel-workbook-into-seperate-files/). The CSV file can contain the following columns: - `accountid`: The ID of your deployment. - `applicationid`: The ID of the Application this coupon is related to. - `attributes`: A json object describing _custom_ referral attribute names and their values. - `batchid`: The ID of the batch this coupon is part of. - `campaignid`: The ID of the campaign this coupon is related to. - `counter`: The number of times this coupon has been redeemed. - `created`: The creation date in RFC3339 of the coupon code. - `deleted`: Whether the coupon code is deleted. - `deleted_changelogid`: The ID of the delete event in the logs. - `discount_counter`: The amount of discount given by this coupon. - `discount_limitval`: The maximum discount amount that can be given be this coupon. - `expirydate`: The end date in RFC3339 of the code redemption period. - `id`: The internal ID of the coupon code. - `importid`: The ID of the import job that created this coupon. - `is_reservation_mandatory`: Whether this coupon requires a reservation to be redeemed. - `limits`: The limits set on this coupon. - `limitval`: The maximum number of redemptions of this code. - `recipientintegrationid`: The integration ID of the recipient of the coupon. Only the customer with this integration ID can redeem this code. Available only for personal codes. - `referralid`: The ID of the referral code that triggered the creation of this coupon (create coupon effect). - `reservation`: Whether the coupon can be reserved for multiple customers. - `reservation_counter`: How many times this coupon has been reserved. - `reservation_limitval`: The maximum of number of reservations this coupon can have. - `startdate`: The start date in RFC3339 of the code redemption period. - `value`: The coupon code.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [Float] :campaign_id Filter results by campaign ID.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [String] :value Filter results performing case-insensitive matching against the coupon code. Both the code and the query are folded to remove all non-alpha-numeric characters.
# @option opts [DateTime] :created_before Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :created_after Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [String] :valid Either \"expired\", \"validNow\", or \"validFuture\". The first option matches coupons in which the expiration date is set and in the past. The second matches coupons in which start date is null or in the past and expiration date is null or in the future, the third matches coupons in which start date is set and in the future.
# @option opts [String] :usable Either \"true\" or \"false\". If \"true\", only coupons where `usageCounter < usageLimit` will be returned, \"false\" will return only coupons where `usageCounter >= usageLimit`.
# @option opts [Integer] :referral_id Filter the results by matching them with the ID of a referral. This filter shows the coupons created by redeeming a referral code.
# @option opts [String] :recipient_integration_id Filter results by match with a profile id specified in the coupon's RecipientIntegrationId field.
# @option opts [String] :batch_id Filter results by batches of coupons
# @option opts [Boolean] :exact_match Filter results to an exact case-insensitive matching against the coupon code. (default to false)
# @option opts [String] :date_format Determines the format of dates in the export document.
# @option opts [String] :campaign_state Filter results by the state of the campaign. - `enabled`: Campaigns that are scheduled, running (activated), or expired. - `running`: Campaigns that are running (activated). - `disabled`: Campaigns that are disabled. - `expired`: Campaigns that are expired. - `archived`: Campaigns that are archived.
# @option opts [Boolean] :values_only Filter results to only return the coupon codes (`value` column) without the associated coupon data. (default to false)
# @return [String]
def export_coupons(application_id, opts = {})
data, _status_code, _headers = export_coupons_with_http_info(application_id, opts)
data
end
# Export coupons
# Download a CSV file containing the coupons that match the given properties. **Tip:** If the exported CSV file is too large to view, you can [split it into multiple files](https://www.makeuseof.com/tag/how-to-split-a-huge-csv-excel-workbook-into-seperate-files/). The CSV file can contain the following columns: - `accountid`: The ID of your deployment. - `applicationid`: The ID of the Application this coupon is related to. - `attributes`: A json object describing _custom_ referral attribute names and their values. - `batchid`: The ID of the batch this coupon is part of. - `campaignid`: The ID of the campaign this coupon is related to. - `counter`: The number of times this coupon has been redeemed. - `created`: The creation date in RFC3339 of the coupon code. - `deleted`: Whether the coupon code is deleted. - `deleted_changelogid`: The ID of the delete event in the logs. - `discount_counter`: The amount of discount given by this coupon. - `discount_limitval`: The maximum discount amount that can be given be this coupon. - `expirydate`: The end date in RFC3339 of the code redemption period. - `id`: The internal ID of the coupon code. - `importid`: The ID of the import job that created this coupon. - `is_reservation_mandatory`: Whether this coupon requires a reservation to be redeemed. - `limits`: The limits set on this coupon. - `limitval`: The maximum number of redemptions of this code. - `recipientintegrationid`: The integration ID of the recipient of the coupon. Only the customer with this integration ID can redeem this code. Available only for personal codes. - `referralid`: The ID of the referral code that triggered the creation of this coupon (create coupon effect). - `reservation`: Whether the coupon can be reserved for multiple customers. - `reservation_counter`: How many times this coupon has been reserved. - `reservation_limitval`: The maximum of number of reservations this coupon can have. - `startdate`: The start date in RFC3339 of the code redemption period. - `value`: The coupon code.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [Float] :campaign_id Filter results by campaign ID.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [String] :value Filter results performing case-insensitive matching against the coupon code. Both the code and the query are folded to remove all non-alpha-numeric characters.
# @option opts [DateTime] :created_before Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :created_after Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [String] :valid Either \"expired\", \"validNow\", or \"validFuture\". The first option matches coupons in which the expiration date is set and in the past. The second matches coupons in which start date is null or in the past and expiration date is null or in the future, the third matches coupons in which start date is set and in the future.
# @option opts [String] :usable Either \"true\" or \"false\". If \"true\", only coupons where `usageCounter < usageLimit` will be returned, \"false\" will return only coupons where `usageCounter >= usageLimit`.
# @option opts [Integer] :referral_id Filter the results by matching them with the ID of a referral. This filter shows the coupons created by redeeming a referral code.
# @option opts [String] :recipient_integration_id Filter results by match with a profile id specified in the coupon's RecipientIntegrationId field.
# @option opts [String] :batch_id Filter results by batches of coupons
# @option opts [Boolean] :exact_match Filter results to an exact case-insensitive matching against the coupon code.
# @option opts [String] :date_format Determines the format of dates in the export document.
# @option opts [String] :campaign_state Filter results by the state of the campaign. - `enabled`: Campaigns that are scheduled, running (activated), or expired. - `running`: Campaigns that are running (activated). - `disabled`: Campaigns that are disabled. - `expired`: Campaigns that are expired. - `archived`: Campaigns that are archived.
# @option opts [Boolean] :values_only Filter results to only return the coupon codes (`value` column) without the associated coupon data.
# @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
def export_coupons_with_http_info(application_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.export_coupons ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.export_coupons"
end
allowable_values = ["expired", "validNow", "validFuture"]
if @api_client.config.client_side_validation && opts[:'valid'] && !allowable_values.include?(opts[:'valid'])
fail ArgumentError, "invalid value for \"valid\", must be one of #{allowable_values}"
end
allowable_values = ["true", "false"]
if @api_client.config.client_side_validation && opts[:'usable'] && !allowable_values.include?(opts[:'usable'])
fail ArgumentError, "invalid value for \"usable\", must be one of #{allowable_values}"
end
allowable_values = ["excel", "ISO8601"]
if @api_client.config.client_side_validation && opts[:'date_format'] && !allowable_values.include?(opts[:'date_format'])
fail ArgumentError, "invalid value for \"date_format\", must be one of #{allowable_values}"
end
allowable_values = ["enabled", "disabled", "archived", "scheduled", "running", "expired", "staged"]
if @api_client.config.client_side_validation && opts[:'campaign_state'] && !allowable_values.include?(opts[:'campaign_state'])
fail ArgumentError, "invalid value for \"campaign_state\", must be one of #{allowable_values}"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/export_coupons'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'campaignId'] = opts[:'campaign_id'] if !opts[:'campaign_id'].nil?
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
query_params[:'value'] = opts[:'value'] if !opts[:'value'].nil?
query_params[:'createdBefore'] = opts[:'created_before'] if !opts[:'created_before'].nil?
query_params[:'createdAfter'] = opts[:'created_after'] if !opts[:'created_after'].nil?
query_params[:'valid'] = opts[:'valid'] if !opts[:'valid'].nil?
query_params[:'usable'] = opts[:'usable'] if !opts[:'usable'].nil?
query_params[:'referralId'] = opts[:'referral_id'] if !opts[:'referral_id'].nil?
query_params[:'recipientIntegrationId'] = opts[:'recipient_integration_id'] if !opts[:'recipient_integration_id'].nil?
query_params[:'batchId'] = opts[:'batch_id'] if !opts[:'batch_id'].nil?
query_params[:'exactMatch'] = opts[:'exact_match'] if !opts[:'exact_match'].nil?
query_params[:'dateFormat'] = opts[:'date_format'] if !opts[:'date_format'].nil?
query_params[:'campaignState'] = opts[:'campaign_state'] if !opts[:'campaign_state'].nil?
query_params[:'valuesOnly'] = opts[:'values_only'] if !opts[:'values_only'].nil?
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/csv'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:body]
# return_type
return_type = opts[:return_type] || 'String'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#export_coupons\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Export customer sessions
# Download a CSV file containing the customer sessions that match the request. **Important:** Archived sessions cannot be exported. See the [retention policy](https://docs.talon.one/docs/product/server-infrastructure-and-data-retention#data-retention-policy). **Tip:** If the exported CSV file is too large to view, you can [split it into multiple files](https://www.makeuseof.com/tag/how-to-split-a-huge-csv-excel-workbook-into-seperate-files/). - `id`: The internal ID of the session. - `firstsession`: Whether this is a first session. - `integrationid`: The integration ID of the session. - `applicationid`: The ID of the Application. - `profileid`: The internal ID of the customer profile. - `profileintegrationid`: The integration ID of the customer profile. - `created`: The timestamp when the session was created. - `state`: The [state](https://docs.talon.one/docs/dev/concepts/entities/customer-sessions#customer-session-states) of the session. - `cartitems`: The cart items in the session. - `discounts`: The discounts in the session. - `total`: The total value of cart items and additional costs in the session, before any discounts are applied. - `attributes`: The attributes set in the session. - `closedat`: Timestamp when the session was closed. - `cancelledat`: Timestamp when the session was cancelled. - `referral`: The referral code in the session. - `identifiers`: The identifiers in the session. - `additional_costs`: The [additional costs](https://docs.talon.one/docs/product/account/dev-tools/managing-additional-costs) in the session. - `updated`: Timestamp of the last session update. - `store_integration_id`: The integration ID of the store. - `coupons`: Coupon codes in the session.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [DateTime] :created_before Filter results comparing the parameter value, expected to be an RFC3339 timestamp string.
# @option opts [DateTime] :created_after Filter results comparing the parameter value, expected to be an RFC3339 timestamp string.
# @option opts [String] :profile_integration_id Only return sessions for the customer that matches this customer integration ID.
# @option opts [String] :date_format Determines the format of dates in the export document.
# @option opts [String] :customer_session_state Filter results by state.
# @return [String]
def export_customer_sessions(application_id, opts = {})
data, _status_code, _headers = export_customer_sessions_with_http_info(application_id, opts)
data
end
# Export customer sessions
# Download a CSV file containing the customer sessions that match the request. **Important:** Archived sessions cannot be exported. See the [retention policy](https://docs.talon.one/docs/product/server-infrastructure-and-data-retention#data-retention-policy). **Tip:** If the exported CSV file is too large to view, you can [split it into multiple files](https://www.makeuseof.com/tag/how-to-split-a-huge-csv-excel-workbook-into-seperate-files/). - `id`: The internal ID of the session. - `firstsession`: Whether this is a first session. - `integrationid`: The integration ID of the session. - `applicationid`: The ID of the Application. - `profileid`: The internal ID of the customer profile. - `profileintegrationid`: The integration ID of the customer profile. - `created`: The timestamp when the session was created. - `state`: The [state](https://docs.talon.one/docs/dev/concepts/entities/customer-sessions#customer-session-states) of the session. - `cartitems`: The cart items in the session. - `discounts`: The discounts in the session. - `total`: The total value of cart items and additional costs in the session, before any discounts are applied. - `attributes`: The attributes set in the session. - `closedat`: Timestamp when the session was closed. - `cancelledat`: Timestamp when the session was cancelled. - `referral`: The referral code in the session. - `identifiers`: The identifiers in the session. - `additional_costs`: The [additional costs](https://docs.talon.one/docs/product/account/dev-tools/managing-additional-costs) in the session. - `updated`: Timestamp of the last session update. - `store_integration_id`: The integration ID of the store. - `coupons`: Coupon codes in the session.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [DateTime] :created_before Filter results comparing the parameter value, expected to be an RFC3339 timestamp string.
# @option opts [DateTime] :created_after Filter results comparing the parameter value, expected to be an RFC3339 timestamp string.
# @option opts [String] :profile_integration_id Only return sessions for the customer that matches this customer integration ID.
# @option opts [String] :date_format Determines the format of dates in the export document.
# @option opts [String] :customer_session_state Filter results by state.
# @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
def export_customer_sessions_with_http_info(application_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.export_customer_sessions ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.export_customer_sessions"
end
allowable_values = ["excel", "ISO8601"]
if @api_client.config.client_side_validation && opts[:'date_format'] && !allowable_values.include?(opts[:'date_format'])
fail ArgumentError, "invalid value for \"date_format\", must be one of #{allowable_values}"
end
allowable_values = ["open", "closed", "partially_returned", "cancelled"]
if @api_client.config.client_side_validation && opts[:'customer_session_state'] && !allowable_values.include?(opts[:'customer_session_state'])
fail ArgumentError, "invalid value for \"customer_session_state\", must be one of #{allowable_values}"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/export_customer_sessions'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'createdBefore'] = opts[:'created_before'] if !opts[:'created_before'].nil?
query_params[:'createdAfter'] = opts[:'created_after'] if !opts[:'created_after'].nil?
query_params[:'profileIntegrationId'] = opts[:'profile_integration_id'] if !opts[:'profile_integration_id'].nil?
query_params[:'dateFormat'] = opts[:'date_format'] if !opts[:'date_format'].nil?
query_params[:'customerSessionState'] = opts[:'customer_session_state'] if !opts[:'customer_session_state'].nil?
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/csv'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:body]
# return_type
return_type = opts[:return_type] || 'String'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#export_customer_sessions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Export customers' tier data
# Download a CSV file containing the tier information for customers of the specified loyalty program. The generated file contains the following columns: - `programid`: The identifier of the loyalty program. It is displayed in your Talon.One deployment URL. - `subledgerid`: The ID of the subledger associated with the loyalty program. This column is empty if the loyalty program has no subledger. In this case, refer to the export file name to get the ID of the loyalty program. - `customerprofileid`: The ID used to integrate customer profiles with the loyalty program. - `tiername`: The name of the tier. - `startdate`: The tier start date in RFC3339. - `expirydate`: The tier expiry date in RFC3339. You can filter the results by providing the following optional input parameters: - `subledgerIds` (optional): Filter results by an array of subledger IDs. If no value is provided, all subledger data for the specified loyalty program will be exported. - `tierNames` (optional): Filter results by an array of tier names. If no value is provided, all tier data for the specified loyalty program will be exported.
# @param loyalty_program_id [String] The identifier for the loyalty program.
# @param [Hash] opts the optional parameters
# @option opts [Array] :subledger_ids An array of subledgers IDs to filter the export by.
# @option opts [Array] :tier_names An array of tier names to filter the export by.
# @return [String]
def export_customers_tiers(loyalty_program_id, opts = {})
data, _status_code, _headers = export_customers_tiers_with_http_info(loyalty_program_id, opts)
data
end
# Export customers' tier data
# Download a CSV file containing the tier information for customers of the specified loyalty program. The generated file contains the following columns: - `programid`: The identifier of the loyalty program. It is displayed in your Talon.One deployment URL. - `subledgerid`: The ID of the subledger associated with the loyalty program. This column is empty if the loyalty program has no subledger. In this case, refer to the export file name to get the ID of the loyalty program. - `customerprofileid`: The ID used to integrate customer profiles with the loyalty program. - `tiername`: The name of the tier. - `startdate`: The tier start date in RFC3339. - `expirydate`: The tier expiry date in RFC3339. You can filter the results by providing the following optional input parameters: - `subledgerIds` (optional): Filter results by an array of subledger IDs. If no value is provided, all subledger data for the specified loyalty program will be exported. - `tierNames` (optional): Filter results by an array of tier names. If no value is provided, all tier data for the specified loyalty program will be exported.
# @param loyalty_program_id [String] The identifier for the loyalty program.
# @param [Hash] opts the optional parameters
# @option opts [Array] :subledger_ids An array of subledgers IDs to filter the export by.
# @option opts [Array] :tier_names An array of tier names to filter the export by.
# @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
def export_customers_tiers_with_http_info(loyalty_program_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.export_customers_tiers ...'
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 ManagementApi.export_customers_tiers"
end
# resource path
local_var_path = '/v1/loyalty_programs/{loyaltyProgramId}/export_customers_tiers'.sub('{' + 'loyaltyProgramId' + '}', CGI.escape(loyalty_program_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'subledgerIds'] = @api_client.build_collection_param(opts[:'subledger_ids'], :csv) if !opts[:'subledger_ids'].nil?
query_params[:'tierNames'] = @api_client.build_collection_param(opts[:'tier_names'], :csv) if !opts[:'tier_names'].nil?
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/csv'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:body]
# return_type
return_type = opts[:return_type] || 'String'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#export_customers_tiers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Export triggered effects
# Download a CSV file containing the triggered effects that match the given attributes. **Tip:** If the exported CSV file is too large to view, you can [split it into multiple files](https://www.makeuseof.com/tag/how-to-split-a-huge-csv-excel-workbook-into-seperate-files/). The generated file can contain the following columns: - `applicationid`: The ID of the Application. - `campaignid`: The ID of the campaign. - `couponid`: The ID of the coupon, when applicable to the effect. - `created`: The timestamp of the effect. - `event_type`: The name of the event. See the [docs](https://docs.talon.one/docs/dev/concepts/entities/events). - `eventid`: The internal ID of the effect. - `name`: The effect name. See the [docs](https://docs.talon.one/docs/dev/integration-api/api-effects). - `profileintegrationid`: The ID of the customer profile, when applicable. - `props`: The [properties](https://docs.talon.one/docs/dev/integration-api/api-effects) of the effect. - `ruleindex`: The index of the rule. - `rulesetid`: The ID of the rule set. - `sessionid`: The internal ID of the session that triggered the effect. - `profileid`: The internal ID of the customer profile. - `sessionintegrationid`: The integration ID of the session. - `total_revenue`: The total revenue. - `store_integration_id`: The integration ID of the store. You choose this ID when you create a store.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [Float] :campaign_id Filter results by campaign ID.
# @option opts [DateTime] :created_before Filter results comparing the parameter value, expected to be an RFC3339 timestamp string. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :created_after Filter results comparing the parameter value, expected to be an RFC3339 timestamp string. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [String] :date_format Determines the format of dates in the export document.
# @return [String]
def export_effects(application_id, opts = {})
data, _status_code, _headers = export_effects_with_http_info(application_id, opts)
data
end
# Export triggered effects
# Download a CSV file containing the triggered effects that match the given attributes. **Tip:** If the exported CSV file is too large to view, you can [split it into multiple files](https://www.makeuseof.com/tag/how-to-split-a-huge-csv-excel-workbook-into-seperate-files/). The generated file can contain the following columns: - `applicationid`: The ID of the Application. - `campaignid`: The ID of the campaign. - `couponid`: The ID of the coupon, when applicable to the effect. - `created`: The timestamp of the effect. - `event_type`: The name of the event. See the [docs](https://docs.talon.one/docs/dev/concepts/entities/events). - `eventid`: The internal ID of the effect. - `name`: The effect name. See the [docs](https://docs.talon.one/docs/dev/integration-api/api-effects). - `profileintegrationid`: The ID of the customer profile, when applicable. - `props`: The [properties](https://docs.talon.one/docs/dev/integration-api/api-effects) of the effect. - `ruleindex`: The index of the rule. - `rulesetid`: The ID of the rule set. - `sessionid`: The internal ID of the session that triggered the effect. - `profileid`: The internal ID of the customer profile. - `sessionintegrationid`: The integration ID of the session. - `total_revenue`: The total revenue. - `store_integration_id`: The integration ID of the store. You choose this ID when you create a store.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [Float] :campaign_id Filter results by campaign ID.
# @option opts [DateTime] :created_before Filter results comparing the parameter value, expected to be an RFC3339 timestamp string. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :created_after Filter results comparing the parameter value, expected to be an RFC3339 timestamp string. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [String] :date_format Determines the format of dates in the export document.
# @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
def export_effects_with_http_info(application_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.export_effects ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.export_effects"
end
allowable_values = ["excel", "ISO8601"]
if @api_client.config.client_side_validation && opts[:'date_format'] && !allowable_values.include?(opts[:'date_format'])
fail ArgumentError, "invalid value for \"date_format\", must be one of #{allowable_values}"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/export_effects'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'campaignId'] = opts[:'campaign_id'] if !opts[:'campaign_id'].nil?
query_params[:'createdBefore'] = opts[:'created_before'] if !opts[:'created_before'].nil?
query_params[:'createdAfter'] = opts[:'created_after'] if !opts[:'created_after'].nil?
query_params[:'dateFormat'] = opts[:'date_format'] if !opts[:'date_format'].nil?
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/csv'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:body]
# return_type
return_type = opts[:return_type] || 'String'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#export_effects\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Export customer loyalty balance to CSV
# ⚠️ Deprecation notice: Support for requests to this endpoint will end soon. To export customer loyalty balances to CSV, use the [Export customer loyalty balances to CSV](/management-api#tag/Loyalty/operation/exportLoyaltyBalances) endpoint. Download a CSV file containing the balance of each customer in the loyalty program. **Tip:** If the exported CSV file is too large to view, you can [split it into multiple files](https://www.makeuseof.com/tag/how-to-split-a-huge-csv-excel-workbook-into-seperate-files/).
# @param loyalty_program_id [String] The identifier for the loyalty program.
# @param [Hash] opts the optional parameters
# @option opts [DateTime] :end_date Used to return expired, active, and pending loyalty balances before this timestamp. You can enter any past, present, or future timestamp value. **Note:** - It must be an RFC3339 timestamp string. - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered.
# @return [String]
def export_loyalty_balance(loyalty_program_id, opts = {})
data, _status_code, _headers = export_loyalty_balance_with_http_info(loyalty_program_id, opts)
data
end
# Export customer loyalty balance to CSV
# ⚠️ Deprecation notice: Support for requests to this endpoint will end soon. To export customer loyalty balances to CSV, use the [Export customer loyalty balances to CSV](/management-api#tag/Loyalty/operation/exportLoyaltyBalances) endpoint. Download a CSV file containing the balance of each customer in the loyalty program. **Tip:** If the exported CSV file is too large to view, you can [split it into multiple files](https://www.makeuseof.com/tag/how-to-split-a-huge-csv-excel-workbook-into-seperate-files/).
# @param loyalty_program_id [String] The identifier for the loyalty program.
# @param [Hash] opts the optional parameters
# @option opts [DateTime] :end_date Used to return expired, active, and pending loyalty balances before this timestamp. You can enter any past, present, or future timestamp value. **Note:** - It must be an RFC3339 timestamp string. - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered.
# @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
def export_loyalty_balance_with_http_info(loyalty_program_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.export_loyalty_balance ...'
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 ManagementApi.export_loyalty_balance"
end
# resource path
local_var_path = '/v1/loyalty_programs/{loyaltyProgramId}/export_customer_balance'.sub('{' + 'loyaltyProgramId' + '}', CGI.escape(loyalty_program_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/csv'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:body]
# return_type
return_type = opts[:return_type] || 'String'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#export_loyalty_balance\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Export customer loyalty balances
# Download a CSV file containing the balance of each customer in the loyalty program. **Tip:** If the exported CSV file is too large to view, you can [split it into multiple files](https://www.makeuseof.com/tag/how-to-split-a-huge-csv-excel-workbook-into-seperate-files/). The generated file can contain the following columns: - `loyaltyProgramID`: The ID of the loyalty program. - `loyaltySubledger`: The name of the subdleger, when applicatble. - `profileIntegrationID`: The integration ID of the customer profile. - `currentBalance`: The current point balance. - `pendingBalance`: The number of pending points. - `expiredBalance`: The number of expired points. - `spentBalance`: The number of spent points. - `currentTier`: The tier that the customer is in at the time of the export.
# @param loyalty_program_id [String] The identifier for the loyalty program.
# @param [Hash] opts the optional parameters
# @option opts [DateTime] :end_date Used to return expired, active, and pending loyalty balances before this timestamp. You can enter any past, present, or future timestamp value. **Note:** - It must be an RFC3339 timestamp string. - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered.
# @return [String]
def export_loyalty_balances(loyalty_program_id, opts = {})
data, _status_code, _headers = export_loyalty_balances_with_http_info(loyalty_program_id, opts)
data
end
# Export customer loyalty balances
# Download a CSV file containing the balance of each customer in the loyalty program. **Tip:** If the exported CSV file is too large to view, you can [split it into multiple files](https://www.makeuseof.com/tag/how-to-split-a-huge-csv-excel-workbook-into-seperate-files/). The generated file can contain the following columns: - `loyaltyProgramID`: The ID of the loyalty program. - `loyaltySubledger`: The name of the subdleger, when applicatble. - `profileIntegrationID`: The integration ID of the customer profile. - `currentBalance`: The current point balance. - `pendingBalance`: The number of pending points. - `expiredBalance`: The number of expired points. - `spentBalance`: The number of spent points. - `currentTier`: The tier that the customer is in at the time of the export.
# @param loyalty_program_id [String] The identifier for the loyalty program.
# @param [Hash] opts the optional parameters
# @option opts [DateTime] :end_date Used to return expired, active, and pending loyalty balances before this timestamp. You can enter any past, present, or future timestamp value. **Note:** - It must be an RFC3339 timestamp string. - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered.
# @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
def export_loyalty_balances_with_http_info(loyalty_program_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.export_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 ManagementApi.export_loyalty_balances"
end
# resource path
local_var_path = '/v1/loyalty_programs/{loyaltyProgramId}/export_customer_balances'.sub('{' + 'loyaltyProgramId' + '}', CGI.escape(loyalty_program_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/csv'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:body]
# return_type
return_type = opts[:return_type] || 'String'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#export_loyalty_balances\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Export all card transaction logs
# Download a CSV file containing the balances of all cards in the loyalty program. **Tip:** If the exported CSV file is too large to view, you can [split it into multiple files](https://www.makeuseof.com/tag/how-to-split-a-huge-csv-excel-workbook-into-seperate-files/). The CSV file contains the following columns: - `loyaltyProgramID`: The ID of the loyalty program. - `loyaltySubledger`: The name of the subdleger, when applicatble. - `cardIdentifier`: The alphanumeric identifier of the loyalty card. - `cardState`:The state of the loyalty card. It can be `active` or `inactive`. - `currentBalance`: The current point balance. - `pendingBalance`: The number of pending points. - `expiredBalance`: The number of expired points. - `spentBalance`: The number of spent points.
# @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 [Hash] opts the optional parameters
# @option opts [DateTime] :end_date Used to return expired, active, and pending loyalty balances before this timestamp. You can enter any past, present, or future timestamp value. **Note:** - It must be an RFC3339 timestamp string. - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered.
# @return [String]
def export_loyalty_card_balances(loyalty_program_id, opts = {})
data, _status_code, _headers = export_loyalty_card_balances_with_http_info(loyalty_program_id, opts)
data
end
# Export all card transaction logs
# Download a CSV file containing the balances of all cards in the loyalty program. **Tip:** If the exported CSV file is too large to view, you can [split it into multiple files](https://www.makeuseof.com/tag/how-to-split-a-huge-csv-excel-workbook-into-seperate-files/). The CSV file contains the following columns: - `loyaltyProgramID`: The ID of the loyalty program. - `loyaltySubledger`: The name of the subdleger, when applicatble. - `cardIdentifier`: The alphanumeric identifier of the loyalty card. - `cardState`:The state of the loyalty card. It can be `active` or `inactive`. - `currentBalance`: The current point balance. - `pendingBalance`: The number of pending points. - `expiredBalance`: The number of expired points. - `spentBalance`: The number of spent points.
# @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 [Hash] opts the optional parameters
# @option opts [DateTime] :end_date Used to return expired, active, and pending loyalty balances before this timestamp. You can enter any past, present, or future timestamp value. **Note:** - It must be an RFC3339 timestamp string. - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered.
# @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
def export_loyalty_card_balances_with_http_info(loyalty_program_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.export_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 ManagementApi.export_loyalty_card_balances"
end
# resource path
local_var_path = '/v1/loyalty_programs/{loyaltyProgramId}/export_card_balances'.sub('{' + 'loyaltyProgramId' + '}', CGI.escape(loyalty_program_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/csv'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:body]
# return_type
return_type = opts[:return_type] || 'String'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#export_loyalty_card_balances\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Export card's ledger log
# Download a CSV file containing a loyalty card ledger log of the loyalty program. **Tip:** If the exported CSV file is too large to view, you can [split it into multiple files](https://www.makeuseof.com/tag/how-to-split-a-huge-csv-excel-workbook-into-seperate-files/).
# @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_id [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 range_start [DateTime] Only return results from after this timestamp. **Note:** - This must be an RFC3339 timestamp string. - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered.
# @param range_end [DateTime] Only return results from before this timestamp. **Note:** - This must be an RFC3339 timestamp string. - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered.
# @param [Hash] opts the optional parameters
# @option opts [String] :date_format Determines the format of dates in the export document.
# @return [String]
def export_loyalty_card_ledger(loyalty_program_id, loyalty_card_id, range_start, range_end, opts = {})
data, _status_code, _headers = export_loyalty_card_ledger_with_http_info(loyalty_program_id, loyalty_card_id, range_start, range_end, opts)
data
end
# Export card's ledger log
# Download a CSV file containing a loyalty card ledger log of the loyalty program. **Tip:** If the exported CSV file is too large to view, you can [split it into multiple files](https://www.makeuseof.com/tag/how-to-split-a-huge-csv-excel-workbook-into-seperate-files/).
# @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_id [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 range_start [DateTime] Only return results from after this timestamp. **Note:** - This must be an RFC3339 timestamp string. - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered.
# @param range_end [DateTime] Only return results from before this timestamp. **Note:** - This must be an RFC3339 timestamp string. - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered.
# @param [Hash] opts the optional parameters
# @option opts [String] :date_format Determines the format of dates in the export document.
# @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
def export_loyalty_card_ledger_with_http_info(loyalty_program_id, loyalty_card_id, range_start, range_end, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.export_loyalty_card_ledger ...'
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 ManagementApi.export_loyalty_card_ledger"
end
# verify the required parameter 'loyalty_card_id' is set
if @api_client.config.client_side_validation && loyalty_card_id.nil?
fail ArgumentError, "Missing the required parameter 'loyalty_card_id' when calling ManagementApi.export_loyalty_card_ledger"
end
if @api_client.config.client_side_validation && loyalty_card_id.to_s.length > 108
fail ArgumentError, 'invalid value for "loyalty_card_id" when calling ManagementApi.export_loyalty_card_ledger, the character length must be smaller than or equal to 108.'
end
# verify the required parameter 'range_start' is set
if @api_client.config.client_side_validation && range_start.nil?
fail ArgumentError, "Missing the required parameter 'range_start' when calling ManagementApi.export_loyalty_card_ledger"
end
# verify the required parameter 'range_end' is set
if @api_client.config.client_side_validation && range_end.nil?
fail ArgumentError, "Missing the required parameter 'range_end' when calling ManagementApi.export_loyalty_card_ledger"
end
allowable_values = ["excel", "ISO8601"]
if @api_client.config.client_side_validation && opts[:'date_format'] && !allowable_values.include?(opts[:'date_format'])
fail ArgumentError, "invalid value for \"date_format\", must be one of #{allowable_values}"
end
# resource path
local_var_path = '/v1/loyalty_programs/{loyaltyProgramId}/cards/{loyaltyCardId}/export_log'.sub('{' + 'loyaltyProgramId' + '}', CGI.escape(loyalty_program_id.to_s)).sub('{' + 'loyaltyCardId' + '}', CGI.escape(loyalty_card_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'rangeStart'] = range_start
query_params[:'rangeEnd'] = range_end
query_params[:'dateFormat'] = opts[:'date_format'] if !opts[:'date_format'].nil?
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/csv'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:body]
# return_type
return_type = opts[:return_type] || 'String'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#export_loyalty_card_ledger\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Export loyalty cards
# Download a CSV file containing the loyalty cards from a specified loyalty program. **Tip:** If the exported CSV file is too large to view, you can [split it into multiple files](https://www.makeuseof.com/tag/how-to-split-a-huge-csv-excel-workbook-into-seperate-files/). The CSV file contains the following columns: - `identifier`: The unique identifier of the loyalty card. - `created`: The date and time the loyalty card was created. - `status`: The status of the loyalty card. - `userpercardlimit`: The maximum number of customer profiles that can be linked to the card. - `customerprofileids`: Integration IDs of the customer profiles linked to the card. - `blockreason`: The reason for transferring and blocking the loyalty card. - `generated`: An indicator of whether the loyalty card was generated. - `batchid`: The ID of the batch the loyalty card is in.
# @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 [Hash] opts the optional parameters
# @option opts [String] :batch_id Filter results by loyalty card batch ID.
# @option opts [String] :date_format Determines the format of dates in the export document.
# @return [String]
def export_loyalty_cards(loyalty_program_id, opts = {})
data, _status_code, _headers = export_loyalty_cards_with_http_info(loyalty_program_id, opts)
data
end
# Export loyalty cards
# Download a CSV file containing the loyalty cards from a specified loyalty program. **Tip:** If the exported CSV file is too large to view, you can [split it into multiple files](https://www.makeuseof.com/tag/how-to-split-a-huge-csv-excel-workbook-into-seperate-files/). The CSV file contains the following columns: - `identifier`: The unique identifier of the loyalty card. - `created`: The date and time the loyalty card was created. - `status`: The status of the loyalty card. - `userpercardlimit`: The maximum number of customer profiles that can be linked to the card. - `customerprofileids`: Integration IDs of the customer profiles linked to the card. - `blockreason`: The reason for transferring and blocking the loyalty card. - `generated`: An indicator of whether the loyalty card was generated. - `batchid`: The ID of the batch the loyalty card is in.
# @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 [Hash] opts the optional parameters
# @option opts [String] :batch_id Filter results by loyalty card batch ID.
# @option opts [String] :date_format Determines the format of dates in the export document.
# @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
def export_loyalty_cards_with_http_info(loyalty_program_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.export_loyalty_cards ...'
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 ManagementApi.export_loyalty_cards"
end
allowable_values = ["excel", "ISO8601"]
if @api_client.config.client_side_validation && opts[:'date_format'] && !allowable_values.include?(opts[:'date_format'])
fail ArgumentError, "invalid value for \"date_format\", must be one of #{allowable_values}"
end
# resource path
local_var_path = '/v1/loyalty_programs/{loyaltyProgramId}/cards/export'.sub('{' + 'loyaltyProgramId' + '}', CGI.escape(loyalty_program_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'batchId'] = opts[:'batch_id'] if !opts[:'batch_id'].nil?
query_params[:'dateFormat'] = opts[:'date_format'] if !opts[:'date_format'].nil?
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/csv'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:body]
# return_type
return_type = opts[:return_type] || 'String'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#export_loyalty_cards\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Export customer's transaction logs
# Download a CSV file containing a customer's transaction logs in the loyalty program. **Tip:** If the exported CSV file is too large to view, you can [split it into multiple files](https://www.makeuseof.com/tag/how-to-split-a-huge-csv-excel-workbook-into-seperate-files/). The generated file can contain the following columns: - `customerprofileid`: The ID of the profile. - `customersessionid`: The ID of the customer session. - `rulesetid`: The ID of the rule set. - `rulename`: The name of the rule. - `programid`: The ID of the loyalty program. - `type`: The transaction type, such as `addition` or `subtraction`. - `name`: The reason for the transaction. - `subledgerid`: The ID of the subledger, when applicable. - `startdate`: The start date of the program. - `expirydate`: The expiration date of the program. - `id`: The ID of the transaction. - `created`: The timestamp of the creation of the loyalty program. - `amount`: The number of points in that transaction. - `archived`: Whether the session related to the transaction is archived. - `campaignid`: The ID of the campaign.
# @param range_start [DateTime] Only return results from after this timestamp. **Note:** - This must be an RFC3339 timestamp string. - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered.
# @param range_end [DateTime] Only return results from before this timestamp. **Note:** - This must be an RFC3339 timestamp string. - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered.
# @param loyalty_program_id [String] The identifier for the loyalty program.
# @param integration_id [String] The identifier of the profile.
# @param [Hash] opts the optional parameters
# @option opts [String] :date_format Determines the format of dates in the export document.
# @return [String]
def export_loyalty_ledger(range_start, range_end, loyalty_program_id, integration_id, opts = {})
data, _status_code, _headers = export_loyalty_ledger_with_http_info(range_start, range_end, loyalty_program_id, integration_id, opts)
data
end
# Export customer's transaction logs
# Download a CSV file containing a customer's transaction logs in the loyalty program. **Tip:** If the exported CSV file is too large to view, you can [split it into multiple files](https://www.makeuseof.com/tag/how-to-split-a-huge-csv-excel-workbook-into-seperate-files/). The generated file can contain the following columns: - `customerprofileid`: The ID of the profile. - `customersessionid`: The ID of the customer session. - `rulesetid`: The ID of the rule set. - `rulename`: The name of the rule. - `programid`: The ID of the loyalty program. - `type`: The transaction type, such as `addition` or `subtraction`. - `name`: The reason for the transaction. - `subledgerid`: The ID of the subledger, when applicable. - `startdate`: The start date of the program. - `expirydate`: The expiration date of the program. - `id`: The ID of the transaction. - `created`: The timestamp of the creation of the loyalty program. - `amount`: The number of points in that transaction. - `archived`: Whether the session related to the transaction is archived. - `campaignid`: The ID of the campaign.
# @param range_start [DateTime] Only return results from after this timestamp. **Note:** - This must be an RFC3339 timestamp string. - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered.
# @param range_end [DateTime] Only return results from before this timestamp. **Note:** - This must be an RFC3339 timestamp string. - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered.
# @param loyalty_program_id [String] The identifier for the loyalty program.
# @param integration_id [String] The identifier of the profile.
# @param [Hash] opts the optional parameters
# @option opts [String] :date_format Determines the format of dates in the export document.
# @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
def export_loyalty_ledger_with_http_info(range_start, range_end, loyalty_program_id, integration_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.export_loyalty_ledger ...'
end
# verify the required parameter 'range_start' is set
if @api_client.config.client_side_validation && range_start.nil?
fail ArgumentError, "Missing the required parameter 'range_start' when calling ManagementApi.export_loyalty_ledger"
end
# verify the required parameter 'range_end' is set
if @api_client.config.client_side_validation && range_end.nil?
fail ArgumentError, "Missing the required parameter 'range_end' when calling ManagementApi.export_loyalty_ledger"
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 ManagementApi.export_loyalty_ledger"
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 ManagementApi.export_loyalty_ledger"
end
allowable_values = ["excel", "ISO8601"]
if @api_client.config.client_side_validation && opts[:'date_format'] && !allowable_values.include?(opts[:'date_format'])
fail ArgumentError, "invalid value for \"date_format\", must be one of #{allowable_values}"
end
# resource path
local_var_path = '/v1/loyalty_programs/{loyaltyProgramId}/profile/{integrationId}/export_log'.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[:'rangeStart'] = range_start
query_params[:'rangeEnd'] = range_end
query_params[:'dateFormat'] = opts[:'date_format'] if !opts[:'date_format'].nil?
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/csv'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:body]
# return_type
return_type = opts[:return_type] || 'String'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#export_loyalty_ledger\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Export giveaway codes of a giveaway pool
# Download a CSV file containing the giveaway codes of a specific giveaway pool. **Tip:** If the exported CSV file is too large to view, you can [split it into multiple files](https://www.makeuseof.com/tag/how-to-split-a-huge-csv-excel-workbook-into-seperate-files/). The CSV file contains the following columns: - `id`: The internal ID of the giveaway. - `poolid`: The internal ID of the giveaway pool. - `code`: The giveaway code. - `startdate`: The validity start date in RFC3339 of the giveaway (can be empty). - `enddate`: The validity end date in RFC3339 of the giveaway (can be empty). - `attributes`: Any custom attributes associated with the giveaway code (can be empty). - `used`: An indication of whether the giveaway is already awarded. - `importid`: The ID of the import which created the giveaway. - `created`: The creation time of the giveaway code. - `profileintegrationid`: The third-party integration ID of the customer profile that was awarded the giveaway. Can be empty if the giveaway was not awarded. - `profileid`: The internal ID of the customer profile that was awarded the giveaway. Can be empty if the giveaway was not awarded or an internal ID does not exist.
# @param pool_id [Integer] The ID of the pool. You can find it in the Campaign Manager, in the **Giveaways** section.
# @param [Hash] opts the optional parameters
# @option opts [DateTime] :created_before Timestamp that filters the results to only contain giveaways created before this date. Must be an RFC3339 timestamp string.
# @option opts [DateTime] :created_after Timestamp that filters the results to only contain giveaways created after this date. Must be an RFC3339 timestamp string.
# @return [String]
def export_pool_giveaways(pool_id, opts = {})
data, _status_code, _headers = export_pool_giveaways_with_http_info(pool_id, opts)
data
end
# Export giveaway codes of a giveaway pool
# Download a CSV file containing the giveaway codes of a specific giveaway pool. **Tip:** If the exported CSV file is too large to view, you can [split it into multiple files](https://www.makeuseof.com/tag/how-to-split-a-huge-csv-excel-workbook-into-seperate-files/). The CSV file contains the following columns: - `id`: The internal ID of the giveaway. - `poolid`: The internal ID of the giveaway pool. - `code`: The giveaway code. - `startdate`: The validity start date in RFC3339 of the giveaway (can be empty). - `enddate`: The validity end date in RFC3339 of the giveaway (can be empty). - `attributes`: Any custom attributes associated with the giveaway code (can be empty). - `used`: An indication of whether the giveaway is already awarded. - `importid`: The ID of the import which created the giveaway. - `created`: The creation time of the giveaway code. - `profileintegrationid`: The third-party integration ID of the customer profile that was awarded the giveaway. Can be empty if the giveaway was not awarded. - `profileid`: The internal ID of the customer profile that was awarded the giveaway. Can be empty if the giveaway was not awarded or an internal ID does not exist.
# @param pool_id [Integer] The ID of the pool. You can find it in the Campaign Manager, in the **Giveaways** section.
# @param [Hash] opts the optional parameters
# @option opts [DateTime] :created_before Timestamp that filters the results to only contain giveaways created before this date. Must be an RFC3339 timestamp string.
# @option opts [DateTime] :created_after Timestamp that filters the results to only contain giveaways created after this date. Must be an RFC3339 timestamp string.
# @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
def export_pool_giveaways_with_http_info(pool_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.export_pool_giveaways ...'
end
# verify the required parameter 'pool_id' is set
if @api_client.config.client_side_validation && pool_id.nil?
fail ArgumentError, "Missing the required parameter 'pool_id' when calling ManagementApi.export_pool_giveaways"
end
# resource path
local_var_path = '/v1/giveaways/pools/{poolId}/export'.sub('{' + 'poolId' + '}', CGI.escape(pool_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'createdBefore'] = opts[:'created_before'] if !opts[:'created_before'].nil?
query_params[:'createdAfter'] = opts[:'created_after'] if !opts[:'created_after'].nil?
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/csv'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:body]
# return_type
return_type = opts[:return_type] || 'String'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#export_pool_giveaways\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Export referrals
# Download a CSV file containing the referrals that match the given parameters. **Tip:** If the exported CSV file is too large to view, you can [split it into multiple files](https://www.makeuseof.com/tag/how-to-split-a-huge-csv-excel-workbook-into-seperate-files/). The CSV file contains the following columns: - `code`: The referral code. - `advocateprofileintegrationid`: The profile ID of the advocate. - `startdate`: The start date in RFC3339 of the code redemption period. - `expirydate`: The end date in RFC3339 of the code redemption period. - `limitval`: The maximum number of redemptions of this code. Defaults to `1` when left blank. - `attributes`: A json object describing _custom_ referral attribute names and their values.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [Float] :campaign_id Filter results by campaign ID.
# @option opts [DateTime] :created_before Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the referral creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :created_after Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the referral creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [String] :valid - `expired`: Matches referrals in which the expiration date is set and in the past. - `validNow`: Matches referrals in which start date is null or in the past and expiration date is null or in the future. - `validFuture`: Matches referrals in which start date is set and in the future.
# @option opts [String] :usable - `true`, only referrals where `usageCounter < usageLimit` will be returned. - `false`, only referrals where `usageCounter >= usageLimit` will be returned.
# @option opts [String] :batch_id Filter results by batches of referrals
# @option opts [String] :date_format Determines the format of dates in the export document.
# @return [String]
def export_referrals(application_id, opts = {})
data, _status_code, _headers = export_referrals_with_http_info(application_id, opts)
data
end
# Export referrals
# Download a CSV file containing the referrals that match the given parameters. **Tip:** If the exported CSV file is too large to view, you can [split it into multiple files](https://www.makeuseof.com/tag/how-to-split-a-huge-csv-excel-workbook-into-seperate-files/). The CSV file contains the following columns: - `code`: The referral code. - `advocateprofileintegrationid`: The profile ID of the advocate. - `startdate`: The start date in RFC3339 of the code redemption period. - `expirydate`: The end date in RFC3339 of the code redemption period. - `limitval`: The maximum number of redemptions of this code. Defaults to `1` when left blank. - `attributes`: A json object describing _custom_ referral attribute names and their values.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [Float] :campaign_id Filter results by campaign ID.
# @option opts [DateTime] :created_before Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the referral creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :created_after Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the referral creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [String] :valid - `expired`: Matches referrals in which the expiration date is set and in the past. - `validNow`: Matches referrals in which start date is null or in the past and expiration date is null or in the future. - `validFuture`: Matches referrals in which start date is set and in the future.
# @option opts [String] :usable - `true`, only referrals where `usageCounter < usageLimit` will be returned. - `false`, only referrals where `usageCounter >= usageLimit` will be returned.
# @option opts [String] :batch_id Filter results by batches of referrals
# @option opts [String] :date_format Determines the format of dates in the export document.
# @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
def export_referrals_with_http_info(application_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.export_referrals ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.export_referrals"
end
allowable_values = ["expired", "validNow", "validFuture"]
if @api_client.config.client_side_validation && opts[:'valid'] && !allowable_values.include?(opts[:'valid'])
fail ArgumentError, "invalid value for \"valid\", must be one of #{allowable_values}"
end
allowable_values = ["true", "false"]
if @api_client.config.client_side_validation && opts[:'usable'] && !allowable_values.include?(opts[:'usable'])
fail ArgumentError, "invalid value for \"usable\", must be one of #{allowable_values}"
end
allowable_values = ["excel", "ISO8601"]
if @api_client.config.client_side_validation && opts[:'date_format'] && !allowable_values.include?(opts[:'date_format'])
fail ArgumentError, "invalid value for \"date_format\", must be one of #{allowable_values}"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/export_referrals'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'campaignId'] = opts[:'campaign_id'] if !opts[:'campaign_id'].nil?
query_params[:'createdBefore'] = opts[:'created_before'] if !opts[:'created_before'].nil?
query_params[:'createdAfter'] = opts[:'created_after'] if !opts[:'created_after'].nil?
query_params[:'valid'] = opts[:'valid'] if !opts[:'valid'].nil?
query_params[:'usable'] = opts[:'usable'] if !opts[:'usable'].nil?
query_params[:'batchId'] = opts[:'batch_id'] if !opts[:'batch_id'].nil?
query_params[:'dateFormat'] = opts[:'date_format'] if !opts[:'date_format'].nil?
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/csv'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:body]
# return_type
return_type = opts[:return_type] || 'String'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#export_referrals\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get access logs for Application
# Retrieve the list of API calls sent to the specified Application.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param range_start [DateTime] Only return results from after this timestamp. **Note:** - This must be an RFC3339 timestamp string. - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered.
# @param range_end [DateTime] Only return results from before this timestamp. **Note:** - This must be an RFC3339 timestamp string. - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered.
# @param [Hash] opts the optional parameters
# @option opts [String] :path Only return results where the request path matches the given regular expression.
# @option opts [String] :method Only return results where the request method matches the given regular expression.
# @option opts [String] :status Filter results by HTTP status codes.
# @option opts [Integer] :page_size The number of items in the response. (default to 1000)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @return [InlineResponse20019]
def get_access_logs_without_total_count(application_id, range_start, range_end, opts = {})
data, _status_code, _headers = get_access_logs_without_total_count_with_http_info(application_id, range_start, range_end, opts)
data
end
# Get access logs for Application
# Retrieve the list of API calls sent to the specified Application.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param range_start [DateTime] Only return results from after this timestamp. **Note:** - This must be an RFC3339 timestamp string. - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered.
# @param range_end [DateTime] Only return results from before this timestamp. **Note:** - This must be an RFC3339 timestamp string. - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered.
# @param [Hash] opts the optional parameters
# @option opts [String] :path Only return results where the request path matches the given regular expression.
# @option opts [String] :method Only return results where the request method matches the given regular expression.
# @option opts [String] :status Filter results by HTTP status codes.
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @return [Array<(InlineResponse20019, Integer, Hash)>] InlineResponse20019 data, response status code and response headers
def get_access_logs_without_total_count_with_http_info(application_id, range_start, range_end, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_access_logs_without_total_count ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.get_access_logs_without_total_count"
end
# verify the required parameter 'range_start' is set
if @api_client.config.client_side_validation && range_start.nil?
fail ArgumentError, "Missing the required parameter 'range_start' when calling ManagementApi.get_access_logs_without_total_count"
end
# verify the required parameter 'range_end' is set
if @api_client.config.client_side_validation && range_end.nil?
fail ArgumentError, "Missing the required parameter 'range_end' when calling ManagementApi.get_access_logs_without_total_count"
end
allowable_values = ["get", "put", "post", "delete", "patch"]
if @api_client.config.client_side_validation && opts[:'method'] && !allowable_values.include?(opts[:'method'])
fail ArgumentError, "invalid value for \"method\", must be one of #{allowable_values}"
end
allowable_values = ["success", "error"]
if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
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 ManagementApi.get_access_logs_without_total_count, 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 ManagementApi.get_access_logs_without_total_count, must be greater than or equal to 1.'
end
# resource path
local_var_path = '/v1/applications/{applicationId}/access_logs/no_total'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'rangeStart'] = range_start
query_params[:'rangeEnd'] = range_end
query_params[:'path'] = opts[:'path'] if !opts[:'path'].nil?
query_params[:'method'] = opts[:'method'] if !opts[:'method'].nil?
query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].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] || 'InlineResponse20019'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_access_logs_without_total_count\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get account details
# Return the details of your companies Talon.One account.
# @param account_id [Integer] The identifier of the account. Retrieve it via the [List users in account](https://docs.talon.one/management-api#operation/getUsers) endpoint in the `accountId` property.
# @param [Hash] opts the optional parameters
# @return [Account]
def get_account(account_id, opts = {})
data, _status_code, _headers = get_account_with_http_info(account_id, opts)
data
end
# Get account details
# Return the details of your companies Talon.One account.
# @param account_id [Integer] The identifier of the account. Retrieve it via the [List users in account](https://docs.talon.one/management-api#operation/getUsers) endpoint in the `accountId` property.
# @param [Hash] opts the optional parameters
# @return [Array<(Account, Integer, Hash)>] Account data, response status code and response headers
def get_account_with_http_info(account_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_account ...'
end
# verify the required parameter 'account_id' is set
if @api_client.config.client_side_validation && account_id.nil?
fail ArgumentError, "Missing the required parameter 'account_id' when calling ManagementApi.get_account"
end
# resource path
local_var_path = '/v1/accounts/{accountId}'.sub('{' + 'accountId' + '}', CGI.escape(account_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] || 'Account'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_account\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get account analytics
# Return the analytics of your Talon.One account.
# @param account_id [Integer] The identifier of the account. Retrieve it via the [List users in account](https://docs.talon.one/management-api#operation/getUsers) endpoint in the `accountId` property.
# @param [Hash] opts the optional parameters
# @return [AccountAnalytics]
def get_account_analytics(account_id, opts = {})
data, _status_code, _headers = get_account_analytics_with_http_info(account_id, opts)
data
end
# Get account analytics
# Return the analytics of your Talon.One account.
# @param account_id [Integer] The identifier of the account. Retrieve it via the [List users in account](https://docs.talon.one/management-api#operation/getUsers) endpoint in the `accountId` property.
# @param [Hash] opts the optional parameters
# @return [Array<(AccountAnalytics, Integer, Hash)>] AccountAnalytics data, response status code and response headers
def get_account_analytics_with_http_info(account_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_account_analytics ...'
end
# verify the required parameter 'account_id' is set
if @api_client.config.client_side_validation && account_id.nil?
fail ArgumentError, "Missing the required parameter 'account_id' when calling ManagementApi.get_account_analytics"
end
# resource path
local_var_path = '/v1/accounts/{accountId}/analytics'.sub('{' + 'accountId' + '}', CGI.escape(account_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] || 'AccountAnalytics'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_account_analytics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get account-level collection
# Retrieve a given account-level collection.
# @param collection_id [Integer] The ID of the collection. You can get it with the [List collections in account](#operation/listAccountCollections) endpoint.
# @param [Hash] opts the optional parameters
# @return [Collection]
def get_account_collection(collection_id, opts = {})
data, _status_code, _headers = get_account_collection_with_http_info(collection_id, opts)
data
end
# Get account-level collection
# Retrieve a given account-level collection.
# @param collection_id [Integer] The ID of the collection. You can get it with the [List collections in account](#operation/listAccountCollections) endpoint.
# @param [Hash] opts the optional parameters
# @return [Array<(Collection, Integer, Hash)>] Collection data, response status code and response headers
def get_account_collection_with_http_info(collection_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_account_collection ...'
end
# verify the required parameter 'collection_id' is set
if @api_client.config.client_side_validation && collection_id.nil?
fail ArgumentError, "Missing the required parameter 'collection_id' when calling ManagementApi.get_account_collection"
end
# resource path
local_var_path = '/v1/collections/{collectionId}'.sub('{' + 'collectionId' + '}', CGI.escape(collection_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] || 'Collection'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_account_collection\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get achievement
# Get the details of a specific achievement.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param achievement_id [Integer] The ID of the achievement. You can get this ID with the [List achievement](https://docs.talon.one/management-api#tag/Achievements/operation/listAchievements) endpoint.
# @param [Hash] opts the optional parameters
# @return [Achievement]
def get_achievement(application_id, campaign_id, achievement_id, opts = {})
data, _status_code, _headers = get_achievement_with_http_info(application_id, campaign_id, achievement_id, opts)
data
end
# Get achievement
# Get the details of a specific achievement.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param achievement_id [Integer] The ID of the achievement. You can get this ID with the [List achievement](https://docs.talon.one/management-api#tag/Achievements/operation/listAchievements) endpoint.
# @param [Hash] opts the optional parameters
# @return [Array<(Achievement, Integer, Hash)>] Achievement data, response status code and response headers
def get_achievement_with_http_info(application_id, campaign_id, achievement_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_achievement ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.get_achievement"
end
# verify the required parameter 'campaign_id' is set
if @api_client.config.client_side_validation && campaign_id.nil?
fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ManagementApi.get_achievement"
end
# verify the required parameter 'achievement_id' is set
if @api_client.config.client_side_validation && achievement_id.nil?
fail ArgumentError, "Missing the required parameter 'achievement_id' when calling ManagementApi.get_achievement"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/campaigns/{campaignId}/achievements/{achievementId}'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'achievementId' + '}', CGI.escape(achievement_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] || 'Achievement'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_achievement\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get additional cost
# Returns the additional cost.
# @param additional_cost_id [Integer] The ID of the additional cost. You can find the ID the the Campaign Manager's URL when you display the details of the cost in **Account** > **Tools** > **Additional costs**.
# @param [Hash] opts the optional parameters
# @return [AccountAdditionalCost]
def get_additional_cost(additional_cost_id, opts = {})
data, _status_code, _headers = get_additional_cost_with_http_info(additional_cost_id, opts)
data
end
# Get additional cost
# Returns the additional cost.
# @param additional_cost_id [Integer] The ID of the additional cost. You can find the ID the the Campaign Manager's URL when you display the details of the cost in **Account** > **Tools** > **Additional costs**.
# @param [Hash] opts the optional parameters
# @return [Array<(AccountAdditionalCost, Integer, Hash)>] AccountAdditionalCost data, response status code and response headers
def get_additional_cost_with_http_info(additional_cost_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_additional_cost ...'
end
# verify the required parameter 'additional_cost_id' is set
if @api_client.config.client_side_validation && additional_cost_id.nil?
fail ArgumentError, "Missing the required parameter 'additional_cost_id' when calling ManagementApi.get_additional_cost"
end
# resource path
local_var_path = '/v1/additional_costs/{additionalCostId}'.sub('{' + 'additionalCostId' + '}', CGI.escape(additional_cost_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] || 'AccountAdditionalCost'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_additional_cost\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List additional costs
# Returns all the defined additional costs for the account.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response. (default to 1000)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @return [InlineResponse20035]
def get_additional_costs(opts = {})
data, _status_code, _headers = get_additional_costs_with_http_info(opts)
data
end
# List additional costs
# Returns all the defined additional costs for the account.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @return [Array<(InlineResponse20035, Integer, Hash)>] InlineResponse20035 data, response status code and response headers
def get_additional_costs_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_additional_costs ...'
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 ManagementApi.get_additional_costs, 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 ManagementApi.get_additional_costs, must be greater than or equal to 1.'
end
# resource path
local_var_path = '/v1/additional_costs'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].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] || 'InlineResponse20035'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_additional_costs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get Application
# Get the application specified by the ID.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @return [Application]
def get_application(application_id, opts = {})
data, _status_code, _headers = get_application_with_http_info(application_id, opts)
data
end
# Get Application
# Get the application specified by the ID.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @return [Array<(Application, Integer, Hash)>] Application data, response status code and response headers
def get_application_with_http_info(application_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_application ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.get_application"
end
# resource path
local_var_path = '/v1/applications/{applicationId}'.sub('{' + 'applicationId' + '}', CGI.escape(application_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] || 'Application'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_application\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get Application health
# Display the health of the Application and show the last time the Application was used. You can also find this information in the Campaign Manager. In your Application, click **Settings** > **Integration API Keys**. See the [docs](https://docs.talon.one/docs/dev/tutorials/monitoring-integration-status).
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @return [ApplicationApiHealth]
def get_application_api_health(application_id, opts = {})
data, _status_code, _headers = get_application_api_health_with_http_info(application_id, opts)
data
end
# Get Application health
# Display the health of the Application and show the last time the Application was used. You can also find this information in the Campaign Manager. In your Application, click **Settings** > **Integration API Keys**. See the [docs](https://docs.talon.one/docs/dev/tutorials/monitoring-integration-status).
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @return [Array<(ApplicationApiHealth, Integer, Hash)>] ApplicationApiHealth data, response status code and response headers
def get_application_api_health_with_http_info(application_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_application_api_health ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.get_application_api_health"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/health_report'.sub('{' + 'applicationId' + '}', CGI.escape(application_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] || 'ApplicationApiHealth'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_application_api_health\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get application's customer
# Retrieve the customers of the specified application.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param customer_id [Integer] The value of the `id` property of a customer profile. Get it with the [List Application's customers](https://docs.talon.one/management-api#operation/getApplicationCustomers) endpoint.
# @param [Hash] opts the optional parameters
# @return [ApplicationCustomer]
def get_application_customer(application_id, customer_id, opts = {})
data, _status_code, _headers = get_application_customer_with_http_info(application_id, customer_id, opts)
data
end
# Get application's customer
# Retrieve the customers of the specified application.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param customer_id [Integer] The value of the `id` property of a customer profile. Get it with the [List Application's customers](https://docs.talon.one/management-api#operation/getApplicationCustomers) endpoint.
# @param [Hash] opts the optional parameters
# @return [Array<(ApplicationCustomer, Integer, Hash)>] ApplicationCustomer data, response status code and response headers
def get_application_customer_with_http_info(application_id, customer_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_application_customer ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.get_application_customer"
end
# verify the required parameter 'customer_id' is set
if @api_client.config.client_side_validation && customer_id.nil?
fail ArgumentError, "Missing the required parameter 'customer_id' when calling ManagementApi.get_application_customer"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/customers/{customerId}'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'customerId' + '}', CGI.escape(customer_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] || 'ApplicationCustomer'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_application_customer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List friends referred by customer profile
# List the friends referred by the specified customer profile in this Application.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param integration_id [String] The Integration ID of the Advocate's Profile.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response. (default to 1000)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [Boolean] :with_total_result_size When this flag is set, the result includes the total size of the result, across all pages. This might decrease performance on large data sets. - When `true`: `hasMore` is true when there is a next page. `totalResultSize` is always zero. - When `false`: `hasMore` is always false. `totalResultSize` contains the total number of results for this query.
# @return [InlineResponse20032]
def get_application_customer_friends(application_id, integration_id, opts = {})
data, _status_code, _headers = get_application_customer_friends_with_http_info(application_id, integration_id, opts)
data
end
# List friends referred by customer profile
# List the friends referred by the specified customer profile in this Application.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param integration_id [String] The Integration ID of the Advocate's Profile.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [Boolean] :with_total_result_size When this flag is set, the result includes the total size of the result, across all pages. This might decrease performance on large data sets. - When `true`: `hasMore` is true when there is a next page. `totalResultSize` is always zero. - When `false`: `hasMore` is always false. `totalResultSize` contains the total number of results for this query.
# @return [Array<(InlineResponse20032, Integer, Hash)>] InlineResponse20032 data, response status code and response headers
def get_application_customer_friends_with_http_info(application_id, integration_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_application_customer_friends ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.get_application_customer_friends"
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 ManagementApi.get_application_customer_friends"
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 ManagementApi.get_application_customer_friends, 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 ManagementApi.get_application_customer_friends, must be greater than or equal to 1.'
end
# resource path
local_var_path = '/v1/applications/{applicationId}/profile/{integrationId}/friends'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'integrationId' + '}', CGI.escape(integration_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
query_params[:'withTotalResultSize'] = opts[:'with_total_result_size'] if !opts[:'with_total_result_size'].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] || 'InlineResponse20032'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_application_customer_friends\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List application's customers
# List all the customers of the specified application.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [String] :integration_id Filter results performing an exact matching against the profile integration identifier.
# @option opts [Integer] :page_size The number of items in the response. (default to 1000)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [Boolean] :with_total_result_size When this flag is set, the result includes the total size of the result, across all pages. This might decrease performance on large data sets. - When `true`: `hasMore` is true when there is a next page. `totalResultSize` is always zero. - When `false`: `hasMore` is always false. `totalResultSize` contains the total number of results for this query.
# @return [InlineResponse20021]
def get_application_customers(application_id, opts = {})
data, _status_code, _headers = get_application_customers_with_http_info(application_id, opts)
data
end
# List application's customers
# List all the customers of the specified application.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [String] :integration_id Filter results performing an exact matching against the profile integration identifier.
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [Boolean] :with_total_result_size When this flag is set, the result includes the total size of the result, across all pages. This might decrease performance on large data sets. - When `true`: `hasMore` is true when there is a next page. `totalResultSize` is always zero. - When `false`: `hasMore` is always false. `totalResultSize` contains the total number of results for this query.
# @return [Array<(InlineResponse20021, Integer, Hash)>] InlineResponse20021 data, response status code and response headers
def get_application_customers_with_http_info(application_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_application_customers ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.get_application_customers"
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 ManagementApi.get_application_customers, 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 ManagementApi.get_application_customers, must be greater than or equal to 1.'
end
# resource path
local_var_path = '/v1/applications/{applicationId}/customers'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'integrationId'] = opts[:'integration_id'] if !opts[:'integration_id'].nil?
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
query_params[:'withTotalResultSize'] = opts[:'with_total_result_size'] if !opts[:'with_total_result_size'].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] || 'InlineResponse20021'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_application_customers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List application customers matching the given attributes
# Get a list of the application customers matching the provided criteria. The match is successful if all the attributes of the request are found in a profile, even if the profile has more attributes that are not present on the request.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param body [CustomerProfileSearchQuery] body
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response. (default to 1000)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [Boolean] :with_total_result_size When this flag is set, the result includes the total size of the result, across all pages. This might decrease performance on large data sets. - When `true`: `hasMore` is true when there is a next page. `totalResultSize` is always zero. - When `false`: `hasMore` is always false. `totalResultSize` contains the total number of results for this query.
# @return [InlineResponse20022]
def get_application_customers_by_attributes(application_id, body, opts = {})
data, _status_code, _headers = get_application_customers_by_attributes_with_http_info(application_id, body, opts)
data
end
# List application customers matching the given attributes
# Get a list of the application customers matching the provided criteria. The match is successful if all the attributes of the request are found in a profile, even if the profile has more attributes that are not present on the request.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param body [CustomerProfileSearchQuery] body
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [Boolean] :with_total_result_size When this flag is set, the result includes the total size of the result, across all pages. This might decrease performance on large data sets. - When `true`: `hasMore` is true when there is a next page. `totalResultSize` is always zero. - When `false`: `hasMore` is always false. `totalResultSize` contains the total number of results for this query.
# @return [Array<(InlineResponse20022, Integer, Hash)>] InlineResponse20022 data, response status code and response headers
def get_application_customers_by_attributes_with_http_info(application_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_application_customers_by_attributes ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.get_application_customers_by_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 ManagementApi.get_application_customers_by_attributes"
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 ManagementApi.get_application_customers_by_attributes, 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 ManagementApi.get_application_customers_by_attributes, must be greater than or equal to 1.'
end
# resource path
local_var_path = '/v1/applications/{applicationId}/customer_search'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
query_params[:'withTotalResultSize'] = opts[:'with_total_result_size'] if !opts[:'with_total_result_size'].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] || 'InlineResponse20022'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_application_customers_by_attributes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List Applications event types
# Get all of the distinct values of the Event `type` property for events recorded in the application. See also: [Track an event](https://docs.talon.one/integration-api#tag/Events/operation/trackEventV2)
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response. (default to 1000)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @return [InlineResponse20028]
def get_application_event_types(application_id, opts = {})
data, _status_code, _headers = get_application_event_types_with_http_info(application_id, opts)
data
end
# List Applications event types
# Get all of the distinct values of the Event `type` property for events recorded in the application. See also: [Track an event](https://docs.talon.one/integration-api#tag/Events/operation/trackEventV2)
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @return [Array<(InlineResponse20028, Integer, Hash)>] InlineResponse20028 data, response status code and response headers
def get_application_event_types_with_http_info(application_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_application_event_types ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.get_application_event_types"
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 ManagementApi.get_application_event_types, 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 ManagementApi.get_application_event_types, must be greater than or equal to 1.'
end
# resource path
local_var_path = '/v1/applications/{applicationId}/event_types'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].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] || 'InlineResponse20028'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_application_event_types\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List Applications events
# Lists all events recorded for an application. Instead of having the total number of results in the response, this endpoint only mentions whether there are more results.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response. (default to 1000)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [String] :type Comma-separated list of types by which to filter events. Must be exact match(es).
# @option opts [DateTime] :created_before Only return events created before this date. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :created_after Only return events created after this date. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [String] :session Session integration ID filter for events. Must be exact match.
# @option opts [String] :profile Profile integration ID filter for events. Must be exact match.
# @option opts [String] :customer_name Customer name filter for events. Will match substrings case-insensitively.
# @option opts [String] :customer_email Customer e-mail address filter for events. Will match substrings case-insensitively.
# @option opts [String] :coupon_code Coupon code
# @option opts [String] :referral_code Referral code
# @option opts [String] :rule_query Rule name filter for events
# @option opts [String] :campaign_query Campaign name filter for events
# @return [InlineResponse20027]
def get_application_events_without_total_count(application_id, opts = {})
data, _status_code, _headers = get_application_events_without_total_count_with_http_info(application_id, opts)
data
end
# List Applications events
# Lists all events recorded for an application. Instead of having the total number of results in the response, this endpoint only mentions whether there are more results.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [String] :type Comma-separated list of types by which to filter events. Must be exact match(es).
# @option opts [DateTime] :created_before Only return events created before this date. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :created_after Only return events created after this date. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [String] :session Session integration ID filter for events. Must be exact match.
# @option opts [String] :profile Profile integration ID filter for events. Must be exact match.
# @option opts [String] :customer_name Customer name filter for events. Will match substrings case-insensitively.
# @option opts [String] :customer_email Customer e-mail address filter for events. Will match substrings case-insensitively.
# @option opts [String] :coupon_code Coupon code
# @option opts [String] :referral_code Referral code
# @option opts [String] :rule_query Rule name filter for events
# @option opts [String] :campaign_query Campaign name filter for events
# @return [Array<(InlineResponse20027, Integer, Hash)>] InlineResponse20027 data, response status code and response headers
def get_application_events_without_total_count_with_http_info(application_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_application_events_without_total_count ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.get_application_events_without_total_count"
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 ManagementApi.get_application_events_without_total_count, 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 ManagementApi.get_application_events_without_total_count, must be greater than or equal to 1.'
end
if @api_client.config.client_side_validation && !opts[:'customer_name'].nil? && opts[:'customer_name'].to_s.length < 2
fail ArgumentError, 'invalid value for "opts[:"customer_name"]" when calling ManagementApi.get_application_events_without_total_count, the character length must be great than or equal to 2.'
end
if @api_client.config.client_side_validation && !opts[:'customer_email'].nil? && opts[:'customer_email'].to_s.length < 2
fail ArgumentError, 'invalid value for "opts[:"customer_email"]" when calling ManagementApi.get_application_events_without_total_count, the character length must be great than or equal to 2.'
end
# resource path
local_var_path = '/v1/applications/{applicationId}/events/no_total'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?
query_params[:'createdBefore'] = opts[:'created_before'] if !opts[:'created_before'].nil?
query_params[:'createdAfter'] = opts[:'created_after'] if !opts[:'created_after'].nil?
query_params[:'session'] = opts[:'session'] if !opts[:'session'].nil?
query_params[:'profile'] = opts[:'profile'] if !opts[:'profile'].nil?
query_params[:'customerName'] = opts[:'customer_name'] if !opts[:'customer_name'].nil?
query_params[:'customerEmail'] = opts[:'customer_email'] if !opts[:'customer_email'].nil?
query_params[:'couponCode'] = opts[:'coupon_code'] if !opts[:'coupon_code'].nil?
query_params[:'referralCode'] = opts[:'referral_code'] if !opts[:'referral_code'].nil?
query_params[:'ruleQuery'] = opts[:'rule_query'] if !opts[:'rule_query'].nil?
query_params[:'campaignQuery'] = opts[:'campaign_query'] if !opts[:'campaign_query'].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] || 'InlineResponse20027'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_application_events_without_total_count\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get Application session
# Get the details of the given session. You can list the sessions with the [List Application sessions](https://docs.talon.one/management-api#tag/Customer-data/operation/getApplicationSessions) endpoint.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param session_id [Integer] The **internal** ID of the session. You can get the ID with the [List Application sessions](https://docs.talon.one/management-api#tag/Customer-data/operation/getApplicationSessions) endpoint.
# @param [Hash] opts the optional parameters
# @return [ApplicationSession]
def get_application_session(application_id, session_id, opts = {})
data, _status_code, _headers = get_application_session_with_http_info(application_id, session_id, opts)
data
end
# Get Application session
# Get the details of the given session. You can list the sessions with the [List Application sessions](https://docs.talon.one/management-api#tag/Customer-data/operation/getApplicationSessions) endpoint.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param session_id [Integer] The **internal** ID of the session. You can get the ID with the [List Application sessions](https://docs.talon.one/management-api#tag/Customer-data/operation/getApplicationSessions) endpoint.
# @param [Hash] opts the optional parameters
# @return [Array<(ApplicationSession, Integer, Hash)>] ApplicationSession data, response status code and response headers
def get_application_session_with_http_info(application_id, session_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_application_session ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.get_application_session"
end
# verify the required parameter 'session_id' is set
if @api_client.config.client_side_validation && session_id.nil?
fail ArgumentError, "Missing the required parameter 'session_id' when calling ManagementApi.get_application_session"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/sessions/{sessionId}'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'sessionId' + '}', CGI.escape(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] || 'ApplicationSession'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_application_session\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List Application sessions
# List all the sessions of the specified Application.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response. (default to 1000)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [String] :profile Profile integration ID filter for sessions. Must be exact match.
# @option opts [String] :state Filter by sessions with this state. Must be exact match.
# @option opts [DateTime] :created_before Only return events created before this date. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :created_after Only return events created after this date. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [String] :coupon Filter by sessions with this coupon. Must be exact match.
# @option opts [String] :referral Filter by sessions with this referral. Must be exact match.
# @option opts [String] :integration_id Filter by sessions with this integration ID. Must be exact match.
# @option opts [String] :store_integration_id The integration ID of the store. You choose this ID when you create a store.
# @return [InlineResponse20026]
def get_application_sessions(application_id, opts = {})
data, _status_code, _headers = get_application_sessions_with_http_info(application_id, opts)
data
end
# List Application sessions
# List all the sessions of the specified Application.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [String] :profile Profile integration ID filter for sessions. Must be exact match.
# @option opts [String] :state Filter by sessions with this state. Must be exact match.
# @option opts [DateTime] :created_before Only return events created before this date. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :created_after Only return events created after this date. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [String] :coupon Filter by sessions with this coupon. Must be exact match.
# @option opts [String] :referral Filter by sessions with this referral. Must be exact match.
# @option opts [String] :integration_id Filter by sessions with this integration ID. Must be exact match.
# @option opts [String] :store_integration_id The integration ID of the store. You choose this ID when you create a store.
# @return [Array<(InlineResponse20026, Integer, Hash)>] InlineResponse20026 data, response status code and response headers
def get_application_sessions_with_http_info(application_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_application_sessions ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.get_application_sessions"
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 ManagementApi.get_application_sessions, 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 ManagementApi.get_application_sessions, must be greater than or equal to 1.'
end
allowable_values = ["open", "closed", "partially_returned", "cancelled"]
if @api_client.config.client_side_validation && opts[:'state'] && !allowable_values.include?(opts[:'state'])
fail ArgumentError, "invalid value for \"state\", must be one of #{allowable_values}"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/sessions'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
query_params[:'profile'] = opts[:'profile'] if !opts[:'profile'].nil?
query_params[:'state'] = opts[:'state'] if !opts[:'state'].nil?
query_params[:'createdBefore'] = opts[:'created_before'] if !opts[:'created_before'].nil?
query_params[:'createdAfter'] = opts[:'created_after'] if !opts[:'created_after'].nil?
query_params[:'coupon'] = opts[:'coupon'] if !opts[:'coupon'].nil?
query_params[:'referral'] = opts[:'referral'] if !opts[:'referral'].nil?
query_params[:'integrationId'] = opts[:'integration_id'] if !opts[:'integration_id'].nil?
query_params[:'storeIntegrationId'] = opts[:'store_integration_id'] if !opts[:'store_integration_id'].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] || 'InlineResponse20026'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_application_sessions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List Applications
# List all applications in the current account.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response. (default to 1000)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @return [InlineResponse2005]
def get_applications(opts = {})
data, _status_code, _headers = get_applications_with_http_info(opts)
data
end
# List Applications
# List all applications in the current account.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @return [Array<(InlineResponse2005, Integer, Hash)>] InlineResponse2005 data, response status code and response headers
def get_applications_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_applications ...'
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 ManagementApi.get_applications, 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 ManagementApi.get_applications, must be greater than or equal to 1.'
end
# resource path
local_var_path = '/v1/applications'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].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] || 'InlineResponse2005'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_applications\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get custom attribute
# Retrieve the specified custom attribute.
# @param attribute_id [Integer] The ID of the attribute. You can find the ID in the Campaign Manager's URL when you display the details of an attribute in **Account** > **Tools** > **Attributes**.
# @param [Hash] opts the optional parameters
# @return [Attribute]
def get_attribute(attribute_id, opts = {})
data, _status_code, _headers = get_attribute_with_http_info(attribute_id, opts)
data
end
# Get custom attribute
# Retrieve the specified custom attribute.
# @param attribute_id [Integer] The ID of the attribute. You can find the ID in the Campaign Manager's URL when you display the details of an attribute in **Account** > **Tools** > **Attributes**.
# @param [Hash] opts the optional parameters
# @return [Array<(Attribute, Integer, Hash)>] Attribute data, response status code and response headers
def get_attribute_with_http_info(attribute_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_attribute ...'
end
# verify the required parameter 'attribute_id' is set
if @api_client.config.client_side_validation && attribute_id.nil?
fail ArgumentError, "Missing the required parameter 'attribute_id' when calling ManagementApi.get_attribute"
end
# resource path
local_var_path = '/v1/attributes/{attributeId}'.sub('{' + 'attributeId' + '}', CGI.escape(attribute_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] || 'Attribute'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_attribute\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List custom attributes
# Return all the custom attributes for the account.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response. (default to 1000)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [String] :entity Returned attributes will be filtered by supplied entity.
# @return [InlineResponse20033]
def get_attributes(opts = {})
data, _status_code, _headers = get_attributes_with_http_info(opts)
data
end
# List custom attributes
# Return all the custom attributes for the account.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [String] :entity Returned attributes will be filtered by supplied entity.
# @return [Array<(InlineResponse20033, Integer, Hash)>] InlineResponse20033 data, response status code and response headers
def get_attributes_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_attributes ...'
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 ManagementApi.get_attributes, 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 ManagementApi.get_attributes, must be greater than or equal to 1.'
end
# resource path
local_var_path = '/v1/attributes'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
query_params[:'entity'] = opts[:'entity'] if !opts[:'entity'].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] || 'InlineResponse20033'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_attributes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List audience members
# Get a paginated list of the customer profiles in a given audience. A maximum of 1000 customer profiles per page is allowed.
# @param audience_id [Integer] The ID of the audience.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response. (default to 1000)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [String] :profile_query The filter to select a profile.
# @return [InlineResponse20031]
def get_audience_memberships(audience_id, opts = {})
data, _status_code, _headers = get_audience_memberships_with_http_info(audience_id, opts)
data
end
# List audience members
# Get a paginated list of the customer profiles in a given audience. A maximum of 1000 customer profiles per page is allowed.
# @param audience_id [Integer] The ID of the audience.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [String] :profile_query The filter to select a profile.
# @return [Array<(InlineResponse20031, Integer, Hash)>] InlineResponse20031 data, response status code and response headers
def get_audience_memberships_with_http_info(audience_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_audience_memberships ...'
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 ManagementApi.get_audience_memberships"
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 ManagementApi.get_audience_memberships, 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 ManagementApi.get_audience_memberships, must be greater than or equal to 1.'
end
# resource path
local_var_path = '/v1/audiences/{audienceId}/memberships'.sub('{' + 'audienceId' + '}', CGI.escape(audience_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
query_params[:'profileQuery'] = opts[:'profile_query'] if !opts[:'profile_query'].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] || 'InlineResponse20031'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_audience_memberships\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List audiences
# Get all audiences created in the account. To create an audience, use [Create audience](https://docs.talon.one/integration-api#tag/Audiences/operation/createAudienceV2).
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response. (default to 1000)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [Boolean] :with_total_result_size When this flag is set, the result includes the total size of the result, across all pages. This might decrease performance on large data sets. - When `true`: `hasMore` is true when there is a next page. `totalResultSize` is always zero. - When `false`: `hasMore` is always false. `totalResultSize` contains the total number of results for this query.
# @return [InlineResponse20029]
def get_audiences(opts = {})
data, _status_code, _headers = get_audiences_with_http_info(opts)
data
end
# List audiences
# Get all audiences created in the account. To create an audience, use [Create audience](https://docs.talon.one/integration-api#tag/Audiences/operation/createAudienceV2).
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [Boolean] :with_total_result_size When this flag is set, the result includes the total size of the result, across all pages. This might decrease performance on large data sets. - When `true`: `hasMore` is true when there is a next page. `totalResultSize` is always zero. - When `false`: `hasMore` is always false. `totalResultSize` contains the total number of results for this query.
# @return [Array<(InlineResponse20029, Integer, Hash)>] InlineResponse20029 data, response status code and response headers
def get_audiences_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_audiences ...'
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 ManagementApi.get_audiences, 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 ManagementApi.get_audiences, must be greater than or equal to 1.'
end
# resource path
local_var_path = '/v1/audiences'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
query_params[:'withTotalResultSize'] = opts[:'with_total_result_size'] if !opts[:'with_total_result_size'].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] || 'InlineResponse20029'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_audiences\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List audience analytics
# Get a list of audience IDs and their member count.
# @param audience_ids [String] The IDs of one or more audiences, separated by commas, by which to filter results.
# @param [Hash] opts the optional parameters
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @return [InlineResponse20030]
def get_audiences_analytics(audience_ids, opts = {})
data, _status_code, _headers = get_audiences_analytics_with_http_info(audience_ids, opts)
data
end
# List audience analytics
# Get a list of audience IDs and their member count.
# @param audience_ids [String] The IDs of one or more audiences, separated by commas, by which to filter results.
# @param [Hash] opts the optional parameters
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @return [Array<(InlineResponse20030, Integer, Hash)>] InlineResponse20030 data, response status code and response headers
def get_audiences_analytics_with_http_info(audience_ids, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_audiences_analytics ...'
end
# verify the required parameter 'audience_ids' is set
if @api_client.config.client_side_validation && audience_ids.nil?
fail ArgumentError, "Missing the required parameter 'audience_ids' when calling ManagementApi.get_audiences_analytics"
end
# resource path
local_var_path = '/v1/audiences/analytics'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'audienceIds'] = audience_ids
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].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] || 'InlineResponse20030'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_audiences_analytics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get campaign
# Retrieve the given campaign.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @return [Campaign]
def get_campaign(application_id, campaign_id, opts = {})
data, _status_code, _headers = get_campaign_with_http_info(application_id, campaign_id, opts)
data
end
# Get campaign
# Retrieve the given campaign.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @return [Array<(Campaign, Integer, Hash)>] Campaign data, response status code and response headers
def get_campaign_with_http_info(application_id, campaign_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_campaign ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.get_campaign"
end
# verify the required parameter 'campaign_id' is set
if @api_client.config.client_side_validation && campaign_id.nil?
fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ManagementApi.get_campaign"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/campaigns/{campaignId}'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'campaignId' + '}', CGI.escape(campaign_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] || 'Campaign'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_campaign\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get analytics of campaigns
# Retrieve statistical data about the performance of the given campaign.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param range_start [DateTime] Only return results from after this timestamp. **Note:** - This must be an RFC3339 timestamp string. - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered.
# @param range_end [DateTime] Only return results from before this timestamp. **Note:** - This must be an RFC3339 timestamp string. - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered.
# @param [Hash] opts the optional parameters
# @option opts [String] :granularity The time interval between the results in the returned time-series.
# @return [InlineResponse20020]
def get_campaign_analytics(application_id, campaign_id, range_start, range_end, opts = {})
data, _status_code, _headers = get_campaign_analytics_with_http_info(application_id, campaign_id, range_start, range_end, opts)
data
end
# Get analytics of campaigns
# Retrieve statistical data about the performance of the given campaign.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param range_start [DateTime] Only return results from after this timestamp. **Note:** - This must be an RFC3339 timestamp string. - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered.
# @param range_end [DateTime] Only return results from before this timestamp. **Note:** - This must be an RFC3339 timestamp string. - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered.
# @param [Hash] opts the optional parameters
# @option opts [String] :granularity The time interval between the results in the returned time-series.
# @return [Array<(InlineResponse20020, Integer, Hash)>] InlineResponse20020 data, response status code and response headers
def get_campaign_analytics_with_http_info(application_id, campaign_id, range_start, range_end, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_campaign_analytics ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.get_campaign_analytics"
end
# verify the required parameter 'campaign_id' is set
if @api_client.config.client_side_validation && campaign_id.nil?
fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ManagementApi.get_campaign_analytics"
end
# verify the required parameter 'range_start' is set
if @api_client.config.client_side_validation && range_start.nil?
fail ArgumentError, "Missing the required parameter 'range_start' when calling ManagementApi.get_campaign_analytics"
end
# verify the required parameter 'range_end' is set
if @api_client.config.client_side_validation && range_end.nil?
fail ArgumentError, "Missing the required parameter 'range_end' when calling ManagementApi.get_campaign_analytics"
end
allowable_values = ["1 hour", "1 day", "1 week", "1 month", "1 year"]
if @api_client.config.client_side_validation && opts[:'granularity'] && !allowable_values.include?(opts[:'granularity'])
fail ArgumentError, "invalid value for \"granularity\", must be one of #{allowable_values}"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/campaigns/{campaignId}/analytics'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'rangeStart'] = range_start
query_params[:'rangeEnd'] = range_end
query_params[:'granularity'] = opts[:'granularity'] if !opts[:'granularity'].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] || 'InlineResponse20020'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_campaign_analytics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List campaigns that match the given attributes
# Get a list of all the campaigns that match a set of attributes.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param body [CampaignSearch] body
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response. (default to 1000)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [String] :campaign_state Filter results by the state of the campaign. - `enabled`: Campaigns that are scheduled, running (activated), or expired. - `running`: Campaigns that are running (activated). - `disabled`: Campaigns that are disabled. - `expired`: Campaigns that are expired. - `archived`: Campaigns that are archived.
# @return [InlineResponse2006]
def get_campaign_by_attributes(application_id, body, opts = {})
data, _status_code, _headers = get_campaign_by_attributes_with_http_info(application_id, body, opts)
data
end
# List campaigns that match the given attributes
# Get a list of all the campaigns that match a set of attributes.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param body [CampaignSearch] body
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [String] :campaign_state Filter results by the state of the campaign. - `enabled`: Campaigns that are scheduled, running (activated), or expired. - `running`: Campaigns that are running (activated). - `disabled`: Campaigns that are disabled. - `expired`: Campaigns that are expired. - `archived`: Campaigns that are archived.
# @return [Array<(InlineResponse2006, Integer, Hash)>] InlineResponse2006 data, response status code and response headers
def get_campaign_by_attributes_with_http_info(application_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_campaign_by_attributes ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.get_campaign_by_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 ManagementApi.get_campaign_by_attributes"
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 ManagementApi.get_campaign_by_attributes, 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 ManagementApi.get_campaign_by_attributes, must be greater than or equal to 1.'
end
allowable_values = ["enabled", "disabled", "archived", "scheduled", "running", "expired", "staged"]
if @api_client.config.client_side_validation && opts[:'campaign_state'] && !allowable_values.include?(opts[:'campaign_state'])
fail ArgumentError, "invalid value for \"campaign_state\", must be one of #{allowable_values}"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/campaigns_search'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
query_params[:'campaignState'] = opts[:'campaign_state'] if !opts[:'campaign_state'].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] || 'InlineResponse2006'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_campaign_by_attributes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get campaign access group
# Get a campaign access group specified by its ID.
# @param campaign_group_id [Integer] The ID of the campaign access group.
# @param [Hash] opts the optional parameters
# @return [CampaignGroup]
def get_campaign_group(campaign_group_id, opts = {})
data, _status_code, _headers = get_campaign_group_with_http_info(campaign_group_id, opts)
data
end
# Get campaign access group
# Get a campaign access group specified by its ID.
# @param campaign_group_id [Integer] The ID of the campaign access group.
# @param [Hash] opts the optional parameters
# @return [Array<(CampaignGroup, Integer, Hash)>] CampaignGroup data, response status code and response headers
def get_campaign_group_with_http_info(campaign_group_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_campaign_group ...'
end
# verify the required parameter 'campaign_group_id' is set
if @api_client.config.client_side_validation && campaign_group_id.nil?
fail ArgumentError, "Missing the required parameter 'campaign_group_id' when calling ManagementApi.get_campaign_group"
end
# resource path
local_var_path = '/v1/campaign_groups/{campaignGroupId}'.sub('{' + 'campaignGroupId' + '}', CGI.escape(campaign_group_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] || 'CampaignGroup'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_campaign_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List campaign access groups
# List the campaign access groups in the current account.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response. (default to 1000)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @return [InlineResponse20011]
def get_campaign_groups(opts = {})
data, _status_code, _headers = get_campaign_groups_with_http_info(opts)
data
end
# List campaign access groups
# List the campaign access groups in the current account.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @return [Array<(InlineResponse20011, Integer, Hash)>] InlineResponse20011 data, response status code and response headers
def get_campaign_groups_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_campaign_groups ...'
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 ManagementApi.get_campaign_groups, 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 ManagementApi.get_campaign_groups, must be greater than or equal to 1.'
end
# resource path
local_var_path = '/v1/campaign_groups'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].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] || 'InlineResponse20011'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_campaign_groups\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List campaign templates
# Retrieve a list of campaign templates.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response. (default to 1000)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [String] :state Filter results by the state of the campaign template.
# @option opts [String] :name Filter results performing case-insensitive matching against the name of the campaign template.
# @option opts [String] :tags Filter results performing case-insensitive matching against the tags of the campaign template. When used in conjunction with the \"name\" query parameter, a logical OR will be performed to search both tags and name for the provided values.
# @option opts [Integer] :user_id Filter results by user ID.
# @return [InlineResponse20012]
def get_campaign_templates(opts = {})
data, _status_code, _headers = get_campaign_templates_with_http_info(opts)
data
end
# List campaign templates
# Retrieve a list of campaign templates.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [String] :state Filter results by the state of the campaign template.
# @option opts [String] :name Filter results performing case-insensitive matching against the name of the campaign template.
# @option opts [String] :tags Filter results performing case-insensitive matching against the tags of the campaign template. When used in conjunction with the \"name\" query parameter, a logical OR will be performed to search both tags and name for the provided values.
# @option opts [Integer] :user_id Filter results by user ID.
# @return [Array<(InlineResponse20012, Integer, Hash)>] InlineResponse20012 data, response status code and response headers
def get_campaign_templates_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_campaign_templates ...'
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 ManagementApi.get_campaign_templates, 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 ManagementApi.get_campaign_templates, must be greater than or equal to 1.'
end
allowable_values = ["draft", "enabled", "disabled"]
if @api_client.config.client_side_validation && opts[:'state'] && !allowable_values.include?(opts[:'state'])
fail ArgumentError, "invalid value for \"state\", must be one of #{allowable_values}"
end
# resource path
local_var_path = '/v1/campaign_templates'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
query_params[:'state'] = opts[:'state'] if !opts[:'state'].nil?
query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?
query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?
query_params[:'userId'] = opts[:'user_id'] if !opts[:'user_id'].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] || 'InlineResponse20012'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_campaign_templates\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List campaigns
# List the campaigns of the specified application that match your filter criteria.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response. (default to 1000)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [String] :campaign_state Filter results by the state of the campaign. - `enabled`: Campaigns that are scheduled, running (activated), or expired. - `running`: Campaigns that are running (activated). - `disabled`: Campaigns that are disabled. - `expired`: Campaigns that are expired. - `archived`: Campaigns that are archived.
# @option opts [String] :name Filter results performing case-insensitive matching against the name of the campaign.
# @option opts [String] :tags Filter results performing case-insensitive matching against the tags of the campaign. When used in conjunction with the \"name\" query parameter, a logical OR will be performed to search both tags and name for the provided values
# @option opts [DateTime] :created_before Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the campaign creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :created_after Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the campaign creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [Integer] :campaign_group_id Filter results to campaigns owned by the specified campaign access group ID.
# @option opts [Integer] :template_id The ID of the campaign template this campaign was created from.
# @option opts [Integer] :store_id Filter results to campaigns linked to the specified store ID.
# @return [InlineResponse2006]
def get_campaigns(application_id, opts = {})
data, _status_code, _headers = get_campaigns_with_http_info(application_id, opts)
data
end
# List campaigns
# List the campaigns of the specified application that match your filter criteria.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [String] :campaign_state Filter results by the state of the campaign. - `enabled`: Campaigns that are scheduled, running (activated), or expired. - `running`: Campaigns that are running (activated). - `disabled`: Campaigns that are disabled. - `expired`: Campaigns that are expired. - `archived`: Campaigns that are archived.
# @option opts [String] :name Filter results performing case-insensitive matching against the name of the campaign.
# @option opts [String] :tags Filter results performing case-insensitive matching against the tags of the campaign. When used in conjunction with the \"name\" query parameter, a logical OR will be performed to search both tags and name for the provided values
# @option opts [DateTime] :created_before Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the campaign creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :created_after Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the campaign creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [Integer] :campaign_group_id Filter results to campaigns owned by the specified campaign access group ID.
# @option opts [Integer] :template_id The ID of the campaign template this campaign was created from.
# @option opts [Integer] :store_id Filter results to campaigns linked to the specified store ID.
# @return [Array<(InlineResponse2006, Integer, Hash)>] InlineResponse2006 data, response status code and response headers
def get_campaigns_with_http_info(application_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_campaigns ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.get_campaigns"
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 ManagementApi.get_campaigns, 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 ManagementApi.get_campaigns, must be greater than or equal to 1.'
end
allowable_values = ["enabled", "disabled", "archived", "scheduled", "running", "expired", "staged"]
if @api_client.config.client_side_validation && opts[:'campaign_state'] && !allowable_values.include?(opts[:'campaign_state'])
fail ArgumentError, "invalid value for \"campaign_state\", must be one of #{allowable_values}"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/campaigns'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
query_params[:'campaignState'] = opts[:'campaign_state'] if !opts[:'campaign_state'].nil?
query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?
query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?
query_params[:'createdBefore'] = opts[:'created_before'] if !opts[:'created_before'].nil?
query_params[:'createdAfter'] = opts[:'created_after'] if !opts[:'created_after'].nil?
query_params[:'campaignGroupId'] = opts[:'campaign_group_id'] if !opts[:'campaign_group_id'].nil?
query_params[:'templateId'] = opts[:'template_id'] if !opts[:'template_id'].nil?
query_params[:'storeId'] = opts[:'store_id'] if !opts[:'store_id'].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] || 'InlineResponse2006'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_campaigns\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get audit logs for an account
# Retrieve the audit logs displayed in **Accounts > Audit logs**.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response. (default to 1000)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [Float] :application_id Filter results by Application ID.
# @option opts [String] :entity_path Filter results on a case insensitive matching of the url path of the entity
# @option opts [Integer] :user_id Filter results by user ID.
# @option opts [DateTime] :created_before Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the change creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :created_after Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the change creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [Boolean] :with_total_result_size When this flag is set, the result includes the total size of the result, across all pages. This might decrease performance on large data sets. - When `true`: `hasMore` is true when there is a next page. `totalResultSize` is always zero. - When `false`: `hasMore` is always false. `totalResultSize` contains the total number of results for this query.
# @option opts [Integer] :management_key_id Filter results that match the given management key ID.
# @option opts [Boolean] :include_old When this flag is set to false, the state without the change will not be returned. The default value is true.
# @return [InlineResponse20041]
def get_changes(opts = {})
data, _status_code, _headers = get_changes_with_http_info(opts)
data
end
# Get audit logs for an account
# Retrieve the audit logs displayed in **Accounts > Audit logs**.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [Float] :application_id Filter results by Application ID.
# @option opts [String] :entity_path Filter results on a case insensitive matching of the url path of the entity
# @option opts [Integer] :user_id Filter results by user ID.
# @option opts [DateTime] :created_before Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the change creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :created_after Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the change creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [Boolean] :with_total_result_size When this flag is set, the result includes the total size of the result, across all pages. This might decrease performance on large data sets. - When `true`: `hasMore` is true when there is a next page. `totalResultSize` is always zero. - When `false`: `hasMore` is always false. `totalResultSize` contains the total number of results for this query.
# @option opts [Integer] :management_key_id Filter results that match the given management key ID.
# @option opts [Boolean] :include_old When this flag is set to false, the state without the change will not be returned. The default value is true.
# @return [Array<(InlineResponse20041, Integer, Hash)>] InlineResponse20041 data, response status code and response headers
def get_changes_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_changes ...'
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 ManagementApi.get_changes, 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 ManagementApi.get_changes, must be greater than or equal to 1.'
end
# resource path
local_var_path = '/v1/changes'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
query_params[:'applicationId'] = opts[:'application_id'] if !opts[:'application_id'].nil?
query_params[:'entityPath'] = opts[:'entity_path'] if !opts[:'entity_path'].nil?
query_params[:'userId'] = opts[:'user_id'] if !opts[:'user_id'].nil?
query_params[:'createdBefore'] = opts[:'created_before'] if !opts[:'created_before'].nil?
query_params[:'createdAfter'] = opts[:'created_after'] if !opts[:'created_after'].nil?
query_params[:'withTotalResultSize'] = opts[:'with_total_result_size'] if !opts[:'with_total_result_size'].nil?
query_params[:'managementKeyId'] = opts[:'management_key_id'] if !opts[:'management_key_id'].nil?
query_params[:'includeOld'] = opts[:'include_old'] if !opts[:'include_old'].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] || 'InlineResponse20041'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_changes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get campaign-level collection
# Retrieve a given campaign-level collection.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param collection_id [Integer] The ID of the collection. You can get it with the [List collections in Application](#operation/listCollectionsInApplication) endpoint.
# @param [Hash] opts the optional parameters
# @return [Collection]
def get_collection(application_id, campaign_id, collection_id, opts = {})
data, _status_code, _headers = get_collection_with_http_info(application_id, campaign_id, collection_id, opts)
data
end
# Get campaign-level collection
# Retrieve a given campaign-level collection.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param collection_id [Integer] The ID of the collection. You can get it with the [List collections in Application](#operation/listCollectionsInApplication) endpoint.
# @param [Hash] opts the optional parameters
# @return [Array<(Collection, Integer, Hash)>] Collection data, response status code and response headers
def get_collection_with_http_info(application_id, campaign_id, collection_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_collection ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.get_collection"
end
# verify the required parameter 'campaign_id' is set
if @api_client.config.client_side_validation && campaign_id.nil?
fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ManagementApi.get_collection"
end
# verify the required parameter 'collection_id' is set
if @api_client.config.client_side_validation && collection_id.nil?
fail ArgumentError, "Missing the required parameter 'collection_id' when calling ManagementApi.get_collection"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/campaigns/{campaignId}/collections/{collectionId}'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'collectionId' + '}', CGI.escape(collection_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] || 'Collection'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_collection\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get collection items
# Retrieve items from a given collection. You can retrieve items from both account-level collections and campaign-level collections using this endpoint.
# @param collection_id [Integer] The ID of the collection. You can get it with the [List collections in account](#operation/listAccountCollections) endpoint.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response. (default to 1000)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @return [InlineResponse20018]
def get_collection_items(collection_id, opts = {})
data, _status_code, _headers = get_collection_items_with_http_info(collection_id, opts)
data
end
# Get collection items
# Retrieve items from a given collection. You can retrieve items from both account-level collections and campaign-level collections using this endpoint.
# @param collection_id [Integer] The ID of the collection. You can get it with the [List collections in account](#operation/listAccountCollections) endpoint.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @return [Array<(InlineResponse20018, Integer, Hash)>] InlineResponse20018 data, response status code and response headers
def get_collection_items_with_http_info(collection_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_collection_items ...'
end
# verify the required parameter 'collection_id' is set
if @api_client.config.client_side_validation && collection_id.nil?
fail ArgumentError, "Missing the required parameter 'collection_id' when calling ManagementApi.get_collection_items"
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 ManagementApi.get_collection_items, 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 ManagementApi.get_collection_items, must be greater than or equal to 1.'
end
# resource path
local_var_path = '/v1/collections/{collectionId}/items'.sub('{' + 'collectionId' + '}', CGI.escape(collection_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
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] || 'InlineResponse20018'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_collection_items\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List coupons
# List all the coupons matching the specified criteria.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response. (default to 1000)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [String] :value Filter results performing case-insensitive matching against the coupon code. Both the code and the query are folded to remove all non-alpha-numeric characters.
# @option opts [DateTime] :created_before Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :created_after Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [String] :valid Either \"expired\", \"validNow\", or \"validFuture\". The first option matches coupons in which the expiration date is set and in the past. The second matches coupons in which start date is null or in the past and expiration date is null or in the future, the third matches coupons in which start date is set and in the future.
# @option opts [String] :usable Either \"true\" or \"false\". If \"true\", only coupons where `usageCounter < usageLimit` will be returned, \"false\" will return only coupons where `usageCounter >= usageLimit`.
# @option opts [String] :redeemed - `true`: only coupons where `usageCounter > 0` will be returned. - `false`: only coupons where `usageCounter = 0` will be returned. - This field cannot be used in conjunction with the `usable` query parameter.
# @option opts [Integer] :referral_id Filter the results by matching them with the ID of a referral. This filter shows the coupons created by redeeming a referral code.
# @option opts [String] :recipient_integration_id Filter results by match with a profile ID specified in the coupon's RecipientIntegrationId field.
# @option opts [String] :batch_id Filter results by batches of coupons
# @option opts [Boolean] :exact_match Filter results to an exact case-insensitive matching against the coupon code. (default to false)
# @option opts [DateTime] :expires_before Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon expiration date timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :expires_after Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon expiration date timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :starts_before Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon start date timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :starts_after Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon start date timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [Boolean] :values_only Filter results to only return the coupon codes (`value` column) without the associated coupon data. (default to false)
# @return [InlineResponse2009]
def get_coupons_without_total_count(application_id, campaign_id, opts = {})
data, _status_code, _headers = get_coupons_without_total_count_with_http_info(application_id, campaign_id, opts)
data
end
# List coupons
# List all the coupons matching the specified criteria.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [String] :value Filter results performing case-insensitive matching against the coupon code. Both the code and the query are folded to remove all non-alpha-numeric characters.
# @option opts [DateTime] :created_before Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :created_after Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [String] :valid Either \"expired\", \"validNow\", or \"validFuture\". The first option matches coupons in which the expiration date is set and in the past. The second matches coupons in which start date is null or in the past and expiration date is null or in the future, the third matches coupons in which start date is set and in the future.
# @option opts [String] :usable Either \"true\" or \"false\". If \"true\", only coupons where `usageCounter < usageLimit` will be returned, \"false\" will return only coupons where `usageCounter >= usageLimit`.
# @option opts [String] :redeemed - `true`: only coupons where `usageCounter > 0` will be returned. - `false`: only coupons where `usageCounter = 0` will be returned. - This field cannot be used in conjunction with the `usable` query parameter.
# @option opts [Integer] :referral_id Filter the results by matching them with the ID of a referral. This filter shows the coupons created by redeeming a referral code.
# @option opts [String] :recipient_integration_id Filter results by match with a profile ID specified in the coupon's RecipientIntegrationId field.
# @option opts [String] :batch_id Filter results by batches of coupons
# @option opts [Boolean] :exact_match Filter results to an exact case-insensitive matching against the coupon code.
# @option opts [DateTime] :expires_before Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon expiration date timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :expires_after Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon expiration date timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :starts_before Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon start date timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :starts_after Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon start date timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [Boolean] :values_only Filter results to only return the coupon codes (`value` column) without the associated coupon data.
# @return [Array<(InlineResponse2009, Integer, Hash)>] InlineResponse2009 data, response status code and response headers
def get_coupons_without_total_count_with_http_info(application_id, campaign_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_coupons_without_total_count ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.get_coupons_without_total_count"
end
# verify the required parameter 'campaign_id' is set
if @api_client.config.client_side_validation && campaign_id.nil?
fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ManagementApi.get_coupons_without_total_count"
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 ManagementApi.get_coupons_without_total_count, 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 ManagementApi.get_coupons_without_total_count, must be greater than or equal to 1.'
end
allowable_values = ["expired", "validNow", "validFuture"]
if @api_client.config.client_side_validation && opts[:'valid'] && !allowable_values.include?(opts[:'valid'])
fail ArgumentError, "invalid value for \"valid\", must be one of #{allowable_values}"
end
allowable_values = ["true", "false"]
if @api_client.config.client_side_validation && opts[:'usable'] && !allowable_values.include?(opts[:'usable'])
fail ArgumentError, "invalid value for \"usable\", must be one of #{allowable_values}"
end
allowable_values = ["true", "false"]
if @api_client.config.client_side_validation && opts[:'redeemed'] && !allowable_values.include?(opts[:'redeemed'])
fail ArgumentError, "invalid value for \"redeemed\", must be one of #{allowable_values}"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/campaigns/{campaignId}/coupons/no_total'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
query_params[:'value'] = opts[:'value'] if !opts[:'value'].nil?
query_params[:'createdBefore'] = opts[:'created_before'] if !opts[:'created_before'].nil?
query_params[:'createdAfter'] = opts[:'created_after'] if !opts[:'created_after'].nil?
query_params[:'valid'] = opts[:'valid'] if !opts[:'valid'].nil?
query_params[:'usable'] = opts[:'usable'] if !opts[:'usable'].nil?
query_params[:'redeemed'] = opts[:'redeemed'] if !opts[:'redeemed'].nil?
query_params[:'referralId'] = opts[:'referral_id'] if !opts[:'referral_id'].nil?
query_params[:'recipientIntegrationId'] = opts[:'recipient_integration_id'] if !opts[:'recipient_integration_id'].nil?
query_params[:'batchId'] = opts[:'batch_id'] if !opts[:'batch_id'].nil?
query_params[:'exactMatch'] = opts[:'exact_match'] if !opts[:'exact_match'].nil?
query_params[:'expiresBefore'] = opts[:'expires_before'] if !opts[:'expires_before'].nil?
query_params[:'expiresAfter'] = opts[:'expires_after'] if !opts[:'expires_after'].nil?
query_params[:'startsBefore'] = opts[:'starts_before'] if !opts[:'starts_before'].nil?
query_params[:'startsAfter'] = opts[:'starts_after'] if !opts[:'starts_after'].nil?
query_params[:'valuesOnly'] = opts[:'values_only'] if !opts[:'values_only'].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] || 'InlineResponse2009'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_coupons_without_total_count\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get customer's activity report
# Fetch the summary report of a given customer in the given application, in a time range.
# @param range_start [DateTime] Only return results from after this timestamp. **Note:** - This must be an RFC3339 timestamp string. - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered.
# @param range_end [DateTime] Only return results from before this timestamp. **Note:** - This must be an RFC3339 timestamp string. - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param customer_id [Integer] The value of the `id` property of a customer profile. Get it with the [List Application's customers](https://docs.talon.one/management-api#operation/getApplicationCustomers) endpoint.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response. (default to 1000)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @return [CustomerActivityReport]
def get_customer_activity_report(range_start, range_end, application_id, customer_id, opts = {})
data, _status_code, _headers = get_customer_activity_report_with_http_info(range_start, range_end, application_id, customer_id, opts)
data
end
# Get customer's activity report
# Fetch the summary report of a given customer in the given application, in a time range.
# @param range_start [DateTime] Only return results from after this timestamp. **Note:** - This must be an RFC3339 timestamp string. - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered.
# @param range_end [DateTime] Only return results from before this timestamp. **Note:** - This must be an RFC3339 timestamp string. - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param customer_id [Integer] The value of the `id` property of a customer profile. Get it with the [List Application's customers](https://docs.talon.one/management-api#operation/getApplicationCustomers) endpoint.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @return [Array<(CustomerActivityReport, Integer, Hash)>] CustomerActivityReport data, response status code and response headers
def get_customer_activity_report_with_http_info(range_start, range_end, application_id, customer_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_customer_activity_report ...'
end
# verify the required parameter 'range_start' is set
if @api_client.config.client_side_validation && range_start.nil?
fail ArgumentError, "Missing the required parameter 'range_start' when calling ManagementApi.get_customer_activity_report"
end
# verify the required parameter 'range_end' is set
if @api_client.config.client_side_validation && range_end.nil?
fail ArgumentError, "Missing the required parameter 'range_end' when calling ManagementApi.get_customer_activity_report"
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.get_customer_activity_report"
end
# verify the required parameter 'customer_id' is set
if @api_client.config.client_side_validation && customer_id.nil?
fail ArgumentError, "Missing the required parameter 'customer_id' when calling ManagementApi.get_customer_activity_report"
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 ManagementApi.get_customer_activity_report, 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 ManagementApi.get_customer_activity_report, must be greater than or equal to 1.'
end
# resource path
local_var_path = '/v1/applications/{applicationId}/customer_activity_reports/{customerId}'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'customerId' + '}', CGI.escape(customer_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'rangeStart'] = range_start
query_params[:'rangeEnd'] = range_end
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] || 'CustomerActivityReport'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_customer_activity_report\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get Activity Reports for Application Customers
# Fetch summary reports for all application customers based on a time range. Instead of having the total number of results in the response, this endpoint only mentions whether there are more results.
# @param range_start [DateTime] Only return results from after this timestamp. **Note:** - This must be an RFC3339 timestamp string. - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered.
# @param range_end [DateTime] Only return results from before this timestamp. **Note:** - This must be an RFC3339 timestamp string. - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response. (default to 1000)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [String] :name Only return reports matching the customer name.
# @option opts [String] :integration_id Filter results performing an exact matching against the profile integration identifier.
# @option opts [String] :campaign_name Only return reports matching the campaign name.
# @option opts [String] :advocate_name Only return reports matching the current customer referrer name.
# @return [InlineResponse20025]
def get_customer_activity_reports_without_total_count(range_start, range_end, application_id, opts = {})
data, _status_code, _headers = get_customer_activity_reports_without_total_count_with_http_info(range_start, range_end, application_id, opts)
data
end
# Get Activity Reports for Application Customers
# Fetch summary reports for all application customers based on a time range. Instead of having the total number of results in the response, this endpoint only mentions whether there are more results.
# @param range_start [DateTime] Only return results from after this timestamp. **Note:** - This must be an RFC3339 timestamp string. - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered.
# @param range_end [DateTime] Only return results from before this timestamp. **Note:** - This must be an RFC3339 timestamp string. - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [String] :name Only return reports matching the customer name.
# @option opts [String] :integration_id Filter results performing an exact matching against the profile integration identifier.
# @option opts [String] :campaign_name Only return reports matching the campaign name.
# @option opts [String] :advocate_name Only return reports matching the current customer referrer name.
# @return [Array<(InlineResponse20025, Integer, Hash)>] InlineResponse20025 data, response status code and response headers
def get_customer_activity_reports_without_total_count_with_http_info(range_start, range_end, application_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_customer_activity_reports_without_total_count ...'
end
# verify the required parameter 'range_start' is set
if @api_client.config.client_side_validation && range_start.nil?
fail ArgumentError, "Missing the required parameter 'range_start' when calling ManagementApi.get_customer_activity_reports_without_total_count"
end
# verify the required parameter 'range_end' is set
if @api_client.config.client_side_validation && range_end.nil?
fail ArgumentError, "Missing the required parameter 'range_end' when calling ManagementApi.get_customer_activity_reports_without_total_count"
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.get_customer_activity_reports_without_total_count"
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 ManagementApi.get_customer_activity_reports_without_total_count, 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 ManagementApi.get_customer_activity_reports_without_total_count, must be greater than or equal to 1.'
end
# resource path
local_var_path = '/v1/applications/{applicationId}/customer_activity_reports/no_total'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'rangeStart'] = range_start
query_params[:'rangeEnd'] = range_end
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?
query_params[:'integrationId'] = opts[:'integration_id'] if !opts[:'integration_id'].nil?
query_params[:'campaignName'] = opts[:'campaign_name'] if !opts[:'campaign_name'].nil?
query_params[:'advocateName'] = opts[:'advocate_name'] if !opts[:'advocate_name'].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] || 'InlineResponse20025'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_customer_activity_reports_without_total_count\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get customer's analytics report
# Fetch analytics for a given customer in the given application.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param customer_id [Integer] The value of the `id` property of a customer profile. Get it with the [List Application's customers](https://docs.talon.one/management-api#operation/getApplicationCustomers) endpoint.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response. (default to 1000)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @return [CustomerAnalytics]
def get_customer_analytics(application_id, customer_id, opts = {})
data, _status_code, _headers = get_customer_analytics_with_http_info(application_id, customer_id, opts)
data
end
# Get customer's analytics report
# Fetch analytics for a given customer in the given application.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param customer_id [Integer] The value of the `id` property of a customer profile. Get it with the [List Application's customers](https://docs.talon.one/management-api#operation/getApplicationCustomers) endpoint.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @return [Array<(CustomerAnalytics, Integer, Hash)>] CustomerAnalytics data, response status code and response headers
def get_customer_analytics_with_http_info(application_id, customer_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_customer_analytics ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.get_customer_analytics"
end
# verify the required parameter 'customer_id' is set
if @api_client.config.client_side_validation && customer_id.nil?
fail ArgumentError, "Missing the required parameter 'customer_id' when calling ManagementApi.get_customer_analytics"
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 ManagementApi.get_customer_analytics, 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 ManagementApi.get_customer_analytics, must be greater than or equal to 1.'
end
# resource path
local_var_path = '/v1/applications/{applicationId}/customers/{customerId}/analytics'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'customerId' + '}', CGI.escape(customer_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].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] || 'CustomerAnalytics'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_customer_analytics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get customer profile
# Return the details of the specified customer profile. Performance tips
You can retrieve the same information via the Integration API, which can save you extra API requests. consider these options: - Request the customer profile to be part of the response content using [Update Customer Session](https://docs.talon.one/integration-api#tag/Customer-sessions/operation/updateCustomerSessionV2). - Send an empty update with the [Update Customer Profile](https://docs.talon.one/integration-api#tag/Customer-profiles/operation/updateCustomerProfileV2) endpoint with `runRuleEngine=false`.
# @param customer_id [Integer] The value of the `id` property of a customer profile. Get it with the [List Application's customers](https://docs.talon.one/management-api#operation/getApplicationCustomers) endpoint.
# @param [Hash] opts the optional parameters
# @return [CustomerProfile]
def get_customer_profile(customer_id, opts = {})
data, _status_code, _headers = get_customer_profile_with_http_info(customer_id, opts)
data
end
# Get customer profile
# Return the details of the specified customer profile. <div class=\"redoc-section\"> <p class=\"title\">Performance tips</p> You can retrieve the same information via the Integration API, which can save you extra API requests. consider these options: - Request the customer profile to be part of the response content using [Update Customer Session](https://docs.talon.one/integration-api#tag/Customer-sessions/operation/updateCustomerSessionV2). - Send an empty update with the [Update Customer Profile](https://docs.talon.one/integration-api#tag/Customer-profiles/operation/updateCustomerProfileV2) endpoint with `runRuleEngine=false`. </div>
# @param customer_id [Integer] The value of the `id` property of a customer profile. Get it with the [List Application's customers](https://docs.talon.one/management-api#operation/getApplicationCustomers) endpoint.
# @param [Hash] opts the optional parameters
# @return [Array<(CustomerProfile, Integer, Hash)>] CustomerProfile data, response status code and response headers
def get_customer_profile_with_http_info(customer_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_customer_profile ...'
end
# verify the required parameter 'customer_id' is set
if @api_client.config.client_side_validation && customer_id.nil?
fail ArgumentError, "Missing the required parameter 'customer_id' when calling ManagementApi.get_customer_profile"
end
# resource path
local_var_path = '/v1/customers/{customerId}'.sub('{' + 'customerId' + '}', CGI.escape(customer_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] || 'CustomerProfile'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_customer_profile\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List customer achievements
# For the given customer profile, list all the achievements that match your filter criteria.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param integration_id [String] The identifier of the profile.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response. (default to 50)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [Integer] :achievement_id The ID of the achievement. You can get this ID with the [List achievement](https://docs.talon.one/management-api#tag/Achievements/operation/listAchievements) endpoint.
# @option opts [String] :title Filter results by the `title` of an achievement.
# @return [InlineResponse20046]
def get_customer_profile_achievement_progress(application_id, integration_id, opts = {})
data, _status_code, _headers = get_customer_profile_achievement_progress_with_http_info(application_id, integration_id, opts)
data
end
# List customer achievements
# For the given customer profile, list all the achievements that match your filter criteria.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param integration_id [String] The identifier of the profile.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [Integer] :achievement_id The ID of the achievement. You can get this ID with the [List achievement](https://docs.talon.one/management-api#tag/Achievements/operation/listAchievements) endpoint.
# @option opts [String] :title Filter results by the `title` of an achievement.
# @return [Array<(InlineResponse20046, Integer, Hash)>] InlineResponse20046 data, response status code and response headers
def get_customer_profile_achievement_progress_with_http_info(application_id, integration_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_customer_profile_achievement_progress ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.get_customer_profile_achievement_progress"
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 ManagementApi.get_customer_profile_achievement_progress"
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 ManagementApi.get_customer_profile_achievement_progress, 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 ManagementApi.get_customer_profile_achievement_progress, must be greater than or equal to 1.'
end
# resource path
local_var_path = '/v1/applications/{applicationId}/achievement_progress/{integrationId}'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'integrationId' + '}', CGI.escape(integration_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
query_params[:'achievementId'] = opts[:'achievement_id'] if !opts[:'achievement_id'].nil?
query_params[:'title'] = opts[:'title'] if !opts[:'title'].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] || 'InlineResponse20046'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_customer_profile_achievement_progress\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List customer profiles
# List all customer profiles.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response. (default to 1000)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [Boolean] :sandbox Indicates whether you are pointing to a sandbox or live customer. (default to false)
# @return [InlineResponse20024]
def get_customer_profiles(opts = {})
data, _status_code, _headers = get_customer_profiles_with_http_info(opts)
data
end
# List customer profiles
# List all customer profiles.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [Boolean] :sandbox Indicates whether you are pointing to a sandbox or live customer.
# @return [Array<(InlineResponse20024, Integer, Hash)>] InlineResponse20024 data, response status code and response headers
def get_customer_profiles_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_customer_profiles ...'
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 ManagementApi.get_customer_profiles, 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 ManagementApi.get_customer_profiles, must be greater than or equal to 1.'
end
# resource path
local_var_path = '/v1/customers/no_total'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
query_params[:'sandbox'] = opts[:'sandbox'] if !opts[:'sandbox'].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] || 'InlineResponse20024'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_customer_profiles\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List customer profiles matching the given attributes
# Get a list of the customer profiles matching the provided criteria. The match is successful if all the attributes of the request are found in a profile, even if the profile has more attributes that are not present on the request.
# @param body [CustomerProfileSearchQuery] body
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response. (default to 1000)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [Boolean] :sandbox Indicates whether you are pointing to a sandbox or live customer. (default to false)
# @return [InlineResponse20023]
def get_customers_by_attributes(body, opts = {})
data, _status_code, _headers = get_customers_by_attributes_with_http_info(body, opts)
data
end
# List customer profiles matching the given attributes
# Get a list of the customer profiles matching the provided criteria. The match is successful if all the attributes of the request are found in a profile, even if the profile has more attributes that are not present on the request.
# @param body [CustomerProfileSearchQuery] body
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [Boolean] :sandbox Indicates whether you are pointing to a sandbox or live customer.
# @return [Array<(InlineResponse20023, Integer, Hash)>] InlineResponse20023 data, response status code and response headers
def get_customers_by_attributes_with_http_info(body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_customers_by_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 ManagementApi.get_customers_by_attributes"
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 ManagementApi.get_customers_by_attributes, 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 ManagementApi.get_customers_by_attributes, must be greater than or equal to 1.'
end
# resource path
local_var_path = '/v1/customer_search/no_total'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
query_params[:'sandbox'] = opts[:'sandbox'] if !opts[:'sandbox'].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] || 'InlineResponse20023'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_customers_by_attributes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List event types
# Fetch all event type definitions for your account.
# @param [Hash] opts the optional parameters
# @option opts [String] :name Filter results to event types with the given name. This parameter implies `includeOldVersions`.
# @option opts [Boolean] :include_old_versions Include all versions of every event type. (default to false)
# @option opts [Integer] :page_size The number of items in the response. (default to 1000)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @return [InlineResponse20039]
def get_event_types(opts = {})
data, _status_code, _headers = get_event_types_with_http_info(opts)
data
end
# List event types
# Fetch all event type definitions for your account.
# @param [Hash] opts the optional parameters
# @option opts [String] :name Filter results to event types with the given name. This parameter implies `includeOldVersions`.
# @option opts [Boolean] :include_old_versions Include all versions of every event type.
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @return [Array<(InlineResponse20039, Integer, Hash)>] InlineResponse20039 data, response status code and response headers
def get_event_types_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_event_types ...'
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 ManagementApi.get_event_types, 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 ManagementApi.get_event_types, must be greater than or equal to 1.'
end
# resource path
local_var_path = '/v1/event_types'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?
query_params[:'includeOldVersions'] = opts[:'include_old_versions'] if !opts[:'include_old_versions'].nil?
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].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] || 'InlineResponse20039'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_event_types\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get exports
# List all past exports
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response. (default to 1000)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [Float] :application_id Filter results by Application ID.
# @option opts [Integer] :campaign_id Filter by the campaign ID on which the limit counters are used.
# @option opts [String] :entity The name of the entity type that was exported.
# @return [InlineResponse20042]
def get_exports(opts = {})
data, _status_code, _headers = get_exports_with_http_info(opts)
data
end
# Get exports
# List all past exports
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [Float] :application_id Filter results by Application ID.
# @option opts [Integer] :campaign_id Filter by the campaign ID on which the limit counters are used.
# @option opts [String] :entity The name of the entity type that was exported.
# @return [Array<(InlineResponse20042, Integer, Hash)>] InlineResponse20042 data, response status code and response headers
def get_exports_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_exports ...'
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 ManagementApi.get_exports, 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 ManagementApi.get_exports, must be greater than or equal to 1.'
end
allowable_values = ["Coupon", "Referral", "Effect", "CustomerSession", "LoyaltyLedger", "LoyaltyLedgerLog", "Collection", "AudienceMembership"]
if @api_client.config.client_side_validation && opts[:'entity'] && !allowable_values.include?(opts[:'entity'])
fail ArgumentError, "invalid value for \"entity\", must be one of #{allowable_values}"
end
# resource path
local_var_path = '/v1/exports'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
query_params[:'applicationId'] = opts[:'application_id'] if !opts[:'application_id'].nil?
query_params[:'campaignId'] = opts[:'campaign_id'] if !opts[:'campaign_id'].nil?
query_params[:'entity'] = opts[:'entity'] if !opts[:'entity'].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] || 'InlineResponse20042'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_exports\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get loyalty card
# Get the given loyalty card.
# @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_id [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
# @return [LoyaltyCard]
def get_loyalty_card(loyalty_program_id, loyalty_card_id, opts = {})
data, _status_code, _headers = get_loyalty_card_with_http_info(loyalty_program_id, loyalty_card_id, opts)
data
end
# Get loyalty card
# Get the given loyalty card.
# @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_id [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
# @return [Array<(LoyaltyCard, Integer, Hash)>] LoyaltyCard data, response status code and response headers
def get_loyalty_card_with_http_info(loyalty_program_id, loyalty_card_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_loyalty_card ...'
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 ManagementApi.get_loyalty_card"
end
# verify the required parameter 'loyalty_card_id' is set
if @api_client.config.client_side_validation && loyalty_card_id.nil?
fail ArgumentError, "Missing the required parameter 'loyalty_card_id' when calling ManagementApi.get_loyalty_card"
end
if @api_client.config.client_side_validation && loyalty_card_id.to_s.length > 108
fail ArgumentError, 'invalid value for "loyalty_card_id" when calling ManagementApi.get_loyalty_card, the character length must be smaller than or equal to 108.'
end
# resource path
local_var_path = '/v1/loyalty_programs/{loyaltyProgramId}/cards/{loyaltyCardId}'.sub('{' + 'loyaltyProgramId' + '}', CGI.escape(loyalty_program_id.to_s)).sub('{' + 'loyaltyCardId' + '}', CGI.escape(loyalty_card_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] || 'LoyaltyCard'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_loyalty_card\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List card's transactions
# Retrieve the transaction logs for the given [loyalty card](https://docs.talon.one/docs/product/loyalty-programs/card-based/card-based-overview) within the specified [card-based loyalty program](https://docs.talon.one/docs/product/loyalty-programs/overview#loyalty-program-types) 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_id [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] :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. - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered.
# @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. - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered.
# @option opts [Integer] :page_size The number of items in the response. (default to 1000)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :subledger_id The ID of the subledger by which we filter the data.
# @return [InlineResponse20016]
def get_loyalty_card_transaction_logs(loyalty_program_id, loyalty_card_id, opts = {})
data, _status_code, _headers = get_loyalty_card_transaction_logs_with_http_info(loyalty_program_id, loyalty_card_id, opts)
data
end
# List card's transactions
# Retrieve the transaction logs for the given [loyalty card](https://docs.talon.one/docs/product/loyalty-programs/card-based/card-based-overview) within the specified [card-based loyalty program](https://docs.talon.one/docs/product/loyalty-programs/overview#loyalty-program-types) 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_id [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] :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. - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered.
# @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. - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered.
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :subledger_id The ID of the subledger by which we filter the data.
# @return [Array<(InlineResponse20016, Integer, Hash)>] InlineResponse20016 data, response status code and response headers
def get_loyalty_card_transaction_logs_with_http_info(loyalty_program_id, loyalty_card_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_loyalty_card_transaction_logs ...'
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 ManagementApi.get_loyalty_card_transaction_logs"
end
# verify the required parameter 'loyalty_card_id' is set
if @api_client.config.client_side_validation && loyalty_card_id.nil?
fail ArgumentError, "Missing the required parameter 'loyalty_card_id' when calling ManagementApi.get_loyalty_card_transaction_logs"
end
if @api_client.config.client_side_validation && loyalty_card_id.to_s.length > 108
fail ArgumentError, 'invalid value for "loyalty_card_id" when calling ManagementApi.get_loyalty_card_transaction_logs, 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 ManagementApi.get_loyalty_card_transaction_logs, 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 ManagementApi.get_loyalty_card_transaction_logs, must be greater than or equal to 1.'
end
# resource path
local_var_path = '/v1/loyalty_programs/{loyaltyProgramId}/cards/{loyaltyCardId}/logs'.sub('{' + 'loyaltyProgramId' + '}', CGI.escape(loyalty_program_id.to_s)).sub('{' + 'loyaltyCardId' + '}', CGI.escape(loyalty_card_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
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?
query_params[:'subledgerId'] = opts[:'subledger_id'] if !opts[:'subledger_id'].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] || 'InlineResponse20016'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_loyalty_card_transaction_logs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List loyalty cards
# For the given card-based loyalty program, list the loyalty cards that match your filter criteria.
# @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 [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response. (default to 1000)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [String] :identifier The card code by which to filter loyalty cards in the response.
# @option opts [Integer] :profile_id Filter results by customer profile ID.
# @option opts [String] :batch_id Filter results by loyalty card batch ID.
# @return [InlineResponse20015]
def get_loyalty_cards(loyalty_program_id, opts = {})
data, _status_code, _headers = get_loyalty_cards_with_http_info(loyalty_program_id, opts)
data
end
# List loyalty cards
# For the given card-based loyalty program, list the loyalty cards that match your filter criteria.
# @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 [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [String] :identifier The card code by which to filter loyalty cards in the response.
# @option opts [Integer] :profile_id Filter results by customer profile ID.
# @option opts [String] :batch_id Filter results by loyalty card batch ID.
# @return [Array<(InlineResponse20015, Integer, Hash)>] InlineResponse20015 data, response status code and response headers
def get_loyalty_cards_with_http_info(loyalty_program_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_loyalty_cards ...'
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 ManagementApi.get_loyalty_cards"
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 ManagementApi.get_loyalty_cards, 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 ManagementApi.get_loyalty_cards, must be greater than or equal to 1.'
end
if @api_client.config.client_side_validation && !opts[:'identifier'].nil? && opts[:'identifier'].to_s.length < 4
fail ArgumentError, 'invalid value for "opts[:"identifier"]" when calling ManagementApi.get_loyalty_cards, the character length must be great than or equal to 4.'
end
if @api_client.config.client_side_validation && !opts[:'profile_id'].nil? && opts[:'profile_id'] < 1
fail ArgumentError, 'invalid value for "opts[:"profile_id"]" when calling ManagementApi.get_loyalty_cards, must be greater than or equal to 1.'
end
# resource path
local_var_path = '/v1/loyalty_programs/{loyaltyProgramId}/cards'.sub('{' + 'loyaltyProgramId' + '}', CGI.escape(loyalty_program_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
query_params[:'identifier'] = opts[:'identifier'] if !opts[:'identifier'].nil?
query_params[:'profileId'] = opts[:'profile_id'] if !opts[:'profile_id'].nil?
query_params[:'batchId'] = opts[:'batch_id'] if !opts[:'batch_id'].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] || 'InlineResponse20015'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_loyalty_cards\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get customer's full loyalty ledger
# Get the loyalty ledger for this profile integration ID. To get the `integrationId` of the profile from a `sessionId`, use the [Update customer session](https://docs.talon.one/integration-api#operation/updateCustomerSessionV2) endpoint. **Important:** To get loyalty transaction logs for a given Integration ID in a loyalty program, we recommend using the Integration API's [Get customer's loyalty logs](https://docs.talon.one/integration-api#tag/Loyalty/operation/getLoyaltyProgramProfileTransactions).
# @param loyalty_program_id [String] The identifier for the loyalty program.
# @param integration_id [String] The identifier of the profile.
# @param [Hash] opts the optional parameters
# @return [LoyaltyLedger]
def get_loyalty_points(loyalty_program_id, integration_id, opts = {})
data, _status_code, _headers = get_loyalty_points_with_http_info(loyalty_program_id, integration_id, opts)
data
end
# Get customer's full loyalty ledger
# Get the loyalty ledger for this profile integration ID. To get the `integrationId` of the profile from a `sessionId`, use the [Update customer session](https://docs.talon.one/integration-api#operation/updateCustomerSessionV2) endpoint. **Important:** To get loyalty transaction logs for a given Integration ID in a loyalty program, we recommend using the Integration API's [Get customer's loyalty logs](https://docs.talon.one/integration-api#tag/Loyalty/operation/getLoyaltyProgramProfileTransactions).
# @param loyalty_program_id [String] The identifier for the loyalty program.
# @param integration_id [String] The identifier of the profile.
# @param [Hash] opts the optional parameters
# @return [Array<(LoyaltyLedger, Integer, Hash)>] LoyaltyLedger data, response status code and response headers
def get_loyalty_points_with_http_info(loyalty_program_id, integration_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_loyalty_points ...'
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 ManagementApi.get_loyalty_points"
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 ManagementApi.get_loyalty_points"
end
# resource path
local_var_path = '/v1/loyalty_programs/{loyaltyProgramId}/profile/{integrationId}'.sub('{' + 'loyaltyProgramId' + '}', CGI.escape(loyalty_program_id.to_s)).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] || 'LoyaltyLedger'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_loyalty_points\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get loyalty program
# Get the specified [loyalty program](https://docs.talon.one/docs/product/loyalty-programs/overview). To list all loyalty programs in your Application, use [List loyalty programs](#operation/getLoyaltyPrograms). To list the loyalty programs that a customer profile is part of, use the [List customer data](https://docs.talon.one/integration-api#tag/Customer-profiles/operation/getCustomerInventory)
# @param loyalty_program_id [Integer] Identifier of the loyalty program. You can get the ID with the [List loyalty programs](https://docs.talon.one/management-api#tag/Loyalty/operation/getLoyaltyPrograms) endpoint.
# @param [Hash] opts the optional parameters
# @return [LoyaltyProgram]
def get_loyalty_program(loyalty_program_id, opts = {})
data, _status_code, _headers = get_loyalty_program_with_http_info(loyalty_program_id, opts)
data
end
# Get loyalty program
# Get the specified [loyalty program](https://docs.talon.one/docs/product/loyalty-programs/overview). To list all loyalty programs in your Application, use [List loyalty programs](#operation/getLoyaltyPrograms). To list the loyalty programs that a customer profile is part of, use the [List customer data](https://docs.talon.one/integration-api#tag/Customer-profiles/operation/getCustomerInventory)
# @param loyalty_program_id [Integer] Identifier of the loyalty program. You can get the ID with the [List loyalty programs](https://docs.talon.one/management-api#tag/Loyalty/operation/getLoyaltyPrograms) endpoint.
# @param [Hash] opts the optional parameters
# @return [Array<(LoyaltyProgram, Integer, Hash)>] LoyaltyProgram data, response status code and response headers
def get_loyalty_program_with_http_info(loyalty_program_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_loyalty_program ...'
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 ManagementApi.get_loyalty_program"
end
# resource path
local_var_path = '/v1/loyalty_programs/{loyaltyProgramId}'.sub('{' + 'loyaltyProgramId' + '}', CGI.escape(loyalty_program_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] || 'LoyaltyProgram'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_loyalty_program\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List loyalty program transactions
# Retrieve loyalty program transaction logs in a given loyalty program with filtering options applied. Manual and imported transactions are also included. **Note:** If no filters are applied, the last 50 loyalty transactions for the given loyalty program are returned. **Important:** To get loyalty transaction logs for a given Integration ID in a loyalty program, we recommend using the Integration API's [Get customer's loyalty logs](https://docs.talon.one/integration-api#tag/Loyalty/operation/getLoyaltyProgramProfileTransactions).
# @param loyalty_program_id [Integer] Identifier of the loyalty program. You can get the ID with the [List loyalty programs](https://docs.talon.one/management-api#tag/Loyalty/operation/getLoyaltyPrograms) endpoint.
# @param [Hash] opts the optional parameters
# @option opts [String] :loyalty_transaction_type Filter results by loyalty transaction type: - `manual`: Loyalty transaction that was done manually. - `session`: Loyalty transaction that resulted from a customer session. - `import`: Loyalty transaction that was imported from a CSV file.
# @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. - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered.
# @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. - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered.
# @option opts [Integer] :page_size The number of items in the response. (default to 50)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @return [InlineResponse20014]
def get_loyalty_program_transactions(loyalty_program_id, opts = {})
data, _status_code, _headers = get_loyalty_program_transactions_with_http_info(loyalty_program_id, opts)
data
end
# List loyalty program transactions
# Retrieve loyalty program transaction logs in a given loyalty program with filtering options applied. Manual and imported transactions are also included. **Note:** If no filters are applied, the last 50 loyalty transactions for the given loyalty program are returned. **Important:** To get loyalty transaction logs for a given Integration ID in a loyalty program, we recommend using the Integration API's [Get customer's loyalty logs](https://docs.talon.one/integration-api#tag/Loyalty/operation/getLoyaltyProgramProfileTransactions).
# @param loyalty_program_id [Integer] Identifier of the loyalty program. You can get the ID with the [List loyalty programs](https://docs.talon.one/management-api#tag/Loyalty/operation/getLoyaltyPrograms) endpoint.
# @param [Hash] opts the optional parameters
# @option opts [String] :loyalty_transaction_type Filter results by loyalty transaction type: - `manual`: Loyalty transaction that was done manually. - `session`: Loyalty transaction that resulted from a customer session. - `import`: Loyalty transaction that was imported from a CSV file.
# @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. - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered.
# @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. - You can include a time component in your string, for example, `T23:59:59` to specify the end of the day. The time zone setting considered is `UTC`. If you do not include a time component, a default time value of `T00:00:00` (midnight) in `UTC` is considered.
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @return [Array<(InlineResponse20014, Integer, Hash)>] InlineResponse20014 data, response status code and response headers
def get_loyalty_program_transactions_with_http_info(loyalty_program_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_loyalty_program_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 ManagementApi.get_loyalty_program_transactions"
end
allowable_values = ["manual", "session", "import"]
if @api_client.config.client_side_validation && opts[:'loyalty_transaction_type'] && !allowable_values.include?(opts[:'loyalty_transaction_type'])
fail ArgumentError, "invalid value for \"loyalty_transaction_type\", must be one of #{allowable_values}"
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 ManagementApi.get_loyalty_program_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 ManagementApi.get_loyalty_program_transactions, must be greater than or equal to 1.'
end
# resource path
local_var_path = '/v1/loyalty_programs/{loyaltyProgramId}/transactions'.sub('{' + 'loyaltyProgramId' + '}', CGI.escape(loyalty_program_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'loyaltyTransactionType'] = opts[:'loyalty_transaction_type'] if !opts[:'loyalty_transaction_type'].nil?
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] || 'InlineResponse20014'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_loyalty_program_transactions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List loyalty programs
# List the loyalty programs of the account.
# @param [Hash] opts the optional parameters
# @return [InlineResponse20013]
def get_loyalty_programs(opts = {})
data, _status_code, _headers = get_loyalty_programs_with_http_info(opts)
data
end
# List loyalty programs
# List the loyalty programs of the account.
# @param [Hash] opts the optional parameters
# @return [Array<(InlineResponse20013, Integer, Hash)>] InlineResponse20013 data, response status code and response headers
def get_loyalty_programs_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_loyalty_programs ...'
end
# resource path
local_var_path = '/v1/loyalty_programs'
# 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] || 'InlineResponse20013'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_loyalty_programs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get loyalty program statistics
# Retrieve the statistics of the specified loyalty program such as the total active points, pending points, spent points, and expired points. **Important:** The returned data does not include the current day. All statistics are updated daily at 11:59 PM in the loyalty program time zone.
# @param loyalty_program_id [Integer] Identifier of the loyalty program. You can get the ID with the [List loyalty programs](https://docs.talon.one/management-api#tag/Loyalty/operation/getLoyaltyPrograms) endpoint.
# @param [Hash] opts the optional parameters
# @return [LoyaltyDashboardData]
def get_loyalty_statistics(loyalty_program_id, opts = {})
data, _status_code, _headers = get_loyalty_statistics_with_http_info(loyalty_program_id, opts)
data
end
# Get loyalty program statistics
# Retrieve the statistics of the specified loyalty program such as the total active points, pending points, spent points, and expired points. **Important:** The returned data does not include the current day. All statistics are updated daily at 11:59 PM in the loyalty program time zone.
# @param loyalty_program_id [Integer] Identifier of the loyalty program. You can get the ID with the [List loyalty programs](https://docs.talon.one/management-api#tag/Loyalty/operation/getLoyaltyPrograms) endpoint.
# @param [Hash] opts the optional parameters
# @return [Array<(LoyaltyDashboardData, Integer, Hash)>] LoyaltyDashboardData data, response status code and response headers
def get_loyalty_statistics_with_http_info(loyalty_program_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_loyalty_statistics ...'
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 ManagementApi.get_loyalty_statistics"
end
# resource path
local_var_path = '/v1/loyalty_programs/{loyaltyProgramId}/statistics'.sub('{' + 'loyaltyProgramId' + '}', CGI.escape(loyalty_program_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] || 'LoyaltyDashboardData'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_loyalty_statistics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List referrals
# List all referrals of the specified campaign.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response. (default to 1000)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [String] :code Filter results performing case-insensitive matching against the referral code. Both the code and the query are folded to remove all non-alpha-numeric characters.
# @option opts [DateTime] :created_before Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the referral creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :created_after Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the referral creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [String] :valid Either \"expired\", \"validNow\", or \"validFuture\". The first option matches referrals in which the expiration date is set and in the past. The second matches referrals in which start date is null or in the past and expiration date is null or in the future, the third matches referrals in which start date is set and in the future.
# @option opts [String] :usable Either \"true\" or \"false\". If \"true\", only referrals where `usageCounter < usageLimit` will be returned, \"false\" will return only referrals where `usageCounter >= usageLimit`.
# @option opts [String] :advocate Filter results by match with a profile ID specified in the referral's AdvocateProfileIntegrationId field.
# @return [InlineResponse20010]
def get_referrals_without_total_count(application_id, campaign_id, opts = {})
data, _status_code, _headers = get_referrals_without_total_count_with_http_info(application_id, campaign_id, opts)
data
end
# List referrals
# List all referrals of the specified campaign.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [String] :code Filter results performing case-insensitive matching against the referral code. Both the code and the query are folded to remove all non-alpha-numeric characters.
# @option opts [DateTime] :created_before Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the referral creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :created_after Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the referral creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [String] :valid Either \"expired\", \"validNow\", or \"validFuture\". The first option matches referrals in which the expiration date is set and in the past. The second matches referrals in which start date is null or in the past and expiration date is null or in the future, the third matches referrals in which start date is set and in the future.
# @option opts [String] :usable Either \"true\" or \"false\". If \"true\", only referrals where `usageCounter < usageLimit` will be returned, \"false\" will return only referrals where `usageCounter >= usageLimit`.
# @option opts [String] :advocate Filter results by match with a profile ID specified in the referral's AdvocateProfileIntegrationId field.
# @return [Array<(InlineResponse20010, Integer, Hash)>] InlineResponse20010 data, response status code and response headers
def get_referrals_without_total_count_with_http_info(application_id, campaign_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_referrals_without_total_count ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.get_referrals_without_total_count"
end
# verify the required parameter 'campaign_id' is set
if @api_client.config.client_side_validation && campaign_id.nil?
fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ManagementApi.get_referrals_without_total_count"
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 ManagementApi.get_referrals_without_total_count, 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 ManagementApi.get_referrals_without_total_count, must be greater than or equal to 1.'
end
allowable_values = ["expired", "validNow", "validFuture"]
if @api_client.config.client_side_validation && opts[:'valid'] && !allowable_values.include?(opts[:'valid'])
fail ArgumentError, "invalid value for \"valid\", must be one of #{allowable_values}"
end
allowable_values = ["true", "false"]
if @api_client.config.client_side_validation && opts[:'usable'] && !allowable_values.include?(opts[:'usable'])
fail ArgumentError, "invalid value for \"usable\", must be one of #{allowable_values}"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/campaigns/{campaignId}/referrals/no_total'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
query_params[:'code'] = opts[:'code'] if !opts[:'code'].nil?
query_params[:'createdBefore'] = opts[:'created_before'] if !opts[:'created_before'].nil?
query_params[:'createdAfter'] = opts[:'created_after'] if !opts[:'created_after'].nil?
query_params[:'valid'] = opts[:'valid'] if !opts[:'valid'].nil?
query_params[:'usable'] = opts[:'usable'] if !opts[:'usable'].nil?
query_params[:'advocate'] = opts[:'advocate'] if !opts[:'advocate'].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] || 'InlineResponse20010'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_referrals_without_total_count\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get role
# Get the details of a specific role. To see all the roles, use the [List roles](/management-api#tag/Roles/operation/listAllRolesV2) endpoint.
# @param role_id [Integer] The ID of role. **Note**: To find the ID of a role, use the [List roles](/management-api#tag/Roles/operation/listAllRolesV2) endpoint.
# @param [Hash] opts the optional parameters
# @return [RoleV2]
def get_role_v2(role_id, opts = {})
data, _status_code, _headers = get_role_v2_with_http_info(role_id, opts)
data
end
# Get role
# Get the details of a specific role. To see all the roles, use the [List roles](/management-api#tag/Roles/operation/listAllRolesV2) endpoint.
# @param role_id [Integer] The ID of role. **Note**: To find the ID of a role, use the [List roles](/management-api#tag/Roles/operation/listAllRolesV2) endpoint.
# @param [Hash] opts the optional parameters
# @return [Array<(RoleV2, Integer, Hash)>] RoleV2 data, response status code and response headers
def get_role_v2_with_http_info(role_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_role_v2 ...'
end
# verify the required parameter 'role_id' is set
if @api_client.config.client_side_validation && role_id.nil?
fail ArgumentError, "Missing the required parameter 'role_id' when calling ManagementApi.get_role_v2"
end
# resource path
local_var_path = '/v2/roles/{roleId}'.sub('{' + 'roleId' + '}', CGI.escape(role_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] || 'RoleV2'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_role_v2\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get ruleset
# Retrieve the specified ruleset.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param ruleset_id [Integer] The ID of the ruleset.
# @param [Hash] opts the optional parameters
# @return [Ruleset]
def get_ruleset(application_id, campaign_id, ruleset_id, opts = {})
data, _status_code, _headers = get_ruleset_with_http_info(application_id, campaign_id, ruleset_id, opts)
data
end
# Get ruleset
# Retrieve the specified ruleset.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param ruleset_id [Integer] The ID of the ruleset.
# @param [Hash] opts the optional parameters
# @return [Array<(Ruleset, Integer, Hash)>] Ruleset data, response status code and response headers
def get_ruleset_with_http_info(application_id, campaign_id, ruleset_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_ruleset ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.get_ruleset"
end
# verify the required parameter 'campaign_id' is set
if @api_client.config.client_side_validation && campaign_id.nil?
fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ManagementApi.get_ruleset"
end
# verify the required parameter 'ruleset_id' is set
if @api_client.config.client_side_validation && ruleset_id.nil?
fail ArgumentError, "Missing the required parameter 'ruleset_id' when calling ManagementApi.get_ruleset"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/campaigns/{campaignId}/rulesets/{rulesetId}'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'rulesetId' + '}', CGI.escape(ruleset_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] || 'Ruleset'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_ruleset\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List campaign rulesets
# List all rulesets of this campaign. A ruleset is a revision of the rules of a campaign. **Important:** The response also includes deleted rules. You should only consider the latest revision of the returned rulesets.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response. (default to 1000)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @return [InlineResponse2007]
def get_rulesets(application_id, campaign_id, opts = {})
data, _status_code, _headers = get_rulesets_with_http_info(application_id, campaign_id, opts)
data
end
# List campaign rulesets
# List all rulesets of this campaign. A ruleset is a revision of the rules of a campaign. **Important:** The response also includes deleted rules. You should only consider the latest revision of the returned rulesets.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @return [Array<(InlineResponse2007, Integer, Hash)>] InlineResponse2007 data, response status code and response headers
def get_rulesets_with_http_info(application_id, campaign_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_rulesets ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.get_rulesets"
end
# verify the required parameter 'campaign_id' is set
if @api_client.config.client_side_validation && campaign_id.nil?
fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ManagementApi.get_rulesets"
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 ManagementApi.get_rulesets, 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 ManagementApi.get_rulesets, must be greater than or equal to 1.'
end
# resource path
local_var_path = '/v1/applications/{applicationId}/campaigns/{campaignId}/rulesets'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].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] || 'InlineResponse2007'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_rulesets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get store
# Get store details for a specific store ID.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param store_id [String] The ID of the store. You can get this ID with the [List stores](#tag/Stores/operation/listStores) endpoint.
# @param [Hash] opts the optional parameters
# @return [Store]
def get_store(application_id, store_id, opts = {})
data, _status_code, _headers = get_store_with_http_info(application_id, store_id, opts)
data
end
# Get store
# Get store details for a specific store ID.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param store_id [String] The ID of the store. You can get this ID with the [List stores](#tag/Stores/operation/listStores) endpoint.
# @param [Hash] opts the optional parameters
# @return [Array<(Store, Integer, Hash)>] Store data, response status code and response headers
def get_store_with_http_info(application_id, store_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_store ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.get_store"
end
# verify the required parameter 'store_id' is set
if @api_client.config.client_side_validation && store_id.nil?
fail ArgumentError, "Missing the required parameter 'store_id' when calling ManagementApi.get_store"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/stores/{storeId}'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'storeId' + '}', CGI.escape(store_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] || 'Store'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_store\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get user
# Retrieve the data (including an invitation code) for a user. Non-admin users can only get their own profile.
# @param user_id [Integer] The ID of the user.
# @param [Hash] opts the optional parameters
# @return [User]
def get_user(user_id, opts = {})
data, _status_code, _headers = get_user_with_http_info(user_id, opts)
data
end
# Get user
# Retrieve the data (including an invitation code) for a user. Non-admin users can only get their own profile.
# @param user_id [Integer] The ID of the user.
# @param [Hash] opts the optional parameters
# @return [Array<(User, Integer, Hash)>] User data, response status code and response headers
def get_user_with_http_info(user_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_user ...'
end
# verify the required parameter 'user_id' is set
if @api_client.config.client_side_validation && user_id.nil?
fail ArgumentError, "Missing the required parameter 'user_id' when calling ManagementApi.get_user"
end
# resource path
local_var_path = '/v1/users/{userId}'.sub('{' + 'userId' + '}', CGI.escape(user_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] || 'User'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List users in account
# Retrieve all users in your account.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response. (default to 1000)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @return [InlineResponse20040]
def get_users(opts = {})
data, _status_code, _headers = get_users_with_http_info(opts)
data
end
# List users in account
# Retrieve all users in your account.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @return [Array<(InlineResponse20040, Integer, Hash)>] InlineResponse20040 data, response status code and response headers
def get_users_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_users ...'
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 ManagementApi.get_users, 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 ManagementApi.get_users, must be greater than or equal to 1.'
end
# resource path
local_var_path = '/v1/users'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].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] || 'InlineResponse20040'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_users\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get webhook
# Returns a webhook by its id.
# @param webhook_id [Integer] The ID of the webhook. You can find the ID in the Campaign Manager's URL when you display the details of the webhook in **Account** > **Webhooks**.
# @param [Hash] opts the optional parameters
# @return [Webhook]
def get_webhook(webhook_id, opts = {})
data, _status_code, _headers = get_webhook_with_http_info(webhook_id, opts)
data
end
# Get webhook
# Returns a webhook by its id.
# @param webhook_id [Integer] The ID of the webhook. You can find the ID in the Campaign Manager's URL when you display the details of the webhook in **Account** > **Webhooks**.
# @param [Hash] opts the optional parameters
# @return [Array<(Webhook, Integer, Hash)>] Webhook data, response status code and response headers
def get_webhook_with_http_info(webhook_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_webhook ...'
end
# verify the required parameter 'webhook_id' is set
if @api_client.config.client_side_validation && webhook_id.nil?
fail ArgumentError, "Missing the required parameter 'webhook_id' when calling ManagementApi.get_webhook"
end
# resource path
local_var_path = '/v1/webhooks/{webhookId}'.sub('{' + 'webhookId' + '}', CGI.escape(webhook_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] || 'Webhook'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List webhook activation log entries
# Webhook activation log entries are created as soon as an integration request triggers a webhook effect. See the [docs](https://docs.talon.one/docs/dev/getting-started/webhooks).
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response. (default to 1000)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [String] :integration_request_uuid Filter results by integration request UUID.
# @option opts [Float] :webhook_id Filter results by webhook id.
# @option opts [Float] :application_id Filter results by Application ID.
# @option opts [Float] :campaign_id Filter results by campaign ID.
# @option opts [DateTime] :created_before Only return events created before this date. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :created_after Only return events created after this date. You can use any time zone setting. Talon.One will convert to UTC internally.
# @return [InlineResponse20037]
def get_webhook_activation_logs(opts = {})
data, _status_code, _headers = get_webhook_activation_logs_with_http_info(opts)
data
end
# List webhook activation log entries
# Webhook activation log entries are created as soon as an integration request triggers a webhook effect. See the [docs](https://docs.talon.one/docs/dev/getting-started/webhooks).
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [String] :integration_request_uuid Filter results by integration request UUID.
# @option opts [Float] :webhook_id Filter results by webhook id.
# @option opts [Float] :application_id Filter results by Application ID.
# @option opts [Float] :campaign_id Filter results by campaign ID.
# @option opts [DateTime] :created_before Only return events created before this date. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :created_after Only return events created after this date. You can use any time zone setting. Talon.One will convert to UTC internally.
# @return [Array<(InlineResponse20037, Integer, Hash)>] InlineResponse20037 data, response status code and response headers
def get_webhook_activation_logs_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_webhook_activation_logs ...'
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 ManagementApi.get_webhook_activation_logs, 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 ManagementApi.get_webhook_activation_logs, must be greater than or equal to 1.'
end
# resource path
local_var_path = '/v1/webhook_activation_logs'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
query_params[:'integrationRequestUuid'] = opts[:'integration_request_uuid'] if !opts[:'integration_request_uuid'].nil?
query_params[:'webhookId'] = opts[:'webhook_id'] if !opts[:'webhook_id'].nil?
query_params[:'applicationId'] = opts[:'application_id'] if !opts[:'application_id'].nil?
query_params[:'campaignId'] = opts[:'campaign_id'] if !opts[:'campaign_id'].nil?
query_params[:'createdBefore'] = opts[:'created_before'] if !opts[:'created_before'].nil?
query_params[:'createdAfter'] = opts[:'created_after'] if !opts[:'created_after'].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] || 'InlineResponse20037'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_webhook_activation_logs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List webhook log entries
# Retrieve all webhook log entries.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response. (default to 1000)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [String] :status Filter results by HTTP status codes.
# @option opts [Float] :webhook_id Filter results by webhook id.
# @option opts [Float] :application_id Filter results by Application ID.
# @option opts [Float] :campaign_id Filter results by campaign ID.
# @option opts [String] :request_uuid Filter results by request UUID.
# @option opts [DateTime] :created_before Filter results where request and response times to return entries before parameter value, expected to be an RFC3339 timestamp string. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :created_after Filter results where request and response times to return entries after parameter value, expected to be an RFC3339 timestamp string. You can use any time zone setting. Talon.One will convert to UTC internally.
# @return [InlineResponse20038]
def get_webhook_logs(opts = {})
data, _status_code, _headers = get_webhook_logs_with_http_info(opts)
data
end
# List webhook log entries
# Retrieve all webhook log entries.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [String] :status Filter results by HTTP status codes.
# @option opts [Float] :webhook_id Filter results by webhook id.
# @option opts [Float] :application_id Filter results by Application ID.
# @option opts [Float] :campaign_id Filter results by campaign ID.
# @option opts [String] :request_uuid Filter results by request UUID.
# @option opts [DateTime] :created_before Filter results where request and response times to return entries before parameter value, expected to be an RFC3339 timestamp string. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :created_after Filter results where request and response times to return entries after parameter value, expected to be an RFC3339 timestamp string. You can use any time zone setting. Talon.One will convert to UTC internally.
# @return [Array<(InlineResponse20038, Integer, Hash)>] InlineResponse20038 data, response status code and response headers
def get_webhook_logs_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_webhook_logs ...'
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 ManagementApi.get_webhook_logs, 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 ManagementApi.get_webhook_logs, must be greater than or equal to 1.'
end
allowable_values = ["success", "error"]
if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
end
# resource path
local_var_path = '/v1/webhook_logs'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
query_params[:'webhookId'] = opts[:'webhook_id'] if !opts[:'webhook_id'].nil?
query_params[:'applicationId'] = opts[:'application_id'] if !opts[:'application_id'].nil?
query_params[:'campaignId'] = opts[:'campaign_id'] if !opts[:'campaign_id'].nil?
query_params[:'requestUuid'] = opts[:'request_uuid'] if !opts[:'request_uuid'].nil?
query_params[:'createdBefore'] = opts[:'created_before'] if !opts[:'created_before'].nil?
query_params[:'createdAfter'] = opts[:'created_after'] if !opts[:'created_after'].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] || 'InlineResponse20038'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_webhook_logs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List webhooks
# List all webhooks.
# @param [Hash] opts the optional parameters
# @option opts [String] :application_ids Checks if the given catalog or its attributes are referenced in the specified Application ID. **Note**: If no Application ID is provided, we check for all connected Applications.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [Integer] :page_size The number of items in the response. (default to 1000)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :creation_type Filter results by creation type.
# @option opts [String] :visibility Filter results by visibility.
# @option opts [Integer] :outgoing_integrations_type_id Filter results by outgoing integration type ID.
# @option opts [String] :title Filter results performing case-insensitive matching against the webhook title.
# @return [InlineResponse20036]
def get_webhooks(opts = {})
data, _status_code, _headers = get_webhooks_with_http_info(opts)
data
end
# List webhooks
# List all webhooks.
# @param [Hash] opts the optional parameters
# @option opts [String] :application_ids Checks if the given catalog or its attributes are referenced in the specified Application ID. **Note**: If no Application ID is provided, we check for all connected Applications.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :creation_type Filter results by creation type.
# @option opts [String] :visibility Filter results by visibility.
# @option opts [Integer] :outgoing_integrations_type_id Filter results by outgoing integration type ID.
# @option opts [String] :title Filter results performing case-insensitive matching against the webhook title.
# @return [Array<(InlineResponse20036, Integer, Hash)>] InlineResponse20036 data, response status code and response headers
def get_webhooks_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.get_webhooks ...'
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 ManagementApi.get_webhooks, 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 ManagementApi.get_webhooks, must be greater than or equal to 1.'
end
allowable_values = ["templateWebhooks", "webhooks"]
if @api_client.config.client_side_validation && opts[:'creation_type'] && !allowable_values.include?(opts[:'creation_type'])
fail ArgumentError, "invalid value for \"creation_type\", must be one of #{allowable_values}"
end
allowable_values = ["visible", "hidden"]
if @api_client.config.client_side_validation && opts[:'visibility'] && !allowable_values.include?(opts[:'visibility'])
fail ArgumentError, "invalid value for \"visibility\", must be one of #{allowable_values}"
end
# resource path
local_var_path = '/v1/webhooks'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'applicationIds'] = opts[:'application_ids'] if !opts[:'application_ids'].nil?
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
query_params[:'creationType'] = opts[:'creation_type'] if !opts[:'creation_type'].nil?
query_params[:'visibility'] = opts[:'visibility'] if !opts[:'visibility'].nil?
query_params[:'outgoingIntegrationsTypeId'] = opts[:'outgoing_integrations_type_id'] if !opts[:'outgoing_integrations_type_id'].nil?
query_params[:'title'] = opts[:'title'] if !opts[:'title'].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] || 'InlineResponse20036'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#get_webhooks\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Import data into existing account-level collection
# Upload a CSV file containing the collection of string values that should be attached as payload for collection. The file should be sent as multipart data. The import **replaces** the initial content of the collection. The CSV file **must** only contain the following column: - `item`: the values in your collection. A collection is limited to 500,000 items. Example: ``` item Addidas Nike Asics ``` **Note:** Before sending a request to this endpoint, ensure the data in the CSV to import is different from the data currently stored in the collection.
# @param collection_id [Integer] The ID of the collection. You can get it with the [List collections in account](#operation/listAccountCollections) endpoint.
# @param [Hash] opts the optional parameters
# @option opts [String] :up_file The file containing the data that is being imported.
# @return [Import]
def import_account_collection(collection_id, opts = {})
data, _status_code, _headers = import_account_collection_with_http_info(collection_id, opts)
data
end
# Import data into existing account-level collection
# Upload a CSV file containing the collection of string values that should be attached as payload for collection. The file should be sent as multipart data. The import **replaces** the initial content of the collection. The CSV file **must** only contain the following column: - `item`: the values in your collection. A collection is limited to 500,000 items. Example: ``` item Addidas Nike Asics ``` **Note:** Before sending a request to this endpoint, ensure the data in the CSV to import is different from the data currently stored in the collection.
# @param collection_id [Integer] The ID of the collection. You can get it with the [List collections in account](#operation/listAccountCollections) endpoint.
# @param [Hash] opts the optional parameters
# @option opts [String] :up_file The file containing the data that is being imported.
# @return [Array<(Import, Integer, Hash)>] Import data, response status code and response headers
def import_account_collection_with_http_info(collection_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.import_account_collection ...'
end
# verify the required parameter 'collection_id' is set
if @api_client.config.client_side_validation && collection_id.nil?
fail ArgumentError, "Missing the required parameter 'collection_id' when calling ManagementApi.import_account_collection"
end
# resource path
local_var_path = '/v1/collections/{collectionId}/import'.sub('{' + 'collectionId' + '}', CGI.escape(collection_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(['multipart/form-data'])
# form parameters
form_params = opts[:form_params] || {}
form_params['upFile'] = opts[:'up_file'] if !opts[:'up_file'].nil?
# http body (model)
post_body = opts[:body]
# return_type
return_type = opts[:return_type] || 'Import'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#import_account_collection\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Import allowed values for attribute
# Upload a CSV file containing a list of [picklist values](https://docs.talon.one/docs/product/account/dev-tools/managing-attributes#picklist-values) for the specified attribute. The file should be sent as multipart data. The import **replaces** the previous list of allowed values for this attribute, if any. The CSV file **must** only contain the following column: - `item` (required): the values in your allowed list, for example a list of SKU's. An allowed list is limited to 500,000 items. Example: ```text item CS-VG-04032021-UP-50D-10 CS-DV-04042021-UP-49D-12 CS-DG-02082021-UP-50G-07 ```
# @param attribute_id [Integer] The ID of the attribute. You can find the ID in the Campaign Manager's URL when you display the details of an attribute in **Account** > **Tools** > **Attributes**.
# @param [Hash] opts the optional parameters
# @option opts [String] :up_file The file containing the data that is being imported.
# @return [Import]
def import_allowed_list(attribute_id, opts = {})
data, _status_code, _headers = import_allowed_list_with_http_info(attribute_id, opts)
data
end
# Import allowed values for attribute
# Upload a CSV file containing a list of [picklist values](https://docs.talon.one/docs/product/account/dev-tools/managing-attributes#picklist-values) for the specified attribute. The file should be sent as multipart data. The import **replaces** the previous list of allowed values for this attribute, if any. The CSV file **must** only contain the following column: - `item` (required): the values in your allowed list, for example a list of SKU's. An allowed list is limited to 500,000 items. Example: ```text item CS-VG-04032021-UP-50D-10 CS-DV-04042021-UP-49D-12 CS-DG-02082021-UP-50G-07 ```
# @param attribute_id [Integer] The ID of the attribute. You can find the ID in the Campaign Manager's URL when you display the details of an attribute in **Account** > **Tools** > **Attributes**.
# @param [Hash] opts the optional parameters
# @option opts [String] :up_file The file containing the data that is being imported.
# @return [Array<(Import, Integer, Hash)>] Import data, response status code and response headers
def import_allowed_list_with_http_info(attribute_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.import_allowed_list ...'
end
# verify the required parameter 'attribute_id' is set
if @api_client.config.client_side_validation && attribute_id.nil?
fail ArgumentError, "Missing the required parameter 'attribute_id' when calling ManagementApi.import_allowed_list"
end
# resource path
local_var_path = '/v1/attributes/{attributeId}/allowed_list/import'.sub('{' + 'attributeId' + '}', CGI.escape(attribute_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(['multipart/form-data'])
# form parameters
form_params = opts[:form_params] || {}
form_params['upFile'] = opts[:'up_file'] if !opts[:'up_file'].nil?
# http body (model)
post_body = opts[:body]
# return_type
return_type = opts[:return_type] || 'Import'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#import_allowed_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Import audience members
# Upload a CSV file containing the integration IDs of the members you want to add to an audience. The file should be sent as multipart data and should contain only the following column (required): - `profileintegrationid`: The integration ID of the customer profile. The import **replaces** the previous list of audience members. **Note:** We recommend limiting your file size to 500MB. Example: ```text profileintegrationid charles alexa ```
# @param audience_id [Integer] The ID of the audience.
# @param [Hash] opts the optional parameters
# @option opts [String] :up_file The file containing the data that is being imported.
# @return [Import]
def import_audiences_memberships(audience_id, opts = {})
data, _status_code, _headers = import_audiences_memberships_with_http_info(audience_id, opts)
data
end
# Import audience members
# Upload a CSV file containing the integration IDs of the members you want to add to an audience. The file should be sent as multipart data and should contain only the following column (required): - `profileintegrationid`: The integration ID of the customer profile. The import **replaces** the previous list of audience members. **Note:** We recommend limiting your file size to 500MB. Example: ```text profileintegrationid charles alexa ```
# @param audience_id [Integer] The ID of the audience.
# @param [Hash] opts the optional parameters
# @option opts [String] :up_file The file containing the data that is being imported.
# @return [Array<(Import, Integer, Hash)>] Import data, response status code and response headers
def import_audiences_memberships_with_http_info(audience_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.import_audiences_memberships ...'
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 ManagementApi.import_audiences_memberships"
end
# resource path
local_var_path = '/v1/audiences/{audienceId}/memberships/import'.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(['multipart/form-data'])
# form parameters
form_params = opts[:form_params] || {}
form_params['upFile'] = opts[:'up_file'] if !opts[:'up_file'].nil?
# http body (model)
post_body = opts[:body]
# return_type
return_type = opts[:return_type] || 'Import'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#import_audiences_memberships\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Import stores
# Upload a CSV file containing the stores you want to link to a specific campaign. Send the file as multipart data. The CSV file **must** only contain the following column: - `store_integration_id`: The identifier of the store. The import **replaces** the previous list of stores linked to the campaign.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [String] :up_file The file containing the data that is being imported.
# @return [Import]
def import_campaign_stores(application_id, campaign_id, opts = {})
data, _status_code, _headers = import_campaign_stores_with_http_info(application_id, campaign_id, opts)
data
end
# Import stores
# Upload a CSV file containing the stores you want to link to a specific campaign. Send the file as multipart data. The CSV file **must** only contain the following column: - `store_integration_id`: The identifier of the store. The import **replaces** the previous list of stores linked to the campaign.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [String] :up_file The file containing the data that is being imported.
# @return [Array<(Import, Integer, Hash)>] Import data, response status code and response headers
def import_campaign_stores_with_http_info(application_id, campaign_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.import_campaign_stores ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.import_campaign_stores"
end
# verify the required parameter 'campaign_id' is set
if @api_client.config.client_side_validation && campaign_id.nil?
fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ManagementApi.import_campaign_stores"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/campaigns/{campaignId}/stores/import'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'campaignId' + '}', CGI.escape(campaign_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(['multipart/form-data'])
# form parameters
form_params = opts[:form_params] || {}
form_params['upFile'] = opts[:'up_file'] if !opts[:'up_file'].nil?
# http body (model)
post_body = opts[:body]
# return_type
return_type = opts[:return_type] || 'Import'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#import_campaign_stores\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Import data into existing campaign-level collection
# Upload a CSV file containing the collection of string values that should be attached as payload for collection. The file should be sent as multipart data. The import **replaces** the initial content of the collection. The CSV file **must** only contain the following column: - `item`: the values in your collection. A collection is limited to 500,000 items. Example: ``` item Addidas Nike Asics ``` **Note:** Before sending a request to this endpoint, ensure the data in the CSV to import is different from the data currently stored in the collection.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param collection_id [Integer] The ID of the collection. You can get it with the [List collections in Application](#operation/listCollectionsInApplication) endpoint.
# @param [Hash] opts the optional parameters
# @option opts [String] :up_file The file containing the data that is being imported.
# @return [Import]
def import_collection(application_id, campaign_id, collection_id, opts = {})
data, _status_code, _headers = import_collection_with_http_info(application_id, campaign_id, collection_id, opts)
data
end
# Import data into existing campaign-level collection
# Upload a CSV file containing the collection of string values that should be attached as payload for collection. The file should be sent as multipart data. The import **replaces** the initial content of the collection. The CSV file **must** only contain the following column: - `item`: the values in your collection. A collection is limited to 500,000 items. Example: ``` item Addidas Nike Asics ``` **Note:** Before sending a request to this endpoint, ensure the data in the CSV to import is different from the data currently stored in the collection.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param collection_id [Integer] The ID of the collection. You can get it with the [List collections in Application](#operation/listCollectionsInApplication) endpoint.
# @param [Hash] opts the optional parameters
# @option opts [String] :up_file The file containing the data that is being imported.
# @return [Array<(Import, Integer, Hash)>] Import data, response status code and response headers
def import_collection_with_http_info(application_id, campaign_id, collection_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.import_collection ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.import_collection"
end
# verify the required parameter 'campaign_id' is set
if @api_client.config.client_side_validation && campaign_id.nil?
fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ManagementApi.import_collection"
end
# verify the required parameter 'collection_id' is set
if @api_client.config.client_side_validation && collection_id.nil?
fail ArgumentError, "Missing the required parameter 'collection_id' when calling ManagementApi.import_collection"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/campaigns/{campaignId}/collections/{collectionId}/import'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'collectionId' + '}', CGI.escape(collection_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(['multipart/form-data'])
# form parameters
form_params = opts[:form_params] || {}
form_params['upFile'] = opts[:'up_file'] if !opts[:'up_file'].nil?
# http body (model)
post_body = opts[:body]
# return_type
return_type = opts[:return_type] || 'Import'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#import_collection\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Import coupons
# Upload a CSV file containing the coupons that should be created. The file should be sent as multipart data. The CSV file contains the following columns: - `value` (required): The coupon code. - `expirydate`: The end date in RFC3339 of the code redemption period. - `startdate`: The start date in RFC3339 of the code redemption period. - `recipientintegrationid`: The integration ID of the recipient of the coupon. Only the customer with this integration ID can redeem this code. Available only for personal codes. - `limitval`: The maximum number of redemptions of this code. For unlimited redemptions, use `0`. Defaults to `1` when not provided. - `discountlimit`: The total discount value that the code can give. This is typically used to represent a gift card value. - `attributes`: A JSON object describing _custom_ coupon attribute names and their values, enclosed with double quotation marks. For example, if you created a [custom attribute](https://docs.talon.one/docs/dev/concepts/attributes#custom-attributes) called `category` associated with the coupon entity, the object in the CSV file, when opened in a text editor, must be: `\"{\"category\": \"10_off\"}\"`. You can use the time zone of your choice. It is converted to UTC internally by Talon.One. **Note:** We recommend limiting your file size to 500MB. **Example:** ```text \"value\",\"expirydate\",\"startdate\",\"recipientintegrationid\",\"limitval\",\"attributes\",\"discountlimit\" COUP1,2018-07-01T04:00:00Z,2018-05-01T04:00:00Z,cust123,1,\"{\"\"Category\"\": \"\"10_off\"\"}\",2.4 ``` Once imported, you can find the `batchId` in the Campaign Manager or by using [List coupons](#tag/Coupons/operation/getCouponsWithoutTotalCount).
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [Boolean] :skip_duplicates An indicator of whether to skip duplicate coupon values instead of causing an error. Duplicate values are ignored when `skipDuplicates=true`.
# @option opts [String] :up_file The file containing the data that is being imported.
# @return [Import]
def import_coupons(application_id, campaign_id, opts = {})
data, _status_code, _headers = import_coupons_with_http_info(application_id, campaign_id, opts)
data
end
# Import coupons
# Upload a CSV file containing the coupons that should be created. The file should be sent as multipart data. The CSV file contains the following columns: - `value` (required): The coupon code. - `expirydate`: The end date in RFC3339 of the code redemption period. - `startdate`: The start date in RFC3339 of the code redemption period. - `recipientintegrationid`: The integration ID of the recipient of the coupon. Only the customer with this integration ID can redeem this code. Available only for personal codes. - `limitval`: The maximum number of redemptions of this code. For unlimited redemptions, use `0`. Defaults to `1` when not provided. - `discountlimit`: The total discount value that the code can give. This is typically used to represent a gift card value. - `attributes`: A JSON object describing _custom_ coupon attribute names and their values, enclosed with double quotation marks. For example, if you created a [custom attribute](https://docs.talon.one/docs/dev/concepts/attributes#custom-attributes) called `category` associated with the coupon entity, the object in the CSV file, when opened in a text editor, must be: `\"{\"category\": \"10_off\"}\"`. You can use the time zone of your choice. It is converted to UTC internally by Talon.One. **Note:** We recommend limiting your file size to 500MB. **Example:** ```text \"value\",\"expirydate\",\"startdate\",\"recipientintegrationid\",\"limitval\",\"attributes\",\"discountlimit\" COUP1,2018-07-01T04:00:00Z,2018-05-01T04:00:00Z,cust123,1,\"{\"\"Category\"\": \"\"10_off\"\"}\",2.4 ``` Once imported, you can find the `batchId` in the Campaign Manager or by using [List coupons](#tag/Coupons/operation/getCouponsWithoutTotalCount).
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [Boolean] :skip_duplicates An indicator of whether to skip duplicate coupon values instead of causing an error. Duplicate values are ignored when `skipDuplicates=true`.
# @option opts [String] :up_file The file containing the data that is being imported.
# @return [Array<(Import, Integer, Hash)>] Import data, response status code and response headers
def import_coupons_with_http_info(application_id, campaign_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.import_coupons ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.import_coupons"
end
# verify the required parameter 'campaign_id' is set
if @api_client.config.client_side_validation && campaign_id.nil?
fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ManagementApi.import_coupons"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/campaigns/{campaignId}/import_coupons'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'skipDuplicates'] = opts[:'skip_duplicates'] if !opts[:'skip_duplicates'].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(['multipart/form-data'])
# form parameters
form_params = opts[:form_params] || {}
form_params['upFile'] = opts[:'up_file'] if !opts[:'up_file'].nil?
# http body (model)
post_body = opts[:body]
# return_type
return_type = opts[:return_type] || 'Import'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#import_coupons\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Import loyalty cards
# Upload a CSV file containing the loyalty cards that you want to use in your card-based loyalty program. Send the file as multipart data. It contains the following columns for each card: - `identifier` (required): The alphanumeric identifier of the loyalty card. - `state` (required): The state of the loyalty card. It can be `active` or `inactive`. - `customerprofileids` (optional): An array of strings representing the identifiers of the customer profiles linked to the loyalty card. The identifiers should be separated with a semicolon (;). **Note:** We recommend limiting your file size to 500MB. **Example:** ```csv identifier,state,customerprofileids 123-456-789AT,active,Alexa001;UserA ```
# @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 [Hash] opts the optional parameters
# @option opts [String] :up_file The file containing the data that is being imported.
# @return [Import]
def import_loyalty_cards(loyalty_program_id, opts = {})
data, _status_code, _headers = import_loyalty_cards_with_http_info(loyalty_program_id, opts)
data
end
# Import loyalty cards
# Upload a CSV file containing the loyalty cards that you want to use in your card-based loyalty program. Send the file as multipart data. It contains the following columns for each card: - `identifier` (required): The alphanumeric identifier of the loyalty card. - `state` (required): The state of the loyalty card. It can be `active` or `inactive`. - `customerprofileids` (optional): An array of strings representing the identifiers of the customer profiles linked to the loyalty card. The identifiers should be separated with a semicolon (;). **Note:** We recommend limiting your file size to 500MB. **Example:** ```csv identifier,state,customerprofileids 123-456-789AT,active,Alexa001;UserA ```
# @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 [Hash] opts the optional parameters
# @option opts [String] :up_file The file containing the data that is being imported.
# @return [Array<(Import, Integer, Hash)>] Import data, response status code and response headers
def import_loyalty_cards_with_http_info(loyalty_program_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.import_loyalty_cards ...'
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 ManagementApi.import_loyalty_cards"
end
# resource path
local_var_path = '/v1/loyalty_programs/{loyaltyProgramId}/import_cards'.sub('{' + 'loyaltyProgramId' + '}', CGI.escape(loyalty_program_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(['multipart/form-data'])
# form parameters
form_params = opts[:form_params] || {}
form_params['upFile'] = opts[:'up_file'] if !opts[:'up_file'].nil?
# http body (model)
post_body = opts[:body]
# return_type
return_type = opts[:return_type] || 'Import'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#import_loyalty_cards\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Import customers into loyalty tiers
# Upload a CSV file containing existing customers to be assigned to existing tiers. Send the file as multipart data. **Important:** This endpoint only works with loyalty programs with advanced tiers (with expiration and downgrade policy) feature enabled. The CSV file should contain the following columns: - `subledgerid` (optional): The ID of the subledger. If this field is empty, the main ledger will be used. - `customerprofileid`: The integration ID of the customer profile to whom the tier should be assigned. - `tiername`: The name of an existing tier to assign to the customer. - `expirydate`: The expiration date of the tier when the tier is reevaluated. It should be a future date. About customer assignment to a tier: - If the customer isn't already in a tier, the customer is assigned to the specified tier during the tier import. - If the customer is already in the tier that's specified in the CSV file, only the expiration date is updated. **Note:** We recommend not using this endpoint to update the tier of a customer. To update a customer's tier, you can [add](/management-api#tag/Loyalty/operation/addLoyaltyPoints) or [deduct](/management-api#tag/Loyalty/operation/removeLoyaltyPoints) their loyalty points. You can use the time zone of your choice. It is converted to UTC internally by Talon.One. **Note:** We recommend limiting your file size to 500MB. **Example:** ```csv subledgerid,customerprofileid,tiername,expirydate SUB1,alexa,Gold,2024-03-21T07:32:14Z ,george,Silver,2025-04-16T21:12:37Z SUB2,avocado,Bronze,2026-05-03T11:47:01Z ```
# @param loyalty_program_id [Integer] Identifier of the loyalty program. You can get the ID with the [List loyalty programs](https://docs.talon.one/management-api#tag/Loyalty/operation/getLoyaltyPrograms) endpoint.
# @param [Hash] opts the optional parameters
# @option opts [String] :up_file The file containing the data that is being imported.
# @return [Import]
def import_loyalty_customers_tiers(loyalty_program_id, opts = {})
data, _status_code, _headers = import_loyalty_customers_tiers_with_http_info(loyalty_program_id, opts)
data
end
# Import customers into loyalty tiers
# Upload a CSV file containing existing customers to be assigned to existing tiers. Send the file as multipart data. **Important:** This endpoint only works with loyalty programs with advanced tiers (with expiration and downgrade policy) feature enabled. The CSV file should contain the following columns: - `subledgerid` (optional): The ID of the subledger. If this field is empty, the main ledger will be used. - `customerprofileid`: The integration ID of the customer profile to whom the tier should be assigned. - `tiername`: The name of an existing tier to assign to the customer. - `expirydate`: The expiration date of the tier when the tier is reevaluated. It should be a future date. About customer assignment to a tier: - If the customer isn't already in a tier, the customer is assigned to the specified tier during the tier import. - If the customer is already in the tier that's specified in the CSV file, only the expiration date is updated. **Note:** We recommend not using this endpoint to update the tier of a customer. To update a customer's tier, you can [add](/management-api#tag/Loyalty/operation/addLoyaltyPoints) or [deduct](/management-api#tag/Loyalty/operation/removeLoyaltyPoints) their loyalty points. You can use the time zone of your choice. It is converted to UTC internally by Talon.One. **Note:** We recommend limiting your file size to 500MB. **Example:** ```csv subledgerid,customerprofileid,tiername,expirydate SUB1,alexa,Gold,2024-03-21T07:32:14Z ,george,Silver,2025-04-16T21:12:37Z SUB2,avocado,Bronze,2026-05-03T11:47:01Z ```
# @param loyalty_program_id [Integer] Identifier of the loyalty program. You can get the ID with the [List loyalty programs](https://docs.talon.one/management-api#tag/Loyalty/operation/getLoyaltyPrograms) endpoint.
# @param [Hash] opts the optional parameters
# @option opts [String] :up_file The file containing the data that is being imported.
# @return [Array<(Import, Integer, Hash)>] Import data, response status code and response headers
def import_loyalty_customers_tiers_with_http_info(loyalty_program_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.import_loyalty_customers_tiers ...'
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 ManagementApi.import_loyalty_customers_tiers"
end
# resource path
local_var_path = '/v1/loyalty_programs/{loyaltyProgramId}/import_customers_tiers'.sub('{' + 'loyaltyProgramId' + '}', CGI.escape(loyalty_program_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(['multipart/form-data'])
# form parameters
form_params = opts[:form_params] || {}
form_params['upFile'] = opts[:'up_file'] if !opts[:'up_file'].nil?
# http body (model)
post_body = opts[:body]
# return_type
return_type = opts[:return_type] || 'Import'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#import_loyalty_customers_tiers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Import loyalty points
# Upload a CSV file containing the loyalty points you want to import into a given loyalty program. Send the file as multipart data. Depending on the type of loyalty program, you can import points into a given customer profile or loyalty card. The CSV file contains the following columns: - `customerprofileid` (optional): For profile-based loyalty programs, the integration ID of the customer profile where the loyalty points are imported. **Note**: If the customer profile does not exist, it will be created. The profile will not be visible in any Application until a session or profile update is received for that profile. - `identifier` (optional): For card-based loyalty programs, the identifier of the loyalty card where the loyalty points are imported. - `amount`: The amount of points to award to the customer profile. - `startdate` (optional): The earliest date when the points can be redeemed. The points are `active` from this date until the expiration date. **Note**: It must be an RFC3339 timestamp string or string `immediate`. Empty or missing values are considered `immediate`. - `expirydate` (optional): The latest date when the points can be redeemed. The points are `expired` after this date. **Note**: It must be an RFC3339 timestamp string or string `unlimited`. Empty or missing values are considered `unlimited`. - `subledgerid` (optional): The ID of the subledger that should received the points. - `reason` (optional): The reason why these points are awarded. You can use the time zone of your choice. It is converted to UTC internally by Talon.One. **Note:** For existing customer profiles and loyalty cards, the imported points are added to any previous active or pending points, depending on the value provided for `startdate`. If `startdate` matches the current date, the imported points are _active_. If it is later, the points are _pending_ until the date provided for `startdate` is reached. **Note:** We recommend limiting your file size to 500MB. **Example for profile-based programs:** ```text customerprofileid,amount,startdate,expirydate,subledgerid,reason URNGV8294NV,100,2009-11-10T23:00:00Z,2009-11-11T23:00:00Z,subledger1,appeasement ``` **Example for card-based programs:** ```text identifier,amount,startdate,expirydate,subledgerid,reason summer-loyalty-card-0543,100,2009-11-10T23:00:00Z,2009-11-11T23:00:00Z,subledger1,appeasement ```
# @param loyalty_program_id [Integer] Identifier of the loyalty program. You can get the ID with the [List loyalty programs](https://docs.talon.one/management-api#tag/Loyalty/operation/getLoyaltyPrograms) endpoint.
# @param [Hash] opts the optional parameters
# @option opts [String] :up_file The file containing the data that is being imported.
# @return [Import]
def import_loyalty_points(loyalty_program_id, opts = {})
data, _status_code, _headers = import_loyalty_points_with_http_info(loyalty_program_id, opts)
data
end
# Import loyalty points
# Upload a CSV file containing the loyalty points you want to import into a given loyalty program. Send the file as multipart data. Depending on the type of loyalty program, you can import points into a given customer profile or loyalty card. The CSV file contains the following columns: - `customerprofileid` (optional): For profile-based loyalty programs, the integration ID of the customer profile where the loyalty points are imported. **Note**: If the customer profile does not exist, it will be created. The profile will not be visible in any Application until a session or profile update is received for that profile. - `identifier` (optional): For card-based loyalty programs, the identifier of the loyalty card where the loyalty points are imported. - `amount`: The amount of points to award to the customer profile. - `startdate` (optional): The earliest date when the points can be redeemed. The points are `active` from this date until the expiration date. **Note**: It must be an RFC3339 timestamp string or string `immediate`. Empty or missing values are considered `immediate`. - `expirydate` (optional): The latest date when the points can be redeemed. The points are `expired` after this date. **Note**: It must be an RFC3339 timestamp string or string `unlimited`. Empty or missing values are considered `unlimited`. - `subledgerid` (optional): The ID of the subledger that should received the points. - `reason` (optional): The reason why these points are awarded. You can use the time zone of your choice. It is converted to UTC internally by Talon.One. **Note:** For existing customer profiles and loyalty cards, the imported points are added to any previous active or pending points, depending on the value provided for `startdate`. If `startdate` matches the current date, the imported points are _active_. If it is later, the points are _pending_ until the date provided for `startdate` is reached. **Note:** We recommend limiting your file size to 500MB. **Example for profile-based programs:** ```text customerprofileid,amount,startdate,expirydate,subledgerid,reason URNGV8294NV,100,2009-11-10T23:00:00Z,2009-11-11T23:00:00Z,subledger1,appeasement ``` **Example for card-based programs:** ```text identifier,amount,startdate,expirydate,subledgerid,reason summer-loyalty-card-0543,100,2009-11-10T23:00:00Z,2009-11-11T23:00:00Z,subledger1,appeasement ```
# @param loyalty_program_id [Integer] Identifier of the loyalty program. You can get the ID with the [List loyalty programs](https://docs.talon.one/management-api#tag/Loyalty/operation/getLoyaltyPrograms) endpoint.
# @param [Hash] opts the optional parameters
# @option opts [String] :up_file The file containing the data that is being imported.
# @return [Array<(Import, Integer, Hash)>] Import data, response status code and response headers
def import_loyalty_points_with_http_info(loyalty_program_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.import_loyalty_points ...'
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 ManagementApi.import_loyalty_points"
end
# resource path
local_var_path = '/v1/loyalty_programs/{loyaltyProgramId}/import_points'.sub('{' + 'loyaltyProgramId' + '}', CGI.escape(loyalty_program_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(['multipart/form-data'])
# form parameters
form_params = opts[:form_params] || {}
form_params['upFile'] = opts[:'up_file'] if !opts[:'up_file'].nil?
# http body (model)
post_body = opts[:body]
# return_type
return_type = opts[:return_type] || 'Import'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#import_loyalty_points\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Import giveaway codes into a giveaway pool
# Upload a CSV file containing the giveaway codes that should be created. Send the file as multipart data. The CSV file contains the following columns: - `code` (required): The code of your giveaway, for instance, a gift card redemption code. - `startdate`: The start date in RFC3339 of the code redemption period. - `enddate`: The last date in RFC3339 of the code redemption period. - `attributes`: A JSON object describing _custom_ giveaway attribute names and their values, enclosed with double quotation marks. For example, if you created a [custom attribute](https://docs.talon.one/docs/dev/concepts/attributes#custom-attributes) called `provider` associated with the giveaway entity, the object in the CSV file, when opened in a text editor, must be: `\"{\"provider\": \"myPartnerCompany\"}\"`. The `startdate` and `enddate` have nothing to do with the _validity_ of the codes. They are only used by the Rule Engine to award the codes or not. You can use the time zone setting of your choice. The values are converted to UTC internally by Talon.One. **Note:** - We recommend limiting your file size to 500MB. - You can import the same code multiple times. Duplicate codes are treated and distributed to customers as unique codes. **Example:** ```text code,startdate,enddate,attributes GIVEAWAY1,2020-11-10T23:00:00Z,2022-11-11T23:00:00Z,\"{\"\"provider\"\": \"\"Amazon\"\"}\" GIVEAWAY2,2020-11-10T23:00:00Z,2022-11-11T23:00:00Z,\"{\"\"provider\"\": \"\"Amazon\"\"}\" GIVEAWAY3,2021-01-10T23:00:00Z,2022-11-11T23:00:00Z,\"{\"\"provider\"\": \"\"Aliexpress\"\"}\" ```
# @param pool_id [Integer] The ID of the pool. You can find it in the Campaign Manager, in the **Giveaways** section.
# @param [Hash] opts the optional parameters
# @option opts [String] :up_file The file containing the data that is being imported.
# @return [Import]
def import_pool_giveaways(pool_id, opts = {})
data, _status_code, _headers = import_pool_giveaways_with_http_info(pool_id, opts)
data
end
# Import giveaway codes into a giveaway pool
# Upload a CSV file containing the giveaway codes that should be created. Send the file as multipart data. The CSV file contains the following columns: - `code` (required): The code of your giveaway, for instance, a gift card redemption code. - `startdate`: The start date in RFC3339 of the code redemption period. - `enddate`: The last date in RFC3339 of the code redemption period. - `attributes`: A JSON object describing _custom_ giveaway attribute names and their values, enclosed with double quotation marks. For example, if you created a [custom attribute](https://docs.talon.one/docs/dev/concepts/attributes#custom-attributes) called `provider` associated with the giveaway entity, the object in the CSV file, when opened in a text editor, must be: `\"{\"provider\": \"myPartnerCompany\"}\"`. The `startdate` and `enddate` have nothing to do with the _validity_ of the codes. They are only used by the Rule Engine to award the codes or not. You can use the time zone setting of your choice. The values are converted to UTC internally by Talon.One. **Note:** - We recommend limiting your file size to 500MB. - You can import the same code multiple times. Duplicate codes are treated and distributed to customers as unique codes. **Example:** ```text code,startdate,enddate,attributes GIVEAWAY1,2020-11-10T23:00:00Z,2022-11-11T23:00:00Z,\"{\"\"provider\"\": \"\"Amazon\"\"}\" GIVEAWAY2,2020-11-10T23:00:00Z,2022-11-11T23:00:00Z,\"{\"\"provider\"\": \"\"Amazon\"\"}\" GIVEAWAY3,2021-01-10T23:00:00Z,2022-11-11T23:00:00Z,\"{\"\"provider\"\": \"\"Aliexpress\"\"}\" ```
# @param pool_id [Integer] The ID of the pool. You can find it in the Campaign Manager, in the **Giveaways** section.
# @param [Hash] opts the optional parameters
# @option opts [String] :up_file The file containing the data that is being imported.
# @return [Array<(Import, Integer, Hash)>] Import data, response status code and response headers
def import_pool_giveaways_with_http_info(pool_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.import_pool_giveaways ...'
end
# verify the required parameter 'pool_id' is set
if @api_client.config.client_side_validation && pool_id.nil?
fail ArgumentError, "Missing the required parameter 'pool_id' when calling ManagementApi.import_pool_giveaways"
end
# resource path
local_var_path = '/v1/giveaways/pools/{poolId}/import'.sub('{' + 'poolId' + '}', CGI.escape(pool_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(['multipart/form-data'])
# form parameters
form_params = opts[:form_params] || {}
form_params['upFile'] = opts[:'up_file'] if !opts[:'up_file'].nil?
# http body (model)
post_body = opts[:body]
# return_type
return_type = opts[:return_type] || 'Import'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#import_pool_giveaways\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Import referrals
# Upload a CSV file containing the referrals that should be created. The file should be sent as multipart data. The CSV file contains the following columns: - `code` (required): The referral code. - `advocateprofileintegrationid` (required): The profile ID of the advocate. - `startdate`: The start date in RFC3339 of the code redemption period. - `expirydate`: The end date in RFC3339 of the code redemption period. - `limitval`: The maximum number of redemptions of this code. Defaults to `1` when left blank. - `attributes`: A JSON object describing _custom_ referral attribute names and their values, enclosed with double quotation marks. For example, if you created a [custom attribute](https://docs.talon.one/docs/dev/concepts/attributes#custom-attributes) called `category` associated with the referral entity, the object in the CSV file, when opened in a text editor, must be: `\"{\"category\": \"10_off\"}\"`. You can use the time zone of your choice. It is converted to UTC internally by Talon.One. **Important:** When you import a CSV file with referrals, a [customer profile](https://docs.talon.one/docs/dev/concepts/entities/customer-profiles) is **not** automatically created for each `advocateprofileintegrationid` column value. Use the [Update customer profile](https://docs.talon.one/integration-api#tag/Customer-profiles/operation/updateCustomerProfileV2) endpoint or the [Update multiple customer profiles](https://docs.talon.one/integration-api#tag/Customer-profiles/operation/updateCustomerProfilesV2) endpoint to create the customer profiles. **Note:** We recommend limiting your file size to 500MB. **Example:** ```text code,startdate,expirydate,advocateprofileintegrationid,limitval,attributes REFERRAL_CODE1,2020-11-10T23:00:00Z,2021-11-11T23:00:00Z,integid_4,1,\"{\"\"my_attribute\"\": \"\"10_off\"\"}\" REFERRAL_CODE2,2020-11-10T23:00:00Z,2021-11-11T23:00:00Z,integid1,1,\"{\"\"my_attribute\"\": \"\"20_off\"\"}\" ```
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [String] :up_file The file containing the data that is being imported.
# @return [Import]
def import_referrals(application_id, campaign_id, opts = {})
data, _status_code, _headers = import_referrals_with_http_info(application_id, campaign_id, opts)
data
end
# Import referrals
# Upload a CSV file containing the referrals that should be created. The file should be sent as multipart data. The CSV file contains the following columns: - `code` (required): The referral code. - `advocateprofileintegrationid` (required): The profile ID of the advocate. - `startdate`: The start date in RFC3339 of the code redemption period. - `expirydate`: The end date in RFC3339 of the code redemption period. - `limitval`: The maximum number of redemptions of this code. Defaults to `1` when left blank. - `attributes`: A JSON object describing _custom_ referral attribute names and their values, enclosed with double quotation marks. For example, if you created a [custom attribute](https://docs.talon.one/docs/dev/concepts/attributes#custom-attributes) called `category` associated with the referral entity, the object in the CSV file, when opened in a text editor, must be: `\"{\"category\": \"10_off\"}\"`. You can use the time zone of your choice. It is converted to UTC internally by Talon.One. **Important:** When you import a CSV file with referrals, a [customer profile](https://docs.talon.one/docs/dev/concepts/entities/customer-profiles) is **not** automatically created for each `advocateprofileintegrationid` column value. Use the [Update customer profile](https://docs.talon.one/integration-api#tag/Customer-profiles/operation/updateCustomerProfileV2) endpoint or the [Update multiple customer profiles](https://docs.talon.one/integration-api#tag/Customer-profiles/operation/updateCustomerProfilesV2) endpoint to create the customer profiles. **Note:** We recommend limiting your file size to 500MB. **Example:** ```text code,startdate,expirydate,advocateprofileintegrationid,limitval,attributes REFERRAL_CODE1,2020-11-10T23:00:00Z,2021-11-11T23:00:00Z,integid_4,1,\"{\"\"my_attribute\"\": \"\"10_off\"\"}\" REFERRAL_CODE2,2020-11-10T23:00:00Z,2021-11-11T23:00:00Z,integid1,1,\"{\"\"my_attribute\"\": \"\"20_off\"\"}\" ```
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [String] :up_file The file containing the data that is being imported.
# @return [Array<(Import, Integer, Hash)>] Import data, response status code and response headers
def import_referrals_with_http_info(application_id, campaign_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.import_referrals ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.import_referrals"
end
# verify the required parameter 'campaign_id' is set
if @api_client.config.client_side_validation && campaign_id.nil?
fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ManagementApi.import_referrals"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/campaigns/{campaignId}/import_referrals'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'campaignId' + '}', CGI.escape(campaign_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(['multipart/form-data'])
# form parameters
form_params = opts[:form_params] || {}
form_params['upFile'] = opts[:'up_file'] if !opts[:'up_file'].nil?
# http body (model)
post_body = opts[:body]
# return_type
return_type = opts[:return_type] || 'Import'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#import_referrals\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Invite user from identity provider
# [Invite a user](https://docs.talon.one/docs/product/account/account-settings/managing-users#inviting-a-user) from an external identity provider to Talon.One by sending an invitation to their email address.
# @param body [NewExternalInvitation] body
# @param [Hash] opts the optional parameters
# @return [nil]
def invite_user_external(body, opts = {})
invite_user_external_with_http_info(body, opts)
nil
end
# Invite user from identity provider
# [Invite a user](https://docs.talon.one/docs/product/account/account-settings/managing-users#inviting-a-user) from an external identity provider to Talon.One by sending an invitation to their email address.
# @param body [NewExternalInvitation] body
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def invite_user_external_with_http_info(body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.invite_user_external ...'
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 ManagementApi.invite_user_external"
end
# resource path
local_var_path = '/v1/users/invite'
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# 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] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#invite_user_external\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List collections in account
# List account-level collections in the account.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response. (default to 1000)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [Boolean] :with_total_result_size When this flag is set, the result includes the total size of the result, across all pages. This might decrease performance on large data sets. - When `true`: `hasMore` is true when there is a next page. `totalResultSize` is always zero. - When `false`: `hasMore` is always false. `totalResultSize` contains the total number of results for this query.
# @option opts [String] :name Filter by collection name.
# @return [InlineResponse20017]
def list_account_collections(opts = {})
data, _status_code, _headers = list_account_collections_with_http_info(opts)
data
end
# List collections in account
# List account-level collections in the account.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [Boolean] :with_total_result_size When this flag is set, the result includes the total size of the result, across all pages. This might decrease performance on large data sets. - When `true`: `hasMore` is true when there is a next page. `totalResultSize` is always zero. - When `false`: `hasMore` is always false. `totalResultSize` contains the total number of results for this query.
# @option opts [String] :name Filter by collection name.
# @return [Array<(InlineResponse20017, Integer, Hash)>] InlineResponse20017 data, response status code and response headers
def list_account_collections_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.list_account_collections ...'
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 ManagementApi.list_account_collections, 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 ManagementApi.list_account_collections, must be greater than or equal to 1.'
end
# resource path
local_var_path = '/v1/collections'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
query_params[:'withTotalResultSize'] = opts[:'with_total_result_size'] if !opts[:'with_total_result_size'].nil?
query_params[:'name'] = opts[:'name'] if !opts[:'name'].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] || 'InlineResponse20017'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#list_account_collections\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List achievements
# List all the achievements for a specific campaign.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response. (default to 50)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :title Filter by the display name for the achievement in the campaign manager. **Note**: If no `title` is provided, all the achievements from the campaign are returned.
# @return [InlineResponse20045]
def list_achievements(application_id, campaign_id, opts = {})
data, _status_code, _headers = list_achievements_with_http_info(application_id, campaign_id, opts)
data
end
# List achievements
# List all the achievements for a specific campaign.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :title Filter by the display name for the achievement in the campaign manager. **Note**: If no `title` is provided, all the achievements from the campaign are returned.
# @return [Array<(InlineResponse20045, Integer, Hash)>] InlineResponse20045 data, response status code and response headers
def list_achievements_with_http_info(application_id, campaign_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.list_achievements ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.list_achievements"
end
# verify the required parameter 'campaign_id' is set
if @api_client.config.client_side_validation && campaign_id.nil?
fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ManagementApi.list_achievements"
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 ManagementApi.list_achievements, 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 ManagementApi.list_achievements, must be greater than or equal to 1.'
end
# resource path
local_var_path = '/v1/applications/{applicationId}/campaigns/{campaignId}/achievements'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
query_params[:'title'] = opts[:'title'] if !opts[:'title'].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] || 'InlineResponse20045'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#list_achievements\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List roles
# List all roles.
# @param [Hash] opts the optional parameters
# @return [InlineResponse20043]
def list_all_roles_v2(opts = {})
data, _status_code, _headers = list_all_roles_v2_with_http_info(opts)
data
end
# List roles
# List all roles.
# @param [Hash] opts the optional parameters
# @return [Array<(InlineResponse20043, Integer, Hash)>] InlineResponse20043 data, response status code and response headers
def list_all_roles_v2_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.list_all_roles_v2 ...'
end
# resource path
local_var_path = '/v2/roles'
# 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] || 'InlineResponse20043'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#list_all_roles_v2\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List items in a catalog
# Return a paginated list of cart items in the given catalog.
# @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 [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response. (default to 1000)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [Boolean] :with_total_result_size When this flag is set, the result includes the total size of the result, across all pages. This might decrease performance on large data sets. - When `true`: `hasMore` is true when there is a next page. `totalResultSize` is always zero. - When `false`: `hasMore` is always false. `totalResultSize` contains the total number of results for this query.
# @option opts [Array] :sku Filter results by one or more SKUs. Must be exact match.
# @option opts [Array] :product_names Filter results by one or more product names. Must be exact match.
# @return [InlineResponse20034]
def list_catalog_items(catalog_id, opts = {})
data, _status_code, _headers = list_catalog_items_with_http_info(catalog_id, opts)
data
end
# List items in a catalog
# Return a paginated list of cart items in the given catalog.
# @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 [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [Boolean] :with_total_result_size When this flag is set, the result includes the total size of the result, across all pages. This might decrease performance on large data sets. - When `true`: `hasMore` is true when there is a next page. `totalResultSize` is always zero. - When `false`: `hasMore` is always false. `totalResultSize` contains the total number of results for this query.
# @option opts [Array] :sku Filter results by one or more SKUs. Must be exact match.
# @option opts [Array] :product_names Filter results by one or more product names. Must be exact match.
# @return [Array<(InlineResponse20034, Integer, Hash)>] InlineResponse20034 data, response status code and response headers
def list_catalog_items_with_http_info(catalog_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.list_catalog_items ...'
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 ManagementApi.list_catalog_items"
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 ManagementApi.list_catalog_items, 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 ManagementApi.list_catalog_items, must be greater than or equal to 1.'
end
# resource path
local_var_path = '/v1/catalogs/{catalogId}/items'.sub('{' + 'catalogId' + '}', CGI.escape(catalog_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
query_params[:'withTotalResultSize'] = opts[:'with_total_result_size'] if !opts[:'with_total_result_size'].nil?
query_params[:'sku'] = @api_client.build_collection_param(opts[:'sku'], :csv) if !opts[:'sku'].nil?
query_params[:'productNames'] = @api_client.build_collection_param(opts[:'product_names'], :csv) if !opts[:'product_names'].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] || 'InlineResponse20034'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#list_catalog_items\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List collections in campaign
# List collections in a given campaign.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response. (default to 1000)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [Boolean] :with_total_result_size When this flag is set, the result includes the total size of the result, across all pages. This might decrease performance on large data sets. - When `true`: `hasMore` is true when there is a next page. `totalResultSize` is always zero. - When `false`: `hasMore` is always false. `totalResultSize` contains the total number of results for this query.
# @option opts [String] :name Filter by collection name.
# @return [InlineResponse20017]
def list_collections(application_id, campaign_id, opts = {})
data, _status_code, _headers = list_collections_with_http_info(application_id, campaign_id, opts)
data
end
# List collections in campaign
# List collections in a given campaign.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [Boolean] :with_total_result_size When this flag is set, the result includes the total size of the result, across all pages. This might decrease performance on large data sets. - When `true`: `hasMore` is true when there is a next page. `totalResultSize` is always zero. - When `false`: `hasMore` is always false. `totalResultSize` contains the total number of results for this query.
# @option opts [String] :name Filter by collection name.
# @return [Array<(InlineResponse20017, Integer, Hash)>] InlineResponse20017 data, response status code and response headers
def list_collections_with_http_info(application_id, campaign_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.list_collections ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.list_collections"
end
# verify the required parameter 'campaign_id' is set
if @api_client.config.client_side_validation && campaign_id.nil?
fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ManagementApi.list_collections"
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 ManagementApi.list_collections, 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 ManagementApi.list_collections, must be greater than or equal to 1.'
end
# resource path
local_var_path = '/v1/applications/{applicationId}/campaigns/{campaignId}/collections'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
query_params[:'withTotalResultSize'] = opts[:'with_total_result_size'] if !opts[:'with_total_result_size'].nil?
query_params[:'name'] = opts[:'name'] if !opts[:'name'].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] || 'InlineResponse20017'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#list_collections\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List collections in Application
# List campaign-level collections from all campaigns in a given Application.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response. (default to 1000)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [Boolean] :with_total_result_size When this flag is set, the result includes the total size of the result, across all pages. This might decrease performance on large data sets. - When `true`: `hasMore` is true when there is a next page. `totalResultSize` is always zero. - When `false`: `hasMore` is always false. `totalResultSize` contains the total number of results for this query.
# @option opts [String] :name Filter by collection name.
# @return [InlineResponse20017]
def list_collections_in_application(application_id, opts = {})
data, _status_code, _headers = list_collections_in_application_with_http_info(application_id, opts)
data
end
# List collections in Application
# List campaign-level collections from all campaigns in a given Application.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [Boolean] :with_total_result_size When this flag is set, the result includes the total size of the result, across all pages. This might decrease performance on large data sets. - When `true`: `hasMore` is true when there is a next page. `totalResultSize` is always zero. - When `false`: `hasMore` is always false. `totalResultSize` contains the total number of results for this query.
# @option opts [String] :name Filter by collection name.
# @return [Array<(InlineResponse20017, Integer, Hash)>] InlineResponse20017 data, response status code and response headers
def list_collections_in_application_with_http_info(application_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.list_collections_in_application ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.list_collections_in_application"
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 ManagementApi.list_collections_in_application, 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 ManagementApi.list_collections_in_application, must be greater than or equal to 1.'
end
# resource path
local_var_path = '/v1/applications/{applicationId}/collections'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
query_params[:'withTotalResultSize'] = opts[:'with_total_result_size'] if !opts[:'with_total_result_size'].nil?
query_params[:'name'] = opts[:'name'] if !opts[:'name'].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] || 'InlineResponse20017'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#list_collections_in_application\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List stores
# List all stores for a specific Application.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response. (default to 1000)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [Boolean] :with_total_result_size When this flag is set, the result includes the total size of the result, across all pages. This might decrease performance on large data sets. - When `true`: `hasMore` is true when there is a next page. `totalResultSize` is always zero. - When `false`: `hasMore` is always false. `totalResultSize` contains the total number of results for this query.
# @option opts [Float] :campaign_id Filter results by campaign ID.
# @option opts [String] :name The name of the store.
# @option opts [String] :integration_id The integration ID of the store.
# @option opts [String] :query Filter results by `name` or `integrationId`.
# @return [InlineResponse20044]
def list_stores(application_id, opts = {})
data, _status_code, _headers = list_stores_with_http_info(application_id, opts)
data
end
# List stores
# List all stores for a specific Application.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [Boolean] :with_total_result_size When this flag is set, the result includes the total size of the result, across all pages. This might decrease performance on large data sets. - When `true`: `hasMore` is true when there is a next page. `totalResultSize` is always zero. - When `false`: `hasMore` is always false. `totalResultSize` contains the total number of results for this query.
# @option opts [Float] :campaign_id Filter results by campaign ID.
# @option opts [String] :name The name of the store.
# @option opts [String] :integration_id The integration ID of the store.
# @option opts [String] :query Filter results by `name` or `integrationId`.
# @return [Array<(InlineResponse20044, Integer, Hash)>] InlineResponse20044 data, response status code and response headers
def list_stores_with_http_info(application_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.list_stores ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.list_stores"
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 ManagementApi.list_stores, 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 ManagementApi.list_stores, must be greater than or equal to 1.'
end
# resource path
local_var_path = '/v1/applications/{applicationId}/stores'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
query_params[:'withTotalResultSize'] = opts[:'with_total_result_size'] if !opts[:'with_total_result_size'].nil?
query_params[:'campaignId'] = opts[:'campaign_id'] if !opts[:'campaign_id'].nil?
query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?
query_params[:'integrationId'] = opts[:'integration_id'] if !opts[:'integration_id'].nil?
query_params[:'query'] = opts[:'query'] if !opts[:'query'].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] || 'InlineResponse20044'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#list_stores\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Activate or deactivate notification
# Activate or deactivate the given notification. When `enabled` is false, updates will no longer be sent for the given notification.
# @param notification_id [Integer] The ID of the notification. Get it with the appropriate _List notifications_ endpoint.
# @param body [NotificationActivation] body
# @param [Hash] opts the optional parameters
# @return [nil]
def notification_activation(notification_id, body, opts = {})
notification_activation_with_http_info(notification_id, body, opts)
nil
end
# Activate or deactivate notification
# Activate or deactivate the given notification. When `enabled` is false, updates will no longer be sent for the given notification.
# @param notification_id [Integer] The ID of the notification. Get it with the appropriate _List notifications_ endpoint.
# @param body [NotificationActivation] body
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def notification_activation_with_http_info(notification_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.notification_activation ...'
end
# verify the required parameter 'notification_id' is set
if @api_client.config.client_side_validation && notification_id.nil?
fail ArgumentError, "Missing the required parameter 'notification_id' when calling ManagementApi.notification_activation"
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 ManagementApi.notification_activation"
end
# resource path
local_var_path = '/v1/notifications/{notificationId}/activation'.sub('{' + 'notificationId' + '}', CGI.escape(notification_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# 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] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#notification_activation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Validate Okta API ownership
# Validate the ownership of the API through a challenge-response mechanism. This challenger endpoint is used by Okta to confirm that communication between Talon.One and Okta is correctly configured and accessible for provisioning and deprovisioning of Talon.One users, and that only Talon.One can receive and respond to events from Okta.
# @param [Hash] opts the optional parameters
# @return [nil]
def okta_event_handler_challenge(opts = {})
okta_event_handler_challenge_with_http_info(opts)
nil
end
# Validate Okta API ownership
# Validate the ownership of the API through a challenge-response mechanism. This challenger endpoint is used by Okta to confirm that communication between Talon.One and Okta is correctly configured and accessible for provisioning and deprovisioning of Talon.One users, and that only Talon.One can receive and respond to events from Okta.
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def okta_event_handler_challenge_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.okta_event_handler_challenge ...'
end
# resource path
local_var_path = '/v1/provisioning/okta'
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# 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] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#okta_event_handler_challenge\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Create notification about added or deducted loyalty points
# Create a notification about added or deducted loyalty points in a given profile-based loyalty program. A notification for added or deducted loyalty points is different from regular webhooks in that it is loyalty program-scoped and has a predefined payload. For more information, see [Managing loyalty notifications](https://docs.talon.one/docs/product/loyalty-programs/managing-loyalty-notifications).
# @param loyalty_program_id [Integer] Identifier of the profile-based loyalty program. You can get the ID with the [List loyalty programs](https://docs.talon.one/management-api#tag/Loyalty/operation/getLoyaltyPrograms) endpoint.
# @param body [NewBaseNotification] body
# @param [Hash] opts the optional parameters
# @return [BaseNotification]
def post_added_deducted_points_notification(loyalty_program_id, body, opts = {})
data, _status_code, _headers = post_added_deducted_points_notification_with_http_info(loyalty_program_id, body, opts)
data
end
# Create notification about added or deducted loyalty points
# Create a notification about added or deducted loyalty points in a given profile-based loyalty program. A notification for added or deducted loyalty points is different from regular webhooks in that it is loyalty program-scoped and has a predefined payload. For more information, see [Managing loyalty notifications](https://docs.talon.one/docs/product/loyalty-programs/managing-loyalty-notifications).
# @param loyalty_program_id [Integer] Identifier of the profile-based loyalty program. You can get the ID with the [List loyalty programs](https://docs.talon.one/management-api#tag/Loyalty/operation/getLoyaltyPrograms) endpoint.
# @param body [NewBaseNotification] body
# @param [Hash] opts the optional parameters
# @return [Array<(BaseNotification, Integer, Hash)>] BaseNotification data, response status code and response headers
def post_added_deducted_points_notification_with_http_info(loyalty_program_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.post_added_deducted_points_notification ...'
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 ManagementApi.post_added_deducted_points_notification"
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 ManagementApi.post_added_deducted_points_notification"
end
# resource path
local_var_path = '/v1/loyalty_programs/{loyaltyProgramId}/notifications/added_deducted_points'.sub('{' + 'loyaltyProgramId' + '}', CGI.escape(loyalty_program_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] || 'BaseNotification'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#post_added_deducted_points_notification\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Create strikethrough notification
# Create a notification for the in the given Application. For more information, see [Managing notifications](https://docs.talon.one/docs/product/applications/outbound-notifications). See the [payload](https://docs.talon.one/outbound-notifications) you will receive.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param body [NewBaseNotification] body
# @param [Hash] opts the optional parameters
# @return [BaseNotification]
def post_catalogs_strikethrough_notification(application_id, body, opts = {})
data, _status_code, _headers = post_catalogs_strikethrough_notification_with_http_info(application_id, body, opts)
data
end
# Create strikethrough notification
# Create a notification for the in the given Application. For more information, see [Managing notifications](https://docs.talon.one/docs/product/applications/outbound-notifications). See the [payload](https://docs.talon.one/outbound-notifications) you will receive.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param body [NewBaseNotification] body
# @param [Hash] opts the optional parameters
# @return [Array<(BaseNotification, Integer, Hash)>] BaseNotification data, response status code and response headers
def post_catalogs_strikethrough_notification_with_http_info(application_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.post_catalogs_strikethrough_notification ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.post_catalogs_strikethrough_notification"
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 ManagementApi.post_catalogs_strikethrough_notification"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/catalogs/notifications/strikethrough'.sub('{' + 'applicationId' + '}', CGI.escape(application_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] || 'BaseNotification'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#post_catalogs_strikethrough_notification\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Create notification about pending loyalty points
# Create a notification about pending loyalty points for a given profile-based loyalty program. For more information, see [Managing loyalty notifications](https://docs.talon.one/docs/product/loyalty-programs/managing-loyalty-notifications).
# @param loyalty_program_id [Integer] Identifier of the profile-based loyalty program. You can get the ID with the [List loyalty programs](https://docs.talon.one/management-api#tag/Loyalty/operation/getLoyaltyPrograms) endpoint.
# @param body [NewBaseNotification] body
# @param [Hash] opts the optional parameters
# @return [BaseNotification]
def post_pending_points_notification(loyalty_program_id, body, opts = {})
data, _status_code, _headers = post_pending_points_notification_with_http_info(loyalty_program_id, body, opts)
data
end
# Create notification about pending loyalty points
# Create a notification about pending loyalty points for a given profile-based loyalty program. For more information, see [Managing loyalty notifications](https://docs.talon.one/docs/product/loyalty-programs/managing-loyalty-notifications).
# @param loyalty_program_id [Integer] Identifier of the profile-based loyalty program. You can get the ID with the [List loyalty programs](https://docs.talon.one/management-api#tag/Loyalty/operation/getLoyaltyPrograms) endpoint.
# @param body [NewBaseNotification] body
# @param [Hash] opts the optional parameters
# @return [Array<(BaseNotification, Integer, Hash)>] BaseNotification data, response status code and response headers
def post_pending_points_notification_with_http_info(loyalty_program_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.post_pending_points_notification ...'
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 ManagementApi.post_pending_points_notification"
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 ManagementApi.post_pending_points_notification"
end
# resource path
local_var_path = '/v1/loyalty_programs/{loyaltyProgramId}/notifications/pending_points'.sub('{' + 'loyaltyProgramId' + '}', CGI.escape(loyalty_program_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] || 'BaseNotification'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#post_pending_points_notification\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Deduct points from customer profile
# Deduct points from the specified loyalty program and specified customer profile. **Important:** - Only active points can be deducted. - Only pending points are rolled back when a session is cancelled or reopened. To get the `integrationId` of the profile from a `sessionId`, use the [Update customer session](https://docs.talon.one/integration-api#operation/updateCustomerSessionV2) endpoint.
# @param loyalty_program_id [String] The identifier for the loyalty program.
# @param integration_id [String] The identifier of the profile.
# @param body [DeductLoyaltyPoints] body
# @param [Hash] opts the optional parameters
# @return [nil]
def remove_loyalty_points(loyalty_program_id, integration_id, body, opts = {})
remove_loyalty_points_with_http_info(loyalty_program_id, integration_id, body, opts)
nil
end
# Deduct points from customer profile
# Deduct points from the specified loyalty program and specified customer profile. **Important:** - Only active points can be deducted. - Only pending points are rolled back when a session is cancelled or reopened. To get the `integrationId` of the profile from a `sessionId`, use the [Update customer session](https://docs.talon.one/integration-api#operation/updateCustomerSessionV2) endpoint.
# @param loyalty_program_id [String] The identifier for the loyalty program.
# @param integration_id [String] The identifier of the profile.
# @param body [DeductLoyaltyPoints] body
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def remove_loyalty_points_with_http_info(loyalty_program_id, integration_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.remove_loyalty_points ...'
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 ManagementApi.remove_loyalty_points"
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 ManagementApi.remove_loyalty_points"
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 ManagementApi.remove_loyalty_points"
end
# resource path
local_var_path = '/v1/loyalty_programs/{loyaltyProgramId}/profile/{integrationId}/deduct_points'.sub('{' + 'loyaltyProgramId' + '}', CGI.escape(loyalty_program_id.to_s)).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'])
# 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] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#remove_loyalty_points\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Reset password
# Consumes the supplied password reset token and updates the password for the associated account.
# @param body [NewPassword] body
# @param [Hash] opts the optional parameters
# @return [NewPassword]
def reset_password(body, opts = {})
data, _status_code, _headers = reset_password_with_http_info(body, opts)
data
end
# Reset password
# Consumes the supplied password reset token and updates the password for the associated account.
# @param body [NewPassword] body
# @param [Hash] opts the optional parameters
# @return [Array<(NewPassword, Integer, Hash)>] NewPassword data, response status code and response headers
def reset_password_with_http_info(body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.reset_password ...'
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 ManagementApi.reset_password"
end
# resource path
local_var_path = '/v1/reset_password'
# 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] || 'NewPassword'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#reset_password\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Create SCIM user
# Create a new Talon.One user using the SCIM provisioning protocol with an identity provider, for example, Microsoft Entra ID.
# @param body [ScimNewUser] body
# @param [Hash] opts the optional parameters
# @return [ScimUser]
def scim_create_user(body, opts = {})
data, _status_code, _headers = scim_create_user_with_http_info(body, opts)
data
end
# Create SCIM user
# Create a new Talon.One user using the SCIM provisioning protocol with an identity provider, for example, Microsoft Entra ID.
# @param body [ScimNewUser] body
# @param [Hash] opts the optional parameters
# @return [Array<(ScimUser, Integer, Hash)>] ScimUser data, response status code and response headers
def scim_create_user_with_http_info(body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.scim_create_user ...'
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 ManagementApi.scim_create_user"
end
# resource path
local_var_path = '/v1/provisioning/scim/Users'
# 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] || 'ScimUser'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#scim_create_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Delete SCIM user
# Delete a specific Talon.One user created using the SCIM provisioning protocol with an identity provider, for example, Microsoft Entra ID.
# @param user_id [Integer] The ID of the user.
# @param [Hash] opts the optional parameters
# @return [nil]
def scim_delete_user(user_id, opts = {})
scim_delete_user_with_http_info(user_id, opts)
nil
end
# Delete SCIM user
# Delete a specific Talon.One user created using the SCIM provisioning protocol with an identity provider, for example, Microsoft Entra ID.
# @param user_id [Integer] The ID of the user.
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def scim_delete_user_with_http_info(user_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.scim_delete_user ...'
end
# verify the required parameter 'user_id' is set
if @api_client.config.client_side_validation && user_id.nil?
fail ArgumentError, "Missing the required parameter 'user_id' when calling ManagementApi.scim_delete_user"
end
# resource path
local_var_path = '/v1/provisioning/scim/Users/{userId}'.sub('{' + 'userId' + '}', CGI.escape(user_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# 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] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#scim_delete_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List supported SCIM resource types
# Retrieve a list of resource types supported by the SCIM provisioning protocol. Resource types define the various kinds of resources that can be managed via the SCIM API, such as users, groups, or custom-defined resources.
# @param [Hash] opts the optional parameters
# @return [ScimResourceTypesListResponse]
def scim_get_resource_types(opts = {})
data, _status_code, _headers = scim_get_resource_types_with_http_info(opts)
data
end
# List supported SCIM resource types
# Retrieve a list of resource types supported by the SCIM provisioning protocol. Resource types define the various kinds of resources that can be managed via the SCIM API, such as users, groups, or custom-defined resources.
# @param [Hash] opts the optional parameters
# @return [Array<(ScimResourceTypesListResponse, Integer, Hash)>] ScimResourceTypesListResponse data, response status code and response headers
def scim_get_resource_types_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.scim_get_resource_types ...'
end
# resource path
local_var_path = '/v1/provisioning/scim/ResourceTypes'
# 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] || 'ScimResourceTypesListResponse'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#scim_get_resource_types\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List supported SCIM schemas
# Retrieve a list of schemas supported by the SCIM provisioning protocol. Schemas define the structure and attributes of the different resources that can be managed via the SCIM API, such as users, groups, and any custom-defined resources.
# @param [Hash] opts the optional parameters
# @return [ScimSchemasListResponse]
def scim_get_schemas(opts = {})
data, _status_code, _headers = scim_get_schemas_with_http_info(opts)
data
end
# List supported SCIM schemas
# Retrieve a list of schemas supported by the SCIM provisioning protocol. Schemas define the structure and attributes of the different resources that can be managed via the SCIM API, such as users, groups, and any custom-defined resources.
# @param [Hash] opts the optional parameters
# @return [Array<(ScimSchemasListResponse, Integer, Hash)>] ScimSchemasListResponse data, response status code and response headers
def scim_get_schemas_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.scim_get_schemas ...'
end
# resource path
local_var_path = '/v1/provisioning/scim/Schemas'
# 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] || 'ScimSchemasListResponse'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#scim_get_schemas\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get SCIM service provider configuration
# Retrieve the configuration settings of the SCIM service provider. It provides details about the features and capabilities supported by the SCIM API, such as the different operation settings.
# @param [Hash] opts the optional parameters
# @return [ScimServiceProviderConfigResponse]
def scim_get_service_provider_config(opts = {})
data, _status_code, _headers = scim_get_service_provider_config_with_http_info(opts)
data
end
# Get SCIM service provider configuration
# Retrieve the configuration settings of the SCIM service provider. It provides details about the features and capabilities supported by the SCIM API, such as the different operation settings.
# @param [Hash] opts the optional parameters
# @return [Array<(ScimServiceProviderConfigResponse, Integer, Hash)>] ScimServiceProviderConfigResponse data, response status code and response headers
def scim_get_service_provider_config_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.scim_get_service_provider_config ...'
end
# resource path
local_var_path = '/v1/provisioning/scim/ServiceProviderConfig'
# 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] || 'ScimServiceProviderConfigResponse'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#scim_get_service_provider_config\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get SCIM user
# Retrieve data for a specific Talon.One user created using the SCIM provisioning protocol with an identity provider, for example, Microsoft Entra ID.
# @param user_id [Integer] The ID of the user.
# @param [Hash] opts the optional parameters
# @return [ScimUser]
def scim_get_user(user_id, opts = {})
data, _status_code, _headers = scim_get_user_with_http_info(user_id, opts)
data
end
# Get SCIM user
# Retrieve data for a specific Talon.One user created using the SCIM provisioning protocol with an identity provider, for example, Microsoft Entra ID.
# @param user_id [Integer] The ID of the user.
# @param [Hash] opts the optional parameters
# @return [Array<(ScimUser, Integer, Hash)>] ScimUser data, response status code and response headers
def scim_get_user_with_http_info(user_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.scim_get_user ...'
end
# verify the required parameter 'user_id' is set
if @api_client.config.client_side_validation && user_id.nil?
fail ArgumentError, "Missing the required parameter 'user_id' when calling ManagementApi.scim_get_user"
end
# resource path
local_var_path = '/v1/provisioning/scim/Users/{userId}'.sub('{' + 'userId' + '}', CGI.escape(user_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] || 'ScimUser'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#scim_get_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List SCIM users
# Retrieve a paginated list of users that have been provisioned using the SCIM protocol with an identity provider, for example, Microsoft Entra ID.
# @param [Hash] opts the optional parameters
# @return [ScimUsersListResponse]
def scim_get_users(opts = {})
data, _status_code, _headers = scim_get_users_with_http_info(opts)
data
end
# List SCIM users
# Retrieve a paginated list of users that have been provisioned using the SCIM protocol with an identity provider, for example, Microsoft Entra ID.
# @param [Hash] opts the optional parameters
# @return [Array<(ScimUsersListResponse, Integer, Hash)>] ScimUsersListResponse data, response status code and response headers
def scim_get_users_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.scim_get_users ...'
end
# resource path
local_var_path = '/v1/provisioning/scim/Users'
# 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] || 'ScimUsersListResponse'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#scim_get_users\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Update SCIM user attributes
# Update certain attributes of a specific Talon.One user created using the SCIM provisioning protocol with an identity provider, for example, Microsoft Entra ID. This endpoint allows for selective adding, removing, or replacing specific attributes while leaving other attributes unchanged.
# @param user_id [Integer] The ID of the user.
# @param body [ScimPatchRequest] body
# @param [Hash] opts the optional parameters
# @return [ScimUser]
def scim_patch_user(user_id, body, opts = {})
data, _status_code, _headers = scim_patch_user_with_http_info(user_id, body, opts)
data
end
# Update SCIM user attributes
# Update certain attributes of a specific Talon.One user created using the SCIM provisioning protocol with an identity provider, for example, Microsoft Entra ID. This endpoint allows for selective adding, removing, or replacing specific attributes while leaving other attributes unchanged.
# @param user_id [Integer] The ID of the user.
# @param body [ScimPatchRequest] body
# @param [Hash] opts the optional parameters
# @return [Array<(ScimUser, Integer, Hash)>] ScimUser data, response status code and response headers
def scim_patch_user_with_http_info(user_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.scim_patch_user ...'
end
# verify the required parameter 'user_id' is set
if @api_client.config.client_side_validation && user_id.nil?
fail ArgumentError, "Missing the required parameter 'user_id' when calling ManagementApi.scim_patch_user"
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 ManagementApi.scim_patch_user"
end
# resource path
local_var_path = '/v1/provisioning/scim/Users/{userId}'.sub('{' + 'userId' + '}', CGI.escape(user_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] || 'ScimUser'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#scim_patch_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Update SCIM user
# Update the details of a specific Talon.One user created using the SCIM provisioning protocol with an identity provider, for example, Microsoft Entra ID. This endpoint replaces all attributes of the specific user with the attributes provided in the request payload.
# @param user_id [Integer] The ID of the user.
# @param body [ScimNewUser] body
# @param [Hash] opts the optional parameters
# @return [ScimUser]
def scim_replace_user_attributes(user_id, body, opts = {})
data, _status_code, _headers = scim_replace_user_attributes_with_http_info(user_id, body, opts)
data
end
# Update SCIM user
# Update the details of a specific Talon.One user created using the SCIM provisioning protocol with an identity provider, for example, Microsoft Entra ID. This endpoint replaces all attributes of the specific user with the attributes provided in the request payload.
# @param user_id [Integer] The ID of the user.
# @param body [ScimNewUser] body
# @param [Hash] opts the optional parameters
# @return [Array<(ScimUser, Integer, Hash)>] ScimUser data, response status code and response headers
def scim_replace_user_attributes_with_http_info(user_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.scim_replace_user_attributes ...'
end
# verify the required parameter 'user_id' is set
if @api_client.config.client_side_validation && user_id.nil?
fail ArgumentError, "Missing the required parameter 'user_id' when calling ManagementApi.scim_replace_user_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 ManagementApi.scim_replace_user_attributes"
end
# resource path
local_var_path = '/v1/provisioning/scim/Users/{userId}'.sub('{' + 'userId' + '}', CGI.escape(user_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] || 'ScimUser'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#scim_replace_user_attributes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List coupons that match the given attributes (without total count)
# List the coupons whose attributes match the query criteria in all the campaigns of the given Application. The match is successful if all the attributes of the request are found in a coupon, even if the coupon has more attributes that are not present on the request. **Note:** The total count is not included in the response.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param body [Object] body
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response. (default to 1000)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [String] :value Filter results performing case-insensitive matching against the coupon code. Both the code and the query are folded to remove all non-alpha-numeric characters.
# @option opts [DateTime] :created_before Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :created_after Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [String] :valid Either \"expired\", \"validNow\", or \"validFuture\". The first option matches coupons in which the expiration date is set and in the past. The second matches coupons in which start date is null or in the past and expiration date is null or in the future, the third matches coupons in which start date is set and in the future.
# @option opts [String] :usable Either \"true\" or \"false\". If \"true\", only coupons where `usageCounter < usageLimit` will be returned, \"false\" will return only coupons where `usageCounter >= usageLimit`.
# @option opts [Integer] :referral_id Filter the results by matching them with the ID of a referral. This filter shows the coupons created by redeeming a referral code.
# @option opts [String] :recipient_integration_id Filter results by match with a profile ID specified in the coupon's RecipientIntegrationId field.
# @option opts [String] :batch_id Filter results by batches of coupons
# @option opts [Boolean] :exact_match Filter results to an exact case-insensitive matching against the coupon code. (default to false)
# @option opts [String] :campaign_state Filter results by the state of the campaign. - `enabled`: Campaigns that are scheduled, running (activated), or expired. - `running`: Campaigns that are running (activated). - `disabled`: Campaigns that are disabled. - `expired`: Campaigns that are expired. - `archived`: Campaigns that are archived.
# @return [InlineResponse2009]
def search_coupons_advanced_application_wide_without_total_count(application_id, body, opts = {})
data, _status_code, _headers = search_coupons_advanced_application_wide_without_total_count_with_http_info(application_id, body, opts)
data
end
# List coupons that match the given attributes (without total count)
# List the coupons whose attributes match the query criteria in all the campaigns of the given Application. The match is successful if all the attributes of the request are found in a coupon, even if the coupon has more attributes that are not present on the request. **Note:** The total count is not included in the response.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param body [Object] body
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [String] :value Filter results performing case-insensitive matching against the coupon code. Both the code and the query are folded to remove all non-alpha-numeric characters.
# @option opts [DateTime] :created_before Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :created_after Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [String] :valid Either \"expired\", \"validNow\", or \"validFuture\". The first option matches coupons in which the expiration date is set and in the past. The second matches coupons in which start date is null or in the past and expiration date is null or in the future, the third matches coupons in which start date is set and in the future.
# @option opts [String] :usable Either \"true\" or \"false\". If \"true\", only coupons where `usageCounter < usageLimit` will be returned, \"false\" will return only coupons where `usageCounter >= usageLimit`.
# @option opts [Integer] :referral_id Filter the results by matching them with the ID of a referral. This filter shows the coupons created by redeeming a referral code.
# @option opts [String] :recipient_integration_id Filter results by match with a profile ID specified in the coupon's RecipientIntegrationId field.
# @option opts [String] :batch_id Filter results by batches of coupons
# @option opts [Boolean] :exact_match Filter results to an exact case-insensitive matching against the coupon code.
# @option opts [String] :campaign_state Filter results by the state of the campaign. - `enabled`: Campaigns that are scheduled, running (activated), or expired. - `running`: Campaigns that are running (activated). - `disabled`: Campaigns that are disabled. - `expired`: Campaigns that are expired. - `archived`: Campaigns that are archived.
# @return [Array<(InlineResponse2009, Integer, Hash)>] InlineResponse2009 data, response status code and response headers
def search_coupons_advanced_application_wide_without_total_count_with_http_info(application_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.search_coupons_advanced_application_wide_without_total_count ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.search_coupons_advanced_application_wide_without_total_count"
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 ManagementApi.search_coupons_advanced_application_wide_without_total_count"
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 ManagementApi.search_coupons_advanced_application_wide_without_total_count, 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 ManagementApi.search_coupons_advanced_application_wide_without_total_count, must be greater than or equal to 1.'
end
allowable_values = ["expired", "validNow", "validFuture"]
if @api_client.config.client_side_validation && opts[:'valid'] && !allowable_values.include?(opts[:'valid'])
fail ArgumentError, "invalid value for \"valid\", must be one of #{allowable_values}"
end
allowable_values = ["true", "false"]
if @api_client.config.client_side_validation && opts[:'usable'] && !allowable_values.include?(opts[:'usable'])
fail ArgumentError, "invalid value for \"usable\", must be one of #{allowable_values}"
end
allowable_values = ["enabled", "disabled", "archived", "scheduled", "running", "expired", "staged"]
if @api_client.config.client_side_validation && opts[:'campaign_state'] && !allowable_values.include?(opts[:'campaign_state'])
fail ArgumentError, "invalid value for \"campaign_state\", must be one of #{allowable_values}"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/coupons_search_advanced/no_total'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
query_params[:'value'] = opts[:'value'] if !opts[:'value'].nil?
query_params[:'createdBefore'] = opts[:'created_before'] if !opts[:'created_before'].nil?
query_params[:'createdAfter'] = opts[:'created_after'] if !opts[:'created_after'].nil?
query_params[:'valid'] = opts[:'valid'] if !opts[:'valid'].nil?
query_params[:'usable'] = opts[:'usable'] if !opts[:'usable'].nil?
query_params[:'referralId'] = opts[:'referral_id'] if !opts[:'referral_id'].nil?
query_params[:'recipientIntegrationId'] = opts[:'recipient_integration_id'] if !opts[:'recipient_integration_id'].nil?
query_params[:'batchId'] = opts[:'batch_id'] if !opts[:'batch_id'].nil?
query_params[:'exactMatch'] = opts[:'exact_match'] if !opts[:'exact_match'].nil?
query_params[:'campaignState'] = opts[:'campaign_state'] if !opts[:'campaign_state'].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] || 'InlineResponse2009'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#search_coupons_advanced_application_wide_without_total_count\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# List coupons that match the given attributes in campaign (without total count)
# List the coupons whose attributes match the query criteria in the given campaign. The match is successful if all the attributes of the request are found in a coupon, even if the coupon has more attributes that are not present on the request. **Note:** The total count is not included in the response.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param body [Object] body
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response. (default to 1000)
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [String] :value Filter results performing case-insensitive matching against the coupon code. Both the code and the query are folded to remove all non-alpha-numeric characters.
# @option opts [DateTime] :created_before Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :created_after Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [String] :valid Either \"expired\", \"validNow\", or \"validFuture\". The first option matches coupons in which the expiration date is set and in the past. The second matches coupons in which start date is null or in the past and expiration date is null or in the future, the third matches coupons in which start date is set and in the future.
# @option opts [String] :usable Either \"true\" or \"false\". If \"true\", only coupons where `usageCounter < usageLimit` will be returned, \"false\" will return only coupons where `usageCounter >= usageLimit`.
# @option opts [Integer] :referral_id Filter the results by matching them with the ID of a referral. This filter shows the coupons created by redeeming a referral code.
# @option opts [String] :recipient_integration_id Filter results by match with a profile ID specified in the coupon's RecipientIntegrationId field.
# @option opts [Boolean] :exact_match Filter results to an exact case-insensitive matching against the coupon code. (default to false)
# @option opts [String] :batch_id Filter results by batches of coupons
# @return [InlineResponse2009]
def search_coupons_advanced_without_total_count(application_id, campaign_id, body, opts = {})
data, _status_code, _headers = search_coupons_advanced_without_total_count_with_http_info(application_id, campaign_id, body, opts)
data
end
# List coupons that match the given attributes in campaign (without total count)
# List the coupons whose attributes match the query criteria in the given campaign. The match is successful if all the attributes of the request are found in a coupon, even if the coupon has more attributes that are not present on the request. **Note:** The total count is not included in the response.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param body [Object] body
# @param [Hash] opts the optional parameters
# @option opts [Integer] :page_size The number of items in the response.
# @option opts [Integer] :skip The number of items to skip when paging through large result sets.
# @option opts [String] :sort The field by which results should be sorted. By default, results are sorted in ascending order. To sort them in descending order, prefix the field name with `-`. **Note:** This parameter works only with numeric fields.
# @option opts [String] :value Filter results performing case-insensitive matching against the coupon code. Both the code and the query are folded to remove all non-alpha-numeric characters.
# @option opts [DateTime] :created_before Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [DateTime] :created_after Filter results comparing the parameter value, expected to be an RFC3339 timestamp string, to the coupon creation timestamp. You can use any time zone setting. Talon.One will convert to UTC internally.
# @option opts [String] :valid Either \"expired\", \"validNow\", or \"validFuture\". The first option matches coupons in which the expiration date is set and in the past. The second matches coupons in which start date is null or in the past and expiration date is null or in the future, the third matches coupons in which start date is set and in the future.
# @option opts [String] :usable Either \"true\" or \"false\". If \"true\", only coupons where `usageCounter < usageLimit` will be returned, \"false\" will return only coupons where `usageCounter >= usageLimit`.
# @option opts [Integer] :referral_id Filter the results by matching them with the ID of a referral. This filter shows the coupons created by redeeming a referral code.
# @option opts [String] :recipient_integration_id Filter results by match with a profile ID specified in the coupon's RecipientIntegrationId field.
# @option opts [Boolean] :exact_match Filter results to an exact case-insensitive matching against the coupon code.
# @option opts [String] :batch_id Filter results by batches of coupons
# @return [Array<(InlineResponse2009, Integer, Hash)>] InlineResponse2009 data, response status code and response headers
def search_coupons_advanced_without_total_count_with_http_info(application_id, campaign_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.search_coupons_advanced_without_total_count ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.search_coupons_advanced_without_total_count"
end
# verify the required parameter 'campaign_id' is set
if @api_client.config.client_side_validation && campaign_id.nil?
fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ManagementApi.search_coupons_advanced_without_total_count"
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 ManagementApi.search_coupons_advanced_without_total_count"
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 ManagementApi.search_coupons_advanced_without_total_count, 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 ManagementApi.search_coupons_advanced_without_total_count, must be greater than or equal to 1.'
end
allowable_values = ["expired", "validNow", "validFuture"]
if @api_client.config.client_side_validation && opts[:'valid'] && !allowable_values.include?(opts[:'valid'])
fail ArgumentError, "invalid value for \"valid\", must be one of #{allowable_values}"
end
allowable_values = ["true", "false"]
if @api_client.config.client_side_validation && opts[:'usable'] && !allowable_values.include?(opts[:'usable'])
fail ArgumentError, "invalid value for \"usable\", must be one of #{allowable_values}"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/campaigns/{campaignId}/coupons_search_advanced/no_total'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
query_params[:'value'] = opts[:'value'] if !opts[:'value'].nil?
query_params[:'createdBefore'] = opts[:'created_before'] if !opts[:'created_before'].nil?
query_params[:'createdAfter'] = opts[:'created_after'] if !opts[:'created_after'].nil?
query_params[:'valid'] = opts[:'valid'] if !opts[:'valid'].nil?
query_params[:'usable'] = opts[:'usable'] if !opts[:'usable'].nil?
query_params[:'referralId'] = opts[:'referral_id'] if !opts[:'referral_id'].nil?
query_params[:'recipientIntegrationId'] = opts[:'recipient_integration_id'] if !opts[:'recipient_integration_id'].nil?
query_params[:'exactMatch'] = opts[:'exact_match'] if !opts[:'exact_match'].nil?
query_params[:'batchId'] = opts[:'batch_id'] if !opts[:'batch_id'].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] || 'InlineResponse2009'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#search_coupons_advanced_without_total_count\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Transfer card data
# Transfer loyalty card data, such as linked customers, loyalty balances and transactions, from a given loyalty card to a new, automatically created loyalty card. **Important:** - The original card is automatically blocked once the new card is created, and it cannot be activated again. - The default status of the new card is _active_.
# @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_id [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 [TransferLoyaltyCard] body
# @param [Hash] opts the optional parameters
# @return [nil]
def transfer_loyalty_card(loyalty_program_id, loyalty_card_id, body, opts = {})
transfer_loyalty_card_with_http_info(loyalty_program_id, loyalty_card_id, body, opts)
nil
end
# Transfer card data
# Transfer loyalty card data, such as linked customers, loyalty balances and transactions, from a given loyalty card to a new, automatically created loyalty card. **Important:** - The original card is automatically blocked once the new card is created, and it cannot be activated again. - The default status of the new card is _active_.
# @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_id [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 [TransferLoyaltyCard] body
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def transfer_loyalty_card_with_http_info(loyalty_program_id, loyalty_card_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.transfer_loyalty_card ...'
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 ManagementApi.transfer_loyalty_card"
end
# verify the required parameter 'loyalty_card_id' is set
if @api_client.config.client_side_validation && loyalty_card_id.nil?
fail ArgumentError, "Missing the required parameter 'loyalty_card_id' when calling ManagementApi.transfer_loyalty_card"
end
if @api_client.config.client_side_validation && loyalty_card_id.to_s.length > 108
fail ArgumentError, 'invalid value for "loyalty_card_id" when calling ManagementApi.transfer_loyalty_card, 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 ManagementApi.transfer_loyalty_card"
end
# resource path
local_var_path = '/v1/loyalty_programs/{loyaltyProgramId}/cards/{loyaltyCardId}/transfer'.sub('{' + 'loyaltyProgramId' + '}', CGI.escape(loyalty_program_id.to_s)).sub('{' + 'loyaltyCardId' + '}', CGI.escape(loyalty_card_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] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#transfer_loyalty_card\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Update account-level collection
# Edit the description of a given account-level collection and enable or disable the collection in the specified Applications.
# @param collection_id [Integer] The ID of the collection. You can get it with the [List collections in account](#operation/listAccountCollections) endpoint.
# @param body [UpdateCollection] body
# @param [Hash] opts the optional parameters
# @return [Collection]
def update_account_collection(collection_id, body, opts = {})
data, _status_code, _headers = update_account_collection_with_http_info(collection_id, body, opts)
data
end
# Update account-level collection
# Edit the description of a given account-level collection and enable or disable the collection in the specified Applications.
# @param collection_id [Integer] The ID of the collection. You can get it with the [List collections in account](#operation/listAccountCollections) endpoint.
# @param body [UpdateCollection] body
# @param [Hash] opts the optional parameters
# @return [Array<(Collection, Integer, Hash)>] Collection data, response status code and response headers
def update_account_collection_with_http_info(collection_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.update_account_collection ...'
end
# verify the required parameter 'collection_id' is set
if @api_client.config.client_side_validation && collection_id.nil?
fail ArgumentError, "Missing the required parameter 'collection_id' when calling ManagementApi.update_account_collection"
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 ManagementApi.update_account_collection"
end
# resource path
local_var_path = '/v1/collections/{collectionId}'.sub('{' + 'collectionId' + '}', CGI.escape(collection_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] || 'Collection'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#update_account_collection\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Update achievement
# Update the details of a specific achievement.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param achievement_id [Integer] The ID of the achievement. You can get this ID with the [List achievement](https://docs.talon.one/management-api#tag/Achievements/operation/listAchievements) endpoint.
# @param body [UpdateAchievement] body
# @param [Hash] opts the optional parameters
# @return [Achievement]
def update_achievement(application_id, campaign_id, achievement_id, body, opts = {})
data, _status_code, _headers = update_achievement_with_http_info(application_id, campaign_id, achievement_id, body, opts)
data
end
# Update achievement
# Update the details of a specific achievement.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param achievement_id [Integer] The ID of the achievement. You can get this ID with the [List achievement](https://docs.talon.one/management-api#tag/Achievements/operation/listAchievements) endpoint.
# @param body [UpdateAchievement] body
# @param [Hash] opts the optional parameters
# @return [Array<(Achievement, Integer, Hash)>] Achievement data, response status code and response headers
def update_achievement_with_http_info(application_id, campaign_id, achievement_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.update_achievement ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.update_achievement"
end
# verify the required parameter 'campaign_id' is set
if @api_client.config.client_side_validation && campaign_id.nil?
fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ManagementApi.update_achievement"
end
# verify the required parameter 'achievement_id' is set
if @api_client.config.client_side_validation && achievement_id.nil?
fail ArgumentError, "Missing the required parameter 'achievement_id' when calling ManagementApi.update_achievement"
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 ManagementApi.update_achievement"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/campaigns/{campaignId}/achievements/{achievementId}'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'achievementId' + '}', CGI.escape(achievement_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] || 'Achievement'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#update_achievement\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Update additional cost
# Updates an existing additional cost. Once created, the only property of an additional cost that cannot be changed is the `name` property (or **API name** in the Campaign Manager). This restriction is in place to prevent accidentally breaking live integrations.
# @param additional_cost_id [Integer] The ID of the additional cost. You can find the ID the the Campaign Manager's URL when you display the details of the cost in **Account** > **Tools** > **Additional costs**.
# @param body [NewAdditionalCost] body
# @param [Hash] opts the optional parameters
# @return [AccountAdditionalCost]
def update_additional_cost(additional_cost_id, body, opts = {})
data, _status_code, _headers = update_additional_cost_with_http_info(additional_cost_id, body, opts)
data
end
# Update additional cost
# Updates an existing additional cost. Once created, the only property of an additional cost that cannot be changed is the `name` property (or **API name** in the Campaign Manager). This restriction is in place to prevent accidentally breaking live integrations.
# @param additional_cost_id [Integer] The ID of the additional cost. You can find the ID the the Campaign Manager's URL when you display the details of the cost in **Account** > **Tools** > **Additional costs**.
# @param body [NewAdditionalCost] body
# @param [Hash] opts the optional parameters
# @return [Array<(AccountAdditionalCost, Integer, Hash)>] AccountAdditionalCost data, response status code and response headers
def update_additional_cost_with_http_info(additional_cost_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.update_additional_cost ...'
end
# verify the required parameter 'additional_cost_id' is set
if @api_client.config.client_side_validation && additional_cost_id.nil?
fail ArgumentError, "Missing the required parameter 'additional_cost_id' when calling ManagementApi.update_additional_cost"
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 ManagementApi.update_additional_cost"
end
# resource path
local_var_path = '/v1/additional_costs/{additionalCostId}'.sub('{' + 'additionalCostId' + '}', CGI.escape(additional_cost_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] || 'AccountAdditionalCost'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#update_additional_cost\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Update custom attribute
# Update an existing custom attribute. Once created, the only property of a custom attribute that can be changed is the description. To change the `type` or `name` property of a custom attribute, create a new attribute and update any relevant integrations and rules to use the new attribute.
# @param attribute_id [Integer] The ID of the attribute. You can find the ID in the Campaign Manager's URL when you display the details of an attribute in **Account** > **Tools** > **Attributes**.
# @param body [NewAttribute] body
# @param [Hash] opts the optional parameters
# @return [Attribute]
def update_attribute(attribute_id, body, opts = {})
data, _status_code, _headers = update_attribute_with_http_info(attribute_id, body, opts)
data
end
# Update custom attribute
# Update an existing custom attribute. Once created, the only property of a custom attribute that can be changed is the description. To change the `type` or `name` property of a custom attribute, create a new attribute and update any relevant integrations and rules to use the new attribute.
# @param attribute_id [Integer] The ID of the attribute. You can find the ID in the Campaign Manager's URL when you display the details of an attribute in **Account** > **Tools** > **Attributes**.
# @param body [NewAttribute] body
# @param [Hash] opts the optional parameters
# @return [Array<(Attribute, Integer, Hash)>] Attribute data, response status code and response headers
def update_attribute_with_http_info(attribute_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.update_attribute ...'
end
# verify the required parameter 'attribute_id' is set
if @api_client.config.client_side_validation && attribute_id.nil?
fail ArgumentError, "Missing the required parameter 'attribute_id' when calling ManagementApi.update_attribute"
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 ManagementApi.update_attribute"
end
# resource path
local_var_path = '/v1/attributes/{attributeId}'.sub('{' + 'attributeId' + '}', CGI.escape(attribute_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] || 'Attribute'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#update_attribute\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Update campaign
# Update the given campaign. **Important:** You cannot use this endpoint to update campaigns if [campaign staging and revisions](https://docs.talon.one/docs/product/applications/managing-general-settings#campaign-staging-and-revisions) is enabled for your Application.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param body [UpdateCampaign] body
# @param [Hash] opts the optional parameters
# @return [Campaign]
def update_campaign(application_id, campaign_id, body, opts = {})
data, _status_code, _headers = update_campaign_with_http_info(application_id, campaign_id, body, opts)
data
end
# Update campaign
# Update the given campaign. **Important:** You cannot use this endpoint to update campaigns if [campaign staging and revisions](https://docs.talon.one/docs/product/applications/managing-general-settings#campaign-staging-and-revisions) is enabled for your Application.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param body [UpdateCampaign] body
# @param [Hash] opts the optional parameters
# @return [Array<(Campaign, Integer, Hash)>] Campaign data, response status code and response headers
def update_campaign_with_http_info(application_id, campaign_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.update_campaign ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.update_campaign"
end
# verify the required parameter 'campaign_id' is set
if @api_client.config.client_side_validation && campaign_id.nil?
fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ManagementApi.update_campaign"
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 ManagementApi.update_campaign"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/campaigns/{campaignId}'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'campaignId' + '}', CGI.escape(campaign_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] || 'Campaign'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#update_campaign\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Update campaign-level collection's description
# Edit the description of a given campaign-level collection.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param collection_id [Integer] The ID of the collection. You can get it with the [List collections in Application](#operation/listCollectionsInApplication) endpoint.
# @param body [UpdateCampaignCollection] body
# @param [Hash] opts the optional parameters
# @return [Collection]
def update_collection(application_id, campaign_id, collection_id, body, opts = {})
data, _status_code, _headers = update_collection_with_http_info(application_id, campaign_id, collection_id, body, opts)
data
end
# Update campaign-level collection's description
# Edit the description of a given campaign-level collection.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param collection_id [Integer] The ID of the collection. You can get it with the [List collections in Application](#operation/listCollectionsInApplication) endpoint.
# @param body [UpdateCampaignCollection] body
# @param [Hash] opts the optional parameters
# @return [Array<(Collection, Integer, Hash)>] Collection data, response status code and response headers
def update_collection_with_http_info(application_id, campaign_id, collection_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.update_collection ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.update_collection"
end
# verify the required parameter 'campaign_id' is set
if @api_client.config.client_side_validation && campaign_id.nil?
fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ManagementApi.update_collection"
end
# verify the required parameter 'collection_id' is set
if @api_client.config.client_side_validation && collection_id.nil?
fail ArgumentError, "Missing the required parameter 'collection_id' when calling ManagementApi.update_collection"
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 ManagementApi.update_collection"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/campaigns/{campaignId}/collections/{collectionId}'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'collectionId' + '}', CGI.escape(collection_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] || 'Collection'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#update_collection\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Update coupon
# Update the specified coupon. Important
With this PUT
endpoint, if you do not explicitly set a value for the startDate
, expiryDate
, and recipientIntegrationId
properties in your request, it is automatically set to null
.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param coupon_id [String] The internal ID of the coupon code. You can find this value in the `id` property from the [List coupons](https://docs.talon.one/management-api#tag/Coupons/operation/getCouponsWithoutTotalCount) endpoint response.
# @param body [UpdateCoupon] body
# @param [Hash] opts the optional parameters
# @return [Coupon]
def update_coupon(application_id, campaign_id, coupon_id, body, opts = {})
data, _status_code, _headers = update_coupon_with_http_info(application_id, campaign_id, coupon_id, body, opts)
data
end
# Update coupon
# Update the specified coupon. <div class=\"redoc-section\"> <p class=\"title\">Important</p> <p>With this <code>PUT</code> endpoint, if you do not explicitly set a value for the <code>startDate</code>, <code>expiryDate</code>, and <code>recipientIntegrationId</code> properties in your request, it is automatically set to <code>null</code>.</p> </div>
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param coupon_id [String] The internal ID of the coupon code. You can find this value in the `id` property from the [List coupons](https://docs.talon.one/management-api#tag/Coupons/operation/getCouponsWithoutTotalCount) endpoint response.
# @param body [UpdateCoupon] body
# @param [Hash] opts the optional parameters
# @return [Array<(Coupon, Integer, Hash)>] Coupon data, response status code and response headers
def update_coupon_with_http_info(application_id, campaign_id, coupon_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.update_coupon ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.update_coupon"
end
# verify the required parameter 'campaign_id' is set
if @api_client.config.client_side_validation && campaign_id.nil?
fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ManagementApi.update_coupon"
end
# verify the required parameter 'coupon_id' is set
if @api_client.config.client_side_validation && coupon_id.nil?
fail ArgumentError, "Missing the required parameter 'coupon_id' when calling ManagementApi.update_coupon"
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 ManagementApi.update_coupon"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/campaigns/{campaignId}/coupons/{couponId}'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'couponId' + '}', CGI.escape(coupon_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] || 'Coupon'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#update_coupon\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Update coupons
# Update all coupons or a specific batch of coupons in the given campaign. You can find the `batchId` on the **Coupons** page of your campaign in the Campaign Manager, or you can use [List coupons](#operation/getCouponsWithoutTotalCount). Important
- Only send sequential requests to this endpoint.
- Requests to this endpoint time out after 30 minutes. If you hit a timeout, contact our support team.
- With this
PUT
endpoint, if you do not explicitly set a value for the startDate
and expiryDate
properties in your request, it is automatically set to null
.
To update a specific coupon, use [Update coupon](#operation/updateCoupon).
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param body [UpdateCouponBatch] body
# @param [Hash] opts the optional parameters
# @return [nil]
def update_coupon_batch(application_id, campaign_id, body, opts = {})
update_coupon_batch_with_http_info(application_id, campaign_id, body, opts)
nil
end
# Update coupons
# Update all coupons or a specific batch of coupons in the given campaign. You can find the `batchId` on the **Coupons** page of your campaign in the Campaign Manager, or you can use [List coupons](#operation/getCouponsWithoutTotalCount). <div class=\"redoc-section\"> <p class=\"title\">Important</p> <ul> <li>Only send sequential requests to this endpoint.</li> <li>Requests to this endpoint time out after 30 minutes. If you hit a timeout, contact our support team.</li> <li>With this <code>PUT</code> endpoint, if you do not explicitly set a value for the <code>startDate</code> and <code>expiryDate</code> properties in your request, it is automatically set to <code>null</code>.</li> </ul> </div> To update a specific coupon, use [Update coupon](#operation/updateCoupon).
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param body [UpdateCouponBatch] body
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def update_coupon_batch_with_http_info(application_id, campaign_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.update_coupon_batch ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.update_coupon_batch"
end
# verify the required parameter 'campaign_id' is set
if @api_client.config.client_side_validation && campaign_id.nil?
fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ManagementApi.update_coupon_batch"
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 ManagementApi.update_coupon_batch"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/campaigns/{campaignId}/coupons'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# 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] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#update_coupon_batch\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Update loyalty card status
# Update the status of the given loyalty card. A card can be _active_ or _inactive_.
# @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_id [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 [UpdateLoyaltyCard] body
# @param [Hash] opts the optional parameters
# @return [LoyaltyCard]
def update_loyalty_card(loyalty_program_id, loyalty_card_id, body, opts = {})
data, _status_code, _headers = update_loyalty_card_with_http_info(loyalty_program_id, loyalty_card_id, body, opts)
data
end
# Update loyalty card status
# Update the status of the given loyalty card. A card can be _active_ or _inactive_.
# @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_id [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 [UpdateLoyaltyCard] body
# @param [Hash] opts the optional parameters
# @return [Array<(LoyaltyCard, Integer, Hash)>] LoyaltyCard data, response status code and response headers
def update_loyalty_card_with_http_info(loyalty_program_id, loyalty_card_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.update_loyalty_card ...'
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 ManagementApi.update_loyalty_card"
end
# verify the required parameter 'loyalty_card_id' is set
if @api_client.config.client_side_validation && loyalty_card_id.nil?
fail ArgumentError, "Missing the required parameter 'loyalty_card_id' when calling ManagementApi.update_loyalty_card"
end
if @api_client.config.client_side_validation && loyalty_card_id.to_s.length > 108
fail ArgumentError, 'invalid value for "loyalty_card_id" when calling ManagementApi.update_loyalty_card, 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 ManagementApi.update_loyalty_card"
end
# resource path
local_var_path = '/v1/loyalty_programs/{loyaltyProgramId}/cards/{loyaltyCardId}'.sub('{' + 'loyaltyProgramId' + '}', CGI.escape(loyalty_program_id.to_s)).sub('{' + 'loyaltyCardId' + '}', CGI.escape(loyalty_card_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] || 'LoyaltyCard'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#update_loyalty_card\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Update referral
# Update the specified referral.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param referral_id [String] The ID of the referral code.
# @param body [UpdateReferral] body
# @param [Hash] opts the optional parameters
# @return [Referral]
def update_referral(application_id, campaign_id, referral_id, body, opts = {})
data, _status_code, _headers = update_referral_with_http_info(application_id, campaign_id, referral_id, body, opts)
data
end
# Update referral
# Update the specified referral.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param campaign_id [Integer] The ID of the campaign. It is displayed in your Talon.One deployment URL.
# @param referral_id [String] The ID of the referral code.
# @param body [UpdateReferral] body
# @param [Hash] opts the optional parameters
# @return [Array<(Referral, Integer, Hash)>] Referral data, response status code and response headers
def update_referral_with_http_info(application_id, campaign_id, referral_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.update_referral ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.update_referral"
end
# verify the required parameter 'campaign_id' is set
if @api_client.config.client_side_validation && campaign_id.nil?
fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ManagementApi.update_referral"
end
# verify the required parameter 'referral_id' is set
if @api_client.config.client_side_validation && referral_id.nil?
fail ArgumentError, "Missing the required parameter 'referral_id' when calling ManagementApi.update_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 ManagementApi.update_referral"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/campaigns/{campaignId}/referrals/{referralId}'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)).sub('{' + 'referralId' + '}', CGI.escape(referral_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] || 'Referral'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#update_referral\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Update role
# Update a specific role.
# @param role_id [Integer] The ID of role. **Note**: To find the ID of a role, use the [List roles](/management-api#tag/Roles/operation/listAllRolesV2) endpoint.
# @param body [RoleV2Base] body
# @param [Hash] opts the optional parameters
# @return [RoleV2]
def update_role_v2(role_id, body, opts = {})
data, _status_code, _headers = update_role_v2_with_http_info(role_id, body, opts)
data
end
# Update role
# Update a specific role.
# @param role_id [Integer] The ID of role. **Note**: To find the ID of a role, use the [List roles](/management-api#tag/Roles/operation/listAllRolesV2) endpoint.
# @param body [RoleV2Base] body
# @param [Hash] opts the optional parameters
# @return [Array<(RoleV2, Integer, Hash)>] RoleV2 data, response status code and response headers
def update_role_v2_with_http_info(role_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.update_role_v2 ...'
end
# verify the required parameter 'role_id' is set
if @api_client.config.client_side_validation && role_id.nil?
fail ArgumentError, "Missing the required parameter 'role_id' when calling ManagementApi.update_role_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 ManagementApi.update_role_v2"
end
# resource path
local_var_path = '/v2/roles/{roleId}'.sub('{' + 'roleId' + '}', CGI.escape(role_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] || 'RoleV2'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#update_role_v2\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Update store
# Update store details for a specific store ID.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param store_id [String] The ID of the store. You can get this ID with the [List stores](#tag/Stores/operation/listStores) endpoint.
# @param body [NewStore] body
# @param [Hash] opts the optional parameters
# @return [Store]
def update_store(application_id, store_id, body, opts = {})
data, _status_code, _headers = update_store_with_http_info(application_id, store_id, body, opts)
data
end
# Update store
# Update store details for a specific store ID.
# @param application_id [Integer] The ID of the Application. It is displayed in your Talon.One deployment URL.
# @param store_id [String] The ID of the store. You can get this ID with the [List stores](#tag/Stores/operation/listStores) endpoint.
# @param body [NewStore] body
# @param [Hash] opts the optional parameters
# @return [Array<(Store, Integer, Hash)>] Store data, response status code and response headers
def update_store_with_http_info(application_id, store_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.update_store ...'
end
# verify the required parameter 'application_id' is set
if @api_client.config.client_side_validation && application_id.nil?
fail ArgumentError, "Missing the required parameter 'application_id' when calling ManagementApi.update_store"
end
# verify the required parameter 'store_id' is set
if @api_client.config.client_side_validation && store_id.nil?
fail ArgumentError, "Missing the required parameter 'store_id' when calling ManagementApi.update_store"
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 ManagementApi.update_store"
end
# resource path
local_var_path = '/v1/applications/{applicationId}/stores/{storeId}'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'storeId' + '}', CGI.escape(store_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] || 'Store'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#update_store\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Update user
# Update the details of a specific user.
# @param user_id [Integer] The ID of the user.
# @param body [UpdateUser] body
# @param [Hash] opts the optional parameters
# @return [User]
def update_user(user_id, body, opts = {})
data, _status_code, _headers = update_user_with_http_info(user_id, body, opts)
data
end
# Update user
# Update the details of a specific user.
# @param user_id [Integer] The ID of the user.
# @param body [UpdateUser] body
# @param [Hash] opts the optional parameters
# @return [Array<(User, Integer, Hash)>] User data, response status code and response headers
def update_user_with_http_info(user_id, body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementApi.update_user ...'
end
# verify the required parameter 'user_id' is set
if @api_client.config.client_side_validation && user_id.nil?
fail ArgumentError, "Missing the required parameter 'user_id' when calling ManagementApi.update_user"
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 ManagementApi.update_user"
end
# resource path
local_var_path = '/v1/users/{userId}'.sub('{' + 'userId' + '}', CGI.escape(user_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] || 'User'
# auth_names
auth_names = opts[:auth_names] || ['management_key', 'manager_auth']
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementApi#update_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
end
end