=begin
#Klaviyo API
#The Klaviyo REST API. Please visit https://developers.klaviyo.com for more details.
The version of the OpenAPI document: 2023-06-15
Contact: developers@klaviyo.com
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 6.2.1
=end
require 'cgi'
module KlaviyoAPI
class TagsApi
attr_accessor :api_client
def initialize(api_client = ApiClient.default)
@api_client = api_client
end
# Create Tag
# Create a tag. An account cannot have more than **500** unique tags. A tag belongs to a single tag group. If the `tag_group_id` is not specified, the tag is added to the account's default tag group.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `tags:read` `tags:write`
# @param tag_create_query [TagCreateQuery]
# @param [Hash] opts the optional parameters
# @return [Hash]
def create_tag(tag_create_query, opts = {})
data, _status_code, _headers = create_tag_with_http_info(tag_create_query, opts)
data
end
# Create Tag
# Create a tag. An account cannot have more than **500** unique tags. A tag belongs to a single tag group. If the `tag_group_id` is not specified, the tag is added to the account's default tag group.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `tags:read` `tags:write`
# @param tag_create_query [TagCreateQuery]
# @param [Hash] opts the optional parameters
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def create_tag_with_http_info(tag_create_query, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TagsApi.create_tag ...'
end
# verify the required parameter 'tag_create_query' is set
if @api_client.config.client_side_validation && tag_create_query.nil?
fail ArgumentError, "Missing the required parameter 'tag_create_query' when calling TagsApi.create_tag"
end
# resource path
local_var_path = '/api/tags/'
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['API_REVISION'] || "2023-06-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/json'])
if !content_type.nil?
header_params['Content-Type'] = content_type
end
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(tag_create_query)
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"TagsApi.create_tag",
: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: TagsApi#create_tag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Create Tag Group
# Create a tag group. An account cannot have more than **50** unique tag groups. If `exclusive` is not specified `true` or `false`, the tag group defaults to non-exclusive. If a tag group is non-exclusive, any given related resource (campaign, flow, etc.) can be linked to multiple tags from that tag group. If a tag group is exclusive, any given related resource can only be linked to one tag from that tag group.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `tags:read` `tags:write`
# @param tag_group_create_query [TagGroupCreateQuery]
# @param [Hash] opts the optional parameters
# @return [Hash]
def create_tag_group(tag_group_create_query, opts = {})
data, _status_code, _headers = create_tag_group_with_http_info(tag_group_create_query, opts)
data
end
# Create Tag Group
# Create a tag group. An account cannot have more than **50** unique tag groups. If `exclusive` is not specified `true` or `false`, the tag group defaults to non-exclusive. If a tag group is non-exclusive, any given related resource (campaign, flow, etc.) can be linked to multiple tags from that tag group. If a tag group is exclusive, any given related resource can only be linked to one tag from that tag group.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `tags:read` `tags:write`
# @param tag_group_create_query [TagGroupCreateQuery]
# @param [Hash] opts the optional parameters
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def create_tag_group_with_http_info(tag_group_create_query, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TagsApi.create_tag_group ...'
end
# verify the required parameter 'tag_group_create_query' is set
if @api_client.config.client_side_validation && tag_group_create_query.nil?
fail ArgumentError, "Missing the required parameter 'tag_group_create_query' when calling TagsApi.create_tag_group"
end
# resource path
local_var_path = '/api/tag-groups/'
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['API_REVISION'] || "2023-06-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/json'])
if !content_type.nil?
header_params['Content-Type'] = content_type
end
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(tag_group_create_query)
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"TagsApi.create_tag_group",
: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: TagsApi#create_tag_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Create Tag Relationships Campaigns
# Associate a tag with one or more campaigns. Any campaign cannot be associated with more than **100** tags. Use the request body to pass in the ID(s) of the campaign(s) that will be associated with the tag.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `campaigns:write` `tags:write`
# @param id [String]
# @param tag_campaign_op [TagCampaignOp]
# @param [Hash] opts the optional parameters
# @return [nil]
def create_tag_relationships_campaigns(id, tag_campaign_op, opts = {})
create_tag_relationships_campaigns_with_http_info(id, tag_campaign_op, opts)
nil
end
# Create Tag Relationships Campaigns
# Associate a tag with one or more campaigns. Any campaign cannot be associated with more than **100** tags. Use the request body to pass in the ID(s) of the campaign(s) that will be associated with the tag.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `campaigns:write` `tags:write`
# @param id [String]
# @param tag_campaign_op [TagCampaignOp]
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def create_tag_relationships_campaigns_with_http_info(id, tag_campaign_op, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TagsApi.create_tag_relationships_campaigns ...'
end
# verify the required parameter 'id' is set
if @api_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling TagsApi.create_tag_relationships_campaigns"
end
# verify the required parameter 'tag_campaign_op' is set
if @api_client.config.client_side_validation && tag_campaign_op.nil?
fail ArgumentError, "Missing the required parameter 'tag_campaign_op' when calling TagsApi.create_tag_relationships_campaigns"
end
# resource path
local_var_path = '/api/tags/{id}/relationships/campaigns/'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['API_REVISION'] || "2023-06-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/json'])
if !content_type.nil?
header_params['Content-Type'] = content_type
end
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(tag_campaign_op)
# return_type
return_type = opts[:debug_return_type]
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"TagsApi.create_tag_relationships_campaigns",
: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: TagsApi#create_tag_relationships_campaigns\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Create Tag Relationships Flows
# Associate a tag with one or more flows. Any flow cannot be associated with more than **100** tags. Use the request body to pass in the ID(s) of the flow(s) that will be associated with the tag.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `flows:write` `tags:write`
# @param id [String]
# @param tag_flow_op [TagFlowOp]
# @param [Hash] opts the optional parameters
# @return [nil]
def create_tag_relationships_flows(id, tag_flow_op, opts = {})
create_tag_relationships_flows_with_http_info(id, tag_flow_op, opts)
nil
end
# Create Tag Relationships Flows
# Associate a tag with one or more flows. Any flow cannot be associated with more than **100** tags. Use the request body to pass in the ID(s) of the flow(s) that will be associated with the tag.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `flows:write` `tags:write`
# @param id [String]
# @param tag_flow_op [TagFlowOp]
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def create_tag_relationships_flows_with_http_info(id, tag_flow_op, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TagsApi.create_tag_relationships_flows ...'
end
# verify the required parameter 'id' is set
if @api_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling TagsApi.create_tag_relationships_flows"
end
# verify the required parameter 'tag_flow_op' is set
if @api_client.config.client_side_validation && tag_flow_op.nil?
fail ArgumentError, "Missing the required parameter 'tag_flow_op' when calling TagsApi.create_tag_relationships_flows"
end
# resource path
local_var_path = '/api/tags/{id}/relationships/flows/'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['API_REVISION'] || "2023-06-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/json'])
if !content_type.nil?
header_params['Content-Type'] = content_type
end
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(tag_flow_op)
# return_type
return_type = opts[:debug_return_type]
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"TagsApi.create_tag_relationships_flows",
: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: TagsApi#create_tag_relationships_flows\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Create Tag Relationships Lists
# Associate a tag with one or more lists. Any list cannot be associated with more than **100** tags. Use the request body to pass in the ID(s) of the lists(s) that will be associated with the tag.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `list:write` `tags:write`
# @param id [String]
# @param tag_list_op [TagListOp]
# @param [Hash] opts the optional parameters
# @return [nil]
def create_tag_relationships_lists(id, tag_list_op, opts = {})
create_tag_relationships_lists_with_http_info(id, tag_list_op, opts)
nil
end
# Create Tag Relationships Lists
# Associate a tag with one or more lists. Any list cannot be associated with more than **100** tags. Use the request body to pass in the ID(s) of the lists(s) that will be associated with the tag.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `list:write` `tags:write`
# @param id [String]
# @param tag_list_op [TagListOp]
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def create_tag_relationships_lists_with_http_info(id, tag_list_op, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TagsApi.create_tag_relationships_lists ...'
end
# verify the required parameter 'id' is set
if @api_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling TagsApi.create_tag_relationships_lists"
end
# verify the required parameter 'tag_list_op' is set
if @api_client.config.client_side_validation && tag_list_op.nil?
fail ArgumentError, "Missing the required parameter 'tag_list_op' when calling TagsApi.create_tag_relationships_lists"
end
# resource path
local_var_path = '/api/tags/{id}/relationships/lists/'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['API_REVISION'] || "2023-06-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/json'])
if !content_type.nil?
header_params['Content-Type'] = content_type
end
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(tag_list_op)
# return_type
return_type = opts[:debug_return_type]
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"TagsApi.create_tag_relationships_lists",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: TagsApi#create_tag_relationships_lists\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Create Tag Relationships Segments
# Associate a tag with one or more segments. Any segment cannot be associated with more than **100** tags. Use the request body to pass in the ID(s) of the segments(s) that will be associated with the tag.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `segments:write` `tags:write`
# @param id [String]
# @param tag_segment_op [TagSegmentOp]
# @param [Hash] opts the optional parameters
# @return [nil]
def create_tag_relationships_segments(id, tag_segment_op, opts = {})
create_tag_relationships_segments_with_http_info(id, tag_segment_op, opts)
nil
end
# Create Tag Relationships Segments
# Associate a tag with one or more segments. Any segment cannot be associated with more than **100** tags. Use the request body to pass in the ID(s) of the segments(s) that will be associated with the tag.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `segments:write` `tags:write`
# @param id [String]
# @param tag_segment_op [TagSegmentOp]
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def create_tag_relationships_segments_with_http_info(id, tag_segment_op, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TagsApi.create_tag_relationships_segments ...'
end
# verify the required parameter 'id' is set
if @api_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling TagsApi.create_tag_relationships_segments"
end
# verify the required parameter 'tag_segment_op' is set
if @api_client.config.client_side_validation && tag_segment_op.nil?
fail ArgumentError, "Missing the required parameter 'tag_segment_op' when calling TagsApi.create_tag_relationships_segments"
end
# resource path
local_var_path = '/api/tags/{id}/relationships/segments/'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['API_REVISION'] || "2023-06-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/json'])
if !content_type.nil?
header_params['Content-Type'] = content_type
end
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(tag_segment_op)
# return_type
return_type = opts[:debug_return_type]
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"TagsApi.create_tag_relationships_segments",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: TagsApi#create_tag_relationships_segments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Delete Tag
# Delete the tag with the given tag ID. Any associations between the tag and other resources will also be removed.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `tags:read` `tags:write`
# @param id [String] The Tag ID
# @param [Hash] opts the optional parameters
# @return [Hash]
def delete_tag(id, opts = {})
data, _status_code, _headers = delete_tag_with_http_info(id, opts)
data
end
# Delete Tag
# Delete the tag with the given tag ID. Any associations between the tag and other resources will also be removed.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `tags:read` `tags:write`
# @param id [String] The Tag ID
# @param [Hash] opts the optional parameters
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def delete_tag_with_http_info(id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TagsApi.delete_tag ...'
end
# verify the required parameter 'id' is set
if @api_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling TagsApi.delete_tag"
end
# resource path
local_var_path = '/api/tags/{id}/'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['API_REVISION'] || "2023-06-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"TagsApi.delete_tag",
: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: TagsApi#delete_tag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Delete Tag Group
# Delete the tag group with the given tag group ID. Any tags inside that tag group, and any associations between those tags and other resources, will also be removed. The default tag group cannot be deleted.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `tags:read` `tags:write`
# @param id [String] The Tag Group ID
# @param [Hash] opts the optional parameters
# @return [Hash]
def delete_tag_group(id, opts = {})
data, _status_code, _headers = delete_tag_group_with_http_info(id, opts)
data
end
# Delete Tag Group
# Delete the tag group with the given tag group ID. Any tags inside that tag group, and any associations between those tags and other resources, will also be removed. The default tag group cannot be deleted.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `tags:read` `tags:write`
# @param id [String] The Tag Group ID
# @param [Hash] opts the optional parameters
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def delete_tag_group_with_http_info(id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TagsApi.delete_tag_group ...'
end
# verify the required parameter 'id' is set
if @api_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling TagsApi.delete_tag_group"
end
# resource path
local_var_path = '/api/tag-groups/{id}/'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['API_REVISION'] || "2023-06-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"TagsApi.delete_tag_group",
: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: TagsApi#delete_tag_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Delete Tag Relationships Campaigns
# Remove a tag's association with one or more campaigns. Use the request body to pass in the ID(s) of the campaign(s) whose association with the tag will be removed.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `campaigns:write` `tags:write`
# @param id [String]
# @param tag_campaign_op [TagCampaignOp]
# @param [Hash] opts the optional parameters
# @return [nil]
def delete_tag_relationships_campaigns(id, tag_campaign_op, opts = {})
delete_tag_relationships_campaigns_with_http_info(id, tag_campaign_op, opts)
nil
end
# Delete Tag Relationships Campaigns
# Remove a tag's association with one or more campaigns. Use the request body to pass in the ID(s) of the campaign(s) whose association with the tag will be removed.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `campaigns:write` `tags:write`
# @param id [String]
# @param tag_campaign_op [TagCampaignOp]
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def delete_tag_relationships_campaigns_with_http_info(id, tag_campaign_op, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TagsApi.delete_tag_relationships_campaigns ...'
end
# verify the required parameter 'id' is set
if @api_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling TagsApi.delete_tag_relationships_campaigns"
end
# verify the required parameter 'tag_campaign_op' is set
if @api_client.config.client_side_validation && tag_campaign_op.nil?
fail ArgumentError, "Missing the required parameter 'tag_campaign_op' when calling TagsApi.delete_tag_relationships_campaigns"
end
# resource path
local_var_path = '/api/tags/{id}/relationships/campaigns/'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['API_REVISION'] || "2023-06-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/json'])
if !content_type.nil?
header_params['Content-Type'] = content_type
end
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(tag_campaign_op)
# return_type
return_type = opts[:debug_return_type]
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"TagsApi.delete_tag_relationships_campaigns",
: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: TagsApi#delete_tag_relationships_campaigns\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Delete Tag Relationships Flows
# Remove a tag's association with one or more flows. Use the request body to pass in the ID(s) of the flows(s) whose association with the tag will be removed.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `flows:write` `tags:write`
# @param id [String]
# @param tag_flow_op [TagFlowOp]
# @param [Hash] opts the optional parameters
# @return [nil]
def delete_tag_relationships_flows(id, tag_flow_op, opts = {})
delete_tag_relationships_flows_with_http_info(id, tag_flow_op, opts)
nil
end
# Delete Tag Relationships Flows
# Remove a tag's association with one or more flows. Use the request body to pass in the ID(s) of the flows(s) whose association with the tag will be removed.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `flows:write` `tags:write`
# @param id [String]
# @param tag_flow_op [TagFlowOp]
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def delete_tag_relationships_flows_with_http_info(id, tag_flow_op, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TagsApi.delete_tag_relationships_flows ...'
end
# verify the required parameter 'id' is set
if @api_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling TagsApi.delete_tag_relationships_flows"
end
# verify the required parameter 'tag_flow_op' is set
if @api_client.config.client_side_validation && tag_flow_op.nil?
fail ArgumentError, "Missing the required parameter 'tag_flow_op' when calling TagsApi.delete_tag_relationships_flows"
end
# resource path
local_var_path = '/api/tags/{id}/relationships/flows/'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['API_REVISION'] || "2023-06-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/json'])
if !content_type.nil?
header_params['Content-Type'] = content_type
end
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(tag_flow_op)
# return_type
return_type = opts[:debug_return_type]
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"TagsApi.delete_tag_relationships_flows",
: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: TagsApi#delete_tag_relationships_flows\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Delete Tag Relationships Lists
# Remove a tag's association with one or more lists. Use the request body to pass in the ID(s) of the list(s) whose association with the tag will be removed.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `list:write` `tags:write`
# @param id [String]
# @param tag_list_op [TagListOp]
# @param [Hash] opts the optional parameters
# @return [nil]
def delete_tag_relationships_lists(id, tag_list_op, opts = {})
delete_tag_relationships_lists_with_http_info(id, tag_list_op, opts)
nil
end
# Delete Tag Relationships Lists
# Remove a tag's association with one or more lists. Use the request body to pass in the ID(s) of the list(s) whose association with the tag will be removed.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `list:write` `tags:write`
# @param id [String]
# @param tag_list_op [TagListOp]
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def delete_tag_relationships_lists_with_http_info(id, tag_list_op, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TagsApi.delete_tag_relationships_lists ...'
end
# verify the required parameter 'id' is set
if @api_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling TagsApi.delete_tag_relationships_lists"
end
# verify the required parameter 'tag_list_op' is set
if @api_client.config.client_side_validation && tag_list_op.nil?
fail ArgumentError, "Missing the required parameter 'tag_list_op' when calling TagsApi.delete_tag_relationships_lists"
end
# resource path
local_var_path = '/api/tags/{id}/relationships/lists/'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['API_REVISION'] || "2023-06-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/json'])
if !content_type.nil?
header_params['Content-Type'] = content_type
end
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(tag_list_op)
# return_type
return_type = opts[:debug_return_type]
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"TagsApi.delete_tag_relationships_lists",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: TagsApi#delete_tag_relationships_lists\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Delete Tag Relationships Segments
# Remove a tag's association with one or more segments. Use the request body to pass in the ID(s) of the segments(s) whose association with the tag will be removed.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `segments:write` `tags:write`
# @param id [String]
# @param tag_segment_op [TagSegmentOp]
# @param [Hash] opts the optional parameters
# @return [nil]
def delete_tag_relationships_segments(id, tag_segment_op, opts = {})
delete_tag_relationships_segments_with_http_info(id, tag_segment_op, opts)
nil
end
# Delete Tag Relationships Segments
# Remove a tag's association with one or more segments. Use the request body to pass in the ID(s) of the segments(s) whose association with the tag will be removed.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `segments:write` `tags:write`
# @param id [String]
# @param tag_segment_op [TagSegmentOp]
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def delete_tag_relationships_segments_with_http_info(id, tag_segment_op, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TagsApi.delete_tag_relationships_segments ...'
end
# verify the required parameter 'id' is set
if @api_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling TagsApi.delete_tag_relationships_segments"
end
# verify the required parameter 'tag_segment_op' is set
if @api_client.config.client_side_validation && tag_segment_op.nil?
fail ArgumentError, "Missing the required parameter 'tag_segment_op' when calling TagsApi.delete_tag_relationships_segments"
end
# resource path
local_var_path = '/api/tags/{id}/relationships/segments/'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['API_REVISION'] || "2023-06-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/json'])
if !content_type.nil?
header_params['Content-Type'] = content_type
end
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(tag_segment_op)
# return_type
return_type = opts[:debug_return_type]
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"TagsApi.delete_tag_relationships_segments",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: TagsApi#delete_tag_relationships_segments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get Tag
# Retrieve the tag with the given tag ID.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `tags:read`
# @param id [String] The Tag ID
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_tag For more information please visit https://developers.klaviyo.com/en/v2023-06-15/reference/api-overview#sparse-fieldsets
# @return [Hash]
def get_tag(id, opts = {})
data, _status_code, _headers = get_tag_with_http_info(id, opts)
data
end
# Get Tag
# Retrieve the tag with the given tag ID.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `tags:read`
# @param id [String] The Tag ID
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_tag For more information please visit https://developers.klaviyo.com/en/v2023-06-15/reference/api-overview#sparse-fieldsets
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_tag_with_http_info(id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TagsApi.get_tag ...'
end
# verify the required parameter 'id' is set
if @api_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling TagsApi.get_tag"
end
allowable_values = ["name"]
if @api_client.config.client_side_validation && opts[:'fields_tag'] && !opts[:'fields_tag'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"fields_tag\", must include one of #{allowable_values}"
end
# resource path
local_var_path = '/api/tags/{id}/'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'fields[tag]'] = @api_client.build_collection_param(opts[:'fields_tag'], :csv) if !opts[:'fields_tag'].nil?
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['API_REVISION'] || "2023-06-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"TagsApi.get_tag",
: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: TagsApi#get_tag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get Tag Group
# Retrieve the tag group with the given tag group ID.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `tags:read`
# @param id [String] The Tag Group ID
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_tag_group For more information please visit https://developers.klaviyo.com/en/v2023-06-15/reference/api-overview#sparse-fieldsets
# @return [Hash]
def get_tag_group(id, opts = {})
data, _status_code, _headers = get_tag_group_with_http_info(id, opts)
data
end
# Get Tag Group
# Retrieve the tag group with the given tag group ID.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `tags:read`
# @param id [String] The Tag Group ID
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_tag_group For more information please visit https://developers.klaviyo.com/en/v2023-06-15/reference/api-overview#sparse-fieldsets
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_tag_group_with_http_info(id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TagsApi.get_tag_group ...'
end
# verify the required parameter 'id' is set
if @api_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling TagsApi.get_tag_group"
end
allowable_values = ["name", "exclusive", "default"]
if @api_client.config.client_side_validation && opts[:'fields_tag_group'] && !opts[:'fields_tag_group'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"fields_tag_group\", must include one of #{allowable_values}"
end
# resource path
local_var_path = '/api/tag-groups/{id}/'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'fields[tag-group]'] = @api_client.build_collection_param(opts[:'fields_tag_group'], :csv) if !opts[:'fields_tag_group'].nil?
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['API_REVISION'] || "2023-06-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"TagsApi.get_tag_group",
: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: TagsApi#get_tag_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get Tag Group Relationships Tags
# Returns the tag IDs of all tags inside the given tag group.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `tags:read`
# @param id [String]
# @param [Hash] opts the optional parameters
# @return [Hash]
def get_tag_group_relationships_tags(id, opts = {})
data, _status_code, _headers = get_tag_group_relationships_tags_with_http_info(id, opts)
data
end
# Get Tag Group Relationships Tags
# Returns the tag IDs of all tags inside the given tag group.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `tags:read`
# @param id [String]
# @param [Hash] opts the optional parameters
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_tag_group_relationships_tags_with_http_info(id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TagsApi.get_tag_group_relationships_tags ...'
end
# verify the required parameter 'id' is set
if @api_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling TagsApi.get_tag_group_relationships_tags"
end
# resource path
local_var_path = '/api/tag-groups/{id}/relationships/tags/'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['API_REVISION'] || "2023-06-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"TagsApi.get_tag_group_relationships_tags",
: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: TagsApi#get_tag_group_relationships_tags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get Tag Group Tags
# Return the tags for a given tag group ID.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `tags:read`
# @param id [String]
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_tag For more information please visit https://developers.klaviyo.com/en/v2023-06-15/reference/api-overview#sparse-fieldsets
# @return [Hash]
def get_tag_group_tags(id, opts = {})
data, _status_code, _headers = get_tag_group_tags_with_http_info(id, opts)
data
end
# Get Tag Group Tags
# Return the tags for a given tag group ID.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `tags:read`
# @param id [String]
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_tag For more information please visit https://developers.klaviyo.com/en/v2023-06-15/reference/api-overview#sparse-fieldsets
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_tag_group_tags_with_http_info(id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TagsApi.get_tag_group_tags ...'
end
# verify the required parameter 'id' is set
if @api_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling TagsApi.get_tag_group_tags"
end
allowable_values = ["name"]
if @api_client.config.client_side_validation && opts[:'fields_tag'] && !opts[:'fields_tag'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"fields_tag\", must include one of #{allowable_values}"
end
# resource path
local_var_path = '/api/tag-groups/{id}/tags/'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'fields[tag]'] = @api_client.build_collection_param(opts[:'fields_tag'], :csv) if !opts[:'fields_tag'].nil?
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['API_REVISION'] || "2023-06-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"TagsApi.get_tag_group_tags",
: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: TagsApi#get_tag_group_tags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get Tag Groups
# List all tag groups in an account. Every account has one default tag group. Tag groups can be filtered by `name`, `exclusive`, and `default`, and sorted by `name` or `id` in ascending or descending order. Returns a maximum of 25 tag groups per request, which can be paginated with [cursor-based pagination](https://developers.klaviyo.com/en/v2022-10-17/reference/api_overview#pagination).
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `tags:read`
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_tag_group For more information please visit https://developers.klaviyo.com/en/v2023-06-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2023-06-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`name`: `contains`, `ends-with`, `equals`, `starts-with`<br>`exclusive`: `equals`<br>`default`: `equals`
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2023-06-15/reference/api-overview#pagination
# @option opts [String] :sort For more information please visit https://developers.klaviyo.com/en/v2023-06-15/reference/api-overview#sorting
# @return [Hash]
def get_tag_groups(opts = {})
data, _status_code, _headers = get_tag_groups_with_http_info(opts)
data
end
# Get Tag Groups
# List all tag groups in an account. Every account has one default tag group. Tag groups can be filtered by `name`, `exclusive`, and `default`, and sorted by `name` or `id` in ascending or descending order. Returns a maximum of 25 tag groups per request, which can be paginated with [cursor-based pagination](https://developers.klaviyo.com/en/v2022-10-17/reference/api_overview#pagination).<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `tags:read`
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_tag_group For more information please visit https://developers.klaviyo.com/en/v2023-06-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2023-06-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`name`: `contains`, `ends-with`, `equals`, `starts-with`<br>`exclusive`: `equals`<br>`default`: `equals`
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2023-06-15/reference/api-overview#pagination
# @option opts [String] :sort For more information please visit https://developers.klaviyo.com/en/v2023-06-15/reference/api-overview#sorting
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_tag_groups_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TagsApi.get_tag_groups ...'
end
allowable_values = ["name", "exclusive", "default"]
if @api_client.config.client_side_validation && opts[:'fields_tag_group'] && !opts[:'fields_tag_group'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"fields_tag_group\", must include one of #{allowable_values}"
end
allowable_values = ["id", "-id", "name", "-name"]
if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
end
# resource path
local_var_path = '/api/tag-groups/'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'fields[tag-group]'] = @api_client.build_collection_param(opts[:'fields_tag_group'], :csv) if !opts[:'fields_tag_group'].nil?
query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil?
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['API_REVISION'] || "2023-06-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"TagsApi.get_tag_groups",
: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: TagsApi#get_tag_groups\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get Tag Relationships Campaigns
# Returns the IDs of all campaigns associated with the given tag.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `campaigns:read` `tags:read`
# @param id [String]
# @param [Hash] opts the optional parameters
# @return [Hash]
def get_tag_relationships_campaigns(id, opts = {})
data, _status_code, _headers = get_tag_relationships_campaigns_with_http_info(id, opts)
data
end
# Get Tag Relationships Campaigns
# Returns the IDs of all campaigns associated with the given tag.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `campaigns:read` `tags:read`
# @param id [String]
# @param [Hash] opts the optional parameters
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_tag_relationships_campaigns_with_http_info(id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TagsApi.get_tag_relationships_campaigns ...'
end
# verify the required parameter 'id' is set
if @api_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling TagsApi.get_tag_relationships_campaigns"
end
# resource path
local_var_path = '/api/tags/{id}/relationships/campaigns/'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['API_REVISION'] || "2023-06-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"TagsApi.get_tag_relationships_campaigns",
: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: TagsApi#get_tag_relationships_campaigns\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get Tag Relationships Flows
# Returns the IDs of all flows associated with the given tag.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `flows:read` `tags:read`
# @param id [String]
# @param [Hash] opts the optional parameters
# @return [Hash]
def get_tag_relationships_flows(id, opts = {})
data, _status_code, _headers = get_tag_relationships_flows_with_http_info(id, opts)
data
end
# Get Tag Relationships Flows
# Returns the IDs of all flows associated with the given tag.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `flows:read` `tags:read`
# @param id [String]
# @param [Hash] opts the optional parameters
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_tag_relationships_flows_with_http_info(id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TagsApi.get_tag_relationships_flows ...'
end
# verify the required parameter 'id' is set
if @api_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling TagsApi.get_tag_relationships_flows"
end
# resource path
local_var_path = '/api/tags/{id}/relationships/flows/'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['API_REVISION'] || "2023-06-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"TagsApi.get_tag_relationships_flows",
: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: TagsApi#get_tag_relationships_flows\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get Tag Relationships Lists
# Returns the IDs of all lists associated with the given tag.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `list:read` `tags:read`
# @param id [String]
# @param [Hash] opts the optional parameters
# @return [Hash]
def get_tag_relationships_lists(id, opts = {})
data, _status_code, _headers = get_tag_relationships_lists_with_http_info(id, opts)
data
end
# Get Tag Relationships Lists
# Returns the IDs of all lists associated with the given tag.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `list:read` `tags:read`
# @param id [String]
# @param [Hash] opts the optional parameters
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_tag_relationships_lists_with_http_info(id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TagsApi.get_tag_relationships_lists ...'
end
# verify the required parameter 'id' is set
if @api_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling TagsApi.get_tag_relationships_lists"
end
# resource path
local_var_path = '/api/tags/{id}/relationships/lists/'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['API_REVISION'] || "2023-06-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"TagsApi.get_tag_relationships_lists",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: TagsApi#get_tag_relationships_lists\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get Tag Relationships Segments
# Returns the IDs of all segments associated with the given tag.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `segments:read` `tags:read`
# @param id [String]
# @param [Hash] opts the optional parameters
# @return [Hash]
def get_tag_relationships_segments(id, opts = {})
data, _status_code, _headers = get_tag_relationships_segments_with_http_info(id, opts)
data
end
# Get Tag Relationships Segments
# Returns the IDs of all segments associated with the given tag.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `segments:read` `tags:read`
# @param id [String]
# @param [Hash] opts the optional parameters
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_tag_relationships_segments_with_http_info(id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TagsApi.get_tag_relationships_segments ...'
end
# verify the required parameter 'id' is set
if @api_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling TagsApi.get_tag_relationships_segments"
end
# resource path
local_var_path = '/api/tags/{id}/relationships/segments/'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['API_REVISION'] || "2023-06-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"TagsApi.get_tag_relationships_segments",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: TagsApi#get_tag_relationships_segments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get Tag Relationships Tag Group
# Returns the ids of all tag groups related to the given tag.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `tags:read`
# @param id [String]
# @param [Hash] opts the optional parameters
# @return [Hash]
def get_tag_relationships_tag_group(id, opts = {})
data, _status_code, _headers = get_tag_relationships_tag_group_with_http_info(id, opts)
data
end
# Get Tag Relationships Tag Group
# Returns the ids of all tag groups related to the given tag.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `tags:read`
# @param id [String]
# @param [Hash] opts the optional parameters
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_tag_relationships_tag_group_with_http_info(id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TagsApi.get_tag_relationships_tag_group ...'
end
# verify the required parameter 'id' is set
if @api_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling TagsApi.get_tag_relationships_tag_group"
end
# resource path
local_var_path = '/api/tags/{id}/relationships/tag-group/'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['API_REVISION'] || "2023-06-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"TagsApi.get_tag_relationships_tag_group",
: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: TagsApi#get_tag_relationships_tag_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get Tag Tag Group
# Returns the tag group resource for a given tag ID.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `tags:read`
# @param id [String]
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_tag_group For more information please visit https://developers.klaviyo.com/en/v2023-06-15/reference/api-overview#sparse-fieldsets
# @return [Hash]
def get_tag_tag_group(id, opts = {})
data, _status_code, _headers = get_tag_tag_group_with_http_info(id, opts)
data
end
# Get Tag Tag Group
# Returns the tag group resource for a given tag ID.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `tags:read`
# @param id [String]
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_tag_group For more information please visit https://developers.klaviyo.com/en/v2023-06-15/reference/api-overview#sparse-fieldsets
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_tag_tag_group_with_http_info(id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TagsApi.get_tag_tag_group ...'
end
# verify the required parameter 'id' is set
if @api_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling TagsApi.get_tag_tag_group"
end
allowable_values = ["name", "exclusive", "default"]
if @api_client.config.client_side_validation && opts[:'fields_tag_group'] && !opts[:'fields_tag_group'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"fields_tag_group\", must include one of #{allowable_values}"
end
# resource path
local_var_path = '/api/tags/{id}/tag-group/'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
# query parameters
query_params = opts[:query_params] || {}
query_params[:'fields[tag-group]'] = @api_client.build_collection_param(opts[:'fields_tag_group'], :csv) if !opts[:'fields_tag_group'].nil?
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['API_REVISION'] || "2023-06-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"TagsApi.get_tag_tag_group",
: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: TagsApi#get_tag_tag_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get Tags
# List all tags in an account. Tags can be filtered by `name`, and sorted by `name` or `id` in ascending or descending order. Returns a maximum of 50 tags per request, which can be paginated with [cursor-based pagination](https://developers.klaviyo.com/en/v2022-10-17/reference/api_overview#pagination).
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `tags:read`
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_tag For more information please visit https://developers.klaviyo.com/en/v2023-06-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2023-06-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`name`: `contains`, `ends-with`, `equals`, `starts-with`
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2023-06-15/reference/api-overview#pagination
# @option opts [String] :sort For more information please visit https://developers.klaviyo.com/en/v2023-06-15/reference/api-overview#sorting
# @return [Hash]
def get_tags(opts = {})
data, _status_code, _headers = get_tags_with_http_info(opts)
data
end
# Get Tags
# List all tags in an account. Tags can be filtered by `name`, and sorted by `name` or `id` in ascending or descending order. Returns a maximum of 50 tags per request, which can be paginated with [cursor-based pagination](https://developers.klaviyo.com/en/v2022-10-17/reference/api_overview#pagination).<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `tags:read`
# @param [Hash] opts the optional parameters
# @option opts [Array] :fields_tag For more information please visit https://developers.klaviyo.com/en/v2023-06-15/reference/api-overview#sparse-fieldsets
# @option opts [String] :filter For more information please visit https://developers.klaviyo.com/en/v2023-06-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`name`: `contains`, `ends-with`, `equals`, `starts-with`
# @option opts [String] :page_cursor For more information please visit https://developers.klaviyo.com/en/v2023-06-15/reference/api-overview#pagination
# @option opts [String] :sort For more information please visit https://developers.klaviyo.com/en/v2023-06-15/reference/api-overview#sorting
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def get_tags_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TagsApi.get_tags ...'
end
allowable_values = ["name"]
if @api_client.config.client_side_validation && opts[:'fields_tag'] && !opts[:'fields_tag'].all? { |item| allowable_values.include?(item) }
fail ArgumentError, "invalid value for \"fields_tag\", must include one of #{allowable_values}"
end
allowable_values = ["id", "-id", "name", "-name"]
if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
end
# resource path
local_var_path = '/api/tags/'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'fields[tag]'] = @api_client.build_collection_param(opts[:'fields_tag'], :csv) if !opts[:'fields_tag'].nil?
query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil?
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['API_REVISION'] || "2023-06-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"TagsApi.get_tags",
: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: TagsApi#get_tags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Update Tag
# Update the tag with the given tag ID. Only a tag's `name` can be changed. A tag cannot be moved from one tag group to another.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `tags:read` `tags:write`
# @param id [String] The Tag ID
# @param tag_update_query [TagUpdateQuery]
# @param [Hash] opts the optional parameters
# @return [Hash]
def update_tag(id, tag_update_query, opts = {})
data, _status_code, _headers = update_tag_with_http_info(id, tag_update_query, opts)
data
end
# Update Tag
# Update the tag with the given tag ID. Only a tag's `name` can be changed. A tag cannot be moved from one tag group to another.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `tags:read` `tags:write`
# @param id [String] The Tag ID
# @param tag_update_query [TagUpdateQuery]
# @param [Hash] opts the optional parameters
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def update_tag_with_http_info(id, tag_update_query, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TagsApi.update_tag ...'
end
# verify the required parameter 'id' is set
if @api_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling TagsApi.update_tag"
end
# verify the required parameter 'tag_update_query' is set
if @api_client.config.client_side_validation && tag_update_query.nil?
fail ArgumentError, "Missing the required parameter 'tag_update_query' when calling TagsApi.update_tag"
end
# resource path
local_var_path = '/api/tags/{id}/'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['API_REVISION'] || "2023-06-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/json'])
if !content_type.nil?
header_params['Content-Type'] = content_type
end
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(tag_update_query)
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"TagsApi.update_tag",
: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: TagsApi#update_tag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Update Tag Group
# Update the tag group with the given tag group ID. Only a tag group's `name` can be changed. A tag group's `exclusive` or `default` value cannot be changed.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `tags:read` `tags:write`
# @param id [String] The Tag Group ID
# @param tag_group_update_query [TagGroupUpdateQuery]
# @param [Hash] opts the optional parameters
# @return [Hash]
def update_tag_group(id, tag_group_update_query, opts = {})
data, _status_code, _headers = update_tag_group_with_http_info(id, tag_group_update_query, opts)
data
end
# Update Tag Group
# Update the tag group with the given tag group ID. Only a tag group's `name` can be changed. A tag group's `exclusive` or `default` value cannot be changed.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `tags:read` `tags:write`
# @param id [String] The Tag Group ID
# @param tag_group_update_query [TagGroupUpdateQuery]
# @param [Hash] opts the optional parameters
# @return [Array<(Hash, Integer, Hash)>] Hash data, response status code and response headers
def update_tag_group_with_http_info(id, tag_group_update_query, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: TagsApi.update_tag_group ...'
end
# verify the required parameter 'id' is set
if @api_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling TagsApi.update_tag_group"
end
# verify the required parameter 'tag_group_update_query' is set
if @api_client.config.client_side_validation && tag_group_update_query.nil?
fail ArgumentError, "Missing the required parameter 'tag_group_update_query' when calling TagsApi.update_tag_group"
end
# resource path
local_var_path = '/api/tag-groups/{id}/'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# klaviyo api revision
header_params['revision'] = ENV['API_REVISION'] || "2023-06-15"
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/json'])
if !content_type.nil?
header_params['Content-Type'] = content_type
end
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(tag_group_update_query)
# return_type
return_type = opts[:debug_return_type] || 'Hash'
# auth_names
auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key']
new_options = opts.merge(
:operation => :"TagsApi.update_tag_group",
: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: TagsApi#update_tag_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
end
end